Fixed ROM enlargement by IPS when IPS is out of order.

This commit is contained in:
n-a-c-h
2004-09-07 13:41:58 +00:00
parent 6270227271
commit 689a9ff384

View File

@@ -140,7 +140,7 @@ void deinitPatch()
void PatchUsingIPS() void PatchUsingIPS()
{ {
unsigned char *ROM = (unsigned char *)romdata; unsigned char *ROM = (unsigned char *)romdata;
int location = 0, length = 0; int location = 0, length = 0, last = 0;
int sub = Header512 ? 512 : 0; int sub = Header512 ? 512 : 0;
IPSPatched = false; IPSPatched = false;
@@ -183,6 +183,7 @@ void PatchUsingIPS()
{ {
if (location >= maxromspace) { goto IPSDone; } if (location >= maxromspace) { goto IPSDone; }
ROM[location] = (unsigned char)IPSget(); ROM[location] = (unsigned char)IPSget();
if (location > last) { last = location; }
} }
else else
{ {
@@ -202,6 +203,7 @@ void PatchUsingIPS()
{ {
if (location >= maxromspace) { goto IPSDone; } if (location >= maxromspace) { goto IPSDone; }
ROM[location] = newVal; ROM[location] = newVal;
if (location > last) { last = location; }
} }
} }
} }
@@ -217,10 +219,10 @@ void PatchUsingIPS()
IPSPatched = true; IPSPatched = true;
//Adjust size values if the ROM was expanded //Adjust size values if the ROM was expanded
if (location > curromspace && location <= maxromspace) if (last > curromspace)
{ {
curromspace = location; curromspace = last;
NumofBytes = location; NumofBytes = last;
NumofBanks = NumofBytes/32768; NumofBanks = NumofBytes/32768;
} }