fix bugs from r4926 (off-by-one error in out-of-range rom-reading check). possibly broke the last u32 in the rom. fixes bug #1406 (phantasy star 0 CHS translation black screen freeze)

This commit is contained in:
zeromus 2014-09-01 23:20:20 +00:00
parent e24720f69d
commit 51e478e66a
3 changed files with 3 additions and 2 deletions

View File

@ -541,7 +541,7 @@ u32 GameInfo::readROM(u32 pos)
}
else
{
if(pos + 4 >= romsize)
if(pos + 4 > romsize)
{
printf("Panic! GameInfo reading out of buffer!\n");
exit(-1);

View File

@ -66,7 +66,7 @@ u32 Slot1Comp_Rom::read()
//if (address > gameInfo.header.endROMoffset)
// ... the cart hardware doesnt know anything about the rom header. if it has a totally bogus endROMoffset, the cart will probably work just fine. and, the +4 is missing anyway:
//3. this is better: it just allows us to read 0xFF anywhere we dont have rom data. forget what the header says
if(address+4 >= gameInfo.romsize)
if(address+4 > gameInfo.romsize)
{
DEBUG_Notify.ReadBeyondEndOfCart(address,gameInfo.romsize);
return 0xFFFFFFFF;

View File

@ -3090,6 +3090,7 @@ int _main()
}
//disable wacky stylus stuff
//TODO - we are obliged to call GlobalDeleteAtom
GlobalAddAtom(MICROSOFT_TABLETPENSERVICE_PROPERTY);
SetProp(MainWindow->getHWnd(),MICROSOFT_TABLETPENSERVICE_PROPERTY,(HANDLE)(
TABLET_DISABLE_PRESSANDHOLD |