Fix crash in CTY scheme when accessing a zero-byte/non-existent

flash file.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2498 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-05-25 11:11:01 +00:00
parent 93deeecadf
commit 3375cb9f98
3 changed files with 6 additions and 8 deletions

View File

@ -192,7 +192,7 @@ uInt8 CartridgeCTY::peek(uInt16 address)
// Is this instruction an immediate mode LDA?
myLDAimmediate = (peekValue == 0xA9);
return myImage[myCurrentBank + address];
return peekValue;
}
}
@ -466,7 +466,7 @@ void CartridgeCTY::loadScore(uInt8 index)
{
serializer.getByteArray(scoreRAM, 256);
}
catch(const char* msg)
catch(...)
{
memset(scoreRAM, 0, 256);
}
@ -487,7 +487,7 @@ void CartridgeCTY::saveScore(uInt8 index)
{
serializer.getByteArray(scoreRAM, 256);
}
catch(const char* msg)
catch(...)
{
memset(scoreRAM, 0, 256);
}
@ -501,7 +501,7 @@ void CartridgeCTY::saveScore(uInt8 index)
{
serializer.putByteArray(scoreRAM, 256);
}
catch(const char* msg)
catch(...)
{
// Maybe add logging here that save failed?
cerr << name() << ": ERROR saving score table " << (int)index << endl;

View File

@ -41,7 +41,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255;
mySize = BSPF_max(minsize, size);
myImage = new uInt8[mySize];
myDPCRAM = new uInt8[8192];
memcpy(myImage, image, size);
createCodeAccessBase(4096 * 6);
@ -94,7 +93,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
CartridgeDPCPlus::~CartridgeDPCPlus()
{
delete[] myImage;
delete[] myDPCRAM;
#ifdef THUMB_SUPPORT
delete myThumbEmulator;

View File

@ -181,8 +181,8 @@ class CartridgeDPCPlus : public Cartridge
// Pointer to the 4K display ROM image of the cartridge
uInt8* myDisplayImage;
// Pointer to the DPC 8k RAM image
uInt8* myDPCRAM;
// The DPC 8k RAM image
uInt8 myDPCRAM[8192];
#ifdef THUMB_SUPPORT
// Pointer to the Thumb ARM emulator object