From 22319167a8ec58d319b44d87e553b5840469f5ee Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Sun, 21 Jul 2024 07:18:38 -0500 Subject: [PATCH] place Requires and LoaderVersion into fstar meta when saving soundtrack gen --- firestar/src/main/java/Clifford.java | 16 ++++++++++++++-- firestar/src/main/java/Gonzo.java | 4 ++++ firestar/src/main/java/Main.java | 4 ++-- firestar/src/main/java/Suggs.java | 4 +++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/firestar/src/main/java/Clifford.java b/firestar/src/main/java/Clifford.java index da20d63..9e41033 100644 --- a/firestar/src/main/java/Clifford.java +++ b/firestar/src/main/java/Clifford.java @@ -47,6 +47,7 @@ public class Clifford implements ActionListener { Main.Mod mod; int index; File directory; + boolean isSoundtrack = false; boolean creating; @@ -195,6 +196,7 @@ public class Clifford implements ActionListener { fileChooser.setFileFilter(new FileNameExtensionFilter("Firestar Mod Package", "fstar")); if (fileChooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { ZipFile zip = new ZipFile(fileChooser.getSelectedFile()); + boolean hasScript = false; try { zip.addFolder(new File(directory.getAbsolutePath() + "/data")); if (new File(directory.getAbsolutePath() + "/delete.txt").exists()) { @@ -203,8 +205,9 @@ public class Clifford implements ActionListener { if (new File(directory.getAbsolutePath() + "/pack.png").exists()) { zip.addFile(new File(directory.getAbsolutePath() + "/pack.png")); } - if (new File(directory.getAbsolutePath() + "/fscript").exists()) { + if (new File(directory.getAbsolutePath() + "/fscript").exists()) { zip.addFile(new File(directory.getAbsolutePath() + "/fscript")); + hasScript = true; } JSONObject container = new JSONObject(); @@ -212,7 +215,16 @@ public class Clifford implements ActionListener { container.put("friendlyName", fName.getText()); container.put("author", fAuthor.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"); zip.setComment(container.toString()); diff --git a/firestar/src/main/java/Gonzo.java b/firestar/src/main/java/Gonzo.java index d41c87b..21cebb7 100644 --- a/firestar/src/main/java/Gonzo.java +++ b/firestar/src/main/java/Gonzo.java @@ -52,6 +52,10 @@ public class Gonzo { private MissPiggy invoker; 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) { invoker = inv; System.out.println("\n\nStarting mod deployment\n\n"); diff --git a/firestar/src/main/java/Main.java b/firestar/src/main/java/Main.java index d45e836..af2a2e1 100644 --- a/firestar/src/main/java/Main.java +++ b/firestar/src/main/java/Main.java @@ -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"), LATEST("KO5ifR1dQ+eHBlgi6TI0Bdkf7hng6h8aYmRgYuHkCLQNn/9ufV+01fmzjNSmwuVHnO4dEBuN8cENACqVFcgA"), ADDON_HD("KO5ifR1dQ+eHBlgi6TI0Bdnv4uNsGG5kYGIR4Ojs7ejuis9/anXfuudVNvzgdu+9z1z+asJojA9uAACgRhTl"), @@ -86,7 +86,7 @@ public class Main { public String author; // if null, "Author is unknown." 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. - // 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 diff --git a/firestar/src/main/java/Suggs.java b/firestar/src/main/java/Suggs.java index 635dfbc..6fb86a6 100644 --- a/firestar/src/main/java/Suggs.java +++ b/firestar/src/main/java/Suggs.java @@ -414,7 +414,9 @@ public class Suggs implements ActionListener, ListSelectionListener { progressDialog.destroyDialog(); 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); }).start(); }