From 45b67d0f1aa5e9f5b02d4ab778298cbae18f5601 Mon Sep 17 00:00:00 2001 From: Maximilian Rehkopf Date: Sun, 1 Jul 2012 03:27:34 +0200 Subject: [PATCH] Firmware: Change ROM size detection for broken headers --- src/smc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/smc.c b/src/smc.c index bbc3b3d..9f6d031 100644 --- a/src/smc.c +++ b/src/smc.c @@ -189,9 +189,11 @@ void smc_id(snes_romprops_t* props) { if(header->romsize == 0 || header->romsize > 13) { props->romsize_bytes = 1024; header->romsize = 0; - while(props->romsize_bytes < file_handle.fsize-1) { - header->romsize++; - props->romsize_bytes <<= 1; + if(file_handle.fsize >= 1024) { + while(props->romsize_bytes < file_handle.fsize-1) { + header->romsize++; + props->romsize_bytes <<= 1; + } } } props->ramsize_bytes = (uint32_t)1024 << header->ramsize;