Skip to content

Commit 47771b1

Browse files
committed
fix: adb for windows issue resolved (as much as can be, anyway)
1 parent 20484e2 commit 47771b1

6 files changed

Lines changed: 42 additions & 23 deletions

File tree

readme.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ adb is also baked in to simplify the process of connecting to an Android device;
2929

3030
## Setup:
3131

32-
1. Add a key and certificate to the same directory as you run the jar from for signing the new APK (I may include a dummy one to remove this step)
3332
1. Run `java -jar [app path]/DropmixModdingTool.jar` (depending on your device you may only need to click on the icon in your Finder/Explorer)
3433
1. Add a valid Dropmix APK file (must be v1.9.0) and verify it
3534
1. (if desired) connect Android device (will fail if more than one available)
3635
1. Go to playlists tab and select the playlists you wish to swap
37-
1. Build the modded version of the APK
36+
1. Build the modded version of the APK (Safe Swap recommended; see Swap info below)
3837
1. Either install it directly to you ADB connected device or save it to your hard drive
38+
1. Once you have all card data downloaded, you should only run the app with wifi and data disabled to prevent constant server data refreshes
39+
40+
### Recommendations:
41+
42+
- As modifying the apk requires the app to be be signed with a new security key, there will be issues with any data you already have. With this in mind it's recommended to use the "Build Re-Signed APK" function to have a straight copy of the app unmodified but with the same signature as other mods
43+
- The Safe Swap modification process isn't perfect but as it doesn't break the data integrity within the app (requiring all card data to be redownloaded), it's a better long term option
3944

4045
## Troubleshooting
4146

@@ -45,13 +50,13 @@ I need to know the version of Java you're using and the output of the log panel
4550
- what version of java is it?
4651
- do you have multiple adb devices conneccted to your computer?
4752
- is the Dropmix APK file definitely 1.9.0
53+
- download all card data via the app and proceed to never use the app while connected to the internet again
4854

4955
### Known Issues:
5056

51-
1. A fresh install of all card data is required after each install currently [I'm guessing this is some kind of auto refresh function baked into the app]
57+
1. Full card swap process triggers redownload of all card assets
5258
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
53-
1. Logs aren't updating correctly; I think I need to add some multithreading functionality
54-
1. UI in general has weird lags tbh
59+
1. UI in general has weird lags tbh; it may need a rethink in general
5560
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
5661
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!
5762
1. No data is saved between instances of the program so you need to readd the apk each time
@@ -60,14 +65,30 @@ I need to know the version of Java you're using and the output of the log panel
6065
## Current functionality:
6166

6267
1. Parse app's key card database
63-
1. Generates a modified version of the application with playlists swapped
68+
1. Generates a modified version of the application with playlists swapped (two processes available)
6469
1. Directly installs modified APK onto connected android device (requires ADB server instance)
6570

71+
### Modification Options
72+
73+
#### Full swap
74+
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.
76+
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
78+
79+
#### Safe Swap
80+
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.
82+
83+
#### Future Options
84+
85+
As I've had to update the game level data for the safe swap, I've largely implemented the parsing and writing of the database which would allow custom cards along with more extensive game modifications (e.g. FX cards rules appear to be set here too)
86+
6687
## Future work:
6788

68-
1. Alternative swap process using `level0` data (will not require fresh data downloads so future-proof but won't have 100% accurate card behaviour)
69-
1. Include associated baffler cards in playlist swaps
70-
1. Mod iOS app on M1 devices
71-
1. Verify working on Windows
72-
1. Tools for straightforward installing of APK without mods
73-
1. Mayyyyybe custom cards? This involves modifying the level0 assets file instead and injecting custom data files post-install so it's not so easy
89+
This is the work I intend to do rather than stretch goals and bolder things
90+
91+
1. Output APK alongside CSV file outlining changes from the main one
92+
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)
94+
1. Mod iOS app on M1 devices

src/AdbWinApi.dll

106 KB
Binary file not shown.

src/AdbWinUsbApi.dll

71.6 KB
Binary file not shown.

src/util/Helpers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ public static <T> List<T> getListFromArray(T[] arr) {
121121
return Arrays.stream(arr).collect(Collectors.toList());
122122
}
123123

124-
public static String saveTempFile(String resourcePath, String tempFileName) {
124+
public static String saveTempFile(String resourcePath, String tempFileName, String extension) {
125125
try {
126126
String srcFileName = UtilAdb.class.getResource(resourcePath).getFile();
127127
System.out.println(srcFileName);
128128
byte[] adbBytes = IOUtils.toByteArray(UtilAdb.class.getResourceAsStream(resourcePath));
129129

130-
Path tempFilePath = Files.createTempFile(tempFileName, null);
130+
Path tempFilePath = Files.createTempFile(tempFileName, extension);
131131
Files.write(tempFilePath, adbBytes);
132132

133133
if (System.getProperty("os.name").toLowerCase().contains("mac")) {

src/util/UtilAdb.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,20 @@ public static void killAdbServer() {
6060
}
6161
}
6262
private static String getAdbPath() {
63-
try {
6463
String adbLocation = "adb-linux";
6564
String os = System.getProperty("os.name").toLowerCase();
6665
if (os.contains("mac")) {
66+
System.out.println("Assuming Windows device, adb");
6767
adbLocation = "adb";
6868
} else if (os.contains("win")) {
69+
System.out.println("Assuming Windows device, using adb.exe");
6970
adbLocation = "adb.exe";
71+
Helpers.saveTempFile("/AdbWinApi.dll", "AdbWinApi", ".DLL");
72+
Helpers.saveTempFile("/AdbWinUsbApi.dll", "AdbWinUsbApi", ".DLL");
7073
} else {
7174
System.out.println(os + " issue; assuming linux");
7275
}
73-
String jarParent = new File(UtilAdb.class.getProtectionDomain().getCodeSource().getLocation()
74-
.toURI()).getParent();
75-
return Helpers.saveTempFile("/" + adbLocation, adbLocation);
76-
} catch (URISyntaxException e) {
77-
throw new RuntimeException(e);
78-
}
76+
return Helpers.saveTempFile("/" + adbLocation, adbLocation, ".EXE");
7977
}
8078
public static boolean installApk(JadbDevice device, String apkPath) {
8179
startServer();

src/util/UtilApk.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public static String recompile(String inputPath, String outputPath) {
9797
}
9898
public static void getKeyAndCert() {
9999
if (UtilApk.keyPath == null) {
100-
UtilApk.keyPath = Helpers.saveTempFile("/key.pk8", "key.pk8");
100+
UtilApk.keyPath = Helpers.saveTempFile("/key.pk8", "key.pk8", null);
101101
}
102102
if (UtilApk.certPath == null) {
103-
UtilApk.certPath = Helpers.saveTempFile("/certificate.pem", "cert.pem");
103+
UtilApk.certPath = Helpers.saveTempFile("/certificate.pem", "cert.pem", null);
104104
}
105105
}
106106
}

0 commit comments

Comments
 (0)