Remove Serializable::name() method, and all reference to it in state files.

- this both speeds up load/save of state files, and makes them smaller
- affects both on-disk files, and Time Machine functionality
This commit is contained in:
Stephen Anthony 2018-09-13 20:50:23 -02:30
parent 524943354e
commit d18f11afa2
85 changed files with 29 additions and 418 deletions

View File

@ -90,6 +90,10 @@
This fixes popping and cracking sounds apparent on some systems, notably
OSX when toggling windowed/fullscreen mode.
* State file format has been optimized to be smaller, and faster loading
and saving. This affects both the files saved to your computer as well
as Time Machine functionality.
* Updated PAL palette.
* Added recently released 'Arkyology' prototype ROM to the database.

View File

@ -27,7 +27,7 @@
#include "StateManager.hxx"
#define STATE_HEADER "05099100state"
#define STATE_HEADER "05099200state"
// #define MOVIE_HEADER "03030000movie"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -229,8 +229,6 @@ void StateManager::loadState(int slot)
{
if(in.getString() != STATE_HEADER)
buf << "Incompatible state " << slot << " file";
else if(in.getString() != myOSystem.console().cartridge().name())
buf << "State " << slot << " file doesn't match current ROM";
else
{
if(myOSystem.console().load(in))
@ -275,9 +273,6 @@ void StateManager::saveState(int slot)
// Add header so that if the state format changes in the future,
// we'll know right away, without having to parse the rest of the file
out.putString(STATE_HEADER);
// Sanity check; prepend the cart type/name
out.putString(myOSystem.console().cartridge().name());
}
catch(...)
{
@ -325,10 +320,9 @@ bool StateManager::loadState(Serializer& in)
// Make sure the file can be opened for reading
if(in)
{
// First test if we have a valid header and cart type
// First test if we have a valid header
// If so, do a complete state load using the Console
return in.getString() == STATE_HEADER &&
in.getString() == myOSystem.console().cartridge().name() &&
myOSystem.console().load(in);
}
}
@ -354,9 +348,6 @@ bool StateManager::saveState(Serializer& out)
// we'll know right away, without having to parse the rest of the file
out.putString(STATE_HEADER);
// Sanity check; prepend the cart type/name
out.putString(myOSystem.console().cartridge().name());
// Do a complete state save using the Console
if(myOSystem.console().save(out))
return true;

View File

@ -145,6 +145,13 @@ class Cartridge : public Device
*/
virtual const uInt8* getImage(uInt32& size) const = 0;
/**
Get a descriptor for the cart name.
@return The name of the object
*/
virtual string name() const = 0;
/**
Informs the cartridge about the name of the ROM file used when
creating this cart.

View File

@ -177,7 +177,6 @@ bool Cartridge0840::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -194,9 +193,6 @@ bool Cartridge0840::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -85,34 +85,13 @@ const uInt8* Cartridge2K::getImage(uInt32& size) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::save(Serializer& out) const
bool Cartridge2K::save(Serializer&) const
{
try
{
out.putString(name());
}
catch(...)
{
cerr << "ERROR: Cartridge2K::save" << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::load(Serializer& in)
bool Cartridge2K::load(Serializer&)
{
try
{
if(in.getString() != name())
return false;
}
catch(...)
{
cerr << "ERROR: Cartridge2K::load" << endl;
return false;
}
return true;
}

View File

@ -239,7 +239,6 @@ bool Cartridge3E::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myCurrentBank);
out.putByteArray(myRAM, 32768);
}
@ -257,9 +256,6 @@ bool Cartridge3E::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myCurrentBank = in.getShort();
in.getByteArray(myRAM, 32768);
}

View File

@ -302,7 +302,6 @@ bool Cartridge3EPlus::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShortArray(bankInUse, 8);
out.putByteArray(myRAM, RAM_TOTAL_SIZE);
}
@ -319,8 +318,6 @@ bool Cartridge3EPlus::load(Serializer& in)
{
try
{
if (in.getString() != name())
return false;
in.getShortArray(bankInUse, 8);
in.getByteArray(myRAM, RAM_TOTAL_SIZE);
}

View File

@ -172,7 +172,6 @@ bool Cartridge3F::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myCurrentBank);
}
catch(...)
@ -189,9 +188,6 @@ bool Cartridge3F::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myCurrentBank = in.getShort();
}
catch(...)

View File

@ -367,8 +367,6 @@ bool Cartridge4A50::save(Serializer& out) const
{
try
{
out.putString(name());
// The 32K bytes of RAM
out.putByteArray(myRAM, 32768);
@ -400,9 +398,6 @@ bool Cartridge4A50::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
in.getByteArray(myRAM, 32768);
// Index pointers

View File

@ -66,34 +66,13 @@ const uInt8* Cartridge4K::getImage(uInt32& size) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4K::save(Serializer& out) const
bool Cartridge4K::save(Serializer&) const
{
try
{
out.putString(name());
}
catch(...)
{
cerr << "ERROR: Cartridge4K::save" << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4K::load(Serializer& in)
bool Cartridge4K::load(Serializer&)
{
try
{
if(in.getString() != name())
return false;
}
catch(...)
{
cerr << "ERROR: Cartridge4K::load" << endl;
return false;
}
return true;
}

View File

@ -118,7 +118,6 @@ bool Cartridge4KSC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putByteArray(myRAM, 128);
}
catch(...)
@ -135,9 +134,6 @@ bool Cartridge4KSC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
in.getByteArray(myRAM, 128);
}
catch(...)

View File

@ -436,8 +436,6 @@ bool CartridgeAR::save(Serializer& out) const
{
try
{
out.putString(name());
// Indicates the offest within the image for the corresponding bank
out.putIntArray(myImageOffset, 2);
@ -483,9 +481,6 @@ bool CartridgeAR::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
// Indicates the offest within the image for the corresponding bank
in.getIntArray(myImageOffset, 2);

View File

@ -136,7 +136,6 @@ bool CartridgeBF::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myBankOffset);
}
catch(...)
@ -153,9 +152,6 @@ bool CartridgeBF::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getInt();
}
catch(...)

View File

@ -184,7 +184,6 @@ bool CartridgeBFSC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myBankOffset);
out.putByteArray(myRAM, 128);
}
@ -202,9 +201,6 @@ bool CartridgeBFSC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getInt();
in.getByteArray(myRAM, 128);
}

View File

@ -546,8 +546,6 @@ bool CartridgeBUS::save(Serializer& out) const
{
try
{
out.putString(name());
// Indicates which bank is currently active
out.putShort(myBankOffset);
@ -589,9 +587,6 @@ bool CartridgeBUS::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
// Indicates which bank is currently active
myBankOffset = in.getShort();

View File

@ -478,8 +478,6 @@ bool CartridgeCDF::save(Serializer& out) const
{
try
{
out.putString(name());
// Indicates which bank is currently active
out.putShort(myBankOffset);
@ -520,9 +518,6 @@ bool CartridgeCDF::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
// Indicates which bank is currently active
myBankOffset = in.getShort();

View File

@ -190,7 +190,6 @@ bool CartridgeCM::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByte(mySWCHA);
out.putByte(myCompuMate->column());
@ -210,9 +209,6 @@ bool CartridgeCM::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
mySWCHA = in.getByte();
myCompuMate->column() = in.getByte();

View File

@ -279,7 +279,6 @@ bool CartridgeCTY::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(getBank());
out.putByteArray(myRAM, 64);
@ -305,9 +304,6 @@ bool CartridgeCTY::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
// Remember what bank we were in
bank(in.getShort());
in.getByteArray(myRAM, 64);

View File

@ -142,7 +142,6 @@ bool CartridgeCV::save(Serializer& out) const
{
try
{
out.putString(name());
out.putByteArray(myRAM, 1024);
}
catch(...)
@ -159,9 +158,6 @@ bool CartridgeCV::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
in.getByteArray(myRAM, 1024);
}
catch(...)

View File

@ -193,7 +193,6 @@ bool CartridgeCVPlus::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myCurrentBank);
out.putByteArray(myRAM, 1024);
}
@ -211,9 +210,6 @@ bool CartridgeCVPlus::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myCurrentBank = in.getShort();
in.getByteArray(myRAM, 1024);
}

View File

@ -307,7 +307,6 @@ bool CartridgeDASH::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShortArray(bankInUse, 8);
out.putShortArray(segmentInUse, 4);
out.putByteArray(myRAM, RAM_TOTAL_SIZE);
@ -325,8 +324,6 @@ bool CartridgeDASH::load(Serializer& in)
{
try
{
if (in.getString() != name())
return false;
in.getShortArray(bankInUse, 8);
in.getShortArray(segmentInUse, 4);
in.getByteArray(myRAM, RAM_TOTAL_SIZE);

View File

@ -132,7 +132,6 @@ bool CartridgeDF::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myBankOffset);
}
catch(...)
@ -149,9 +148,6 @@ bool CartridgeDF::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getInt();
}
catch(...)

View File

@ -184,7 +184,6 @@ bool CartridgeDFSC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myBankOffset);
out.putByteArray(myRAM, 128);
}
@ -202,9 +201,6 @@ bool CartridgeDFSC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getInt();
in.getByteArray(myRAM, 128);
}

View File

@ -445,8 +445,6 @@ bool CartridgeDPC::save(Serializer& out) const
{
try
{
out.putString(name());
// Indicates which bank is currently active
out.putShort(myBankOffset);
@ -486,9 +484,6 @@ bool CartridgeDPC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
// Indicates which bank is currently active
myBankOffset = in.getShort();

View File

@ -633,8 +633,6 @@ bool CartridgeDPCPlus::save(Serializer& out) const
{
try
{
out.putString(name());
// Indicates which bank is currently active
out.putShort(myBankOffset);
@ -696,9 +694,6 @@ bool CartridgeDPCPlus::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
// Indicates which bank is currently active
myBankOffset = in.getShort();

View File

@ -200,7 +200,6 @@ bool CartridgeE0::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShortArray(myCurrentSlice, 4);
}
catch(...)
@ -217,9 +216,6 @@ bool CartridgeE0::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
in.getShortArray(myCurrentSlice, 4);
}
catch(...)

View File

@ -132,7 +132,6 @@ bool CartridgeEF::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -149,9 +148,6 @@ bool CartridgeEF::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -184,7 +184,6 @@ bool CartridgeEFSC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByteArray(myRAM, 128);
}
@ -202,9 +201,6 @@ bool CartridgeEFSC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
in.getByteArray(myRAM, 128);
}

View File

@ -144,7 +144,6 @@ bool CartridgeF0::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -161,9 +160,6 @@ bool CartridgeF0::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -140,7 +140,6 @@ bool CartridgeF4::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -157,9 +156,6 @@ bool CartridgeF4::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -190,7 +190,6 @@ bool CartridgeF4SC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByteArray(myRAM, 128);
}
@ -208,9 +207,6 @@ bool CartridgeF4SC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
in.getByteArray(myRAM, 128);
}

View File

@ -180,7 +180,6 @@ bool CartridgeF6::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -197,9 +196,6 @@ bool CartridgeF6::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -233,7 +233,6 @@ bool CartridgeF6SC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByteArray(myRAM, 128);
}
@ -251,9 +250,6 @@ bool CartridgeF6SC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
in.getByteArray(myRAM, 128);
}

View File

@ -169,7 +169,6 @@ bool CartridgeF8::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -186,9 +185,6 @@ bool CartridgeF8::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -213,7 +213,6 @@ bool CartridgeF8SC::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByteArray(myRAM, 128);
}
@ -231,9 +230,6 @@ bool CartridgeF8SC::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
in.getByteArray(myRAM, 128);
}

View File

@ -223,7 +223,6 @@ bool CartridgeFA::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByteArray(myRAM, 256);
}
@ -241,9 +240,6 @@ bool CartridgeFA::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
in.getByteArray(myRAM, 256);
}

View File

@ -289,7 +289,6 @@ bool CartridgeFA2::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putByteArray(myRAM, 256);
}
@ -307,9 +306,6 @@ bool CartridgeFA2::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
in.getByteArray(myRAM, 256);
}

View File

@ -139,7 +139,6 @@ bool CartridgeFE::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
out.putBool(myLastAccessWasFE);
}
@ -157,9 +156,6 @@ bool CartridgeFE::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
myLastAccessWasFE = in.getBool();
}

View File

@ -155,7 +155,6 @@ bool CartridgeMDM::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myBankOffset);
}
catch(...)
@ -172,9 +171,6 @@ bool CartridgeMDM::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getInt();
}
catch(...)

View File

@ -252,7 +252,6 @@ bool CartridgeMNetwork::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShortArray(myCurrentSlice, NUM_SEGMENTS);
out.putShort(myCurrentRAM);
out.putByteArray(myRAM, RAM_SIZE);
@ -270,9 +269,6 @@ bool CartridgeMNetwork::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
in.getShortArray(myCurrentSlice, NUM_SEGMENTS);
myCurrentRAM = in.getShort();
in.getByteArray(myRAM, RAM_SIZE);

View File

@ -160,7 +160,6 @@ bool CartridgeSB::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myBankOffset);
}
catch(...)
@ -177,9 +176,6 @@ bool CartridgeSB::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getInt();
}
catch(...)

View File

@ -169,7 +169,6 @@ bool CartridgeUA::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myBankOffset);
}
catch(...)
@ -186,9 +185,6 @@ bool CartridgeUA::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myBankOffset = in.getShort();
}
catch(...)

View File

@ -266,7 +266,6 @@ bool CartridgeWD::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myCurrentBank);
out.putByteArray(myRAM, 64);
out.putLong(myCyclesAtBankswitchInit);
@ -286,9 +285,6 @@ bool CartridgeWD::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myCurrentBank = in.getShort();
in.getByteArray(myRAM, 64);
myCyclesAtBankswitchInit = in.getLong();

View File

@ -155,7 +155,6 @@ bool CartridgeX07::save(Serializer& out) const
{
try
{
out.putString(name());
out.putShort(myCurrentBank);
}
catch(...)
@ -172,9 +171,6 @@ bool CartridgeX07::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myCurrentBank = in.getShort();
}
catch(...)

View File

@ -149,13 +149,6 @@ class Console : public Serializable
*/
bool load(Serializer& in) override;
/**
Get a descriptor for this console class (used in error checking).
@return The name of the object
*/
string name() const override { return "Console"; }
/**
Set the properties to those given

View File

@ -251,7 +251,7 @@ class Controller : public Serializable
/**
Returns the name of this controller.
*/
string name() const override { return myName; }
string name() const { return myName; }
/**
Inject a callback to be notified on analog pin updates.

View File

@ -79,13 +79,6 @@ class Device : public Serializable
*/
virtual bool load(Serializer& in) override = 0;
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
virtual string name() const override = 0;
public:
/**
Get the byte at the specified address

View File

@ -400,12 +400,8 @@ void M6502::interruptHandler()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool M6502::save(Serializer& out) const
{
const string& CPU = name();
try
{
out.putString(CPU);
out.putByte(A); // Accumulator
out.putByte(X); // X index register
out.putByte(Y); // Y index register
@ -452,13 +448,8 @@ bool M6502::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool M6502::load(Serializer& in)
{
const string& CPU = name();
try
{
if(in.getString() != CPU)
return false;
A = in.getByte(); // Accumulator
X = in.getByte(); // X index register
Y = in.getByte(); // Y index register

View File

@ -214,13 +214,6 @@ class M6502 : public Serializable
*/
bool load(Serializer& in) override;
/**
Get a null terminated string which is the processor's name (i.e. "M6532")
@return The name of the device
*/
string name() const override { return "M6502"; }
#ifdef DEBUGGER_SUPPORT
public:
// Attach the specified debugger.

View File

@ -368,8 +368,6 @@ bool M6532::save(Serializer& out) const
{
try
{
out.putString(name());
out.putByteArray(myRAM, 128);
out.putInt(myTimer);
@ -403,9 +401,6 @@ bool M6532::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
in.getByteArray(myRAM, 128);
myTimer = in.getInt();

View File

@ -100,13 +100,6 @@ class M6532 : public Device
*/
bool load(Serializer& in) override;
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "M6532"; }
public:
/**
Get the byte at the specified address

View File

@ -66,13 +66,6 @@ class NullDevice : public Device
*/
bool load(Serializer& in) override { return true; }
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "NullDevice"; }
public:
/**
Get the byte at the specified address

View File

@ -65,7 +65,6 @@ class Random : public Serializable
{
try
{
out.putString(name());
out.putInt(myValue);
}
catch(...)
@ -87,9 +86,6 @@ class Random : public Serializable
{
try
{
if(in.getString() != name())
return false;
myValue = in.getInt();
}
catch(...)
@ -101,13 +97,6 @@ class Random : public Serializable
return true;
}
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "Random"; }
private:
// Indicates the next random number
// We make this mutable, since it's not immediately obvious that

View File

@ -53,13 +53,6 @@ class Serializable
@return False on any errors, else true
*/
virtual bool load(Serializer& in) = 0;
/**
Get a descriptor for the object name (used in error checking).
@return The name of the object
*/
virtual string name() const = 0;
};
#endif

