Firmware: Change ROM size detection for broken headers

This commit is contained in:
Maximilian Rehkopf 2012-07-01 03:27:34 +02:00
parent e23a76d812
commit 45b67d0f1a

View File

@ -189,11 +189,13 @@ void smc_id(snes_romprops_t* props) {
if(header->romsize == 0 || header->romsize > 13) { if(header->romsize == 0 || header->romsize > 13) {
props->romsize_bytes = 1024; props->romsize_bytes = 1024;
header->romsize = 0; header->romsize = 0;
if(file_handle.fsize >= 1024) {
while(props->romsize_bytes < file_handle.fsize-1) { while(props->romsize_bytes < file_handle.fsize-1) {
header->romsize++; header->romsize++;
props->romsize_bytes <<= 1; props->romsize_bytes <<= 1;
} }
} }
}
props->ramsize_bytes = (uint32_t)1024 << header->ramsize; props->ramsize_bytes = (uint32_t)1024 << header->ramsize;
props->romsize_bytes = (uint32_t)1024 << header->romsize; props->romsize_bytes = (uint32_t)1024 << header->romsize;
props->expramsize_bytes = (uint32_t)1024 << header->expramsize; props->expramsize_bytes = (uint32_t)1024 << header->expramsize;