schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
759 stars 62 forks source link

Load State issue in POP1 and POP2 #406

Open Elgeweily opened 1 year ago

Elgeweily commented 1 year ago

In Prince of Persia 1 or 2 on the Miyoo Mini Plus (Onion OS 4.2) using DOSBox Pure core on Retroarch, when I load a saved state it causes the whole game to restart back to the game intro, even when I am in Retroarch quick menu and press Resume which is supposed to go back to the game at the same point I left it, the whole game restarts, any idea what could be the issue?

Note: occasionally, a saved state loads successfully, but 90% of of the time it doesn't.

schellingb commented 1 year ago

Is it possible to enable logging to a file on that device and get the log file off the device and post it here? Settings under Logging:

Elgeweily commented 1 year ago

logfile.log

I think the part with the errors (line 224), is when I first start the game, and indeed the same errors show on screen.......but the part where I try to manually save and load (which causes the game to restart) is at line 241

schellingb commented 1 year ago

hmm, it logs "Unable to save state while game is not running" which should mean that you're trying to save a state while in the command line or in the start menu. Due to some DOSBox internals save states only work when a game is running. This is what the log has:

I think the problem is RetroArch's auto-save and save-undo feature. Because loading a state causes RetroArch to save a state to enable the "load undo". Auto-save is a bit complicated due to loading not being supported before the game runs. Undo save states are also a bit of a headache.

For now you can try to set the Emulation -> Save States Support setting to "Enable save states with rewind". This will cause saving/loading before the game is running to not error and maybe it will cause the whole thing to work.

I will try to see if I can make auto-save and save-undo work nicer with the default setting in the next version. Thanks for reporting.

Elgeweily commented 1 year ago

Thanks for your response, but these errors are not related to the issue in question, these errors happen when I first start the game and are caused by the Auto Save/Auto Load options of RetroArch. When I disable both of them in RetroArch Saving settings, the errors go away, but the issue persists.....attached the log file where the errors are gone, but the issue still happens.

retroarch1970_01_0401_01_34.log

schellingb commented 1 year ago

So you ran the game, saved the state, then loaded the state and it caused the core to restart? hmm..

What seems a bit weird is this part:

[INFO] [State]: Saving state "/mnt/SDCARD/Saves/CurrentProfile/states/DOSBox-pure/Prince of Persia 2.state1", 1307448 bytes. [INFO] [State]: File already exists. Saving to backup buffer ... [INFO] [State]: Loading state "/mnt/SDCARD/Saves/CurrentProfile/states/DOSBox-pure/Prince of Persia 2.state1", 1406800 bytes.

Wonder why it says it saved 1307448 bytes but then proceeds to load 1406800 bytes from that the same file...

Can you upload that "Prince of Persia 2.state1" here?

schellingb commented 1 year ago

You say this happens in POP1 and POP2 for you, have you tried other games? Do they all have the same issue or is it specific to POP1 and POP2?

Elgeweily commented 1 year ago

[INFO] [State]: Saving state "/mnt/SDCARD/Saves/CurrentProfile/states/DOSBox-pure/Prince of Persia 2.state1", 1307448 bytes. [INFO] [State]: File already exists. Saving to backup buffer ... [INFO] [State]: Loading state "/mnt/SDCARD/Saves/CurrentProfile/states/DOSBox-pure/Prince of Persia 2.state1", 1406800 bytes.

Note: Maybe it is unrelated, but sometimes when I close POP2, it exits with error code 139.

Elgeweily commented 1 year ago

I think the loading part has something to do with the fact that the state file already exists and it is trying to overwrite it....because when I save on a clean slot, it just logs "Saving state.......", but in either case, the issue happens.

Elgeweily commented 1 year ago

Ok, here are some more findings: