mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.61k stars 769 forks source link

mGBA is suddenly refusing to load .sav files for certain games until a fresh save is created #2473

Open DrunkRichtofen opened 2 years ago

DrunkRichtofen commented 2 years ago

I don't know why this has begun to happen, but for some reason, certain games that have .sav files for ingame saves don't seem to recognize that there is a saved game present. In these cases, starting a new game and saving again fixes the issue, though that means losing the previous save. At one point, I decided to move an old save to another folder, then start a fresh save to test whether or not the save function in general was broken. After confirming that I could load my new save, I shut off mGBA and moved the old save back and replaced the new save. They both had the same file name and extention, but once the old save was back, the emulator/game acted as if there was no save data.

There's no pattern or consistancy to which .sav files are no apparently unreadable, including how old the files are. Some .sav files were created on the same day, but oine will work while another doesn't. On one game that also has a save state, I am able to load the save state and the game successfully saves, but the save is still not read and the game acts as though there isn't one. Only when I start a new save does it start reading the file properly. Are some of the .sav files simply corrupt now, or is this an issue with mGBA itself?

endrift commented 2 years ago

What version of mGBA are you using, what OS, what type of game (GB or GBA or both), and does this still occur if you don't load any states before attempting to save?

DrunkRichtofen commented 2 years ago

I'm using mGBA version 0.9.3 on Windows 10. This issue is spread across GB and GBA games, while some other GB/GBA games are without issue. E.g: Pokemon Blue and Pokemon Firered cannot load a save until I start a new game, while Pokemon Red and Pokemon Ruby are just fine. Yes, this issue occurs before and after loading save states. Most of the games that have this issue are ones that don't have save states.

DrunkRichtofen commented 2 years ago

I've further tested to see if I can find a fix/workaround for this issue. With all affected games, starting a fresh save allows me to load like normal, but attempting to load a previous save is impossible, unless I do so with a save state. Loading a save state and then saving ingame, however, leaves the issue unresolved. I attempted to temporarily move the already existing .sav file, and then move it back after testing to see if it will save and load a new game, but the old .sav file is still not loadable while the new one is fine.

There are some that have stopped working without explaination that were created/used within a week of save files that still work. Asuming the file itself may be the issue, I once again moved the old .sav file and allowed an new file to be created, then saved a new game to see if it could be loaded. After confirming that it could, I then loaded a previously created save state and saved the game. The game saved successfully, but it still only allowed me to load the brand new save, not the one saved through the save state.

There is no pattern, and before they already stopped working, no files were moved/edited from the day they were created.

kenjinsama commented 2 years ago

Is there any news ? I can confirm the issue. I do not know how but if I switch from a game to another, It happens some time.

mathturtle commented 1 year ago

I can also confirm the issue. I'm using mGBA 0.8.3 on Windows 10 (because I got tired of redoing my settings every update) but I've tested 0.9.3 and confirmed the bug still exists there.

What I did (playing pokemon ruby): played through the game saving and loading normally, worked fine tried to open the save file in a save file editor, found it was incompatible copied the save file to a backup folder opened mGBA, made a save state of the game deleted the save file and tried forcing mGBA to use the 128k format (1M flash) played through the game enough to save making a new save confirmed that worked with the save editor program tried loading my save state... ummm it is gone? tried to restore my settings and copied the backup save file back to its place now the bug happens and the emulator doesn't recognize that it has a save file present, it will only let me start a new game

tylerqr commented 1 year ago

I'm able to reproduce this same thing with mgba on Mac OS, with Pokemon fireRed. It seems totally random. Quitting mgba and loading it again sometimes will load my save file, and then suddenly instead of loading the existing .sav file it creates a .sa2 file at the moment the rom is loaded and acts like there never was an existing save file, though the original .sav file is still right there. I've tried editing the new .sa2 file to something like .sa223434 and editing the original .sav to be .sa2 and I think it worked once, but can't reproduce it again. I've tried renaming the file extension .sa2 to .sav and visa versa, still no dice. Very frustrating issue.

Save states are also disappearing.

preston7363 commented 3 weeks ago

I'm having the same problem too. I clocked in many hours in Pokemon LeafGreen and caught a few legendaries. I saved the game and turned off my computer. The next day, I accidentally loaded up the wrong save file, taking me back to the starter pokemon selection. I tried to load the other save file but it wouldn't load. Please someone find a solution.

endrift commented 3 weeks ago

That sounds entirely unrelated to the issue here. Please join the discord or forums if you want support anyway, as that doesn't really sound like a bug.

preston7363 commented 3 weeks ago

No no, you've got a misunderstanding. mGBA isn't loading a save file and it just takes me to the beginning of the game where all the controls are explained and where you make a fresh save. The only saves that work are the ones that are made at the beginning of the game.