MorsGames / sm64plus

A fork of sm64-port that focuses on QoL improvements and customizability.
https://mfgg.net/index.php?act=resdb&param=02&c=2&id=38190
456 stars 33 forks source link

Use dumped EEPROM save from original cartridge #14

Closed parski closed 3 years ago

parski commented 3 years ago

I've dumped my Super Mario 64 cartridge to get the ROM to use for compiling an executable. While I was at it I also dumped the EEPROM to get my save data. Now I want to look into getting my cartridge save data to work with this PC port but I can't even seem to find the save file. Want to point me in the right direction? Has anyone managed to get original save data to work with a PC version?

parski commented 3 years ago

For anyone else looking for the save on Windows it's in:

C:\Users\user\AppData\Local\SM64Plus

The filename is: savedata.bin.

parski commented 3 years ago

Byte and word swapping seems to almost do the trick comparing a just created save (top) with my original save (bottom).

save

Wondering if it's either that the PC version adds other stuff to the save data or if it might be a regional thing since my cartridge is PAL.

MorsGames commented 3 years ago

It's because I believe the emulators use little endian while the port uses big endian for the save files, it could be other way around though. I might add a toggle for that as a setting to the next version.

The port does add new stuff though, but it should be compatible with the N64 version regardless.

parski commented 3 years ago

Ah, so you're reading the save files like an emulator? Why?

Anyway, previously I byte- and word swapped the save file but this had the same result in game as using the EEPROM dump straight up. Every save file would be listed as "NEW" and selecting it would start the intro cinematic.

However, if I only word swap (no byte swap) the top two slots are listed as "NEW" permadeath slots even though I have not enabled permadeath obviously since the save file is a dump from a PAL launch copy of Super Mario 64.

slot

Selecting the top leftmost slot does not lead to the intro cinematic but puts me at the spawn point with my stars but Mario has no had and he's hunched and breathing deep as if he has low HP.

start

Lakitu is at the bridge and some doors have been locked again. Progress seems pretty garbled in general.

sm64

Are you sure the added things would be compatible with the Nintendo 64 version because it doesn't seem like it the other way around.

MorsGames commented 3 years ago

Ah, so you're reading the save files like an emulator? Why?

Well, I think that's just how the game works, the way save files work is pretty much the same as the base port I based my fork on.

I looked a bit more into this issue and apparently I was wrong about the whole byte order thing. I THINK the save files for the original are in big-endian since that's the native order of N64's CPU, meanwhile the port uses little-endian since that's the default for x86 platforms.

And I know that the save files should be interchangeable in theory since I use empty bytes for all the extra save options. I did a very similar thing back then when this was a ROM hack and not a fork of the PC port and I could just swap the save files and it would just work.

I'll try artificially swapping the bytes myself to see what happens, but unfortunately this is a topic I'm not super familiar with, and I don't want to spend hours on this feature specifically, so if I can't get it working like that I'll probably scrap the idea for that save file toggle.

parski commented 3 years ago

That makes sense that the save files use the endianness of the host architecture.

And I know that the save files should be interchangeable in theory since I use empty bytes for all the extra save options.

And those bytes are at an address at the end of the save data? As in appended to the regular data. If they are in the beginning maybe my data is offset or something. Just a guess.

I don't want to spend hours on this feature specifically

I hope I didn't make you feel like you have to spend time on this. I created the issue to show my intent but also to see if anybody had done it successfully before and could help me or at least to document my process of figuring out how to get this to work. I'm very thankful for the help you're providing but feel to close the issue and refer me to my chambers if you feel it is out of place.

parski commented 3 years ago

Here is my EEPROM dump in case anybody wants a dump to play with:

SUPERMARIO64.zip

MorsGames commented 3 years ago

I hope I didn't make you feel like you have to spend time on this. I created the issue to show my intent but also to see if anybody had done it successfully before and could help me or at least to document my process of figuring out how to get this to work. I'm very thankful for the help you're providing but feel to close the issue and refer me to my chambers if you feel it is out of place.

Nah it's fine, it's something I wanted to add in myself after seeing this issue.

MorsGames commented 3 years ago

I messed around for a bit longer and couldn't really figure it out. I'm sure it would be possible but I'm really not sure how exactly, so I'm closing this issue (at least for now).