comparison romdb.c @ 2097:0407d812cb4a

Fix off-by-one in sega mapper heuristic
author Michael Pavone <pavone@retrodev.com>
date Mon, 07 Feb 2022 22:47:11 -0800
parents 8ee7ecbf3f21
children 5d575c42fff5
comparison
equal deleted inserted replaced
2096:460c93c19146 2097:0407d812cb4a
263 } else if (rom_end > nearest_pow2(size)) { 263 } else if (rom_end > nearest_pow2(size)) {
264 rom_end = nearest_pow2(size); 264 rom_end = nearest_pow2(size);
265 } 265 }
266 info->save_type = SAVE_NONE; 266 info->save_type = SAVE_NONE;
267 uint8_t is_med_ssf = size >= 0x108 && !memcmp("SEGA SSF", rom + 0x100, 8); 267 uint8_t is_med_ssf = size >= 0x108 && !memcmp("SEGA SSF", rom + 0x100, 8);
268 if (is_med_ssf || (size >= 0x400000 && rom_end_raw <= 0x400000)) { 268 if (is_med_ssf || (size > 0x400000 && rom_end_raw <= 0x400000)) {
269 if (is_med_ssf && rom_end < 16*1024*1024) { 269 if (is_med_ssf && rom_end < 16*1024*1024) {
270 info->rom = rom = realloc(rom, 16*1024*1024); 270 info->rom = rom = realloc(rom, 16*1024*1024);
271 } 271 }
272 info->mapper_start_index = 0; 272 info->mapper_start_index = 0;
273 info->mapper_type = is_med_ssf ? MAPPER_SEGA_MED_V2 : MAPPER_SEGA; 273 info->mapper_type = is_med_ssf ? MAPPER_SEGA_MED_V2 : MAPPER_SEGA;