mirror of
https://github.com/visualboyadvance-m/visualboyadvance-m
synced 2025-10-05 15:42:52 +02:00
Revert "Check file size for GBA ROM and reduce memory footprint"
This reverts commit 56ea6456f5
.
This commit is contained in:
@@ -1675,31 +1675,16 @@ void GBAMatrixWrite16(GBAMatrix_t *matrix, uint32_t address, uint16_t value)
|
||||
}
|
||||
}
|
||||
|
||||
static size_t get_gba_rom_size(const char* szFile)
|
||||
{
|
||||
size_t size = 0;
|
||||
FILE *f = fopen(szFile, "rb");
|
||||
|
||||
if (f == NULL)
|
||||
return 0;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
fclose(f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int CPULoadRom(const char* szFile)
|
||||
{
|
||||
romSize = get_gba_rom_size(szFile);
|
||||
romSize = SIZE_ROM * 4;
|
||||
if (g_rom != NULL) {
|
||||
CPUCleanUp();
|
||||
}
|
||||
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||
|
||||
g_rom = (uint8_t*)malloc(romSize);
|
||||
g_rom = (uint8_t*)malloc(SIZE_ROM * 4);
|
||||
if (g_rom == NULL) {
|
||||
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
||||
"ROM");
|
||||
@@ -1844,14 +1829,14 @@ int CPULoadRom(const char* szFile)
|
||||
|
||||
int CPULoadRomData(const char* data, int size)
|
||||
{
|
||||
romSize = size % 2 == 0 ? size : size + 1;
|
||||
romSize = SIZE_ROM * 4;
|
||||
if (g_rom != NULL) {
|
||||
CPUCleanUp();
|
||||
}
|
||||
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||
|
||||
g_rom = (uint8_t*)malloc(romSize);
|
||||
g_rom = (uint8_t*)malloc(SIZE_ROM * 4);
|
||||
if (g_rom == NULL) {
|
||||
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
||||
"ROM");
|
||||
@@ -1884,7 +1869,7 @@ int CPULoadRomData(const char* data, int size)
|
||||
memcpy(&ident, &g_rom[0xAC], 1);
|
||||
|
||||
if (ident == 'M') {
|
||||
g_rom2 = (uint8_t *)malloc(romSize);
|
||||
g_rom2 = (uint8_t *)malloc(SIZE_ROM * 4);
|
||||
memcpy(g_rom2, data, size);
|
||||
romSize = 0x01000000;
|
||||
|
||||
|
@@ -1802,9 +1802,9 @@ bool retro_load_game(const struct retro_game_info *game)
|
||||
return emulating;
|
||||
}
|
||||
|
||||
bool retro_load_game_special(unsigned, const struct retro_game_info *game, size_t)
|
||||
bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
|
||||
{
|
||||
return retro_load_game(game);
|
||||
return false;
|
||||
}
|
||||
|
||||
void retro_unload_game(void)
|
||||
|
@@ -21,4 +21,3 @@ firmware2_desc = "gbc_bios.bin (Game Boy Color BIOS)"
|
||||
firmware2_path = "gbc_bios.bin"
|
||||
firmware2_opt = "true"
|
||||
notes = "(!) gba_bios.bin (md5): a860e8c0b6d573d191e4ec7db1b1e4f6|(!) gb_bios.bin (md5): 32fbbd84168d3482956eb3c5051637f5|(!) gbc_bios.bin (md5): dbfce9db9deaa2567f6a84fde55f9680"
|
||||
|
||||
|
Reference in New Issue
Block a user