From df5fcbe3777e5400b28362b14fa4edab453ad6d3 Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Sun, 10 Jul 2005 20:55:37 +0000 Subject: [PATCH] Fixed looking for data all over the place on files which are too small. --- zsnes/src/initc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zsnes/src/initc.c b/zsnes/src/initc.c index 1875afe8..b2f9771e 100755 --- a/zsnes/src/initc.c +++ b/zsnes/src/initc.c @@ -293,6 +293,18 @@ void BankCheck() infoloc = 0; Interleaved = false; + if (NumofBytes < Lo) + { + romtype = 1; + infoloc = 1; //Whatever, we just need a valid location + } + + if (NumofBytes < Hi) + { + romtype = 1; + infoloc = Lo; + } + if (NumofBytes >= 0x500000) { //Deinterleave if neccesary @@ -1027,7 +1039,7 @@ void SplitSupport() SplittedROM = false; //Same Game add on - if (ROM[Hi+CompanyOffset] == 0x33 && curromspace == 0x80000 && + if (curromspace == 0x80000 && ROM[Hi+CompanyOffset] == 0x33 && !ROM[Hi+BankOffset] && !ROM[Hi+BSMonthOffset] && !ROM[Hi+BSDayOffset]) { addOnStart = 0x200000; @@ -1036,7 +1048,7 @@ void SplitSupport() } //SD Gundam G-Next add on - if (ROM[Lo+CompanyOffset] == 0x33 && curromspace == 0x80000 && + if (curromspace == 0x80000 && ROM[Lo+CompanyOffset] == 0x33 && !ROM[Lo+BankOffset] && !ROM[Lo+BSMonthOffset] && !ROM[Lo+BSDayOffset] && !strncmp(ROM+Lo, "GNEXT", 5)) { addOnStart = 0x400000;