next step is to implement our first i/o

This commit is contained in:
Downforce Agent 2024-04-19 18:06:52 -05:00
parent cc2c143ff2
commit 82fc9773a6
6 changed files with 88 additions and 20 deletions

View File

@ -1,7 +1,7 @@
<component name="libraryTable">
<library name="org.json-1.6-20240205">
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/org.json-1.6-20240205.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/org.json.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -1,6 +1,6 @@
![](https://files.worlio.com/users/bonkmaykr/http/git/embed/firestar.png)
# about 10% complete (basic frontend in progress, nonfunctional)
# about 30% complete (basic frontend in progress, nonfunctional)
Firestar is a mod manager for WipEout 2048 which automatically handles sorting mods by priority and repacking game assets based on selected add-on packs. It runs on a desktop/laptop computer and aims to allow easy installation of mods for users who have only a surface level understanding of hacking the PSVita.
TODO: modlist window screenshot

BIN
lib/org.json.jar Executable file

Binary file not shown.

View File

@ -40,10 +40,10 @@ public class Main {
//public static String psarc; //sdk location
public class Mod {
public String path;
public String path; // file name
public int version = 1;
//public int gameversion; //TODO detect a game version and compatibility? // no
public int priority = 0;
public int priority = 0; //unused
public String friendlyName;
public String game; //TODO for multi game support
public int loaderversion = 0; //minimum required vint or feature level from Firestar

View File

@ -9,7 +9,7 @@
<border type="none"/>
<children>
<grid id="6cdb1" binding="descriptionContainer" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="10" bottom="0" right="0"/>
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false">
<minimum-size width="300" height="-1"/>
@ -19,7 +19,20 @@
</constraints>
<properties/>
<border type="line" title="Description"/>
<children/>
<children>
<component id="a9cee" class="javax.swing.JTextPane" binding="descriptionField">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<focusable value="false"/>
<text value="Select a mod from the list on the right to view more details, or to make changes to your installation."/>
</properties>
</component>
</children>
</grid>
<scrollpane id="ecc63" binding="modListScrollContainer">
<constraints>

View File

@ -17,9 +17,13 @@
*/
import javax.swing.*;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
@ -37,7 +41,7 @@ public class MissPiggy implements ActionListener {
//JMenuItem menuItem;
JScrollPane modListScrollContainer;
public JList<String/*JLabel*/> modList;
public JList<String> modList;
private JButton toggleButton;
private JButton moveUpButton;
private JButton deleteButton1;
@ -45,6 +49,7 @@ public class MissPiggy implements ActionListener {
private JButton optionsButton;
private JButton importButton;
private JButton deployButton;
private JTextPane descriptionField;
private int selectedItem;
@ -54,16 +59,29 @@ public class MissPiggy implements ActionListener {
// todo display modlist
/// DEBUG ///
Main.Mod testModEntry = /*entryPoint*/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";
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.game = "2048";
testModEntry.path = "unused";
testModEntry.path = "/home/bonkyboo/madarao_sneaky2_square.png"; //used to test file sizes
testModEntry.version = 1;
testModEntry.priority = 0; //might discard this in favor of the list index for simplicity
testModEntry.loaderversion = 0;
Main.Mods.add(testModEntry);
Main.Mods.add(testModEntry);
//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.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.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
@ -103,8 +121,42 @@ public class MissPiggy implements ActionListener {
toolsMenu.getItem(1).addActionListener(this);
helpMenu.getItem(0).addActionListener(this);
descriptionField.getDocument().putProperty("filterNewlines", Boolean.FALSE);
modList.addListSelectionListener(e -> {
String authorDisplay;
File pathReference = new File(Main.Mods.get(modList.getSelectedIndex()).path);
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.UP);
float modFileSize = pathReference.length(); //precise units
String modFileSizeStr = String.valueOf(modFileSize);
String modFileSizeUnits = "bytes";
if (pathReference.length() >= 1024) {
modFileSizeStr = String.valueOf(df.format(modFileSize / 1024));
modFileSizeUnits = "Kilobytes";
}
if (pathReference.length() >= 1024 * 1024) {
modFileSizeStr = String.valueOf(df.format(modFileSize / (1024 * 1024)));
modFileSizeUnits = "Megabytes";
}
if (pathReference.length() >= 1024 * 1024 * 1024) {
modFileSizeStr = String.valueOf(df.format(modFileSize / (1024 * 1024 * 1024)));
modFileSizeUnits = "Gigabytes";
}
if (Main.Mods.get(modList.getSelectedIndex()).author == null) {
authorDisplay = "an Unknown Author";
} else {
authorDisplay = Main.Mods.get(modList.getSelectedIndex()).author;
}
descriptionField.setText(
"\"" + Main.Mods.get(modList.getSelectedIndex()).friendlyName + "\"\n" +
"by " + authorDisplay + "\n\n" +
"Version " + Main.Mods.get(modList.getSelectedIndex()).version + "\n" +
modFileSizeStr + " " + modFileSizeUnits + " in size"
);});
// display window
frame.setSize(800, 600); // 1280 800
frame.setMinimumSize(new Dimension(640,480));
frame.setTitle("Firestar Mod Manager");
frame.setResizable(true);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
@ -115,6 +167,7 @@ public class MissPiggy implements ActionListener {
public void InitializeModListInGUI() { // i really wanted this to be "lights, camera, action" but the code organizing kept getting stupider and stupider so i gave up
// cleanup
descriptionField.setText("Select a mod from the list on the right to view more details, or to make changes to your installation.");
modList.clearSelection();
modList.removeAll();
modList.setVisibleRowCount(Main.Mods.size());
@ -127,20 +180,22 @@ public class MissPiggy implements ActionListener {
/*JLabel[]*/String[] contents = new String[Main.Mods.size()];
System.out.println("Initializing modList to GUI with length of " + Main.Mods.size() + "units"); //debug
while (i < Main.Mods.size()) {
//JLabel label = new JLabel(Main.Mods.get(i).friendlyName);
//label.setVisible(true);
//contents[i] = label; //modList.add(label);
contents[i] = Main.Mods.get(i).friendlyName;
//debug
if (Main.Mods.get(i).author == null) {Main.Mods.get(i).author = "Anonymous";}
System.out.println("Added " + Main.Mods.get(i).friendlyName + " by " + Main.Mods.get(i).author);
String authorDisplay;
if (Main.Mods.get(i).author == null) {authorDisplay = "Anonymous";} else {authorDisplay = "\"" + Main.Mods.get(i).author + "\"";}
System.out.println("Added " + Main.Mods.get(i).friendlyName + " by " + authorDisplay);
i++;
}
modList.setListData(contents);
}
private ListSelectionListener whenItemSelected() {
return null;
}
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getSource() == fileMenu.getItem(5)) {System.exit(0);} else