Read/write requires[] and extracts[]

This commit is contained in:
2025-02-20 09:08:23 -06:00
parent f336be5a0a
commit f07a75276c
3 changed files with 44 additions and 16 deletions

View File

@@ -163,12 +163,15 @@ public class Clifford implements ActionListener {
JOptionPane.showMessageDialog(frame, "Mod name cannot be empty.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
container.put("version", mod.version);
container.put("friendlyName", mod.friendlyName);
container.put("author", mod.author);
container.put("description", mod.description);
container.put("loaderversion", mod.loaderversion);
container.put("game", mod.game);
if (!mod.requires.isEmpty()) container.put("requires", mod.requires);
if (!mod.extracts.isEmpty()) container.put("extracts", mod.extracts);
try {
new ZipFile(System.getProperty("user.home") + "/.firestar/mods/" + mod.path.trim()).setComment(container.toString());
@@ -213,22 +216,39 @@ public class Clifford implements ActionListener {
hasScript = true;
}
ArrayList<String> requires = new ArrayList<>();
ArrayList<String> extracts = new ArrayList<>();
if (isSoundtrack) {
requires.add("data2.psarc");
extracts.add("data/plugins/music/Definition.xml");
extracts.add("data/plugins/languages/american/entries.xml");
extracts.add("data/plugins/languages/danish/entries.xml");
extracts.add("data/plugins/languages/dutch/entries.xml");
extracts.add("data/plugins/languages/english/entries.xml");
extracts.add("data/plugins/languages/finnish/entries.xml");
extracts.add("data/plugins/languages/french/entries.xml");
extracts.add("data/plugins/languages/german/entries.xml");
extracts.add("data/plugins/languages/italian/entries.xml");
extracts.add("data/plugins/languages/japanese/entries.xml");
extracts.add("data/plugins/languages/norwegian/entries.xml");
extracts.add("data/plugins/languages/polish/entries.xml");
extracts.add("data/plugins/languages/portuguese/entries.xml");
extracts.add("data/plugins/languages/russian/entries.xml");
extracts.add("data/plugins/languages/spanish/entries.xml");
extracts.add("data/plugins/languages/swedish/entries.xml");
}
JSONObject container = new JSONObject();
container.put("version", Integer.parseInt(fVersion.getText()));
container.put("friendlyName", fName.getText());
container.put("author", fAuthor.getText());
container.put("description", fDescription.getText());
if (!requires.isEmpty()) container.put("requires", requires);
if (!extracts.isEmpty()) container.put("extracts", extracts);
// 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) {
ArrayList<boolean[]> requiresTemp = new ArrayList<>();
requiresTemp.add(new boolean[]{false, true, false, false});
requiresTemp.add(new boolean[]{true, false, false, false});
container.put("requires", requiresTemp); // Pull localization files for patching.
// TODO: container.put paths patched in fscript
}
} else {
container.put("loaderversion", 0);
}

View File

@@ -57,7 +57,7 @@ public class Main {
public enum ArcTarget { // install target for 2048, type used by downloader
BASE("http://zeus.dl.playstation.net/cdn/UP9000/PCSA00015_00/NYEoaBGfiWymSEVZKxoyrKyBFsZNoFqxdyAIpZayZYuLLbCAArYrYXjPNhKCfXcONmhIZzZEeArycSrjiJOuNMWuWsDONUxMIQtMk.pkg"),
FIRST("http://gs.ww.np.dl.playstation.net/ppkg/np/PCSA00015/PCSA00015_T5/a4b7d9e35ed56e86/UP9000-PCSA00015_00-WIPEOUT2048BASE0-A0104-V0100-059564fcab8ce66d19b5a563e92677e581313205-PE.pkg"), // TODO ALLOW DATA1 DOWNLOAD
FIRST("http://gs.ww.np.dl.playstation.net/ppkg/np/PCSA00015/PCSA00015_T5/a4b7d9e35ed56e86/UP9000-PCSA00015_00-WIPEOUT2048BASE0-A0104-V0100-059564fcab8ce66d19b5a563e92677e581313205-PE.pkg"),
LATEST("http://gs.ww.np.dl.playstation.net/ppkg/np/PCSA00015/PCSA00015_T5/a4b7d9e35ed56e86/UP9000-PCSA00015_00-WIPEOUT2048BASE0-A0104-V0100-059564fcab8ce66d19b5a563e92677e581313205-PE.pkg"),
ADDON_HD("http://zeus.dl.playstation.net/cdn/UP9000/PCSA00015_00/JYMqGNXUKqHEyNLjbOgrWcJdnQJUMzgadRFWekbWFBXAwMeGikOyiHkXKogKIfqGhtNwKgmNWwwcrJORmRUTDzylBPwjGVnVjyDfh.pkg"),
ADDON_HD_FURY("http://zeus.dl.playstation.net/cdn/UP9000/PCSA00015_00/IAoJQaDpySenBmQCKiqecEPMzSdPfPcdXupxZXLTYYTuRgtsdTaHxbeejwGKRQpjJOKBdMMFzSoeEhsHYxNUasQrEzkZPeBxUEqnp.pkg");
@@ -97,8 +97,8 @@ public class Main {
public int loaderversion = 0; //minimum required vint or feature level from Firestar
public String author; // if null, "Author is unknown."
public boolean enabled = true;
public List<boolean[]> requires = new ArrayList<>(); // 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 'false true false false' in ost gen if necessary (patches change localization)
public List<String> requires = new ArrayList<>();
public List<String> extracts = new ArrayList<>();
}
// Mods
@@ -127,7 +127,7 @@ public class Main {
System.out.printf("FIRESTAR MOD MANAGER for WipEout 2048\n" + vstr + " (codename " + vcode + ") major " + vint + "\n" +
"JVM host appears to be " + System.getProperty("os.name") +
"\nRunning from " + System.getProperty("user.dir") +
"\nCopyright (C) 2024 bonkmaykr\n\nThis program is free software: you can redistribute it and/or modify\n" +
"\nCopyright (C) 2025 Canithesis Interactive\n\nThis program is free software: you can redistribute it and/or modify\n" +
"it under the terms of the GNU General Public License as published by\n" +
"the Free Software Foundation, either version 3 of the License, or\n" +
"(at your option) any later version.\n" +
@@ -273,10 +273,6 @@ public class Main {
JOptionPane.showMessageDialog(null, "All remote dependencies satisfied.", "Download Completed", JOptionPane.INFORMATION_MESSAGE);
return true;
}
public static boolean callDownloaderStatically (String url, String folder, String name) {
return new Fozzie().DownloadFile(url, folder, name);
}
public static Process exec(String[] cmd, String cwd) throws IOException {
Process p;

View File

@@ -31,8 +31,11 @@ import java.math.RoundingMode;
import java.net.URI;
import java.nio.file.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import net.lingala.zip4j.*;
import org.json.JSONException;
import org.json.JSONObject;
@@ -230,6 +233,16 @@ public class MissPiggy implements ActionListener {
if (metadata.has("loaderversion")) {m.loaderversion = Integer.parseInt(metadata.get("loaderversion").toString());}
if (metadata.has("game")) {m.game = metadata.get("game").toString();}
if (m.loaderversion >= 1) {
// Firestar 1.3 features
if (metadata.has("requires"))
for (Object i : (ArrayList<Object>)((Map<String, Object>)metadata.toMap()).get("requires"))
m.requires.add(i.toString());
if (metadata.has("extracts"))
for (Object i : (ArrayList<Object>)((Map<String, Object>)metadata.toMap()).get("extracts"))
m.extracts.add(i.toString());
}
//send to list
Main.Mods.add(m);
} catch (Exception e) {
@@ -460,7 +473,6 @@ public class MissPiggy implements ActionListener {
}
public void removeAllGUI() {
// todo warning dialog that nukes list when Yes is clicked
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete all mods?", "Remove All", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
if (result == JOptionPane.YES_OPTION) {