diff --git a/firestar/src/main/java/Bert.form b/firestar/src/main/java/Bert.form index b21139d..7499e47 100644 --- a/firestar/src/main/java/Bert.form +++ b/firestar/src/main/java/Bert.form @@ -108,7 +108,7 @@ - + @@ -120,54 +120,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + diff --git a/firestar/src/main/java/Bert.java b/firestar/src/main/java/Bert.java index 6ccc765..ec5c203 100644 --- a/firestar/src/main/java/Bert.java +++ b/firestar/src/main/java/Bert.java @@ -25,6 +25,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.*; +import java.util.ArrayList; public class Bert implements ActionListener { BufferedImage windowIcon; @@ -32,10 +33,10 @@ public class Bert implements ActionListener { private JPanel frameContainer; private JButton cancelbtn; private JButton downloadbtn; - private JRadioButton baseRad; - private JRadioButton patchRad; - private JRadioButton hdRad; - private JRadioButton furyRad; + private JCheckBox patchCheck; + private JCheckBox baseCheck; + private JCheckBox hdCheck; + private JCheckBox furyCheck; private ButtonGroup radios = new ButtonGroup(); private JFrame invoker; @@ -56,11 +57,6 @@ public class Bert implements ActionListener { frame.setLocationRelativeTo(parent); frame.setAlwaysOnTop(true); - radios.add(baseRad); - radios.add(patchRad); - radios.add(hdRad); - radios.add(furyRad); - cancelbtn.addActionListener(this); downloadbtn.addActionListener(this); @@ -112,29 +108,31 @@ public class Bert implements ActionListener { new File(Main.inpath + "dlc1.psarc").delete(); new File(Main.inpath + "dlc2.psarc").delete(); - Main.ArcTarget type; - Main.ArcKey key; - if (baseRad.isSelected()) { - type = Main.ArcTarget.BASE; - key = Main.ArcKey.BASE; + ArrayList arcs = new ArrayList(); + ArrayList keys = new ArrayList(); + if (baseCheck.isSelected()) { + arcs.add(Main.ArcTarget.BASE); + keys.add(Main.ArcKey.BASE); System.out.println("Begin download of data (Game version 1.0)"); - } else - if (patchRad.isSelected()) { - type = Main.ArcTarget.LATEST; - key = Main.ArcKey.LATEST; + } + if (patchCheck.isSelected()) { + arcs.add(Main.ArcTarget.LATEST); + keys.add(Main.ArcKey.LATEST); System.out.println("Begin download of data2 (Game version 1.04)"); - } else - if (hdRad.isSelected()) { - type = Main.ArcTarget.ADDON_HD; - key = Main.ArcKey.ADDON_HD; + } + if (hdCheck.isSelected()) { + arcs.add(Main.ArcTarget.ADDON_HD); + keys.add(Main.ArcKey.ADDON_HD); System.out.println("Begin download of dlc1 (HD DLC)"); - } else - if (furyRad.isSelected()) { - type = Main.ArcTarget.ADDON_HD_FURY; - key = Main.ArcKey.ADDON_HD_FURY; + } + if (furyCheck.isSelected()) { + arcs.add(Main.ArcTarget.ADDON_HD_FURY); + keys.add(Main.ArcKey.ADDON_HD_FURY); System.out.println("Begin download of dlc2 (Fury DLC)"); - } else { - return; // fire hydrant + } + if (arcs.isEmpty()) { + JOptionPane.showMessageDialog(invoker, "Select one or more asset packs.", "Error", JOptionPane.ERROR_MESSAGE); + return; } frame.dispose(); @@ -143,119 +141,140 @@ public class Bert implements ActionListener { Thread downloaderPopupThread = new Thread(new Runnable() { // run on separate thread to prevent GUI freezing @Override public void run() { - // download file - boolean downloader = new Fozzie().DownloadFile(type.toString(), Main.inpath, "asset.pkg"); - if (!downloader) { - // cleanup - new File(Main.inpath + "asset.pkg").delete(); - - // restore controls - invoker.setEnabled(true); - invoker.setVisible(true); - invoker.toFront(); - invoker.repaint(); - return; - } - - // dump contents - System.out.println("Extracting asset.pkg"); - Fozzie popup = new Fozzie(); - popup.displayTextOnly("Extracting PKG...", "Extracting"); - Process p; - try { - if (!Main.windows) {p = Runtime.getRuntime().exec(new String[]{"bash","-c","cd " + Main.inpath + ";wine pkg2zip.exe -x asset.pkg " + key.toString()});} - else {p = Runtime.getRuntime().exec(new String[]{Main.inpath + "pkg2zip.exe", "-x", "asset.pkg", key.toString()}, null, new File(Main.inpath));} //inpath cannot change here - InputStream debugin = new BufferedInputStream(p.getInputStream()); - OutputStream debugout = new BufferedOutputStream(System.out); - int c; - while ((c = debugin.read()) != -1) { - debugout.write(c); + for (Main.ArcTarget type : arcs) { + String key = ""; + switch (type) { + case BASE -> key = Main.ArcKey.BASE.toString(); + case LATEST -> key = Main.ArcKey.LATEST.toString(); + case ADDON_HD -> key = Main.ArcKey.ADDON_HD.toString(); + case ADDON_HD_FURY -> key = Main.ArcKey.ADDON_HD_FURY.toString(); + } + if (key.isEmpty()) { + System.out.println("Internal Error: Bert got dementia. Get a programmer!"); + JOptionPane.showMessageDialog(invoker, "Internal Error: Bert got dementia. Get a programmer!", "Fatal Error", JOptionPane.ERROR_MESSAGE); + return; } - debugin.close(); - debugout.close(); - p.waitFor(); - } catch (Exception e) { - System.out.println(e.getMessage()); - JOptionPane.showMessageDialog(invoker, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); - new File(Main.inpath + "asset.pkg").delete(); - invoker.setEnabled(true); - invoker.setVisible(true); - invoker.toFront(); - invoker.repaint(); - return; - } - // decrypt - System.out.println("Decrypting asset.pkg"); - String extracted; - String name; - if (type == Main.ArcTarget.BASE) { - extracted = "app/PCSA00015"; - name = "data.psarc"; - } else if (type == Main.ArcTarget.LATEST) { - extracted = "patch/PCSA00015"; - name = "data2.psarc"; - } else if (type == Main.ArcTarget.ADDON_HD) { - extracted = "addcont/PCSA00015/DLC1W2048PACKAGE"; - name = "dlc1.psarc"; - } else if (type == Main.ArcTarget.ADDON_HD_FURY) { // this is not "always true" - intellij is actually very dumj - extracted = "addcont/PCSA00015/DLC2W2048PACKAGE"; - name = "dlc2.psarc"; - } else { - System.out.println("Internal Error: Bert got dementia. Get a programmer!"); - JOptionPane.showMessageDialog(invoker, "Internal Error: Bert got dementia. Get a programmer!", "Fatal Error", JOptionPane.ERROR_MESSAGE); + // download file + boolean downloader = new Fozzie().DownloadFile(type.toString(), Main.inpath, "asset.pkg"); + if (!downloader) { + // cleanup + new File(Main.inpath + "asset.pkg").delete(); + + // restore controls + invoker.setEnabled(true); + invoker.setVisible(true); + invoker.toFront(); + invoker.repaint(); + return; + } + + // dump contents + System.out.println("Extracting asset.pkg"); + Fozzie popup = new Fozzie(); + popup.displayTextOnly("Extracting PKG...", "Extracting"); + Process p; + try { + if (!Main.windows) { + p = Runtime.getRuntime().exec(new String[]{"bash", "-c", "cd " + Main.inpath + ";wine pkg2zip.exe -x asset.pkg " + key.toString()}); + } else { + p = Runtime.getRuntime().exec(new String[]{Main.inpath + "pkg2zip.exe", "-x", "asset.pkg", key.toString()}, null, new File(Main.inpath)); + } //inpath cannot change here + InputStream debugin = new BufferedInputStream(p.getInputStream()); + OutputStream debugout = new BufferedOutputStream(System.out); + int c; + while ((c = debugin.read()) != -1) { + debugout.write(c); + } + debugin.close(); + debugout.close(); + p.waitFor(); + } catch (Exception e) { + System.out.println(e.getMessage()); + JOptionPane.showMessageDialog(invoker, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); + new File(Main.inpath + "asset.pkg").delete(); + invoker.setEnabled(true); + invoker.setVisible(true); + invoker.toFront(); + invoker.repaint(); + return; + } + + // decrypt + System.out.println("Decrypting asset.pkg"); + String extracted; + String name; + if (type == Main.ArcTarget.BASE) { + extracted = "app/PCSA00015"; + name = "data.psarc"; + } else if (type == Main.ArcTarget.LATEST) { + extracted = "patch/PCSA00015"; + name = "data2.psarc"; + } else if (type == Main.ArcTarget.ADDON_HD) { + extracted = "addcont/PCSA00015/DLC1W2048PACKAGE"; + name = "dlc1.psarc"; + } else if (type == Main.ArcTarget.ADDON_HD_FURY) { // this is not "always true" - intellij is actually very dumj + extracted = "addcont/PCSA00015/DLC2W2048PACKAGE"; + name = "dlc2.psarc"; + } else { + System.out.println("Internal Error: Bert got dementia. Get a programmer!"); + JOptionPane.showMessageDialog(invoker, "Internal Error: Bert got dementia. Get a programmer!", "Fatal Error", JOptionPane.ERROR_MESSAGE); + new File(Main.inpath + "asset.pkg").delete(); + Main.deleteDir(new File(Main.inpath + "app/")); + Main.deleteDir(new File(Main.inpath + "patch/")); + Main.deleteDir(new File(Main.inpath + "addcont/")); + invoker.setEnabled(true); + invoker.setVisible(true); + invoker.toFront(); + invoker.repaint(); + return; + } + + popup.setText("Decrypting protected PFS:
" + extracted + "", "Decrypting"); + + try { + if (!Main.windows) { + p = Runtime.getRuntime().exec(new String[]{"bash", "-c", "cd " + Main.inpath + ";wine psvpfsparser.exe -i " + extracted + " -o ./temp/ -z " + key.toString() + " -f cma.henkaku.xyz"}); + } else { + p = Runtime.getRuntime().exec(new String[]{Main.inpath + "psvpfsparser.exe", "-i", extracted, "-o", "./temp/", "-z", key.toString(), "-f", "cma.henkaku.xyz"}, null, new File(Main.inpath)); + } + InputStream debugin = new BufferedInputStream(p.getInputStream()); + OutputStream debugout = new BufferedOutputStream(System.out); + int c; + while ((c = debugin.read()) != -1) { + debugout.write(c); + } + debugin.close(); + debugout.close(); + p.waitFor(); + } catch (Exception e) { + System.out.println(e.getMessage()); + JOptionPane.showMessageDialog(invoker, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); + new File(Main.inpath + "asset.pkg").delete(); + Main.deleteDir(new File(Main.inpath + "app/")); + Main.deleteDir(new File(Main.inpath + "patch/")); + Main.deleteDir(new File(Main.inpath + "addcont/")); + invoker.setEnabled(true); + invoker.setVisible(true); + invoker.toFront(); + invoker.repaint(); + return; + } + + popup.setText("Deleting temporary files...", "Cleaning Up"); + + // stage & cleanup + System.out.println("Cleaning up"); new File(Main.inpath + "asset.pkg").delete(); + new File(Main.inpath + "temp/PSP2/" + name).renameTo(new File(Main.inpath + name)); Main.deleteDir(new File(Main.inpath + "app/")); Main.deleteDir(new File(Main.inpath + "patch/")); Main.deleteDir(new File(Main.inpath + "addcont/")); - invoker.setEnabled(true); - invoker.setVisible(true); - invoker.toFront(); - invoker.repaint(); - return; + Main.deleteDir(new File(Main.inpath + "temp/")); + + popup.destroyDialog(); } - popup.setText("Decrypting protected PFS:
" + extracted + "", "Decrypting"); - - try { - if (!Main.windows) {p = Runtime.getRuntime().exec(new String[]{"bash","-c","cd " + Main.inpath + ";wine psvpfsparser.exe -i " + extracted + " -o ./temp/ -z " + key.toString() + " -f cma.henkaku.xyz"});} - else {p = Runtime.getRuntime().exec(new String[]{Main.inpath + "psvpfsparser.exe", "-i", extracted, "-o", "./temp/", "-z", key.toString(), "-f", "cma.henkaku.xyz"}, null, new File(Main.inpath));} - InputStream debugin = new BufferedInputStream(p.getInputStream()); - OutputStream debugout = new BufferedOutputStream(System.out); - int c; - while ((c = debugin.read()) != -1) { - debugout.write(c); - } - debugin.close(); - debugout.close(); - p.waitFor(); - } catch (Exception e) { - System.out.println(e.getMessage()); - JOptionPane.showMessageDialog(invoker, "CRITICAL FAILURE: " + e.getMessage(), "Fatal Error", JOptionPane.ERROR_MESSAGE); - new File(Main.inpath + "asset.pkg").delete(); - Main.deleteDir(new File(Main.inpath + "app/")); - Main.deleteDir(new File(Main.inpath + "patch/")); - Main.deleteDir(new File(Main.inpath + "addcont/")); - invoker.setEnabled(true); - invoker.setVisible(true); - invoker.toFront(); - invoker.repaint(); - return; - } - - popup.setText("Deleting temporary files...", "Cleaning Up"); - - // stage & cleanup - System.out.println("Cleaning up"); - new File(Main.inpath + "asset.pkg").delete(); - new File(Main.inpath + "temp/PSP2/" + name).renameTo(new File(Main.inpath + name)); - Main.deleteDir(new File(Main.inpath + "app/")); - Main.deleteDir(new File(Main.inpath + "patch/")); - Main.deleteDir(new File(Main.inpath + "addcont/")); - Main.deleteDir(new File(Main.inpath + "temp/")); - - popup.destroyDialog(); - // restore controls JOptionPane.showMessageDialog(frame, "Assets downloaded successfully.", "Download Complete", JOptionPane.INFORMATION_MESSAGE); invoker.setEnabled(true); diff --git a/firestar/src/main/java/WilkinsCoffee.form b/firestar/src/main/java/WilkinsCoffee.form index 5c57386..d0fed0e 100644 --- a/firestar/src/main/java/WilkinsCoffee.form +++ b/firestar/src/main/java/WilkinsCoffee.form @@ -1,6 +1,6 @@
- + @@ -25,7 +25,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -66,21 +66,9 @@ - - - - - - - - - - - - - + @@ -90,12 +78,24 @@ + + + + + + + + + + + + - + @@ -126,6 +126,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/firestar/src/main/java/WilkinsCoffee.java b/firestar/src/main/java/WilkinsCoffee.java index 6e5e6f8..5d53936 100644 --- a/firestar/src/main/java/WilkinsCoffee.java +++ b/firestar/src/main/java/WilkinsCoffee.java @@ -46,6 +46,12 @@ public class WilkinsCoffee implements ActionListener { private JPanel inputContainer2; private JButton EXPORT_openFolderBtn; private JLabel pathDisplay; + private JPanel checklistContainer; + private JLabel checklistFury; + private JLabel checklistHD; + private JLabel checklistPatch2; + private JLabel checklistPatch1; + private JLabel checklistBase; public enum Pages { INTRO(0), @@ -66,6 +72,7 @@ public class WilkinsCoffee implements ActionListener { public void setup() { page = Pages.INTRO; inputContainer.setVisible(false); + checklistContainer.setVisible(false); inputContainer2.setVisible(false); // check if this is windows or not @@ -110,6 +117,7 @@ public class WilkinsCoffee implements ActionListener { frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLayout(new GridLayout()); frame.setLocationRelativeTo(null); + refreshChecklist(); frame.setVisible(true); } @@ -122,6 +130,8 @@ public class WilkinsCoffee implements ActionListener { if (new Bert(frame).reportWhenDownloaded(threadParent)) { contBtn.setEnabled(true); contBtn.setBackground(new Color(221, 88, 11)); //orange + + refreshChecklist(); } }}); waiterThread.start(); @@ -189,6 +199,7 @@ public class WilkinsCoffee implements ActionListener { contBtn.setEnabled(false); contBtn.setBackground(new Color(102, 74, 58)); //brown inputContainer.setVisible(true); + checklistContainer.setVisible(true); if (!sdkInstalled) { PSARC_downBtn.setEnabled(false); PSARC_downBtn.setBackground(new Color(102, 74, 58)); //brown @@ -221,6 +232,7 @@ public class WilkinsCoffee implements ActionListener { contBtn.setEnabled(true); contBtn.setBackground(new Color(221, 88, 11)); //orange inputContainer.setVisible(false); + checklistContainer.setVisible(false); inputContainer2.setVisible(true); instructions.setText("\n" + @@ -275,4 +287,25 @@ public class WilkinsCoffee implements ActionListener { } } } + + private void refreshChecklist() { + ImageIcon positive = new ImageIcon(Main.class.getResource("/lightPositive.png")); + ImageIcon negative = new ImageIcon(Main.class.getResource("/lightNegative.png")); + + if(new File(Main.inpath + "data.psarc").exists()) { + checklistBase.setIcon(positive); + } else {checklistBase.setIcon(negative);} + if(new File(Main.inpath + "data1.psarc").exists()) { + checklistPatch1.setIcon(positive); + } else {checklistPatch1.setIcon(negative);} + if(new File(Main.inpath + "data2.psarc").exists()) { + checklistPatch2.setIcon(positive); + } else {checklistPatch2.setIcon(negative);} + if(new File(Main.inpath + "dlc1.psarc").exists()) { + checklistHD.setIcon(positive); + } else {checklistHD.setIcon(negative);} + if(new File(Main.inpath + "dlc2.psarc").exists()) { + checklistFury.setIcon(positive); + } else {checklistFury.setIcon(negative);} + } } diff --git a/firestar/src/main/resources/lightNegative.png b/firestar/src/main/resources/lightNegative.png new file mode 100644 index 0000000..2950d2e Binary files /dev/null and b/firestar/src/main/resources/lightNegative.png differ diff --git a/firestar/src/main/resources/lightPositive.png b/firestar/src/main/resources/lightPositive.png new file mode 100644 index 0000000..c9b8f67 Binary files /dev/null and b/firestar/src/main/resources/lightPositive.png differ