MiSTer-devel / WonderSwan_MiSTer

WonderSwan Color for MiSTer
GNU General Public License v2.0
12 stars 13 forks source link

How to convert saves for use in software emulators? #10

Closed euan-forrester closed 1 year ago

euan-forrester commented 2 years ago

Hello, I'm the author of savefileconverter.com (https://github.com/euan-forrester/save-file-converter) and I've been working on adding support for converting saves to and from MiSTer formats.

I was looking at WonderSwan saves on the MiSTer, and I noticed that the example saves I got were all 0x200 bytes larger than a power of 2. Looking at one example, for Rockman & Forte, I noticed what appeared to be a header containing the magic Rbw0508_Ver1.00 at offset 0 and then 0x1A1B29 at offset 0x18. I'm using the emulator mednafen, the default for OpenEmu.

Can you give me any guidance on what I should be adding and removing from WonderSwan (and WonderSwan Color) save files to convert them back and forth between a software emulator and the MiSTer format?

Thanks very much!

RobertPeip commented 2 years ago

Save files from Wonderswan contain one extra sector for RTC data at the end. You can probably just cut it off and use the save file that remains.

I haven't tried that yet, because i never used any savegame from this core in any emulator, but i think it should work.

Converting to Mister format should be the same: ignore the extra size and just rename the file from the emulator. The core should load it fine but RTC data is missing.

euan-forrester commented 2 years ago

Awesome, thank you!

For converting to the Mister format, I'm happy to pad out the file with 0x00 or 0xFF or even random data for those final 0x200 bytes if that's somehow 'better' for the core. Does one of those make sense? Or should I just rename the emulator file and not pad it?

Also, are WonderSwan and WonderSwan Color the same from the perspective of save files? Or should I treat them differently somehow? I'm not very familiar with the WonderSwan, although it looks like a super cool machine!

EDIT: I've added support for the WonderSwan here, which currently pads out the file with 0x00: https://savefileconverter.com/#/mister and I made a save with mednafen for Rockman & Forte where the first slot has the first level passed: Rockman & Forte - Mirai Kara no Chousensha (Japan).523004d48e9d606e1557c2c57af6790b.sav.zip

I don't have a MiSTer to test with: any chance I could ask you to convert that save using the tool and then test it, and send me back the resulting file after it gets saved by the MiSTer so I can convert it back and test it on the emulator?

RobertPeip commented 2 years ago

It doesn't matter if it's padded or just not available. The RTC data will be wrong either way and the user has to set the time once manually anyway.

I can try the savegame later.

euan-forrester commented 2 years ago

Fair enough, and thanks for trying it out!

I can get the local time from the browser -- if you could describe the format I could set it in the save file?

RobertPeip commented 2 years ago

Sorry, I totally forget about it...

The savegame can be loaded. Here is what is saved back from Mister after loading your savegame: Rockman & Forte - Mirai Kara no Chousen Sha (J) [M][!].zip

euan-forrester commented 2 years ago

No worries!

That's fantastic, and I was able to convert it back and load it again in the emulator, so it all seems to be working! Thank you!

Would it be possible for me to set the RTC information when converting the file to the MiSTer format? I can get information about the current time from the browser, so if you're able to describe the format I should be able to set it and save people the step of setting the clock.

RobertPeip commented 2 years ago

I don't think it's useful to have that. If the user doesn't provide a savegame with time info, you can't just generate it, as there is also a time the game itself saves in the savegame.

euan-forrester commented 2 years ago

Oh okay, I guess I don't quite understand then, fair enough. I assumed that I'd write the current real time to both the actual time and the game time, but it sounds like that won't work the way that I expect.

euan-forrester commented 1 year ago

Thank you again for your help with this!

RobertPeip commented 1 year ago

Hey, I just closed this today as I thought it would be long solved.

If you still have anything you need, let me know.

euan-forrester commented 1 year ago

Yeah I saw the notification and it reminded me that I should have circled back and said thank you! It's all resolved and working great! Thanks for your help!