fieryhenry / BCSFE-Python

A python save editor for the mobile game The Battle Cats
MIT License
126 stars 17 forks source link

ADBD Requires Root, Won't Run In Production #17

Closed ann4belle closed 1 year ago

ann4belle commented 1 year ago

For this to work, the Android device needs to be running adbd as root - something that isn't allowed in production builds, which most devices are running.

There's a pretty simple workaround for this (assuming the Android device is rooted). I tried to implement it myself and create a PR, but I couldn't quite get it right.

The workaround would look something like this:

  1. If adb returns an "access denied" error when pulling the save file, try adb root
  2. If that returns "adb cannot run as root in production builds", run adb shell su -c "cp /data/data/jp.co.ponos.battlecatsen/files/SAVE_FILE /sdcard/SAVE_FILE && chmod o+rw /sdcard/SAVE_FILE", then just pull /sdcard/SAVE_FILE to get the save
  3. To upload the save, just push the file to /sdcard/SAVE_FILE and run adb shell su -c "cp /sdcard/SAVE_FILE /data/data/jp.co.ponos.battlecatsen/files/SAVE_FILE"

You may also have to chown /data/data/jp.co.ponos.battlecatsen/files/SAVE_FILE after this - I'm not sure if ADB keeps ownership and permissions when a file is overwritten.

fieryhenry commented 1 year ago

Thanks for this. If you can, can you check that the latest commit fixes this? (on branch 3.0.0)

ann4belle commented 1 year ago

Seems to work, thanks!