libretro / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
38 stars 60 forks source link

savestate related issues #209

Open barbudreadmon opened 1 year ago

barbudreadmon commented 1 year ago

Looking at the other opened issues and this other issue that ended up in my forum pms by mistake :

picodrive

This core apparently suffer from quite a few issues related to savestate usage, which include runahead, netplay and rewind.

FWIW, a new api callback was introduced a few months ago, it allows to know about the savestate context, so that you can provide different savestates depending on the situation (which, in my personal experience as an emudev, is necessary sometimes), you can find an example of its usage at https://github.com/libretro/FBNeo/commit/f6ccad2a657b6959ade071718580a7c4713bcf43

If those various savestate-related issues can't be solved, then my personal recommendation would be to downgrade this core's savestate_features from deterministic to serialized in its info file, so that runahead/netplay aren't allowed anymore.

irixxxx commented 1 year ago

I tried runahead with some games with no apparent problems. Since this seems game dependent, could you please name some games having these issues?

barbudreadmon commented 1 year ago

It seems to be about 32x games, i asked this person to answer here

CyberLabSystems commented 1 year ago

I've only noticed it with Mortal Kombat II so far. Haven't tested on other games. I don't really play 32X games just experienced it while updating my CRT Shader Presets.

irixxxx commented 1 year ago

Is it also the case it you disable the sh2 drc?

CyberLabSystems commented 1 year ago

I don't know what is the sh2 drc and I'm not seeing any option like that in the PicoDrive (1.99-0a4ec83) Core Options.

I changed the Sample Rate to Native and disabled Dynamic Recompilers.

What I've noticed is that sometimes when I enter the Menu then resume emulation the video is frozen but the audio plays. To a certain extent reentering the Menu then Resuming Emulation has caused it to resume playing normally. Sometimes the video would continue to freeze and jump forward a few frames after toggling the Menu with the audio continuing to play.

I've tried this both with Dynamic Recompilers on and off and the behavior was the same.

I still have to Restart twice to get a complete restart though.

hizzlekizzle commented 1 year ago

I believe it's the core options > performance > "dynamic recompilers ON/OFF" setting. Try putting it to OFF and see if the behavior persists.

CyberLabSystems commented 1 year ago

I believe it's the core options > performance > "dynamic recompilers ON/OFF" setting. Try putting it to OFF and see if the behavior persists.

Thanks, I tested and updated my post. Was in the process of updating it when you replied. Also note that I use this core with HSM Mega Bezel Reflection Shader which can add an extraordinary amount of GPU load to the equation.

CyberLabSystems commented 1 year ago

Just tested PicoDrive(1.98-9cb99ce) with RetroArch 1.12.0 and it said "Failed to load save state. Run-Ahead disabled." after I entered and exited the Menu. Before I entered the Menu there was a Black Screen on startup with the Background music playing. This is in Mortal Kombat II.

irixxxx commented 1 year ago

It never worked correctly before 1.99 for MegaCD and especially 32X games. The reason is that it doesn't save certain aspects of the state which aren't really needed because they could be retrieved after a short time of running. The exact core state is however not the same if compared to the system state running up to that exact same point without saving and loading, which is mandatory for run-ahead to work correctly.

I improved on this by adding some of the most crucial fields to the save file, but to improve this to perfection would mean to add a lot of additional information to the save/load logic (probably making this incompatible with old save states :-/). The emulated 8-bit systems and plain Megadrive and MegaCD games should work, though, as far as I can tell only 32X games are still affected to some extent.

I'm planning to look into this for the upcoming 2.00 release, however I'm having very little spare time ATM, so this can take a while.

barbudreadmon commented 1 year ago

probably making this incompatible with old save states

Again, there is this new api call i mentioned above, you can make savestates specific to the context (save to disk, runahead, second instance, netplay).