irixxxx / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
47 stars 24 forks source link

Savestates not working in Nintendo Wii (Virtua Racing Deluxe 32X, Genesis, Master System and more...) #120

Closed saulfabregwiivc closed 3 months ago

saulfabregwiivc commented 3 months ago

Like the title says the game Virtua Racing Deluxe for the Sega 32X works fine but if i make a savestate in any part of the game and then try to load it (restore the savestate) it crashes the game or even the emulated system.

It doesn't solve trying to reset the game cause trying to reset it after loading a savestate leads in a blackscreen.

Any help for this? Thanks!

PS: BTW, i'm trying to play it on the Wii (Libretro)

irixxxx commented 3 months ago

Tried with standalone and libretro version under linux and osx, no problem loading a saved state of the 1st level. Describe in more details what you did. Also, it would be helpful if you could cross check with a different platform.

saulfabregwiivc commented 3 months ago

Tried Windows (cause it's the only another platform can i access right now since i don't have other devices/consoles), and savestates work pretty fine there.

Btw, on the Wii version, trying to use savestates have very different weid behaviors instead of doing its job (tried on Nintendo Wii with your changes from this repo).

For trigger the issue on Wii:

  1. Select and play any game of any Sega system (Master System, Genesis, 32X, etc...)
  2. Select any slot for savestates and choose "Save State"
  3. Select the slot you chosen for save the state, then try to load it with "Load State".
  4. It should restore all what i did when i saved the state, but it's not doing its job.

Behaviors of savestates on Wii (and maybe on all big-endian platforms):

Master System/Game Gear: Trying to load a savestate just don't load the savestate, the game keeps running.

Genesis: Trying to load a savestate don't load it actually, crash the game, or even make it reset the game.

32X: Trying to load a savestate crashes the game.

On Windows these issues don't happen. I think it's platform specific?

irixxxx commented 3 months ago

fixed with 64360d1.

this could only ever have worked previously if the compiler made enum types as small as possible (in this case, to a byte)...

irixxxx commented 3 months ago

For the record: I only found this by using a linux docker container for a big endian s390 cpu ;-)

saulfabregwiivc commented 3 months ago

Tested, and now the savestates are fully working on Wii on all emulated Sega platforms!

Tested Master System, Game Gear, Genesis, and 32X. Every game i've tested can save and load savestates fine now, only World Grand Prix (E) struggles at savestates (trying to load a savestate resets the game).

irixxxx commented 3 months ago

Good find. SMS save load fixed with da41488.