512 byte EEPROM save support?

Posts: 15
Joined: Tue Jul 21, 2020 12:31 am

512 byte EEPROM save support?

Unread post by bry111 »

Does the GBA core support 512 byte EEPROM saves? I had very minor trouble with one game that uses them - Scurge Hive.

The first thing I noticed is that MiSTer produces 8192 byte saves for Scurge (like most other GBA EEPROM saves I guess). But oddly, it contained content from the save for the previous game I was playing - in this case I was previously playing Wario Land 4, and the Scurge save contained strings from the WL4 save like "AutoSAVEWar4key" so I guess saves aren't being cleared when swapping games?

Second, I tried copying a 512 byte save originally created elsewhere over to the MiSTer. The game behaved as if there was no save. But it seemed to work fine if I 0-padded the save file out to 8192 bytes first. So, moving saves around doesn't really work as is but at least the workaround is simple enough.
Posts: 68
Joined: Sat May 23, 2020 12:55 pm
Been thanked: 19 times

Re: 512 byte EEPROM save support?

Unread post by FPGAzumSpass »

There is a switch for the Flash size, but none for the EEPROM Size, as the core internally doesn't know the EEPROM size.
The saveram isn't cleared on loading a new game, so the upper data may be from a last game, but that shouldn't be a problem anyway.

Saveram was never meant to be interchangable with e.g. Flashcards or emulators.
E.g. All games with RTC add some data behind the savedata.

If you like, you can change it and start a pull request.
There is a line
"if(save_eeprom) save_sz <= save_sz | 8'hF;"
With small EEPROM you probably just need to switch that to 8'h1.
Maybe it requires changes in the HPS, too.

However, you also need to find which size of EEPROM the game really has.
This information is NOT in the catridge itself, you must guess it from the kind of access the game does.
Post Reply