prepare downloader for diff system

This commit is contained in:
Downforce Agent 2024-07-13 17:25:27 -05:00
parent f209f5f37a
commit 317eeedb29
6 changed files with 311 additions and 185 deletions

View File

@ -108,7 +108,7 @@
</component>
</children>
</grid>
<grid id="c82fd" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="1000f" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@ -120,54 +120,53 @@
</properties>
<border type="none"/>
<children>
<component id="11210" class="javax.swing.JRadioButton" binding="baseRad">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<focusPainted value="false"/>
<foreground color="-1"/>
<horizontalTextPosition value="10"/>
<text value="Base game only, no updates"/>
</properties>
</component>
<component id="94d8" class="javax.swing.JRadioButton" binding="hdRad">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<focusPainted value="false"/>
<foreground color="-1"/>
<horizontalTextPosition value="10"/>
<text value="HD DLC, without Fury"/>
</properties>
</component>
<component id="69445" class="javax.swing.JRadioButton" binding="patchRad">
<component id="ec9c0" class="javax.swing.JCheckBox" binding="patchCheck">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="10" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<focusPainted value="false"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<text value="Base game only, 1.04"/>
<horizontalTextPosition value="11"/>
<text value="Updates"/>
</properties>
</component>
<component id="35def" class="javax.swing.JRadioButton" binding="furyRad">
<component id="a6e9" class="javax.swing.JCheckBox" binding="baseCheck">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="6" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<horizontalTextPosition value="10"/>
<text value="Base game"/>
</properties>
</component>
<component id="f3723" class="javax.swing.JCheckBox" binding="hdCheck">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<horizontalTextPosition value="10"/>
<text value="HD Add-On Pack"/>
</properties>
</component>
<component id="5ed0c" class="javax.swing.JCheckBox" binding="furyCheck">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<focusPainted value="false"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<horizontalAlignment value="10"/>
<horizontalTextPosition value="11"/>
<selected value="true"/>
<text value="HD Fury DLC"/>
<verticalTextPosition value="0"/>
<selected value="false"/>
<text value="Fury Add-On Pack"/>
</properties>
</component>
</children>

View File

@ -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<Main.ArcTarget> arcs = new ArrayList<Main.ArcTarget>();
ArrayList<Main.ArcKey> keys = new ArrayList<Main.ArcKey>();
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,6 +141,20 @@ public class Bert implements ActionListener {
Thread downloaderPopupThread = new Thread(new Runnable() { // run on separate thread to prevent GUI freezing
@Override
public void run() {
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;
}
// download file
boolean downloader = new Fozzie().DownloadFile(type.toString(), Main.inpath, "asset.pkg");
if (!downloader) {
@ -163,8 +175,11 @@ public class Bert implements ActionListener {
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
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;
@ -218,8 +233,11 @@ public class Bert implements ActionListener {
popup.setText("<html>Decrypting protected PFS:<br/>" + extracted + "</html>", "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));}
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;
@ -255,6 +273,7 @@ public class Bert implements ActionListener {
Main.deleteDir(new File(Main.inpath + "temp/"));
popup.destroyDialog();
}
// restore controls
JOptionPane.showMessageDialog(frame, "Assets downloaded successfully.", "Download Complete", JOptionPane.INFORMATION_MESSAGE);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="WilkinsCoffee">
<grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="416" height="479"/>
@ -25,7 +25,7 @@
</component>
<component id="29913" class="javax.swing.JEditorPane" binding="instructions">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="1" use-parent-layout="false">
<grid row="0" column="1" row-span="2" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="1" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
</constraints>
@ -45,7 +45,7 @@
</component>
<component id="c3ec3" class="javax.swing.JButton" binding="contBtn">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-2271221"/>
@ -58,7 +58,7 @@
<grid id="ee2dd" binding="inputContainer" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="3" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
@ -66,21 +66,9 @@
</properties>
<border type="none"/>
<children>
<component id="1c41b" class="javax.swing.JButton" binding="PSARC_downBtn">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-2271221"/>
<borderPainted value="false"/>
<focusPainted value="false"/>
<foreground color="-1"/>
<text value="Auto-Download"/>
</properties>
</component>
<component id="30c84" class="javax.swing.JButton" binding="PSARC_impBtn">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-2271221"/>
@ -90,12 +78,24 @@
<text value="Import My Own"/>
</properties>
</component>
<component id="1c41b" class="javax.swing.JButton" binding="PSARC_downBtn">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-2271221"/>
<borderPainted value="false"/>
<focusPainted value="false"/>
<foreground color="-1"/>
<text value="Auto-Download"/>
</properties>
</component>
</children>
</grid>
<grid id="8468" binding="inputContainer2" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="3" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
@ -126,6 +126,81 @@
</component>
</children>
</grid>
<grid id="71c64" binding="checklistContainer" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<opaque value="false"/>
</properties>
<border type="none"/>
<children>
<component id="eae72" class="javax.swing.JLabel" binding="checklistFury">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<icon value="lightNegative.png"/>
<text value="Fury DLC"/>
</properties>
</component>
<component id="ae838" class="javax.swing.JLabel" binding="checklistHD">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<icon value="lightNegative.png"/>
<text value="HD DLC"/>
</properties>
</component>
<component id="35a85" class="javax.swing.JLabel" binding="checklistPatch2">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<icon value="lightNegative.png"/>
<text value="Patch 2"/>
</properties>
</component>
<component id="4ca0c" class="javax.swing.JLabel" binding="checklistPatch1">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<icon value="lightNegative.png"/>
<text value="Patch 1"/>
</properties>
</component>
<component id="94f98" class="javax.swing.JLabel" binding="checklistBase">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
<icon value="lightNegative.png"/>
<text value="Base"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>

View File

@ -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("<html>\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);}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B