place Requires and LoaderVersion into fstar meta when saving soundtrack gen

This commit is contained in:
Downforce Agent 2024-07-21 07:18:38 -05:00
parent c24da0edfd
commit 22319167a8
4 changed files with 23 additions and 5 deletions

View File

@ -47,6 +47,7 @@ public class Clifford implements ActionListener {
Main.Mod mod; Main.Mod mod;
int index; int index;
File directory; File directory;
boolean isSoundtrack = false;
boolean creating; boolean creating;
@ -195,6 +196,7 @@ public class Clifford implements ActionListener {
fileChooser.setFileFilter(new FileNameExtensionFilter("Firestar Mod Package", "fstar")); fileChooser.setFileFilter(new FileNameExtensionFilter("Firestar Mod Package", "fstar"));
if (fileChooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { if (fileChooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
ZipFile zip = new ZipFile(fileChooser.getSelectedFile()); ZipFile zip = new ZipFile(fileChooser.getSelectedFile());
boolean hasScript = false;
try { try {
zip.addFolder(new File(directory.getAbsolutePath() + "/data")); zip.addFolder(new File(directory.getAbsolutePath() + "/data"));
if (new File(directory.getAbsolutePath() + "/delete.txt").exists()) { if (new File(directory.getAbsolutePath() + "/delete.txt").exists()) {
@ -205,6 +207,7 @@ public class Clifford implements ActionListener {
} }
if (new File(directory.getAbsolutePath() + "/fscript").exists()) { if (new File(directory.getAbsolutePath() + "/fscript").exists()) {
zip.addFile(new File(directory.getAbsolutePath() + "/fscript")); zip.addFile(new File(directory.getAbsolutePath() + "/fscript"));
hasScript = true;
} }
JSONObject container = new JSONObject(); JSONObject container = new JSONObject();
@ -212,7 +215,16 @@ public class Clifford implements ActionListener {
container.put("friendlyName", fName.getText()); container.put("friendlyName", fName.getText());
container.put("author", fAuthor.getText()); container.put("author", fAuthor.getText());
container.put("description", fDescription.getText()); container.put("description", fDescription.getText());
container.put("loaderversion", 0); // TODO for later versions: Change depending on features inside of mod folder // todo later versions: handle logic for setting this depending on the fscript version too.
// firestar 1.3 can't generate any version other than v1 so this is not necessary right now, but will become necessary when fscript features are added.
if (hasScript) {
container.put("loaderversion", 1);
if (isSoundtrack) {
container.put("requires", new boolean[]{false, true, false, false}); // Pull localization files for patching.
}
} else {
container.put("loaderversion", 0);
}
container.put("game", "2048"); container.put("game", "2048");
zip.setComment(container.toString()); zip.setComment(container.toString());

View File

@ -52,6 +52,10 @@ public class Gonzo {
private MissPiggy invoker; private MissPiggy invoker;
public String oArcTarget = "dlc2.psarc"; // which psarc to rebuild the assets in public String oArcTarget = "dlc2.psarc"; // which psarc to rebuild the assets in
// TODO 1.3: Implement requires boolean[] from Main.Mod
// Rework system to choose the last PSARC and then add more before it when called by requires[]
// Instead of the current system where it simply grabs them all and bloats the file.
public void DeployMods(MissPiggy inv) { public void DeployMods(MissPiggy inv) {
invoker = inv; invoker = inv;
System.out.println("\n\nStarting mod deployment\n\n"); System.out.println("\n\nStarting mod deployment\n\n");

View File

@ -60,7 +60,7 @@ public class Main {
} }
} }
public enum ArcKey { // install target for 2048, type used by downloader public enum ArcKey { // decryption keys for 2048, type used by downloader
BASE("KO5ifR1dQ+eHBlgi6TI0Bdkf7hng6h8aYmRgYuHkCLQNn/9ufV+01fmzjNSmwuVHnO4dEBuN8cENACqVFcgA"), BASE("KO5ifR1dQ+eHBlgi6TI0Bdkf7hng6h8aYmRgYuHkCLQNn/9ufV+01fmzjNSmwuVHnO4dEBuN8cENACqVFcgA"),
LATEST("KO5ifR1dQ+eHBlgi6TI0Bdkf7hng6h8aYmRgYuHkCLQNn/9ufV+01fmzjNSmwuVHnO4dEBuN8cENACqVFcgA"), LATEST("KO5ifR1dQ+eHBlgi6TI0Bdkf7hng6h8aYmRgYuHkCLQNn/9ufV+01fmzjNSmwuVHnO4dEBuN8cENACqVFcgA"),
ADDON_HD("KO5ifR1dQ+eHBlgi6TI0Bdnv4uNsGG5kYGIR4Ojs7ejuis9/anXfuudVNvzgdu+9z1z+asJojA9uAACgRhTl"), ADDON_HD("KO5ifR1dQ+eHBlgi6TI0Bdnv4uNsGG5kYGIR4Ojs7ejuis9/anXfuudVNvzgdu+9z1z+asJojA9uAACgRhTl"),
@ -86,7 +86,7 @@ public class Main {
public String author; // if null, "Author is unknown." public String author; // if null, "Author is unknown."
public boolean enabled = true; public boolean enabled = true;
public boolean[] requires = new boolean[]{false, false, false, false}; // TODO: load optional "requires" array from mod meta if it exists. it will be base, patches, hd dlc, and fury dlc in that order. public boolean[] requires = new boolean[]{false, false, false, false}; // TODO: load optional "requires" array from mod meta if it exists. it will be base, patches, hd dlc, and fury dlc in that order.
// TODO: save 'true true false false' in ost gen if neccessary (patches change localization) // TODO: save 'false true false false' in ost gen if necessary (patches change localization)
} }
// Mods // Mods

View File

@ -414,7 +414,9 @@ public class Suggs implements ActionListener, ListSelectionListener {
progressDialog.destroyDialog(); progressDialog.destroyDialog();
frame.dispose(); frame.dispose();
new Clifford().Action(frame, new File(Main.inpath + "temp/")); Clifford saveDialog = new Clifford();
saveDialog.isSoundtrack = true;
saveDialog.Action(frame, new File(Main.inpath + "temp/"));
parent.setEnabled(true); parent.setEnabled(true);
}).start(); }).start();
} }