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