Better handling of tiny ROMs

This commit is contained in:
Lior Halphon 2021-10-05 19:53:43 +03:00
parent 9a957674d9
commit d1caeafe5e

View File

@ -284,7 +284,7 @@ int GB_load_rom(GB_gameboy_t *gb, const char *path)
gb->rom_size |= gb->rom_size >> 1; gb->rom_size |= gb->rom_size >> 1;
gb->rom_size++; gb->rom_size++;
} }
if (gb->rom_size == 0) { if (gb->rom_size < 0x8000) {
gb->rom_size = 0x8000; gb->rom_size = 0x8000;
} }
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
@ -396,7 +396,7 @@ int GB_load_gbs_from_buffer(GB_gameboy_t *gb, const uint8_t *buffer, size_t size
gb->rom_size++; gb->rom_size++;
} }
if (gb->rom_size == 0) { if (gb->rom_size < 0x8000) {
gb->rom_size = 0x8000; gb->rom_size = 0x8000;
} }