mgba-emu / mgba

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

mGBA doesn't write any battery files or save states #281

Closed adcgx closed 3 years ago

adcgx commented 8 years ago

I tried using mGBA for my Pokémon tournament. I configured mGBA in portable mode to the right settings, and then copied the folder onto a USB-flashdrive. I then handed this drive around so people could get a copy. However, the copied version of mGBA failed to create .SAV files next to the rom - regular save states did not work either.

Without knowing anything about it, I suspect it has something to do with "portable mode"? IMO, portable mode should be default for an application that does not provide an installer/uninstaller. Writing permanent data somewhere on the filesystem without the option to remove it isn't very nice.

EDIT: I forgot to mention something important - i wrote a batch script to quickly copy and launch the ROM with start "" "%userprofile%\Desktop\mGBA\mGBA.exe" "%userprofile%\Desktop\mGBA\ROM.gba"

Maybe it's related to the use of backslahes in the parameter?

endrift commented 8 years ago

Portable mode does not write to the registry, nor does non-portable mode. All config files wind up in %appdata%\mGBA.

Also yeah, backslashes were reported to be broken, but I thought I fixed it?

adcgx commented 8 years ago

Yeah sorry, I edited my post shortly after realizing my mistake. I can't be certain what exactly caused the issue, but it was consistent for everyone playing. No save states, no battery saves - I also tried defining custom paths for the save-files in the settings, but to no avail.

GideonZhi commented 8 years ago

I'm having this issue myself (Windows 7 x64) and am not using portable mode. Instead I'm launching with Kodi and Advance Launcher, cl mgba -f "d:\Emulation\Gameboy Advance\GBA ROMs\romname.gba". I used the built-in dialog to force saves to the same directory all my roms are stored in, and the path it generated was D:/Emulation/Gameboy Advance/GBA ROMs - when I adjusted it to d:\Emulation\Gameboy Advance\GBA ROMs\ it worked.

endrift commented 7 years ago

Is this still a problem? I think it should have been fixed by now.

msmigiel commented 7 years ago

I've recently been playing the Minnish Cap and got to the end of the game (using save states instead of battery saves) and got to the point where the game ends and you must save and reload your game from the battery save. I am seeing this problem in that my battery save is not showing up.

I also went back and manually saved it from inside the game and again, no battery save so it appears this issue is still not fixed. I'm running mGBA 0.52 on Windows 7.

EDIT: Save states do work and I'm running in portable mode. I've played around with the path, even using just "C:\" and "C:/" and while the .sav file is created, it doesn't work as none of my game saves show up.

SPON23567 commented 6 years ago

hey i figured out PRECISELY what is going on with the saving issue. turns out thers a glitch in the emulator that occurs EXACTLY after loading your current savefile and starting the game. once in if you complete actions in games and save and leave the game or exit to the consoles menu [or anything that involves leaving the mgba emulator game you are playing] the emulation software glitches out and refused to load or save any savefiles created after returning. basically if on a vita or wii and you temporarily exit the app or the console sleeps the game you are playing will no longer register saves. it will however keep the most recent savefile UP TO the first point you exited. on the vita i tested this, using single and multiple actions and various methods of leaving the game from total leaving to just putting the console on screen sleep or pressing the PS button. upon returning and doing LITERALLY ANYTHING after these actions NOTHING saves. however ALL ACTIONS and game data achieved PRIOR to these things after loading the game up and then saving actually created a valid savedata. so the mgba developer team just needs to find where in the code it is causing the game to exit upon going standby and basically write the app to always run in the background. that should theoreticaly prevent games from thinking you left. otherwise if you want to keep your savefiles and play being able to save just make sure you save BEFORE doing anything that might exit the game. i did however find a bypass for lack of savegame capabilites: 1.use the "take screenshot" option

  1. go to the "save state" option
  2. save state
  3. when you restart your game back up, if your normal savegame fails just load the save state. i tested it and taking a screenshot seems to guaraantee the ability to create a savestate every time. to check whether the state saved just move or change the visuals around you in some way and go to "load state" and select whatever # state you saved. if its different from your current view, it worked.

but there you go. i found what was going on with this rediculous saving issue and even found a way around it. now someone please go fix it.

endrift commented 6 years ago

Whoa, that's really detailed. Thanks, I'll take a look this weekend.

endrift commented 5 years ago

