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

[hackrom Pokemon Red++] After loading a savestate, saving the game doesn't update the .SAV #2396

Closed
RafaelTrepaUnCarballo opened this issue Dec 27, 2021 · 1 comment
Labels
feature:savestates Issues in save state implementation
Milestone

Comments

@RafaelTrepaUnCarballo
Copy link

RafaelTrepaUnCarballo commented Dec 27, 2021

Latest mgba Build: 0.10.7172-cb9f7 (both Switch and win64 versions)
Hack: Patched rom red-plus-plus-v3.0.2-hard

I was playing normally, first in my PC (in BGB) and later in mGBA on my Switch. mGBA recognized the save, I could play an hour, saving without problems...

...but at some point at the end of Mt Moon, after saving and loading some savestates in a short time, mgba stopped updating the battery file with my save file. I kept playing until Misty, then saved and savestated. The next time I opened mgba, my progress was gone.

I uploaded the last savestate, saved the game, but as soon as I closed mgba or hard-reset the game, the game loaded the outdated battery file instead of the save after loading the savestate.

The same behaviour happens in mGBA PC: I can't do a permanent save after loading a state in this hackrom

red-plus-plus-v3.0.2-hard SAV and SAVESTATE.zip

@endrift endrift added this to the mGBA 0.10.0 milestone Jan 19, 2022
@endrift endrift added the feature:savestates Issues in save state implementation label Jan 19, 2022
@endrift
Copy link
Member

endrift commented Jan 21, 2022

This is sort of unfortunate because the problem is that R++ is perpetually writing to the save file, and mGBA tries to wait until 15 frames after a game finishes writing to the save file before flushing it to disk. There is, however, a bug whereby when you load a savestate it won't write back the save file at all if it's never flushed after a save finishes. This is fixed in a commit I'm about to push, but it does mean that it won't get flushed to disk if emulator crashes. Further, it means that even loading a savestate will overwrite the save on disk because mGBA can't tell the difference between using the save as extra RAM and using it to actually save the game...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:savestates Issues in save state implementation
Projects
None yet
Development

No branches or pull requests

2 participants