in atari_py/ale_interface/src/emucore/CartAR.cxx [503:568]
bool CartridgeAR::load(Deserializer& in)
{
string cart = name();
try
{
if(in.getString() != cart)
return false;
uInt32 i, limit;
// Indicates the offest within the image for the corresponding bank
limit = (uInt32) in.getInt();
for(i = 0; i < limit; ++i)
myImageOffset[i] = (uInt32) in.getInt();
// The 6K of RAM and 2K of ROM contained in the Supercharger
limit = (uInt32) in.getInt();
for(i = 0; i < limit; ++i)
myImage[i] = (uInt8) in.getInt();
// The 256 byte header for the current 8448 byte load
limit = (uInt32) in.getInt();
for(i = 0; i < limit; ++i)
myHeader[i] = (uInt8) in.getInt();
// All of the 8448 byte loads associated with the game
// Note that the size of this array is myNumberOfLoadImages * 8448
limit = (uInt32) in.getInt();
for(i = 0; i < limit; ++i)
myLoadImages[i] = (uInt8) in.getInt();
// Indicates how many 8448 loads there are
myNumberOfLoadImages = (uInt8) in.getInt();
// Indicates if the RAM is write enabled
myWriteEnabled = in.getBool();
// Indicates if the ROM's power is on or off
myPower = in.getBool();
// Indicates when the power was last turned on
myPowerRomCycle = (Int32) in.getInt();
// Data hold register used for writing
myDataHoldRegister = (uInt8) in.getInt();
// Indicates number of distinct accesses when data hold register was set
myNumberOfDistinctAccesses = (uInt32) in.getInt();
// Indicates if a write is pending or not
myWritePending = in.getBool();
}
catch(const char* msg)
{
ale::Logger::Error << msg << endl;
return false;
}
catch(...)
{
ale::Logger::Error << "Unknown error in load state for " << cart << endl;
return false;
}
return true;
}