@SPON23567 your bug was actually #1123 (I think), but it's fixed now. HUGE thanks for tracking that down, it's been a serious issue for years.

endrift commented 4 years ago

So there was an issue writing saves when you had the save path (by default the ROM's directory) in a place that was read-only. mGBA now gives a warning if you try to do this. Does the warning appear for anyone who was having an issue in this thread, using a dev build?

edxmon commented 4 years ago

This bug is present in 0.8.1 and 0.8.2. I just experienced the same bug while playing Minish Cap on Vita on version 0.8.1. I beat the final boss, credits rolled and the save prompt appeared, I selected "Save". The game title screen appears and when I select "Continue" there are no save files to select, only create a new save file. Luckily I created a save state right before the last boss. I checked the Vita's homebrew browser to find that mGBA 0.8.2 was now available, so I downloaded it. I loaded my save state created in 0.8.1 in 0.8.2 and proceeded to save within the same. I exited the game by entering the mGBA menu and selecting "Reset Game" and there i still no save file to load from the game's title screen. Using Vita Shell I can see my save states (.ss0, .ss1 & .ss2) as well as my save file ("rom name".sav) in the same folder as the ROM, it is 8KB I believe.

Is there anyway to circumvent this bug and create a usable save file? There are parts of this game only achievable by loading a post credits save file.

EDIT: After updating to 0.8.2 I created a new save file in game. I exited the game using the mGBA menu and selecting "Reset Game" and verified that the newly created save file was present. I then proceeded to load a save state and saved within the game. I reset the game using the mGBA menu again and tried to load a save, there were no save files at all.

EDIT 2: Attached the .sav (delete the .zip at the end) file that mGBA creates but is not recognized by the game, per request with @mGBA_emu on Twitter. Legend of Zelda, The - The Minish Cap (U).sav.zip

EDIT 3: Found and downloaded an 8KB .sav online. Placed it in the ROM folder and Minish Cap (the game) recognized it as a save file and it loaded fine. Moved the character to another area, saved within the game and exited the game via mGBA menu. Loaded one of my own save states, moved my character around and saved within the game, then exited via mGBA menu. Reloaded the game and no save files are recognized any more. Checked the Rom folder and the .sav file is still there. It seems there is something related to my own save states that breaks the .sav files.

Thank you for your support!

I've recently been playing the Minnish Cap and got to the end of the game (using save states instead of battery saves) and got to the point where the game ends and you must save and reload your game from the battery save. I am seeing this problem in that my battery save is not showing up.

I also went back and manually saved it from inside the game and again, no battery save so it appears this issue is still not fixed. I'm running mGBA 0.52 on Windows 7.

EDIT: Save states do work and I'm running in portable mode. I've played around with the path, even using just "C:\" and "C:/" and while the .sav file is created, it doesn't work as none of my game saves show up.

SPON23567 commented 4 years ago

if you actually receive this, the emulation has issues saving games sometimes. you need to make sure that the emulator is set to save the game in the same location as the rom being played. it is a setting in mGBA where you can select where saves are stored, just select the same place the games are loaded from. also another fix is to use the screenshot feature to make a game save screenshot and then savestate, save the game, then check that the save state worked. if you save the game it should store the .sav data where your rom is played from. basically you want to see that in your rom folder there is "minish cap.gba" and "minish cap.gba.sav".another thing that can cause save issues and gurantees loss of data is if you:a. exit the emulation in any wayb. go to the psvita home screenc. press the home button during gameplayd. the vita goes into sleep mode during emulation [many times this can delete any save data after the last save made and render saving impossible].basically set your sleep time to the max allowed in console settings and if your system ever sleeps or you do anything to stop emulation [even temporarily] you need to make a savestate, exit the emulation, close the software via the swipe icon [where you swipe to "wipe-close" a program, then reopen the emulator, load the savestate, then save again. then you can close again and reopen the custom software to make sure the save worked.  On Tuesday, July 7, 2020, 02:16:25 PM EDT, edxmon notifications@github.com wrote:

This bug is still present in 0.8.1 and 0.8.2. I just experienced the same bug while playing Minish Cap on Vita on version 0.8.1. I beat the final boss, credits rolled and the save prompt appeared, I selected "Save". The game title screen appears and when I select "Continue" there are no save files to select, only create a new save file. Luckily I created a save state right before the last boss. I checked the Vita's homebrew browser to find that mGBA 0.8.2 was now available, so I downloaded it. I loaded my save state created in 0.8.1 in 0.8.2 and proceeded to save within the same. I exited the game by entering the mGBA menu and selecting "Reset Game" and there i still no save file to load from the game's title screen. Using Vita Shell I can see my save states (.ss0, .ss1 & .ss2) as well as my save file ("rom name".sav) in the same folder as the ROM, it is 8KB I believe.

Is there anyway to circumvent this bug and create a usable save file? There are parts of this game only achievable by loading a post credits save file.

Thank you for your support!

I've recently been playing the Minnish Cap and got to the end of the game (using save states instead of battery saves) and got to the point where the game ends and you must save and reload your game from the battery save. I am seeing this problem in that my battery save is not showing up.

I also went back and manually saved it from inside the game and again, no battery save so it appears this issue is still not fixed. I'm running mGBA 0.52 on Windows 7.

EDIT: Save states do work and I'm running in portable mode. I've played around with the path, even using just "C:" and "C:/" and while the .sav file is created, it doesn't work as none of my game saves show up.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

endrift commented 4 years ago

The Vita sleep save bug should be fixed by now, fwiw.

edxmon commented 4 years ago

I've done everything you mentioned SPON, since you mentioned it as a possible solution even before my post, my .sav are still not recognized. As mentioned in my post above, the .sav is indeed in the same folder as the ROM, yet the game does not recognize it as a save file. Also, as mentioned in my post I can put a downloaded save file in the ROM folder and it will be recognized by the game, and be updated as I progress in the game. The issue is somehow related to my save states. My save states function works perfectly, but somehow once I load a save states and try to save within that save state in game it makes ANY .sav in the ROM folder unrecognizable by the game.

SPON23567 commented 4 years ago

see i know that what i described previously is a primary issue. i also know that save files can be transferred and played from the vita, to the pc, and back to the vita. if you use mgba emulator for the computer, make a save, then copy that save to the vita, the save file is playable. also what you describe sounds like an actual error i found when playing minish cap myself at one point, and one found in many other games. this can be caused by several issues:1. if your save data is corrupted2. if you have an ingame save, make a save state AFTER saving the game physically. NEVER load a savestate created in any game prior to a physical save otherwise it corrupts the savefile and renders the game nigh unplayable3. your savestate itself may be corrupted. this can be prevented by going to load your savestate after making it, and checking if the image associated with it matches where you are/were when you made it. basically make a savestate, move one step in any direction, then make another second savestate, check the two savestates and there should be an image of the game with it, if the first savestate image matches your location BEFORE you took that one step you are good to go. 4. [forgot to mention this in the first reply] could be a battery/in game clock issue. make sure that in the "battery", "save type", and "in game clock" settings are set to automatic for the battery and save type, and "use real time clock" for the clock settings.  you can also use the above method of making/moving a save from mgba on the computer to the vita [it works both ways] to test your savefiles. minish cap is a wierd game with savefiles and savestates. nintendo ds roms and some GC roms have a serious freak panic attack when loading a savestate made prior to an actual ingame save.  if all else fails try doing a fresh install of mgba on your vita. you can back up your files to the pc with the file transfer system the vita exploit uses [always check to confirm]. sometimes mgba settings get out of whack, it is rare but it can happen. just literally reinstall the emulator settings through qcma on the computer using a fresh new install of a new stock mgba install file, then take your roms and savefiles and move them back to the appropriate folders in the vita. then reopen mgba on the vita after the fresh install, and go through all the settings it has available making sure you have the right settings [listed in my two posts]. you want [usually] "use real time clock", detect game type [save, rom type] automatically, "load/save games from the same location", set up all [and i mean ALL] your button configs making sure none overlap [best is to have x=a, =b, traingle=open emulation settings menu, L/O=speedup [as acceleration only seems to like working with shoulder buttons or the "O" button, and O=either swap screen display type OR another needed function, have traingle in the emulation settings menu be the back button, x=confirm, etc., and to have the save type be automatic. since brightness can be controlled outside the emulation via the vita settings brightness can usually be disabled.  whatever you do though, do not pull a dumbdumbstupida## like me and disable the option for the emulator settings menu and accidentally set the emulator to full screen. had to reinstall mgba twice cause "i can no do technology" the first time i ever used mgba. the second time was sheer accident.  if nothing else works you could try e-mailing someone in the chat here your folder with the specific setup of your rom and savefile, and screenshot your mgba settings. words help solve issue, photos help end them. hope one of the two replies i gave help out. On Tuesday, July 7, 2020, 02:16:25 PM EDT, edxmon notifications@github.com wrote:

This bug is still present in 0.8.1 and 0.8.2. I just experienced the same bug while playing Minish Cap on Vita on version 0.8.1. I beat the final boss, credits rolled and the save prompt appeared, I selected "Save". The game title screen appears and when I select "Continue" there are no save files to select, only create a new save file. Luckily I created a save state right before the last boss. I checked the Vita's homebrew browser to find that mGBA 0.8.2 was now available, so I downloaded it. I loaded my save state created in 0.8.1 in 0.8.2 and proceeded to save within the same. I exited the game by entering the mGBA menu and selecting "Reset Game" and there i still no save file to load from the game's title screen. Using Vita Shell I can see my save states (.ss0, .ss1 & .ss2) as well as my save file ("rom name".sav) in the same folder as the ROM, it is 8KB I believe.

Is there anyway to circumvent this bug and create a usable save file? There are parts of this game only achievable by loading a post credits save file.

Thank you for your support!

I've recently been playing the Minnish Cap and got to the end of the game (using save states instead of battery saves) and got to the point where the game ends and you must save and reload your game from the battery save. I am seeing this problem in that my battery save is not showing up.

I also went back and manually saved it from inside the game and again, no battery save so it appears this issue is still not fixed. I'm running mGBA 0.52 on Windows 7.EDIT: Save states do work and I'm running in portable mode. I've played around with the path, even using just "C:" and "C:/" and while the .sav file is created, it doesn't work as none of my game saves show up.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

SPON23567 commented 4 years ago

ok, then. are you loading savestates created prior to your savefile ingame? or post making your save file?if prior, i made an additional reply that may help. if post, it may be an issue with the save type, location settings, rom detection issue, or maybe an internal battery or clock issue. again i mentioned these.  On Wednesday, July 8, 2020, 10:28:12 PM EDT, edxmon notifications@github.com wrote:

I've done everything you mentioned SPON, since you mentioned it as a possible solution even before my post, my .sav are still not recognized. As mentioned in my post above, the .sav is indeed in the same folder as the ROM, yet the game does not recognize it as a save file. Also, as mentioned in my post I can put a downloaded save file in the ROM folder and it will be recognized by the game, and be updated as I progress in the game. The issue is somehow related to my save states. My save states function works perfectly, but somehow once I load a save states and try to save within that save state in game it makes ANY .sav in the ROM folder unrecognizable by the game.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

SPON23567 commented 4 years ago

this may also be of help:this may be a forum page for someone needing a savefile, but it also might help you get a working save file for yourself.  desperate for minish cap save file

|

desperate for minish cap save file

Ive just plaed through the minish cap for the first time and my game freezes at the first tornado in dark hyrule... |

|

|

search for  "use the file-import-gameshark snapshot, then use file-reset, then save the game by the in-game save function not the VBA save function."

On Wednesday, July 8, 2020, 10:28:12 PM EDT, edxmon <notifications@github.com> wrote:  

I've done everything you mentioned SPON, since you mentioned it as a possible solution even before my post, my .sav are still not recognized. As mentioned in my post above, the .sav is indeed in the same folder as the ROM, yet the game does not recognize it as a save file. Also, as mentioned in my post I can put a downloaded save file in the ROM folder and it will be recognized by the game, and be updated as I progress in the game. The issue is somehow related to my save states. My save states function works perfectly, but somehow once I load a save states and try to save within that save state in game it makes ANY .sav in the ROM folder unrecognizable by the game.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

endrift commented 3 years ago

I'm not entirely sure what the current status of this is-- @SPON23567's previous replies have been through email which made the formatting confusing enough to be basically unreadable. If you could verify what the current status of saving is, with a recent development build, and reply on the website so the formatting doesn't mess it up, that would help a lot. Seeing lots of large blocks of text with no real indication of if it's lifted from a reply or not makes it impossible to follow.

endrift commented 3 years ago

Closing, since it was sort of a conflation of three or so different bugs, some of which have been fixed. Please file a new issue if you find problems still.