implement mod list load

This commit is contained in:
Downforce Agent 2024-05-07 00:47:43 -05:00
parent 0b6e6fd276
commit 4086dfd319
3 changed files with 25 additions and 30 deletions

View File

@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="net.lingala.zip4j" type="repository">
<properties maven-id="net.lingala.zip4j:zip4j:2.11.5" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/lingala/zip4j/zip4j/2.11.5/zip4j-2.11.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -8,5 +8,6 @@
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="org.json-1.6-20240205" level="project" /> <orderEntry type="library" name="org.json-1.6-20240205" level="project" />
<orderEntry type="library" name="net.lingala.zip4j" level="project" />
</component> </component>
</module> </module>

View File

@ -26,7 +26,9 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.nio.file.*;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import net.lingala.zip4j.*;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE; import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
@ -57,37 +59,10 @@ public class MissPiggy implements ActionListener {
private int selectedItem; private int selectedItem;
public String priorityList;
// Initialize the main window // Initialize the main window
public void Action(/*Main entryPoint*/) { public void Action(/*Main entryPoint*/) {
/// DEBUG ///
Main.Mod testModEntry = new Main().new Mod(); //this is retarded? we're making a new object of a certain type, why the fuck do you care where it comes from? static or regardless??
testModEntry.friendlyName = "Example Mod 1";
testModEntry.description = "Example Mod 1";
testModEntry.game = "2048";
testModEntry.path = "/home/bonkyboo/madarao_sneaky2_square.png"; //used to test file sizes
testModEntry.version = 1;
//testModEntry.priority = 0; //will discard this in favor of the list index for simplicity
Main.Mods.add(testModEntry);
Main.Mod testModEntry2 = new Main().new Mod();
testModEntry2.friendlyName = "Example Mod 2";
testModEntry2.description = "Example Mod 2";
testModEntry2.author = "Daniel Chang";
testModEntry2.game = "2048";
testModEntry2.path = "/home/bonkyboo/chengou.mp4";
testModEntry2.version = 1;
testModEntry2.loaderversion = 0;
Main.Mods.add(testModEntry2);
Main.Mod testModEntry3 = new Main().new Mod();
testModEntry3.friendlyName = "Example Mod 3";
testModEntry3.description = "Example Mod 3";
testModEntry3.author = "John Dekka";
testModEntry3.game = "2048";
testModEntry3.path = "/home/bonkyboo/round2.mp4";
testModEntry3.version = 1;
testModEntry3.loaderversion = 0;
Main.Mods.add(testModEntry3);
///-/////-///
// populate menu bar // populate menu bar
menuBar = new JMenuBar(); menuBar = new JMenuBar();
fileMenu = new JMenu("File"); fileMenu = new JMenu("File");
@ -103,6 +78,8 @@ public class MissPiggy implements ActionListener {
toolsMenu.add(new JMenuItem("Edit Metadata")); // disabled if a mod is not selected from the list toolsMenu.add(new JMenuItem("Edit Metadata")); // disabled if a mod is not selected from the list
toolsMenu.add(new JMenuItem("Generate New Mod from Folder...")); toolsMenu.add(new JMenuItem("Generate New Mod from Folder..."));
toolsMenu.add(new JMenuItem("Create Soundtrack Mod..."));
//toolsMenu.add(new JMenuItem("Download Mod from URL")); // TODO: implement. move option to File menu. should be ez
helpMenu.add(new JMenuItem("About Firestar")); helpMenu.add(new JMenuItem("About Firestar"));
@ -184,6 +161,13 @@ public class MissPiggy implements ActionListener {
modList.setVisibleRowCount(Main.Mods.size()); modList.setVisibleRowCount(Main.Mods.size());
modList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); modList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
try {
priorityList = new String(Files.readAllBytes(Paths.get(Main.inpath + "mods/index"))); //let's please stop repasting the config path over and over - refactor this if customizable inpath is implemented
} catch (IOException e) {
//new File();
priorityList = "";
}
// add text entry for each // add text entry for each
int i = 0; int i = 0;
/*JLabel[]*/String[] contents = new String[Main.Mods.size()]; /*JLabel[]*/String[] contents = new String[Main.Mods.size()];