mirror of
https://github.com/libretro/vba-next.git
synced 2024-11-27 01:40:21 +00:00
Update gbaconv.c to add SRAM support
This commit is contained in:
parent
0c310082a6
commit
cf92dc93f9
@ -14,6 +14,7 @@ enum save_type
|
||||
EEPROM_8K,
|
||||
FLASH_64K,
|
||||
FLASH_128K,
|
||||
SRAM,
|
||||
SAVE_UNKNOWN
|
||||
};
|
||||
|
||||
@ -29,6 +30,8 @@ static const char *save_type_to_string(enum save_type type)
|
||||
return "FLASH 512kbit";
|
||||
case FLASH_128K:
|
||||
return "FLASH 1MBit";
|
||||
case SRAM:
|
||||
return "SRAM";
|
||||
|
||||
default:
|
||||
return "Unknown type";
|
||||
@ -56,9 +59,13 @@ static enum save_type detect_save_type(const uint8_t *data, unsigned size)
|
||||
return FLASH_64K;
|
||||
if (size == 0x20000)
|
||||
return FLASH_128K;
|
||||
if (size == 0x8000)
|
||||
return SRAM;
|
||||
|
||||
if (size == (0x20000 + 0x2000))
|
||||
{
|
||||
if (scan_section(data, 0x8000) && !scan_section(data + 0x8000, 0x1A000))
|
||||
return SRAM;
|
||||
if (scan_section(data, 0x10000) && !scan_section(data + 0x10000, 0x10000))
|
||||
return FLASH_64K;
|
||||
if (scan_section(data, 0x20000))
|
||||
@ -101,6 +108,11 @@ static void dump_srm(FILE *file, const uint8_t *data, enum save_type type)
|
||||
fwrite(buf, 1, 0x2000, file);
|
||||
break;
|
||||
|
||||
case SRAM:
|
||||
fwrite(data, 1, 0x8000, file);
|
||||
fwrite(buf, 1, 0x1A000, file);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -128,6 +140,10 @@ static void dump_sav(FILE *file, const uint8_t *data, enum save_type type)
|
||||
fwrite(data, 1, 0x20000, file);
|
||||
break;
|
||||
|
||||
case SRAM:
|
||||
fwrite(data, 1, 0x8000, file);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user