View File

@ -78,13 +78,6 @@ class Switches : public Serializable
*/
bool load(Serializer& in) override;
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "Switches"; }
/**
Query the 'Console_TelevisionType' switches bit.

View File

@ -202,7 +202,6 @@ bool System::save(Serializer& out) const
{
try
{
out.putString(name());
out.putLong(myCycles);
out.putByte(myDataBusState);
@ -232,9 +231,6 @@ bool System::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myCycles = in.getLong();
myDataBusState = in.getByte();

View File

@ -377,13 +377,6 @@ class System : public Serializable
*/
bool load(Serializer& in) override;
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "System"; }
private:
const OSystem& myOSystem;

View File

@ -116,19 +116,11 @@ AudioChannel& Audio::channel1()
return myChannel1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Audio::name() const
{
return "TIA_Audio";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Audio::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myCounter);
// The queue starts out pristine after loading, so we don't need to save
@ -151,8 +143,6 @@ bool Audio::load(Serializer& in)
{
try
{
if (in.getString() != name()) return false;
myCounter = in.getInt();
if (!myChannel0.load(in)) return false;

View File

@ -44,7 +44,6 @@ class Audio : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override;
private:
void phase1();

View File

@ -141,19 +141,11 @@ void AudioChannel::audf(uInt8 value)
myAudf = value & 0x1f;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string AudioChannel::name() const
{
return "TIA_AudioChannel";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AudioChannel::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(myAudc);
out.putInt(myAudv);
out.putInt(myAudf);
@ -181,8 +173,6 @@ bool AudioChannel::load(Serializer& in)
{
try
{
if (in.getString() != name()) return false;
myAudc = in.getInt();
myAudv = in.getInt();
myAudf = in.getInt();

View File

@ -43,7 +43,6 @@ class AudioChannel : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override;
private:
uInt8 myAudc;

View File

@ -82,8 +82,6 @@ bool Background::save(Serializer& out) const
{
try
{
out.putString(name());
out.putByte(myColor);
out.putByte(myObjectColor);
out.putByte(myDebugColor);
@ -103,9 +101,6 @@ bool Background::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myColor = in.getByte();
myObjectColor = in.getByte();
myDebugColor = in.getByte();

View File

@ -46,7 +46,6 @@ class Background : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_BK"; }
private:
void applyColors();

View File

@ -288,8 +288,6 @@ bool Ball::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(collision);
out.putInt(myCollisionMaskDisabled);
out.putInt(myCollisionMaskEnabled);
@ -330,9 +328,6 @@ bool Ball::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
collision = in.getInt();
myCollisionMaskDisabled = in.getInt();
myCollisionMaskEnabled = in.getInt();

View File

@ -82,7 +82,6 @@ class Ball : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_Ball"; }
public:

View File

@ -48,7 +48,6 @@ class DelayQueue : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override;
private:
DelayQueueMember<capacity> myMembers[length];
@ -166,11 +165,4 @@ bool DelayQueue<length, capacity>::load(Serializer& in)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<unsigned length, unsigned capacity>
string DelayQueue<length, capacity>::name() const
{
return "TIA_DelayQueue";
}
#endif // TIA_DELAY_QUEUE

View File

@ -47,7 +47,6 @@ class DelayQueueMember : public Serializable {
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override;
public:
Entry myEntries[capacity];
@ -155,11 +154,4 @@ bool DelayQueueMember<capacity>::load(Serializer& in)
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<unsigned capacity>
string DelayQueueMember<capacity>::name() const
{
return "TIA_DelayQueueMember";
}
#endif // TIA_DELAY_QUEUE_MEMBER

View File

@ -59,8 +59,6 @@ bool LatchedInput::save(Serializer& out) const
{
try
{
out.putString(name());
out.putBool(myModeLatched);
out.putByte(myLatchedValue);
}
@ -78,9 +76,6 @@ bool LatchedInput::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myModeLatched = in.getBool();
myLatchedValue = in.getByte();
}

View File

@ -40,7 +40,6 @@ class LatchedInput : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_LatchedInput"; }
private:
bool myModeLatched;

View File

@ -305,8 +305,6 @@ bool Missile::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(collision);
out.putInt(myCollisionMaskDisabled);
out.putInt(myCollisionMaskEnabled);
@ -347,9 +345,6 @@ bool Missile::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
collision = in.getInt();
myCollisionMaskDisabled = in.getInt();
myCollisionMaskEnabled = in.getInt();

View File

@ -76,7 +76,6 @@ class Missile : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_Missile"; }
public:

View File

@ -110,8 +110,6 @@ bool PaddleReader::save(Serializer& out) const
{
try
{
out.putString(name());
out.putDouble(myUThresh);
out.putDouble(myU);
@ -137,9 +135,6 @@ bool PaddleReader::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
myUThresh = in.getDouble();
myU = in.getDouble();

View File

@ -44,7 +44,6 @@ class PaddleReader : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_PaddleReader"; }
private:

View File

@ -444,8 +444,6 @@ bool Player::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(collision);
out.putInt(myCollisionMaskDisabled);
out.putInt(myCollisionMaskEnabled);
@ -491,9 +489,6 @@ bool Player::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
collision = in.getInt();
myCollisionMaskDisabled = in.getInt();
myCollisionMaskEnabled = in.getInt();

View File

@ -87,7 +87,6 @@ class Player : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_Player"; }
public:

View File

@ -293,8 +293,6 @@ bool Playfield::save(Serializer& out) const
{
try
{
out.putString(name());
out.putInt(collision);
out.putInt(myCollisionMaskDisabled);
out.putInt(myCollisionMaskEnabled);
@ -336,9 +334,6 @@ bool Playfield::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
collision = in.getInt();
myCollisionMaskDisabled = in.getInt();
myCollisionMaskEnabled = in.getInt();

View File

@ -69,7 +69,6 @@ class Playfield : public Serializable
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_Playfield"; }
public:

View File

@ -237,8 +237,6 @@ bool TIA::save(Serializer& out) const
{
try
{
out.putString(name());
if(!myDelayQueue.save(out)) return false;
if(!myFrameManager->save(out)) return false;
@ -308,9 +306,6 @@ bool TIA::load(Serializer& in)
{
try
{
if(in.getString() != name())
return false;
if(!myDelayQueue.load(in)) return false;
if(!myFrameManager->load(in)) return false;

View File

@ -482,13 +482,6 @@ class TIA : public Device
*/
bool load(Serializer& in) override;
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "TIA"; }
/**
* Run and forward TIA emulation to the current system clock.
*/

View File

@ -113,9 +113,8 @@ void AbstractFrameManager::layout(FrameLayout layout)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFrameManager::save(Serializer& out) const
{
try {
out.putString(name());
try
{
out.putBool(myIsRendering);
out.putBool(myVsync);
out.putBool(myVblank);
@ -137,9 +136,8 @@ bool AbstractFrameManager::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFrameManager::load(Serializer& in)
{
try {
if (in.getString() != name()) return false;
try
{
myIsRendering = in.getBool();
myVsync = in.getBool();
myVblank = in.getBool();

View File

@ -220,12 +220,6 @@ class AbstractFrameManager : public Serializable
*/
virtual bool onLoad(Serializer& in) { throw runtime_error("cannot be serialized"); }
/**
* This needs to be overriden if state serialization is implemented
* (unnecesary in autodetect managers).
*/
string name() const override { throw runtime_error("state serialization is not implemented!"); }
protected:
// These need to be called in order to drive the frame lifecycle of the
// emulation.

View File

@ -64,8 +64,6 @@ class FrameManager: public AbstractFrameManager {
bool onLoad(Serializer& in) override;
string name() const override { return "TIA_FrameManager"; }
private:
enum State {

View File

@ -86,9 +86,8 @@ void JitterEmulation::updateJitter(Int32 scanlineDifference)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool JitterEmulation::save(Serializer& out) const
{
try {
out.putString(name());
try
{
out.putInt(myLastFrameScanlines);
out.putInt(myStableFrameFinalLines);
out.putInt(myStableFrames);
@ -111,9 +110,8 @@ bool JitterEmulation::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool JitterEmulation::load(Serializer& in)
{
try {
if (in.getString() != name()) return false;
try
{
myLastFrameScanlines = in.getInt();
myStableFrameFinalLines = in.getInt();
myStableFrames = in.getInt();

View File

@ -48,8 +48,6 @@ class JitterEmulation: public Serializable {
*/
bool load(Serializer& in) override;
string name() const override { return "JitterEmulation"; }
private:
void updateJitter(Int32 scanlineDifference);

View File

@ -569,7 +569,9 @@ void GameInfoDialog::saveConfig()
instance().frameBuffer().tiaSurface().enablePhosphor(myPhosphor->getState(), myPPBlend->getValue());
if (reset)
instance().console().tia().frameReset();
} else {
}
else
{
myGameProperties.set(
Display_YStart,
myYStart->getValueLabel() == "Auto" ? "0" : myYStart->getValueLabel()