profi200 / open_agb_firm

open_agb_firm is a bare metal app for running GBA homebrew/games using the 3DS builtin GBA hardware.
GNU General Public License v3.0
860 stars 42 forks source link

Add homebrew save type overrides #40

Closed exelotl closed 2 years ago

exelotl commented 3 years ago

The EverDrive GBA X5 firmware allows homebrew developers to force a certain save type using '1' to '4' as the first character of the Game Code in the ROM header.

From the OS changelog:

If ROM isn't exists in bram-db then first char of ROM ID can be used as save memory selector: 1 - EEPROM 2 - SRAM 3 - FLASH-64 4 - FLASH-128 Number should be stored as char, eg 1 equal to 0x31 in hex format

In addition, games using the Butano engine are currently using 'S' as the first character (I guess they saw the proposal in the Twitter thread but not the eventual changelog entry).

This PR adds detection for these to open_agb_firm, to make it play nicely with modern homebrew.

Maybe once https://github.com/profi200/open_agb_firm/issues/9 is done, SRAM should also become the default for unrecognised games?

profi200 commented 3 years ago

That's a strange way of forcing a save type but ok. The only problem i see is when the save type db stuff is in homebrew not setting the game code field to zeros might unnecessarily go through the db lookup.

Also a side note: I wanted to go with the .eep file extension for EEPROM saves since that's apparently what the Everdrives and RetroArch use and unfortunately all emulators have the EEPROM save laid out wrong when they save in .sav files.

profi200 commented 2 years ago

Merging this for now. If this gives any issues it can easily be reverted.