Famicom Disk - Save Game Conversion

Started by roundy, March 20, 2024, 07:07:58 am

Previous topic - Next topic

roundy

Hi all, hopefully someone here will have an answer or some guidance.

First off, I'm not sure if you're familiar with the MiSTer, but TLDR it's an FPGA based emulator.

I've completed Zelda I on it, and my save game data is written to a .sav file - the original Zelda rom is "vanilla" and so when loading the game it obviously does something with this .sav file that is separate to the rom

My question is, does anybody know how these .sav files are made up and how I can write its data back onto the FDS rom image, specifically so I can play the rom on my Magic Wild Card where the save data directly writes to the rom as if it were an actual disk.

Hope that all makes sense and thanks in advance!

roundy

Just worked it out so if anybody else finds themselves in the same boat

The .sav file the MiSTer looks to generate is just the FDS image with the saved changes written to that to preserve the original FDS image so it seems.

Comparing my .sav file to the FDS rom file in a hex editor showed that my .sav file seemed to have some rubbish information at the top of the file where it looks like the header should be, so removing that junk and changing the file extension to .fds looks to have resolved it.


P

Heh, that makes sense since the whole disk is technically writable. Mesen does something similar and actually uses the IPS format for saving the changes made to an FDS image, saving some file space (since an IPS file contains the difference between two files). Patching the original FDS image with the IPS file applies those changes to it.


But anyway, the header might be done by MISTER but the FDS format may also have a header, although it is sometimes omitted since it isn't that useful.
An FDS file is exactly: 65500 times the number of disk sides plus the 16-byte header. So that's 65516 byte for a headered single-sided game, 131 016 byte for headered double-sided etc.

If there are any more bytes than that it might be the MISTER header.

It's a pretty odd size, the FDS format originates from the fwNES emulator. Nintendo's own QD format uses exactly 64 kB per side without headers and with all CRCs included.