Prevent creating .sav files for ROMs claiming they have a battery but have no cartridge RAM or RTC
This commit is contained in:
parent
7dc575d01e
commit
0fa2d6ea2f
@ -341,6 +341,7 @@ int gb_load_state(GB_gameboy_t *gb, const char *path)
|
||||
int gb_save_battery(GB_gameboy_t *gb, const char *path)
|
||||
{
|
||||
if (!gb->cartridge_type->has_battery) return 0; // Nothing to save.
|
||||
if (gb->mbc_ram_size == 0 && !gb->cartridge_type->has_rtc) return 0; /* Claims to have battery, but has no RAM or RTC */
|
||||
FILE *f = fopen(path, "w");
|
||||
if (!f) {
|
||||
return errno;
|
||||
|
Loading…
Reference in New Issue
Block a user