Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy storage on Android for savegames #119

Open
eadmaster opened this issue Sep 29, 2022 · 3 comments
Open

Legacy storage on Android for savegames #119

eadmaster opened this issue Sep 29, 2022 · 3 comments
Labels
enhancement Change to or improvement of existing behavior

Comments

@eadmaster
Copy link

Is your feature request related to a problem? Please describe.
I'd like to backup and restore my saves without rooting the device.

Describe the solution you'd like
set the LegacyExternalStorage flag in the app manifest and change the savegames location to /sdcard/AM2R.

Mame4Droid is currently providing this as an option.

Describe alternatives you've considered
Rooting the device.

Additional context
Add any other context or screenshots about the feature request here.

@eadmaster eadmaster added the enhancement Change to or improvement of existing behavior label Sep 29, 2022
@Lojemiru
Copy link
Collaborator

Hmm. I like the consideration to make saves accessible/non-deleted between installations, but this seems to rely on functionality that will likely be phased out in the near future (knowing Google's approach) and I'm not entirely sure we can even repoint GameMaker at that directory if we were to get the flag into the app manifest.

Worth looking into at some point, but I'll be up front and say it's not a huge priority what with the current internal process going on unless @Miepee decides to take on some Android pain.

@eadmaster
Copy link
Author

An alternative, we may have a manual save import/export feature into the app own scoped storage.

@Miepee
Copy link
Contributor

Miepee commented Sep 30, 2022

I'd like to backup and restore my saves without rooting the device.

You actually can. I found a way to do that, but forgot to document it publically / put it on faq
Only works tho, if you're on Android 11 or less (or in other words, will not work for Android 12 and higher).

  • Install/download ADB
  • Enable developer mode on Android (if not done already)
  • Connect your phone via USB to the PC, and allow ADB developer access
  • open a terminal, and execute adb backup -f ./mybackup.ab -apk com.companyname.AM2RWrapper (you may need to replace com.companyname.AM2RWrapper with com.lojical.AM2R on specific am2r versions, or with something else entirely for mods. You can use adb shell pm list packages -f -3 to list out all packages installed onto the system and find the name from there.)
  • Go to your phone, and type in your phone password in order to allow the backup
  • Now a mybackup.ab file should have been created in the folder you were in
  • Download Android-Backup-Extractor (see the right side with the releases tab)
  • Have some Java runtime installed
  • Execute java -jar ./abe unpack <path to the mybackup.ab> mybackup.tar
  • Open mybackup.tar with an unarchiver of your choice. All AM2R data is gonna be found in apps/<packagename from above>/f

set the LegacyExternalStorage flag in the app manifest and change the savegames location to /sdcard/AM2R.

I am not that familiar with Androids storage systems that developed over the years. In order for your approach to work, would one need to do both, or would simply setting the LegacyExternalStorage be enough?
Because for GameMaker games, changing the save location is simply not possible. The runner doesn't allow you to access anything (regardless of reading or writing) outside of /data/data/<package name>/files See the old GMS1.4 documentation here
This also means, that a "save import/export"- feature would also be impossible to implement.

MAME4droid is able to get away with that, because they have the possibility to write their own apk and code for it. With GameMaker (which is what the project is written) we do not have such luxury, as we're bound to whatever YoYoGames decides would be best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Change to or improvement of existing behavior
Projects
None yet
Development

No branches or pull requests

3 participants