Compare commits
2 Commits
125fc238b3
...
f615b199a4
Author | SHA1 | Date | |
---|---|---|---|
f615b199a4 | |||
34c5f17d71 |
|
@ -96,8 +96,8 @@ public class Bert implements ActionListener {
|
|||
if (result == JOptionPane.NO_OPTION) {return;}
|
||||
System.out.println("User requested download of assets. Deleting existing PSARCs");
|
||||
new File(Main.inpath + "data.psarc").delete();
|
||||
new File(Main.inpath + "data01.psarc").delete();
|
||||
new File(Main.inpath + "data02.psarc").delete();
|
||||
new File(Main.inpath + "data1.psarc").delete();
|
||||
new File(Main.inpath + "data2.psarc").delete();
|
||||
new File(Main.inpath + "dlc1.psarc").delete();
|
||||
new File(Main.inpath + "dlc2.psarc").delete();
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class Bert implements ActionListener {
|
|||
if (patchRad.isSelected()) {
|
||||
type = Main.ArcTarget.LATEST;
|
||||
key = Main.ArcKey.LATEST;
|
||||
System.out.println("Begin download of data02 (Game version 1.04)");
|
||||
System.out.println("Begin download of data2 (Game version 1.04)");
|
||||
} else
|
||||
if (hdRad.isSelected()) {
|
||||
type = Main.ArcTarget.ADDON_HD;
|
||||
|
@ -148,10 +148,20 @@ public class Bert implements ActionListener {
|
|||
|
||||
// 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());
|
||||
|
@ -173,7 +183,7 @@ public class Bert implements ActionListener {
|
|||
name = "data.psarc";
|
||||
} else if (type == Main.ArcTarget.LATEST) {
|
||||
extracted = "patch/PCSA00015";
|
||||
name = "data02.psarc";
|
||||
name = "data2.psarc";
|
||||
} else if (type == Main.ArcTarget.ADDON_HD) {
|
||||
extracted = "addcont/PCSA00015/DLC1W2048PACKAGE";
|
||||
name = "dlc1.psarc";
|
||||
|
@ -184,26 +194,9 @@ public class Bert implements ActionListener {
|
|||
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();
|
||||
new File(Main.inpath + "app/").delete();
|
||||
new File(Main.inpath + "patch/").delete();
|
||||
new File(Main.inpath + "addcont/").delete();
|
||||
invoker.setEnabled(true);
|
||||
invoker.setVisible(true);
|
||||
invoker.toFront();
|
||||
invoker.repaint();
|
||||
return;
|
||||
}
|
||||
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));}
|
||||
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();
|
||||
new File(Main.inpath + "app/").delete();
|
||||
new File(Main.inpath + "patch/").delete();
|
||||
new File(Main.inpath + "addcont/").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();
|
||||
|
@ -211,15 +204,47 @@ public class Bert implements ActionListener {
|
|||
return;
|
||||
}
|
||||
|
||||
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));}
|
||||
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 + "addcont/"));
|
||||
Main.deleteDir(new File(Main.inpath + "patch/"));
|
||||
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);
|
||||
|
|
|
@ -96,6 +96,38 @@ public class Fozzie {
|
|||
}
|
||||
}
|
||||
|
||||
public void displayTextOnly(String text, String title) {
|
||||
frame.add(frameContainer);
|
||||
frame.setSize(300, 100);
|
||||
frame.setTitle(title);
|
||||
frame.setResizable(false);
|
||||
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
frame.setLayout(new GridLayout());
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setAlwaysOnTop(true);
|
||||
try {
|
||||
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
|
||||
frame.setIconImage(windowIcon);
|
||||
} catch (IOException e) {
|
||||
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
|
||||
}
|
||||
frame.setVisible(true);
|
||||
|
||||
label.setText(text);
|
||||
|
||||
progressBar.setVisible(false);
|
||||
}
|
||||
|
||||
public void setText(String text, String title) {
|
||||
label.setText(text);
|
||||
frame.setTitle(title);
|
||||
}
|
||||
|
||||
public void destroyDialog() {
|
||||
frame.setVisible(false);
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
public void disconnect() throws IOException {
|
||||
inputStream.close();
|
||||
httpConn.disconnect();
|
||||
|
|
Loading…
Reference in New Issue
Block a user