agg23 / openfpga-SNES

SNES for the Analogue Pocket
GNU General Public License v3.0
382 stars 15 forks source link

Save deleted when reset core and CPU turbo are enabled together. #56

Closed multi-vitamin closed 1 year ago

multi-vitamin commented 1 year ago

If you use cpu turbo and choose reset core instead of load cartridge, The save will be deleted.

i checked this happen with Ys3, Final Fantasy 6.

However, Ys4 was not deleted.

Perhaps if the glitch is severe, it will be deleted.

agg23 commented 1 year ago

Do either of those titles actually experience slowdown?

From the MiSTer turbo docs:

Use of the CPU Turbo function is outside the normal operation of SNES hardware. Undesirable issues will occur if you use this feature in many games.

The save was not deleted, it was corrupted. Did the game actually function besides the save corruption?

multi-vitamin commented 1 year ago

Game didn't slow down, it was just a test. It doesn't support it, so only a glitched screen comes out.

Any ideas why save file gets corrupted when I select core reset option?

agg23 commented 1 year ago

If you enabled the turbo option after the game started the first time, then resetting the core would be the first time the game started from its initial state with the turbo enabled. If that's not the case, it's possible that whatever corruption occurs to the game executing state clobbers the reset vector, so specifically using the reset option causes the CPU to jump to that vector, which is where things get messed up in the save.

Since turbo messes with the timing of the CPU, anything could be happening, so somehow the save RAM is getting clobbered.

In any case, there's nothing I (or anyone really) can do here. When you mess with CPU timing, anything can happen.

multi-vitamin commented 1 year ago

Thank you for reply.