Skip to content

Commit b8956ab

Browse files
committed
fix: repairing some disabled states
1 parent fd320e3 commit b8956ab

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

readme.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ I need to know the version of Java you're using and the output of the log panel
5454

5555
### Known Issues:
5656

57-
1. Full card swap process triggers redownload of all card assets
58-
1. I raced through this so the UI is janky as hell. I expect frequent restarts. Some of it looks pretty bad with the Java 1.8 compilation settings but it'll do
59-
1. UI in general has weird lags tbh; it may need a rethink in general
57+
1. Full Swap process triggers re-download of all card assets
58+
1. I raced through this so the UI is janky as hell. I expect frequent restarts. Some of it looks pretty bad with the Java 1.8 compilation settings but it'll do. Would greatly appreciate from a more experienced Java developer here.
6059
1. Need to figure out the licensing stuff fully. My understanding is that all the libraries I depend on here use Apache 2.0 so I will use that too
6160
1. The included keys for signing the APK currently have had less than zero thought put into them. This is a rough and insecure project. If you want to improve anything around the security of this project I'd love the help!
62-
1. No data is saved between instances of the program so you need to readd the apk each time
61+
1. No data is saved between instances of the program so you need to re-add the apk each time
6362
1. The app does a terrible job cleaning up after itself, the directory you run the app from will likely have some junk folders in it, they'll overwrite each time you run the app and it's safe to delete them
6463

6564
## Current functionality:
@@ -72,13 +71,13 @@ I need to know the version of Java you're using and the output of the log panel
7271

7372
#### Full swap
7473

75-
This simply swaps the card IDs on the top level data tables (found in sharedassets), meaning a card will behave exactly like its swapped counterpart.
74+
This simply swaps the card IDs on the top level data tables (found in sharedassets), meaning a card should behave exactly like its swapped counterpart.
7675

77-
Unfortunately this means the card's have data which does not match the app data and a fresh download of assets will be triggered before the game can be played; meaning limited long term value
76+
Unfortunately this means the cards have data which does not match the app data and a fresh download of assets will be triggered before the game can be played; meaning limited long term value
7877

7978
#### Safe Swap
8079

81-
This swaps the IDs in the game level data (found in level0), mostly behaving exactly the same however "Power" appears to come from the top level database.
80+
This swaps the IDs in the game level data (found in level0), mostly behaving exactly the same however "Power" appears to come from the top level database and I may be missing other areas where issues exist
8281

8382
#### Future Options
8483

@@ -88,7 +87,7 @@ As I've had to update the game level data for the safe swap, I've largely implem
8887

8988
This is the work I intend to do rather than stretch goals and bolder things
9089

91-
1. Output APK alongside CSV file outlining changes from the main one
90+
1. Output APK alongside CSV file outlining changes from the main one (with same name, possibly?)
9291
1. Verify working on Windows (partially checked, ADB not)
93-
1. Tools for straightforward installing of APK without mods (i.e. install APK to device, copy data files over)
92+
1. Tools for straightforward installing of APK and data without mods (i.e. install APK to device, copy data files over)
9493
1. Mod iOS app on M1 devices

src/model/AppState.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public static TreeMap<String, String> getCardSwapFromPlaylist(TreeMap<String, St
220220
String srcBaffler = srcPl.getBaffler();
221221
String swapBaffler = swapPl.getBaffler();
222222
if (srcBaffler != null && swapBaffler != null) {
223+
System.out.printf("Swapping bafflers for %s (%s) and %s (%s)\n", srcPl.name, srcBaffler, swapPl.name, swapBaffler);
223224
generatedCardSwap.put(srcBaffler, swapBaffler);
224225
generatedCardSwap.put(swapBaffler, srcBaffler);
225226
}

src/ui/UIPlaylistActions.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ public void renderActions() {
3333
removeAll();
3434
AppState as = AppState.getInstance();
3535
UIPlaylistActions that = this;
36+
boolean recompileButtonsActive = verifiedModApk == null && as.currentProcess.equals(Process.NONE);
3637
JButton resignedApkBtn = SwingFactory.buildButton("Build Re-Signed APK", new ActionListener() {
3738
@Override
3839
public void actionPerformed(ActionEvent e) {
3940
freshDecompile(false, false);
4041
}
4142
});
42-
resignedApkBtn.setEnabled(verifiedModApk == null && as.currentProcess.equals(Process.NONE) && as.playlistSwap.isEmpty());
43+
resignedApkBtn.setEnabled(recompileButtonsActive && as.playlistSwap.isEmpty());
4344
add(resignedApkBtn);
4445

46+
boolean swapButtonsActive = !as.playlistSwap.isEmpty() && recompileButtonsActive;
47+
4548
JCheckBox cb = new JCheckBox("swap bafflers if possible");
4649
cb.addActionListener(new ActionListener() {
4750
@Override
@@ -58,15 +61,15 @@ public void actionPerformed(ActionEvent e) {
5861
freshDecompile(true, false);
5962
}
6063
});
61-
modApkBtn.setEnabled(!as.playlistSwap.isEmpty() && verifiedModApk == null && as.currentProcess.equals(Process.NONE));
64+
modApkBtn.setEnabled(swapButtonsActive);
6265
add(modApkBtn);
6366
JButton safeModApkBtn = SwingFactory.buildButton("Safe Swap", new ActionListener() {
6467
@Override
6568
public void actionPerformed(ActionEvent e) {
6669
freshDecompile(true, true);
6770
}
6871
});
69-
safeModApkBtn.setEnabled(!as.playlistSwap.isEmpty() && verifiedModApk == null);
72+
safeModApkBtn.setEnabled(swapButtonsActive);
7073
add(safeModApkBtn);
7174

7275
JButton installApkBtn = SwingFactory.buildButton("Install APK", new ActionListener() {

src/ui/UISetup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public void renderApkInput(int row) {
159159
public void actionPerformed(ActionEvent ev) {
160160
System.out.println("Verifying APK: Setting up database...");
161161
AppState.setCurrentProcess(Process.DECOMPILING);
162-
refresh();
163162
SwingWorker sw = new SwingWorker() {
164163
@Override
165164
protected Object doInBackground() throws Exception {
@@ -173,6 +172,7 @@ protected Object doInBackground() throws Exception {
173172
return null;
174173
}
175174
};
175+
refresh();
176176
sw.execute();
177177
}
178178
}

src/util/UtilAdb.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ private static String getAdbPath() {
6868
} else if (os.contains("win")) {
6969
System.out.println("Assuming Windows device, using adb.exe");
7070
adbLocation = "adb.exe";
71+
// Windows requires these library files in the same directory
7172
Helpers.saveTempFile("/AdbWinApi.dll", "AdbWinApi", ".DLL");
7273
Helpers.saveTempFile("/AdbWinUsbApi.dll", "AdbWinUsbApi", ".DLL");
7374
} else {
7475
System.out.println(os + " issue; assuming linux");
7576
}
76-
return Helpers.saveTempFile("/" + adbLocation, adbLocation, ".EXE");
77+
return Helpers.saveTempFile("/" + adbLocation, adbLocation, adbLocation.contains(".exe") ? ".EXE" : null);
7778
}
7879
public static boolean installApk(JadbDevice device, String apkPath) {
7980
startServer();

0 commit comments

Comments
 (0)