libretro / libretro-cap32

caprice32 4.2.0 libretro
21 stars 34 forks source link

Autofix old corrupted snapshots on load #107

Closed Emashzed closed 2 years ago

Emashzed commented 2 years ago

Following yesterday's SNA fix, this enhancements allows the autodetection and loading of older corrupted snapshots.

In these snapshots, any setting -- among which the RAM size -- is offset by one, and in 99.99% of snapshots, 64 or 128 will be in sh.ram_size[1] instead of sh.ram_size[0]. It is then easy to handle the bad SNA on the fly. Older SNAs that wouldn't be detected would be CPC configurations where the RAM is different than 64k or 128k (hopefully a very vast minority).

This fix will allow users to still use their old snapshots and be none the wiser :) (new snapshots will be created with the good format)

DSkywalk commented 2 years ago

I don't really like the way you have thought to detect the old format, and neither the "conversion" part, I was just yesterday thinking something for this in a different way... give me a few days to check it and see if I can take advantage of some of your ideas.

I'll check it and let you know something here. Thanks again!

DSkywalk commented 2 years ago

resolved at a491e0e9ed575b15de69de596e59448601480780 Thank you also @Emashzed :+1:

Emashzed commented 2 years ago

Ha, using the version byte as a check is a very nice idea indeed ! Great job @DSkywalk :)