mirror of https://github.com/stella-emu/stella.git
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from files as well as in-memory streams. As a result, Deserializer class has been removed. Added state rewinding to the debugger. For now, this is limited to 100 levels of undo, with a new state generated each time a step/trace/frame/ scanline advance is performed. The undo level is 'rolling', in that it remembers the last 100 levels (so you lose the oldest states when you start adding more than 100). For now, this is tied to the 'Alt-r' key in the debugger. Still TODO is add a button for it, and clean up some TIA output issues when rewinding. Added support for 6K version of Supercharger ROMs (this fixes issues with the 6K version of Cubis). Cleaned up the Serializable infrastructure, making sure that all classes that need to implement it actually do so now. Fixed issue with editable widgets in the UI, where pressing Enter on the keypad wasn't actually being registered. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
85dcb63483
commit
3c5cc40e08
2
Todo.txt
2
Todo.txt
|
@ -9,7 +9,7 @@
|
|||
SSSS ttt eeeee llll llll aaaaa
|
||||
|
||||
===============================================================================
|
||||
To Do List - June 2009
|
||||
To Do List - August 2009
|
||||
===============================================================================
|
||||
|
||||
If you would like to contribute to Stella's development then find something
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
#include "OSystem.hxx"
|
||||
|
@ -40,9 +37,9 @@ SoundNull::~SoundNull()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundNull::load(Deserializer& in)
|
||||
bool SoundNull::load(Serializer& in)
|
||||
{
|
||||
string soundDevice = "TIASound";
|
||||
const string& soundDevice = "TIASound";
|
||||
if(in.getString() != soundDevice)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#define SOUND_NULL_HXX
|
||||
|
||||
class OSystem;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Sound.hxx"
|
||||
|
@ -138,12 +136,12 @@ class SoundNull : public Sound
|
|||
|
||||
public:
|
||||
/**
|
||||
Loads the current state of this device from the given Deserializer.
|
||||
Loads the current state of this device from the given Serializer.
|
||||
|
||||
@param in The deserializer device to load from.
|
||||
@param in The Serializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Saves the current state of this device to the given Serializer.
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include "TIASnd.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "System.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
@ -198,12 +196,6 @@ void SoundSDL::mute(bool state)
|
|||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
// Ignore multiple calls to do the same thing
|
||||
if(myIsMuted == state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myIsMuted = state;
|
||||
|
||||
SDL_PauseAudio(myIsMuted ? 1 : 0);
|
||||
|
@ -435,58 +427,9 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundSDL::load(Deserializer& in)
|
||||
bool SoundSDL::save(Serializer& out) const
|
||||
{
|
||||
string device = "TIASound";
|
||||
|
||||
try
|
||||
{
|
||||
if(in.getString() != device)
|
||||
return false;
|
||||
|
||||
uInt8 reg1 = 0, reg2 = 0, reg3 = 0, reg4 = 0, reg5 = 0, reg6 = 0;
|
||||
reg1 = (uInt8) in.getByte();
|
||||
reg2 = (uInt8) in.getByte();
|
||||
reg3 = (uInt8) in.getByte();
|
||||
reg4 = (uInt8) in.getByte();
|
||||
reg5 = (uInt8) in.getByte();
|
||||
reg6 = (uInt8) in.getByte();
|
||||
|
||||
myLastRegisterSetCycle = (Int32) in.getInt();
|
||||
|
||||
// Only update the TIA sound registers if sound is enabled
|
||||
// Make sure to empty the queue of previous sound fragments
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
SDL_PauseAudio(1);
|
||||
myRegWriteQueue.clear();
|
||||
myTIASound.set(0x15, reg1);
|
||||
myTIASound.set(0x16, reg2);
|
||||
myTIASound.set(0x17, reg3);
|
||||
myTIASound.set(0x18, reg4);
|
||||
myTIASound.set(0x19, reg5);
|
||||
myTIASound.set(0x1a, reg6);
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
}
|
||||
catch(char *msg)
|
||||
{
|
||||
cerr << msg << endl;
|
||||
return false;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
cerr << "Unknown error in load state for " << device << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundSDL::save(Serializer& out)
|
||||
{
|
||||
string device = "TIASound";
|
||||
const string& device = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -528,6 +471,55 @@ bool SoundSDL::save(Serializer& out)
|
|||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundSDL::load(Serializer& in)
|
||||
{
|
||||
const string& device = name();
|
||||
|
||||
try
|
||||
{
|
||||
if(in.getString() != device)
|
||||
return false;
|
||||
|
||||
uInt8 reg1 = 0, reg2 = 0, reg3 = 0, reg4 = 0, reg5 = 0, reg6 = 0;
|
||||
reg1 = (uInt8) in.getByte();
|
||||
reg2 = (uInt8) in.getByte();
|
||||
reg3 = (uInt8) in.getByte();
|
||||
reg4 = (uInt8) in.getByte();
|
||||
reg5 = (uInt8) in.getByte();
|
||||
reg6 = (uInt8) in.getByte();
|
||||
|
||||
myLastRegisterSetCycle = (Int32) in.getInt();
|
||||
|
||||
// Only update the TIA sound registers if sound is enabled
|
||||
// Make sure to empty the queue of previous sound fragments
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
SDL_PauseAudio(1);
|
||||
myRegWriteQueue.clear();
|
||||
myTIASound.set(0x15, reg1);
|
||||
myTIASound.set(0x16, reg2);
|
||||
myTIASound.set(0x17, reg3);
|
||||
myTIASound.set(0x18, reg4);
|
||||
myTIASound.set(0x19, reg5);
|
||||
myTIASound.set(0x1a, reg6);
|
||||
if(!myIsMuted) SDL_PauseAudio(0);
|
||||
}
|
||||
}
|
||||
catch(char *msg)
|
||||
{
|
||||
cerr << msg << endl;
|
||||
return false;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
cerr << "Unknown error in load state for " << device << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundSDL::RegWriteQueue::RegWriteQueue(uInt32 capacity)
|
||||
: myCapacity(capacity),
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
||||
#ifndef SOUND_SDL_HXX
|
||||
#define SOUND_SDL_HXX
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -138,21 +138,28 @@ class SoundSDL : public Sound
|
|||
void adjustVolume(Int8 direction);
|
||||
|
||||
public:
|
||||
/**
|
||||
Loads the current state of this device from the given Deserializer.
|
||||
|
||||
@param in The deserializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
|
||||
/**
|
||||
Saves the current state of this device to the given Serializer.
|
||||
|
||||
@param out The serializer device to save to.
|
||||
@return The result of the save. True on success, false on failure.
|
||||
*/
|
||||
bool save(Serializer& out);
|
||||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Loads the current state of this device from the given Serializer.
|
||||
|
||||
@param in The Serializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for this console class (used in error checking).
|
||||
|
||||
@return The name of the object
|
||||
*/
|
||||
string name() const { return "TIASound"; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -277,5 +284,6 @@ class SoundSDL : public Sound
|
|||
static void callback(void* udata, uInt8* stream, int len);
|
||||
};
|
||||
|
||||
#endif // SOUND_SUPPORT
|
||||
#endif
|
||||
|
||||
#endif // SOUND_SUPPORT
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#ifndef STACK_HXX
|
||||
#define STACK_HXX
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
|
||||
/**
|
||||
* Extremly simple fixed size stack class.
|
||||
* Simple fixed size stack class.
|
||||
*/
|
||||
template <class T, int MAX_SIZE = 10>
|
||||
class FixedStack
|
||||
|
@ -34,6 +34,7 @@ class FixedStack
|
|||
FixedStack<T, MAX_SIZE>() : _size(0) {}
|
||||
|
||||
bool empty() const { return _size <= 0; }
|
||||
bool full() const {return _size >= MAX_SIZE; }
|
||||
void clear() { _size = 0; }
|
||||
void push(const T& x)
|
||||
{
|
|
@ -108,7 +108,8 @@ Debugger::Debugger(OSystem* osystem)
|
|||
myReadTraps(NULL),
|
||||
myWriteTraps(NULL),
|
||||
myWidth(1050),
|
||||
myHeight(620)
|
||||
myHeight(620),
|
||||
myRewindManager(NULL)
|
||||
{
|
||||
// Get the dialog size
|
||||
int w, h;
|
||||
|
@ -125,6 +126,8 @@ Debugger::Debugger(OSystem* osystem)
|
|||
myReadTraps = new PackedBitArray(0x10000);
|
||||
myWriteTraps = new PackedBitArray(0x10000);
|
||||
|
||||
myRewindManager = new RewindManager(*osystem);
|
||||
|
||||
// Allow access to this object from any class
|
||||
// Technically this violates pure OO programming, but since I know
|
||||
// there will only be ever one instance of debugger in Stella,
|
||||
|
@ -146,6 +149,8 @@ Debugger::~Debugger()
|
|||
delete myBreakPoints;
|
||||
delete myReadTraps;
|
||||
delete myWriteTraps;
|
||||
|
||||
delete myRewindManager;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -215,6 +220,9 @@ void Debugger::setConsole(Console* console)
|
|||
// Make sure cart RAM is added before this is called,
|
||||
// otherwise the debugger state won't know about it
|
||||
saveOldState();
|
||||
|
||||
// Empty the rewind list
|
||||
myRewindManager->clear();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -656,6 +664,12 @@ void Debugger::nextFrame(int frames)
|
|||
lockBankswitchState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::rewindState()
|
||||
{
|
||||
return myRewindManager->rewindState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::clearAllBreakPoints()
|
||||
{
|
||||
|
@ -748,6 +762,9 @@ void Debugger::saveOldState()
|
|||
myRamDebug->saveOldState();
|
||||
myRiotDebug->saveOldState();
|
||||
myTiaDebug->saveOldState();
|
||||
|
||||
// Add another rewind level to the Undo list
|
||||
myRewindManager->addState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -755,6 +772,9 @@ void Debugger::setStartState()
|
|||
{
|
||||
// Lock the bus each time the debugger is entered, so we don't disturb anything
|
||||
lockBankswitchState();
|
||||
|
||||
// Start a new rewind list
|
||||
myRewindManager->clear();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -931,3 +951,75 @@ void Debugger::unlockBankswitchState()
|
|||
mySystem->unlockDataBus();
|
||||
myConsole->cartridge().unlockBank();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Debugger::RewindManager::RewindManager(OSystem& system)
|
||||
: myOSystem(system),
|
||||
mySize(0),
|
||||
myTop(0)
|
||||
{
|
||||
for(int i = 0; i < MAX_SIZE; ++i)
|
||||
myStateList[i] = (Serializer*) NULL;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Debugger::RewindManager::~RewindManager()
|
||||
{
|
||||
for(int i = 0; i < MAX_SIZE; ++i)
|
||||
delete myStateList[i];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::RewindManager::addState()
|
||||
{
|
||||
// Are we still within the allowable size, or are we overwriting an item?
|
||||
mySize++; if(mySize > MAX_SIZE) mySize = MAX_SIZE;
|
||||
|
||||
// Create a new Serializer object if we need one
|
||||
if(myStateList[myTop] == NULL)
|
||||
myStateList[myTop] = new Serializer();
|
||||
Serializer& s = *(myStateList[myTop]);
|
||||
|
||||
if(s.isValid())
|
||||
{
|
||||
s.reset();
|
||||
myOSystem.state().saveState(s);
|
||||
myOSystem.console().tia().saveDisplay(s);
|
||||
myTop = (myTop + 1) % MAX_SIZE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::RewindManager::rewindState()
|
||||
{
|
||||
if(mySize > 0)
|
||||
{
|
||||
mySize--;
|
||||
myTop = myTop == 0 ? MAX_SIZE - 1 : myTop - 1;
|
||||
Serializer& s = *(myStateList[myTop]);
|
||||
|
||||
s.reset();
|
||||
myOSystem.state().loadState(s);
|
||||
myOSystem.console().tia().loadDisplay(s);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::RewindManager::isEmpty()
|
||||
{
|
||||
return mySize == 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::RewindManager::clear()
|
||||
{
|
||||
for(int i = 0; i < MAX_SIZE; ++i)
|
||||
if(myStateList[i] != NULL)
|
||||
myStateList[i]->reset();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class TiaZoomWidget;
|
|||
class EditTextWidget;
|
||||
class RomWidget;
|
||||
class Expression;
|
||||
class Serializer;
|
||||
|
||||
#include <map>
|
||||
|
||||
|
@ -43,6 +44,7 @@ class Expression;
|
|||
#include "PackedBitArray.hxx"
|
||||
#include "PromptWidget.hxx"
|
||||
#include "Rect.hxx"
|
||||
#include "Stack.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
typedef map<string,Expression*> FunctionMap;
|
||||
|
@ -337,6 +339,7 @@ class Debugger : public DialogContainer
|
|||
int trace();
|
||||
void nextScanline(int lines);
|
||||
void nextFrame(int frames);
|
||||
bool rewindState();
|
||||
|
||||
void toggleBreakPoint(int bp);
|
||||
|
||||
|
@ -399,6 +402,29 @@ class Debugger : public DialogContainer
|
|||
// Dimensions of the entire debugger window
|
||||
uInt32 myWidth;
|
||||
uInt32 myHeight;
|
||||
|
||||
// Class holding all rewind state functionality in the debugger
|
||||
// Essentially, it's a modified circular array-based stack
|
||||
// that cleverly deals with allocation/deallocation of memory
|
||||
class RewindManager
|
||||
{
|
||||
public:
|
||||
RewindManager(OSystem& system);
|
||||
virtual ~RewindManager();
|
||||
|
||||
public:
|
||||
bool addState();
|
||||
bool rewindState();
|
||||
bool isEmpty();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
enum { MAX_SIZE = 100 };
|
||||
OSystem& myOSystem;
|
||||
Serializer* myStateList[MAX_SIZE];
|
||||
uInt32 mySize, myTop;
|
||||
};
|
||||
RewindManager* myRewindManager;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1117,6 +1117,16 @@ void DebuggerParser::executeReset()
|
|||
commandResult = "reset CPU";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// "rewind"
|
||||
void DebuggerParser::executeRewind()
|
||||
{
|
||||
if(debugger->rewindState())
|
||||
commandResult = "rewind by one level";
|
||||
else
|
||||
commandResult = "no states left to rewind";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// "riot"
|
||||
void DebuggerParser::executeRiot()
|
||||
|
@ -1671,6 +1681,15 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
|||
&DebuggerParser::executeReset
|
||||
},
|
||||
|
||||
{
|
||||
"rewind",
|
||||
"Rewind state to last step/trace/scanline/frame advance",
|
||||
false,
|
||||
true,
|
||||
{ kARG_END_ARGS },
|
||||
&DebuggerParser::executeRewind
|
||||
},
|
||||
|
||||
{
|
||||
"riot",
|
||||
"Show RIOT timer/input status",
|
||||
|
|
|
@ -81,7 +81,7 @@ class DebuggerParser
|
|||
|
||||
private:
|
||||
enum {
|
||||
kNumCommands = 57,
|
||||
kNumCommands = 58,
|
||||
kMAX_ARG_TYPES = 10 // TODO: put in separate header file Command.hxx
|
||||
};
|
||||
|
||||
|
@ -169,6 +169,7 @@ class DebuggerParser
|
|||
void executePrint();
|
||||
void executeRam(); // also implements 'poke' command
|
||||
void executeReset();
|
||||
void executeRewind();
|
||||
void executeRiot();
|
||||
void executeRom();
|
||||
void executeRun();
|
||||
|
|
|
@ -45,6 +45,7 @@ enum {
|
|||
kDDTraceCmd = 'DDtr',
|
||||
kDDAdvCmd = 'DDav',
|
||||
kDDSAdvCmd = 'DDsv',
|
||||
kDDRewindCmd = 'DDrw',
|
||||
kDDExitCmd = 'DDex'
|
||||
};
|
||||
|
||||
|
@ -102,6 +103,9 @@ void DebuggerDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
case 'l':
|
||||
doScanlineAdvance();
|
||||
break;
|
||||
case 'r':
|
||||
doRewind();
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
break;
|
||||
|
@ -135,6 +139,10 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
doScanlineAdvance();
|
||||
break;
|
||||
|
||||
case kDDRewindCmd:
|
||||
doRewind();
|
||||
break;
|
||||
|
||||
case kDDExitCmd:
|
||||
doExit();
|
||||
break;
|
||||
|
@ -243,6 +251,8 @@ void DebuggerDialog::addRomArea()
|
|||
DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance().consoleFont(),
|
||||
xpos, 20);
|
||||
|
||||
ops->setFlags(WIDGET_BORDER);
|
||||
|
||||
const int bwidth = instance().consoleFont().getStringWidth("Frame +1 "),
|
||||
bheight = instance().consoleFont().getLineHeight() + 2;
|
||||
int buttonX = r.right - bwidth - 5, buttonY = r.top + 5;
|
||||
|
@ -297,6 +307,12 @@ void DebuggerDialog::doScanlineAdvance()
|
|||
instance().debugger().parser().run("scanline #1");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doRewind()
|
||||
{
|
||||
instance().debugger().parser().run("rewind");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExit()
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@ class DebuggerDialog : public Dialog
|
|||
void doTrace();
|
||||
void doScanlineAdvance();
|
||||
void doAdvance();
|
||||
void doRewind();
|
||||
void doExit();
|
||||
};
|
||||
|
||||
|
|
|
@ -147,12 +147,12 @@ class Cartridge : public Device
|
|||
virtual bool save(Serializer& out) const = 0;
|
||||
|
||||
/**
|
||||
Load the current state of this device from the given Deserializer.
|
||||
Load the current state of this device from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in) = 0;
|
||||
virtual bool load(Serializer& in) = 0;
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -193,7 +193,7 @@ uInt8* Cartridge0840::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge0840::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -215,9 +215,9 @@ bool Cartridge0840::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge0840::load(Deserializer& in)
|
||||
bool Cartridge0840::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -103,12 +103,12 @@ class Cartridge0840 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -131,7 +131,7 @@ uInt8* Cartridge2K::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge2K::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -152,9 +152,9 @@ bool Cartridge2K::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge2K::load(Deserializer& in)
|
||||
bool Cartridge2K::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#define CARTRIDGE2K_HXX
|
||||
|
||||
class System;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Cart.hxx"
|
||||
|
@ -109,12 +107,12 @@ class Cartridge2K : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -243,7 +243,7 @@ uInt8* Cartridge3E::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge3E::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -270,9 +270,9 @@ bool Cartridge3E::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge3E::load(Deserializer& in)
|
||||
bool Cartridge3E::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -135,12 +135,12 @@ class Cartridge3E : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -184,7 +184,7 @@ uInt8* Cartridge3F::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge3F::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -206,9 +206,9 @@ bool Cartridge3F::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge3F::load(Deserializer& in)
|
||||
bool Cartridge3F::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -112,12 +112,12 @@ class Cartridge3F : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -320,7 +320,7 @@ uInt8* Cartridge4A50::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge4A50::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -360,9 +360,9 @@ bool Cartridge4A50::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge4A50::load(Deserializer& in)
|
||||
bool Cartridge4A50::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -114,12 +114,12 @@ class Cartridge4A50 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -109,7 +109,7 @@ uInt8* Cartridge4K::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge4K::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -130,9 +130,9 @@ bool Cartridge4K::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Cartridge4K::load(Deserializer& in)
|
||||
bool Cartridge4K::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@ class Cartridge4K : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -425,7 +425,7 @@ uInt8* CartridgeAR::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeAR::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -490,9 +490,9 @@ bool CartridgeAR::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeAR::load(Deserializer& in)
|
||||
bool CartridgeAR::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -121,12 +121,12 @@ class CartridgeAR : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -168,7 +168,7 @@ uInt8* CartridgeCV::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeCV::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -194,9 +194,9 @@ bool CartridgeCV::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeCV::load(Deserializer& in)
|
||||
bool CartridgeCV::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -108,12 +108,12 @@ class CartridgeCV : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -474,7 +474,7 @@ uInt8* CartridgeDPC::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeDPC::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -531,9 +531,9 @@ bool CartridgeDPC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeDPC::load(Deserializer& in)
|
||||
bool CartridgeDPC::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -113,12 +113,12 @@ class CartridgeDPC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -229,7 +229,7 @@ uInt8* CartridgeE0::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeE0::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -254,9 +254,9 @@ bool CartridgeE0::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeE0::load(Deserializer& in)
|
||||
bool CartridgeE0::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -110,12 +110,12 @@ class CartridgeE0 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -240,7 +240,7 @@ uInt8* CartridgeE7::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeE7::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -274,9 +274,9 @@ bool CartridgeE7::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeE7::load(Deserializer& in)
|
||||
bool CartridgeE7::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -127,12 +127,12 @@ class CartridgeE7 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -141,7 +141,7 @@ uInt8* CartridgeEF::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeEF::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -164,9 +164,9 @@ bool CartridgeEF::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeEF::load(Deserializer& in)
|
||||
bool CartridgeEF::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -109,12 +109,12 @@ class CartridgeEF : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -181,7 +181,7 @@ uInt8* CartridgeEFSC::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeEFSC::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -204,9 +204,9 @@ bool CartridgeEFSC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeEFSC::load(Deserializer& in)
|
||||
bool CartridgeEFSC::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -109,12 +109,12 @@ class CartridgeEFSC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -146,7 +146,7 @@ uInt8* CartridgeF4::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF4::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -168,9 +168,9 @@ bool CartridgeF4::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF4::load(Deserializer& in)
|
||||
bool CartridgeF4::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@ class CartridgeF4 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -187,7 +187,7 @@ uInt8* CartridgeF4SC::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF4SC::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -215,9 +215,9 @@ bool CartridgeF4SC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF4SC::load(Deserializer& in)
|
||||
bool CartridgeF4SC::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@ class CartridgeF4SC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "CartF6.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -189,7 +187,7 @@ uInt8* CartridgeF6::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF6::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -212,9 +210,9 @@ bool CartridgeF6::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF6::load(Deserializer& in)
|
||||
bool CartridgeF6::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@ class CartridgeF6 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -227,7 +227,7 @@ uInt8* CartridgeF6SC::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF6SC::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -256,9 +256,9 @@ bool CartridgeF6SC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF6SC::load(Deserializer& in)
|
||||
bool CartridgeF6SC::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@ class CartridgeF6SC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -171,7 +171,7 @@ uInt8* CartridgeF8::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF8::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -194,9 +194,9 @@ bool CartridgeF8::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF8::load(Deserializer& in)
|
||||
bool CartridgeF8::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -106,12 +106,12 @@ class CartridgeF8 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -207,7 +207,7 @@ uInt8* CartridgeF8SC::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF8SC::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -235,9 +235,9 @@ bool CartridgeF8SC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeF8SC::load(Deserializer& in)
|
||||
bool CartridgeF8SC::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -105,12 +105,12 @@ class CartridgeF8SC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -219,7 +219,7 @@ uInt8* CartridgeFASC::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeFASC::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -247,9 +247,9 @@ bool CartridgeFASC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeFASC::load(Deserializer& in)
|
||||
bool CartridgeFASC::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -110,12 +110,12 @@ class CartridgeFASC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -112,7 +112,7 @@ uInt8* CartridgeFE::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeFE::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -133,9 +133,9 @@ bool CartridgeFE::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeFE::load(Deserializer& in)
|
||||
bool CartridgeFE::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -117,12 +117,12 @@ class CartridgeFE : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -153,7 +153,7 @@ uInt8* CartridgeMB::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeMB::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -176,9 +176,9 @@ bool CartridgeMB::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeMB::load(Deserializer& in)
|
||||
bool CartridgeMB::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -111,12 +111,12 @@ class CartridgeMB : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -231,7 +231,7 @@ uInt8* CartridgeMC::getImage(int& size)
|
|||
bool CartridgeMC::save(Serializer& out) const
|
||||
{
|
||||
uInt32 i;
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -262,10 +262,10 @@ bool CartridgeMC::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeMC::load(Deserializer& in)
|
||||
bool CartridgeMC::load(Serializer& in)
|
||||
{
|
||||
uInt32 i;
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -212,12 +212,12 @@ class CartridgeMC : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -172,7 +172,7 @@ uInt8* CartridgeSB::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeSB::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -194,9 +194,9 @@ bool CartridgeSB::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeSB::load(Deserializer& in)
|
||||
bool CartridgeSB::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -103,12 +103,12 @@ class CartridgeSB : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -179,7 +179,7 @@ uInt8* CartridgeUA::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeUA::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -202,9 +202,9 @@ bool CartridgeUA::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeUA::load(Deserializer& in)
|
||||
bool CartridgeUA::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -106,12 +106,12 @@ class CartridgeUA : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -165,7 +165,7 @@ uInt8* CartridgeX07::getImage(int& size)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeX07::save(Serializer& out) const
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -187,9 +187,9 @@ bool CartridgeX07::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CartridgeX07::load(Deserializer& in)
|
||||
bool CartridgeX07::load(Serializer& in)
|
||||
{
|
||||
string cart = name();
|
||||
const string& cart = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -115,12 +115,12 @@ class CartridgeX07 : public Cartridge
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this cart from the given Deserializer.
|
||||
Load the current state of this cart from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -219,7 +219,7 @@ bool Console::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Console::load(Deserializer& in)
|
||||
bool Console::load(Serializer& in)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -142,12 +142,12 @@ class Console : public Serializable
|
|||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Loads the current state of this console class from the given Deserializer.
|
||||
Loads the current state of this console class from the given Serializer.
|
||||
|
||||
@param in The deserializer device to load from.
|
||||
@param in The Serializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for this console class (used in error checking).
|
||||
|
|
|
@ -143,7 +143,7 @@ bool Controller::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Controller::load(Deserializer& in)
|
||||
bool Controller::load(Serializer& in)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -174,12 +174,12 @@ class Controller : public Serializable
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Loads the current state of this controller from the given Deserializer.
|
||||
Loads the current state of this controller from the given Serializer.
|
||||
|
||||
@param in The deserializer device to load from.
|
||||
@param in The serializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Returns the name of this controller.
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "Random.hxx"
|
||||
#include "Switches.hxx"
|
||||
#include "System.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
|
||||
#include "M6532.hxx"
|
||||
|
||||
|
@ -298,7 +296,7 @@ void M6532::setPinState()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool M6532::save(Serializer& out) const
|
||||
{
|
||||
string device = name();
|
||||
const string& device = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -338,9 +336,9 @@ bool M6532::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool M6532::load(Deserializer& in)
|
||||
bool M6532::load(Serializer& in)
|
||||
{
|
||||
string device = name();
|
||||
const string& device = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
class Console;
|
||||
class RiotDebug;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Device.hxx"
|
||||
|
@ -96,12 +94,12 @@ class M6532 : public Device
|
|||
virtual bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this device from the given Deserializer.
|
||||
Load the current state of this device from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in);
|
||||
virtual bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#define SERIALIZABLE_HXX
|
||||
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
|
||||
/**
|
||||
This class provides an interface for (de)serializing objects.
|
||||
|
@ -45,12 +44,12 @@ class Serializable
|
|||
virtual bool save(Serializer& out) const = 0;
|
||||
|
||||
/**
|
||||
Load the current state of the object from the given Deserializer.
|
||||
Load the current state of the object from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in) = 0;
|
||||
virtual bool load(Serializer& in) = 0;
|
||||
|
||||
/**
|
||||
Get a descriptor for the object name (used in error checking).
|
||||
|
|
|
@ -16,39 +16,125 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "Serializer.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Serializer::Serializer(void)
|
||||
Serializer::Serializer(const string& filename)
|
||||
: myStream(NULL),
|
||||
myUseFilestream(true)
|
||||
{
|
||||
// When using fstreams, we need to manually create the file first
|
||||
// if we want to use it in read/write mode, since it won't be created
|
||||
// if it doesn't already exist
|
||||
// However, if it *does* exist, we don't want to overwrite it
|
||||
// So we open in write and append mode - the write creates the file
|
||||
// when necessary, and the append doesn't delete any data if it
|
||||
// already exists
|
||||
fstream temp(filename.c_str(), ios::out | ios::app);
|
||||
temp.close();
|
||||
|
||||
fstream* str = new fstream(filename.c_str(), ios::in | ios::out | ios::binary);
|
||||
if(str && str->is_open())
|
||||
{
|
||||
myStream = str;
|
||||
reset();
|
||||
}
|
||||
else
|
||||
delete str;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Serializer::Serializer(void)
|
||||
: myStream(NULL),
|
||||
myUseFilestream(false)
|
||||
{
|
||||
myStream = new stringstream(ios::in | ios::out | ios::binary);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Serializer::~Serializer(void)
|
||||
{
|
||||
close();
|
||||
if(myStream != NULL)
|
||||
{
|
||||
if(myUseFilestream)
|
||||
((fstream*)myStream)->close();
|
||||
|
||||
delete myStream;
|
||||
myStream = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Serializer::open(const string& fileName)
|
||||
bool Serializer::isValid(void)
|
||||
{
|
||||
close();
|
||||
myStream.open(fileName.c_str(), ios::out | ios::binary);
|
||||
|
||||
return isOpen();
|
||||
return myStream != NULL;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Serializer::close(void)
|
||||
void Serializer::reset(void)
|
||||
{
|
||||
myStream.close();
|
||||
myStream.clear();
|
||||
myStream->seekg(ios_base::beg);
|
||||
myStream->seekp(ios_base::beg);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Serializer::isOpen(void)
|
||||
char Serializer::getByte(void)
|
||||
{
|
||||
return myStream.is_open();
|
||||
if(myStream->eof())
|
||||
throw "Serializer::getByte() end of file";
|
||||
|
||||
char buf;
|
||||
myStream->read(&buf, 1);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int Serializer::getInt(void)
|
||||
{
|
||||
if(myStream->eof())
|
||||
throw "Serializer::getInt() end of file";
|
||||
|
||||
int val = 0;
|
||||
unsigned char buf[4];
|
||||
myStream->read((char*)buf, 4);
|
||||
for(int i = 0; i < 4; ++i)
|
||||
val += (int)(buf[i]) << (i<<3);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Serializer::getString(void)
|
||||
{
|
||||
int len = getInt();
|
||||
string str;
|
||||
str.resize((string::size_type)len);
|
||||
myStream->read(&str[0], (streamsize)len);
|
||||
|
||||
if(myStream->bad())
|
||||
throw "Serializer::getString() file read failed";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Serializer::getBool(void)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
char b = getByte();
|
||||
if(b == (char)TruePattern)
|
||||
result = true;
|
||||
else if(b == (char)FalsePattern)
|
||||
result = false;
|
||||
else
|
||||
throw "Serializer::getBool() data corruption";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -56,9 +142,9 @@ void Serializer::putByte(char value)
|
|||
{
|
||||
char buf[1];
|
||||
buf[0] = value;
|
||||
myStream.write(buf, 1);
|
||||
if(myStream.bad())
|
||||
throw "Serializer: file write failed";
|
||||
myStream->write(buf, 1);
|
||||
if(myStream->bad())
|
||||
throw "Serializer::putByte() file write failed";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -68,9 +154,9 @@ void Serializer::putInt(int value)
|
|||
for(int i = 0; i < 4; ++i)
|
||||
buf[i] = (value >> (i<<3)) & 0xff;
|
||||
|
||||
myStream.write((char*)buf, 4);
|
||||
if(myStream.bad())
|
||||
throw "Serializer: file write failed";
|
||||
myStream->write((char*)buf, 4);
|
||||
if(myStream->bad())
|
||||
throw "Serializer::putInt() file write failed";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -78,10 +164,10 @@ void Serializer::putString(const string& str)
|
|||
{
|
||||
int len = str.length();
|
||||
putInt(len);
|
||||
myStream.write(str.data(), (streamsize)len);
|
||||
myStream->write(str.data(), (streamsize)len);
|
||||
|
||||
if(myStream.bad())
|
||||
throw "Serializer: file write failed";
|
||||
if(myStream->bad())
|
||||
throw "Serializer::putString() file write failed";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -19,18 +19,21 @@
|
|||
#ifndef SERIALIZER_HXX
|
||||
#define SERIALIZER_HXX
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include "bspf.hxx"
|
||||
|
||||
/**
|
||||
This class implements a Serializer device, whereby data is
|
||||
serialized and sent to an output binary file in a system-
|
||||
independent way.
|
||||
This class implements a Serializer device, whereby data is serialized and
|
||||
read from/written to a binary stream in a system-independent way. The
|
||||
stream can be either an actual file, or an in-memory structure.
|
||||
|
||||
Bytes are written as characters, integers are written as 4 characters
|
||||
(32-bit), strings are written as characters prepended by the length of the
|
||||
string, boolean values are written using a special character pattern.
|
||||
|
||||
All bytes and ints should be cast to their appropriate data type upon
|
||||
method return.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id$
|
||||
*/
|
||||
|
@ -38,11 +41,15 @@ class Serializer
|
|||
{
|
||||
public:
|
||||
/**
|
||||
Creates a new Serializer device.
|
||||
Creates a new Serializer device for streaming binary data.
|
||||
|
||||
Open must be called with a valid file before this Serializer can
|
||||
be used.
|
||||
If a filename is provided, the stream will be to the given
|
||||
filename. Otherwise, the stream will be in memory.
|
||||
|
||||
The isValid() method must immediately be called to verify the stream
|
||||
was correctly initialized.
|
||||
*/
|
||||
Serializer(const string& filename);
|
||||
Serializer(void);
|
||||
|
||||
/**
|
||||
|
@ -52,23 +59,43 @@ class Serializer
|
|||
|
||||
public:
|
||||
/**
|
||||
Opens the given file for output. Multiple calls to this method
|
||||
will close previously opened files.
|
||||
|
||||
@param fileName The filename to send the serialized data to.
|
||||
@return Result of opening the file. True on success, false on failure
|
||||
Answers whether the serializer is currently initialized for reading
|
||||
and writing.
|
||||
*/
|
||||
bool open(const string& fileName);
|
||||
bool isValid(void);
|
||||
|
||||
/**
|
||||
Closes the current output stream.
|
||||
Resets the read/write location to the beginning of the stream.
|
||||
*/
|
||||
void close(void);
|
||||
void reset(void);
|
||||
|
||||
/**
|
||||
Answers whether the serializer is currently opened
|
||||
Reads a byte value (8-bit) from the current input stream.
|
||||
|
||||
@result The char value which has been read from the stream.
|
||||
*/
|
||||
bool isOpen(void);
|
||||
char getByte(void);
|
||||
|
||||
/**
|
||||
Reads an int value (32-bit) from the current input stream.
|
||||
|
||||
@result The int value which has been read from the stream.
|
||||
*/
|
||||
int getInt(void);
|
||||
|
||||
/**
|
||||
Reads a string from the current input stream.
|
||||
|
||||
@result The string which has been read from the stream.
|
||||
*/
|
||||
string getString(void);
|
||||
|
||||
/**
|
||||
Reads a boolean value from the current input stream.
|
||||
|
||||
@result The boolean value which has been read from the stream.
|
||||
*/
|
||||
bool getBool(void);
|
||||
|
||||
/**
|
||||
Writes an byte value (8-bit) to the current output stream.
|
||||
|
@ -100,7 +127,8 @@ class Serializer
|
|||
|
||||
private:
|
||||
// The stream to send the serialized data to.
|
||||
fstream myStream;
|
||||
iostream* myStream;
|
||||
bool myUseFilestream;
|
||||
|
||||
enum {
|
||||
TruePattern = 0xfe,
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
#define SOUND_HXX
|
||||
|
||||
class OSystem;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
|
||||
#include "Serializable.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
/**
|
||||
|
@ -32,7 +31,7 @@ class Deserializer;
|
|||
@author Stephen Anthony
|
||||
@version $Id$
|
||||
*/
|
||||
class Sound
|
||||
class Sound : public Serializable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -134,23 +133,6 @@ class Sound
|
|||
*/
|
||||
virtual void adjustVolume(Int8 direction) = 0;
|
||||
|
||||
public:
|
||||
/**
|
||||
Loads the current state of this device from the given Deserializer.
|
||||
|
||||
@param in The deserializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
virtual bool load(Deserializer& in) = 0;
|
||||
|
||||
/**
|
||||
Saves the current state of this device to the given Serializer.
|
||||
|
||||
@param out The serializer device to save to.
|
||||
@return The result of the save. True on success, false on failure.
|
||||
*/
|
||||
virtual bool save(Serializer& out) = 0;
|
||||
|
||||
protected:
|
||||
// The OSystem for this sound object
|
||||
OSystem* myOSystem;
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "Control.hxx"
|
||||
#include "Switches.hxx"
|
||||
#include "System.hxx"
|
||||
#include "Serializable.hxx"
|
||||
|
||||
#include "StateManager.hxx"
|
||||
|
||||
|
@ -56,6 +55,7 @@ bool StateManager::isActive()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool StateManager::toggleRecordMode()
|
||||
{
|
||||
#if 0
|
||||
if(myActiveMode != kMovieRecordMode) // Turn on movie record mode
|
||||
{
|
||||
myActiveMode = kOffMode;
|
||||
|
@ -92,13 +92,15 @@ bool StateManager::toggleRecordMode()
|
|||
}
|
||||
|
||||
return myActiveMode == kMovieRecordMode;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool StateManager::toggleRewindMode()
|
||||
{
|
||||
// FIXME - For now, I'm going to use this to activate movie playback
|
||||
|
||||
#if 0
|
||||
// Close the writer, since we're about to re-open in read mode
|
||||
myMovieWriter.close();
|
||||
|
||||
|
@ -139,11 +141,14 @@ bool StateManager::toggleRewindMode()
|
|||
}
|
||||
|
||||
return myActiveMode == kMoviePlaybackMode;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StateManager::update()
|
||||
{
|
||||
#if 0
|
||||
switch(myActiveMode)
|
||||
{
|
||||
case kMovieRecordMode:
|
||||
|
@ -161,6 +166,7 @@ void StateManager::update()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -178,8 +184,8 @@ void StateManager::loadState(int slot)
|
|||
<< name << ".st" << slot;
|
||||
|
||||
// Make sure the file can be opened for reading
|
||||
Deserializer in;
|
||||
if(!in.open(buf.str()))
|
||||
Serializer in(buf.str());
|
||||
if(!in.isValid())
|
||||
{
|
||||
buf.str("");
|
||||
buf << "Error loading state " << slot;
|
||||
|
@ -198,7 +204,6 @@ void StateManager::loadState(int slot)
|
|||
else
|
||||
buf << "Invalid data in state " << slot << " file";
|
||||
|
||||
in.close();
|
||||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
}
|
||||
|
@ -218,8 +223,8 @@ void StateManager::saveState(int slot)
|
|||
<< name << ".st" << slot;
|
||||
|
||||
// Make sure the file can be opened for writing
|
||||
Serializer out;
|
||||
if(!out.open(buf.str()))
|
||||
Serializer out(buf.str());
|
||||
if(!out.isValid())
|
||||
{
|
||||
myOSystem->frameBuffer().showMessage("Error saving state file");
|
||||
return;
|
||||
|
@ -246,7 +251,6 @@ void StateManager::saveState(int slot)
|
|||
else
|
||||
buf << "Error saving state " << slot;
|
||||
|
||||
out.close();
|
||||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
}
|
||||
|
@ -262,9 +266,52 @@ void StateManager::changeState()
|
|||
myOSystem->frameBuffer().showMessage(buf.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool StateManager::loadState(Serializer& in)
|
||||
{
|
||||
if(&myOSystem->console())
|
||||
{
|
||||
// Make sure the file can be opened for reading
|
||||
if(in.isValid())
|
||||
{
|
||||
// First test if we have a valid header
|
||||
// If so, do a complete state load using the Console
|
||||
const string& md5 = myOSystem->console().properties().get(Cartridge_MD5);
|
||||
if(in.getString() == STATE_HEADER && in.getString() == md5 &&
|
||||
myOSystem->console().load(in))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool StateManager::saveState(Serializer& out)
|
||||
{
|
||||
if(&myOSystem->console())
|
||||
{
|
||||
// Make sure the file can be opened for writing
|
||||
if(out.isValid())
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Prepend the ROM md5 so this state file only works with that ROM
|
||||
out.putString(myOSystem->console().properties().get(Cartridge_MD5));
|
||||
|
||||
// Do a complete state save using the Console
|
||||
if(myOSystem->console().save(out))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StateManager::reset()
|
||||
{
|
||||
#if 0
|
||||
myCurrentSlot = 0;
|
||||
|
||||
switch(myActiveMode)
|
||||
|
@ -281,6 +328,7 @@ void StateManager::reset()
|
|||
break;
|
||||
}
|
||||
myActiveMode = kOffMode;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
class OSystem;
|
||||
|
||||
#include "Deserializer.hxx"
|
||||
#include "Serializer.hxx"
|
||||
|
||||
/**
|
||||
|
@ -78,6 +77,26 @@ class StateManager
|
|||
*/
|
||||
void changeState();
|
||||
|
||||
/**
|
||||
Load a state into the current system from the given Serializer.
|
||||
No messages are printed to the screen.
|
||||
|
||||
@param in The Serializer object to use
|
||||
|
||||
@return False on any load errors, else true
|
||||
*/
|
||||
bool loadState(Serializer& in);
|
||||
|
||||
/**
|
||||
Save the current state from the system into the given Serializer.
|
||||
No messages are printed to the screen.
|
||||
|
||||
@param out The Serializer object to use
|
||||
|
||||
@return False on any save errors, else true
|
||||
*/
|
||||
bool saveState(Serializer& out);
|
||||
|
||||
/**
|
||||
Resets manager to defaults
|
||||
*/
|
||||
|
@ -120,7 +139,7 @@ class StateManager
|
|||
|
||||
// Serializer classes used to save/load the eventstream
|
||||
Serializer myMovieWriter;
|
||||
Deserializer myMovieReader;
|
||||
Serializer myMovieReader;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -123,7 +123,7 @@ bool Switches::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Switches::load(Deserializer& in)
|
||||
bool Switches::load(Serializer& in)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -74,12 +74,12 @@ class Switches : public Serializable
|
|||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of the switches from the given Deserializer.
|
||||
Load the current state of the switches from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -24,9 +24,8 @@
|
|||
|
||||
#include "Console.hxx"
|
||||
#include "Control.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Device.hxx"
|
||||
#include "M6502.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Sound.hxx"
|
||||
#include "System.hxx"
|
||||
|
@ -288,7 +287,7 @@ void TIA::install(System& system, Device& device)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIA::save(Serializer& out) const
|
||||
{
|
||||
string device = name();
|
||||
const string& device = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -338,12 +337,6 @@ bool TIA::save(Serializer& out) const
|
|||
out.putBool(myRESMP0);
|
||||
out.putBool(myRESMP1);
|
||||
out.putInt(myCollision);
|
||||
out.putInt(myPOSP0);
|
||||
out.putInt(myPOSP1);
|
||||
out.putInt(myPOSM0);
|
||||
out.putInt(myPOSM1);
|
||||
out.putInt(myPOSBL);
|
||||
|
||||
out.putByte((char)myCurrentGRP0);
|
||||
out.putByte((char)myCurrentGRP1);
|
||||
|
||||
|
@ -358,9 +351,11 @@ bool TIA::save(Serializer& out) const
|
|||
out.putBool(myDumpEnabled);
|
||||
out.putInt(myDumpDisabledCycle);
|
||||
|
||||
out.putInt(myFrameCounter);
|
||||
out.putBool(myPartialFrameFlag);
|
||||
out.putBool(myFrameGreyed);
|
||||
out.putInt(myPOSP0);
|
||||
out.putInt(myPOSP1);
|
||||
out.putInt(myPOSM0);
|
||||
out.putInt(myPOSM1);
|
||||
out.putInt(myPOSBL);
|
||||
|
||||
out.putInt(myMotionClockP0);
|
||||
out.putInt(myMotionClockP1);
|
||||
|
@ -378,6 +373,8 @@ bool TIA::save(Serializer& out) const
|
|||
out.putInt(myPreviousHMOVEPos);
|
||||
out.putBool(myHMOVEBlankEnabled);
|
||||
|
||||
out.putInt(myFrameCounter);
|
||||
|
||||
// Save the sound sample stuff ...
|
||||
mySound.save(out);
|
||||
}
|
||||
|
@ -396,9 +393,9 @@ bool TIA::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIA::load(Deserializer& in)
|
||||
bool TIA::load(Serializer& in)
|
||||
{
|
||||
string device = name();
|
||||
const string& device = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -449,12 +446,6 @@ bool TIA::load(Deserializer& in)
|
|||
myRESMP0 = in.getBool();
|
||||
myRESMP1 = in.getBool();
|
||||
myCollision = (uInt16) in.getInt();
|
||||
myPOSP0 = (Int16) in.getInt();
|
||||
myPOSP1 = (Int16) in.getInt();
|
||||
myPOSM0 = (Int16) in.getInt();
|
||||
myPOSM1 = (Int16) in.getInt();
|
||||
myPOSBL = (Int16) in.getInt();
|
||||
|
||||
myCurrentGRP0 = (uInt8) in.getByte();
|
||||
myCurrentGRP1 = (uInt8) in.getByte();
|
||||
|
||||
|
@ -469,9 +460,11 @@ bool TIA::load(Deserializer& in)
|
|||
myDumpEnabled = in.getBool();
|
||||
myDumpDisabledCycle = (Int32) in.getInt();
|
||||
|
||||
myFrameCounter = (Int32) in.getInt();
|
||||
myPartialFrameFlag = in.getBool();
|
||||
myFrameGreyed = in.getBool();
|
||||
myPOSP0 = (Int16) in.getInt();
|
||||
myPOSP1 = (Int16) in.getInt();
|
||||
myPOSM0 = (Int16) in.getInt();
|
||||
myPOSM1 = (Int16) in.getInt();
|
||||
myPOSBL = (Int16) in.getInt();
|
||||
|
||||
myMotionClockP0 = (Int32) in.getInt();
|
||||
myMotionClockP1 = (Int32) in.getInt();
|
||||
|
@ -489,6 +482,8 @@ bool TIA::load(Deserializer& in)
|
|||
myPreviousHMOVEPos = (Int32) in.getInt();
|
||||
myHMOVEBlankEnabled = in.getBool();
|
||||
|
||||
myFrameCounter = (Int32) in.getInt();
|
||||
|
||||
// Load the sound sample stuff ...
|
||||
mySound.load(in);
|
||||
|
||||
|
@ -509,6 +504,67 @@ bool TIA::load(Deserializer& in)
|
|||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIA::saveDisplay(Serializer& out) const
|
||||
{
|
||||
try
|
||||
{
|
||||
out.putBool(myPartialFrameFlag);
|
||||
out.putInt(myFramePointerClocks);
|
||||
|
||||
for(int i = 0; i < 160*320; ++i)
|
||||
out.putByte(myCurrentFrameBuffer[i]);
|
||||
}
|
||||
catch(char *msg)
|
||||
{
|
||||
cerr << msg << endl;
|
||||
return false;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
cerr << "Unknown error in save state for TIA display" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool TIA::loadDisplay(Serializer& in)
|
||||
{
|
||||
try
|
||||
{
|
||||
myPartialFrameFlag = in.getBool();
|
||||
myFramePointerClocks = (uInt32) in.getInt();
|
||||
|
||||
// Reset frame buffer pointer and data
|
||||
clearBuffers();
|
||||
myFramePointer = myCurrentFrameBuffer;
|
||||
for(int i = 0; i < 160*320; ++i)
|
||||
myCurrentFrameBuffer[i] = (uInt8) in.getByte();
|
||||
|
||||
// If we're in partial frame mode, make sure to re-create the screen
|
||||
// as it existed when the state was saved
|
||||
if(myPartialFrameFlag)
|
||||
{
|
||||
myFramePointer += myFramePointerClocks;
|
||||
myFrameGreyed = true;
|
||||
}
|
||||
}
|
||||
catch(char *msg)
|
||||
{
|
||||
cerr << msg << endl;
|
||||
return false;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
cerr << "Unknown error in load state for TIA display" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::update()
|
||||
{
|
||||
|
@ -563,6 +619,7 @@ inline void TIA::startFrame()
|
|||
|
||||
// Reset frame buffer pointer
|
||||
myFramePointer = myCurrentFrameBuffer;
|
||||
myFramePointerClocks = 0;
|
||||
|
||||
// If color loss is enabled then update the color registers based on
|
||||
// the number of scanlines in the last frame that was generated
|
||||
|
@ -700,6 +757,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
{
|
||||
// Calculate the ending frame pointer value
|
||||
uInt8* ending = myFramePointer + clocksToUpdate;
|
||||
myFramePointerClocks += clocksToUpdate;
|
||||
|
||||
// See if we're in the vertical blank region
|
||||
if(myVBLANK & 0x02)
|
||||
|
@ -1441,8 +1499,13 @@ inline void TIA::waitHorizontalSync()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::greyOutFrame()
|
||||
{
|
||||
cerr << "greyOutFrame(): scanlines = " << scanlines() << endl;
|
||||
uInt32 c = scanlines();
|
||||
if(c < myFrameYStart) c = myFrameYStart;
|
||||
if(c > (myFrameHeight + myFrameYStart))
|
||||
return;
|
||||
|
||||
cerr << "greying frame from scanline " << c << endl;
|
||||
|
||||
uInt8* buffer = myCurrentFrameBuffer + myFramePointerOffset;
|
||||
for(uInt32 s = c; s < (myFrameHeight + myFrameYStart); ++s)
|
||||
|
|
|
@ -106,12 +106,34 @@ class TIA : public Device
|
|||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this device from the given Deserializer.
|
||||
Load the current state of this device from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
The following are very similar to save() and load(), except they
|
||||
do a 'deeper' save of the display data itself.
|
||||
|
||||
Normally, the internal framebuffer doesn't need to be saved to
|
||||
a state file, since the file already contains all the information
|
||||
needed to re-create it, starting from scanline 0. In effect, when a
|
||||
state is loaded, the framebuffer is empty, and the next call to
|
||||
update() generates valid framebuffer data.
|
||||
|
||||
However, state files saved from the debugger need more information,
|
||||
such as the exact state of the internal framebuffer itself *before*
|
||||
we call update(), including if the display was in partial frame mode.
|
||||
|
||||
Essentially, a normal state save has 'frame resolution', whereas
|
||||
the debugger state save has 'cycle resolution', and hence needs
|
||||
more information. The methods below save/load this extra info,
|
||||
and eliminate having to save approx. 50K to normal state files.
|
||||
*/
|
||||
bool saveDisplay(Serializer& out) const;
|
||||
bool loadDisplay(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
@ -302,6 +324,11 @@ class TIA : public Device
|
|||
// (the exported frame buffer is a vertical 'sliding window' of the actual buffer)
|
||||
uInt32 myFramePointerOffset;
|
||||
|
||||
// Indicates the number of 'colour clocks' offset from the base
|
||||
// frame buffer pointer
|
||||
// (this is used when loading state files with a 'partial' frame)
|
||||
uInt32 myFramePointerClocks;
|
||||
|
||||
// Indicates the width of the visible scanline
|
||||
uInt32 myFrameWidth;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void TIASound::set(uInt16 address, uInt8 value)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIASound::get(uInt16 address)
|
||||
uInt8 TIASound::get(uInt16 address) const
|
||||
{
|
||||
switch(address)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ class TIASound
|
|||
|
||||
@param address Register address
|
||||
*/
|
||||
uInt8 get(uInt16 address);
|
||||
uInt8 get(uInt16 address) const;
|
||||
|
||||
/**
|
||||
Create sound samples based on the current sound register settings
|
||||
|
|
|
@ -74,12 +74,12 @@ class Device : public Serializable
|
|||
virtual bool save(Serializer& out) const = 0;
|
||||
|
||||
/**
|
||||
Load the current state of this device from the given Deserializer.
|
||||
Load the current state of this device from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
virtual bool load(Deserializer& in) = 0;
|
||||
virtual bool load(Serializer& in) = 0;
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
//#define DEBUG_OUTPUT
|
||||
#define debugStream cout
|
||||
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
#include "Debugger.hxx"
|
||||
#include "Expression.hxx"
|
||||
|
@ -334,9 +331,9 @@ void M6502::interruptHandler()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool M6502::save(Serializer& out)
|
||||
bool M6502::save(Serializer& out) const
|
||||
{
|
||||
string CPU = name();
|
||||
const string& CPU = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -380,9 +377,9 @@ bool M6502::save(Serializer& out)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool M6502::load(Deserializer& in)
|
||||
bool M6502::load(Serializer& in)
|
||||
{
|
||||
string CPU = name();
|
||||
const string& CPU = name();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
class D6502;
|
||||
class M6502;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
class Debugger;
|
||||
class CpuDebug;
|
||||
class Expression;
|
||||
|
@ -32,6 +30,7 @@ class PackedBitArray;
|
|||
#include "System.hxx"
|
||||
#include "Array.hxx"
|
||||
#include "StringList.hxx"
|
||||
#include "Serializable.hxx"
|
||||
|
||||
typedef Common::Array<Expression*> ExpressionList;
|
||||
|
||||
|
@ -48,7 +47,7 @@ typedef Common::Array<Expression*> ExpressionList;
|
|||
@author Bradford W. Mott
|
||||
@version $Id$
|
||||
*/
|
||||
class M6502
|
||||
class M6502 : public Serializable
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -183,22 +182,22 @@ class M6502
|
|||
@param out The serializer device to save to.
|
||||
@return The result of the save. True on success, false on failure.
|
||||
*/
|
||||
bool save(Serializer& out);
|
||||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Loads the current state of this device from the given Deserializer.
|
||||
Loads the current state of this device from the given Serializer.
|
||||
|
||||
@param in The deserializer device to load from.
|
||||
@param in The Serializer device to load from.
|
||||
@return The result of the load. True on success, false on failure.
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a null terminated string which is the processor's name (i.e. "M6532")
|
||||
|
||||
@return The name of the device
|
||||
*/
|
||||
const char* name() const { return "M6502High"; }
|
||||
string name() const { return "M6502"; }
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
// $Id$
|
||||
//============================================================================
|
||||
|
||||
#include "NullDev.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "NullDev.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
NullDevice::NullDevice()
|
||||
|
@ -61,7 +60,7 @@ bool NullDevice::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool NullDevice::load(Deserializer& in)
|
||||
bool NullDevice::load(Serializer& in)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#define NULLDEVICE_HXX
|
||||
|
||||
class System;
|
||||
class Serializer;
|
||||
class Deserializer;
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Device.hxx"
|
||||
|
@ -70,12 +68,12 @@ class NullDevice : public Device
|
|||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this device from the given Deserializer.
|
||||
Load the current state of this device from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -274,7 +274,7 @@ bool System::save(Serializer& out) const
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool System::load(Deserializer& in)
|
||||
bool System::load(Serializer& in)
|
||||
{
|
||||
const string& device = name();
|
||||
try
|
||||
|
|
|
@ -307,12 +307,12 @@ class System : public Serializable
|
|||
bool save(Serializer& out) const;
|
||||
|
||||
/**
|
||||
Load the current state of this system from the given Deserializer.
|
||||
Load the current state of this system from the given Serializer.
|
||||
|
||||
@param in The Deserializer object to use
|
||||
@param in The Serializer object to use
|
||||
@return False on any errors, else true
|
||||
*/
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
|
||||
/**
|
||||
Get a descriptor for the device name (used in error checking).
|
||||
|
|
|
@ -32,7 +32,6 @@ MODULE_OBJS := \
|
|||
src/emucore/CartX07.o \
|
||||
src/emucore/Console.o \
|
||||
src/emucore/Control.o \
|
||||
src/emucore/Deserializer.o \
|
||||
src/emucore/Driving.o \
|
||||
src/emucore/Event.o \
|
||||
src/emucore/EventHandler.o \
|
||||
|
|
|
@ -98,7 +98,7 @@ bool EditableWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
bool handled = true;
|
||||
bool dirty = false;
|
||||
|
||||
switch (keycode)
|
||||
switch (ascii)
|
||||
{
|
||||
case '\n': // enter/return
|
||||
case '\r':
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
#include "TIASnd.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "System.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
@ -318,7 +316,7 @@ void SoundWinCE::update(void)
|
|||
}
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::load(Deserializer& in)
|
||||
bool SoundWinCE::load(Serializer& in)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class SoundWinCE : public Sound
|
|||
void set(uInt16 addr, uInt8 value, Int32 cycle);
|
||||
void setVolume(Int32 percent);
|
||||
void adjustVolume(Int8 direction);
|
||||
bool load(Deserializer& in);
|
||||
bool load(Serializer& in);
|
||||
bool save(Serializer& out);
|
||||
void update(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue