Re-abled state loading/saving.

There's still a few final items to fix, but it's 99% complete.
This commit is contained in:
Stephen Anthony 2017-03-25 17:58:58 -02:30
parent 0976fb1d93
commit fd4122e017
19 changed files with 411 additions and 88 deletions

View File

@ -133,6 +133,15 @@ void Serializer::getIntArray(uInt32* array, uInt32 size) const
myStream->read(reinterpret_cast<char*>(array), sizeof(uInt32)*size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
double Serializer::getDouble() const
{
double val = 0.0;
myStream->read(reinterpret_cast<char*>(&val), sizeof(double));
return val;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Serializer::getString() const
{
@ -186,6 +195,12 @@ void Serializer::putIntArray(const uInt32* array, uInt32 size)
myStream->write(reinterpret_cast<const char*>(array), sizeof(uInt32)*size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Serializer::putDouble(double value)
{
myStream->write(reinterpret_cast<char*>(&value), sizeof(double));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Serializer::putString(const string& str)
{

View File

@ -110,6 +110,13 @@ class Serializer
*/
void getIntArray(uInt32* array, uInt32 size) const;
/**
Reads a double value (signed 64-bit) from the current input stream.
@result The double value which has been read from the stream.
*/
double getDouble() const;
/**
Reads a string from the current input stream.
@ -169,6 +176,13 @@ class Serializer
*/
void putIntArray(const uInt32* array, uInt32 size);
/**
Writes a double value (signed 64-bit) to the current output stream.
@param value The double value to write to the output stream.
*/
void putDouble(double value);
/**
Writes a string to the current output stream.

View File

@ -28,7 +28,7 @@
#include "StateManager.hxx"
#define STATE_HEADER "04090200state"
#define STATE_HEADER "04090300state"
#define MOVIE_HEADER "03030000movie"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -530,7 +530,7 @@ int Thumbulator::execute()
pc = read_register(15);
#if 0 // FIXME SA - not sure if this should be enabled
#if 0
if(handler_mode)
{
if((pc & 0xF0000000) == 0xF0000000)

View File

@ -90,8 +90,6 @@ bool Background::load(Serializer& in)
myObjectColor = in.getByte();
myDebugColor = in.getByte();
myDebugEnabled = in.getBool();
applyColors();
}
catch(...)
{

View File

@ -278,9 +278,6 @@ bool Ball::load(Serializer& in)
myIsRendering = in.getBool();
myRenderCounter = in.getByte();
updateEnabled();
applyColors();
}
catch(...)
{

View File

@ -56,3 +56,39 @@ void DelayQueue::reset()
memset(myIndices, 0xFF, 0xFF);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DelayQueue::save(Serializer& out) const
{
try
{
// FIXME out.putVector(myMembers);
out.putByte(myIndex);
out.putByteArray(myIndices, 0xFF);
}
catch(...)
{
cerr << "ERROR: TIA_DelayQueue::save" << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DelayQueue::load(Serializer& in)
{
try
{
// FIXME in.getVector(myMembers);
myIndex = in.getByte();
in.getByteArray(myIndices, 0xFF);
}
catch(...)
{
cerr << "ERROR: TIA_DelayQueue::load" << endl;
return false;
}
return true;
}

View File

@ -18,10 +18,11 @@
#ifndef TIA_DELAY_QUEUE
#define TIA_DELAY_QUEUE
#include "Serializable.hxx"
#include "bspf.hxx"
#include "DelayQueueMember.hxx"
class DelayQueue
class DelayQueue : public Serializable
{
public:
DelayQueue(uInt8 length, uInt8 size);
@ -34,12 +35,16 @@ class DelayQueue
template<class T> void execute(T executor);
/**
Serializable methods (see that class for more information).
*/
bool save(Serializer& out) const override;
bool load(Serializer& in) override;
string name() const override { return "TIA_DelayQueue"; }
private:
vector<DelayQueueMember> myMembers;
uInt8 myIndex;
uInt8 myIndices[0xFF];
private:

View File

@ -15,8 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
// namespace TIA6502tsCore
#include "DrawCounterDecodes.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -316,7 +316,6 @@ void FrameManager::setFixedHeight(uInt32 height)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool FrameManager::save(Serializer& out) const
{
try
@ -325,7 +324,29 @@ bool FrameManager::save(Serializer& out) const
if (!myVblankManager.save(out)) return false;
// TODO - save instance variables
out.putInt(uInt32(myLayout));
out.putBool(myAutodetectLayout);
out.putInt(uInt32(myState));
out.putInt(myLineInState);
out.putInt(myCurrentFrameTotalLines);
out.putInt(myCurrentFrameFinalLines);
out.putInt(myVsyncLines);
out.putDouble(myFrameRate);
out.putInt(myY); out.putInt(myLastY);
out.putBool(myFramePending);
out.putInt(myTotalFrames);
out.putInt(myFramesInMode);
out.putBool(myModeConfirmed);
out.putBool(myVsync);
out.putInt(myVblankLines);
out.putInt(myKernelLines);
out.putInt(myOverscanLines);
out.putInt(myFrameLines);
out.putInt(myHeight);
out.putInt(myFixedHeight);
}
catch(...)
{
@ -333,11 +354,10 @@ bool FrameManager::save(Serializer& out) const
return false;
}
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool FrameManager::load(Serializer& in)
{
try
@ -347,7 +367,29 @@ bool FrameManager::load(Serializer& in)
if (!myVblankManager.load(in)) return false;
// TODO - load instance variables
myLayout = FrameLayout(in.getInt());
myAutodetectLayout = in.getBool();
myState = State(in.getInt());
myLineInState = in.getInt();
myCurrentFrameTotalLines = in.getInt();
myCurrentFrameFinalLines = in.getInt();
myVsyncLines = in.getInt();
myFrameRate = float(in.getDouble());
myY = in.getInt(); myLastY = in.getInt();
myFramePending = in.getBool();
myTotalFrames = in.getInt();
myFramesInMode = in.getInt();
myModeConfirmed = in.getBool();
myVsync = in.getBool();
myVblankLines = in.getInt();
myKernelLines = in.getInt();
myOverscanLines = in.getInt();
myFrameLines = in.getInt();
myHeight = in.getInt();
myFixedHeight = in.getInt();
}
catch(...)
{
@ -355,5 +397,5 @@ bool FrameManager::load(Serializer& in)
return false;
}
return false;
return true;
}

View File

@ -43,9 +43,7 @@ class LatchedInput : public Serializable
string name() const override { return "TIA_LatchedInput"; }
private:
bool myModeLatched;
uInt8 myLatchedValue;
private:

View File

@ -26,7 +26,8 @@ enum Count: Int8 {
Missile::Missile(uInt32 collisionMask)
: myCollisionMaskDisabled(collisionMask),
myCollisionMaskEnabled(0xFFFF),
myIsSuppressed(false)
myIsSuppressed(false),
myDecodesOffset(0)
{
reset();
}
@ -34,7 +35,7 @@ Missile::Missile(uInt32 collisionMask)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Missile::reset()
{
myDecodes = DrawCounterDecodes::get().missileDecodes()[0];
myDecodes = DrawCounterDecodes::get().missileDecodes()[myDecodesOffset];
myIsEnabled = false;
myEnam = false;
myResmp = 0;
@ -137,8 +138,9 @@ void Missile::nusiz(uInt8 value)
{
static constexpr uInt8 ourWidths[] = { 1, 2, 4, 8 };
myDecodesOffset = value & 0x07;
myWidth = ourWidths[(value & 0x30) >> 4];
myDecodes = DrawCounterDecodes::get().missileDecodes()[value & 0x07];
myDecodes = DrawCounterDecodes::get().missileDecodes()[myDecodesOffset];
if (myIsRendering && myRenderCounter >= myWidth)
myIsRendering = false;
@ -243,14 +245,36 @@ void Missile::applyColors()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool Missile::save(Serializer& out) const
{
try
{
out.putString(name());
// TODO - save instance variables
out.putInt(collision);
out.putInt(myCollisionMaskDisabled);
out.putInt(myCollisionMaskEnabled);
out.putBool(myIsEnabled);
out.putBool(myIsSuppressed);
out.putBool(myEnam);
out.putByte(myResmp);
out.putByte(myHmmClocks);
out.putByte(myCounter);
out.putBool(myIsMoving);
out.putByte(myWidth);
out.putByte(myEffectiveWidth);
out.putByte(myLastMovementTick);
out.putBool(myIsRendering);
out.putByte(myRenderCounter);
out.putByte(myDecodesOffset);
out.putByte(myColor);
out.putByte(myObjectColor); out.putByte(myDebugColor);
out.putBool(myDebugEnabled);
}
catch(...)
{
@ -258,11 +282,10 @@ bool Missile::save(Serializer& out) const
return false;
}
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool Missile::load(Serializer& in)
{
try
@ -270,7 +293,31 @@ bool Missile::load(Serializer& in)
if(in.getString() != name())
return false;
// TODO - load instance variables
collision = in.getInt();
myCollisionMaskDisabled = in.getInt();
myCollisionMaskEnabled = in.getInt();
myIsEnabled = in.getBool();
myIsSuppressed = in.getBool();
myEnam = in.getBool();
myResmp = in.getByte();
myHmmClocks = in.getByte();
myCounter = in.getByte();
myIsMoving = in.getBool();
myWidth = in.getByte();
myEffectiveWidth = in.getByte();
myLastMovementTick = in.getByte();
myIsRendering = in.getBool();
myRenderCounter = in.getByte();
myDecodesOffset = in.getByte();
myDecodes = DrawCounterDecodes::get().missileDecodes()[myDecodesOffset];
myColor = in.getByte();
myObjectColor = in.getByte(); myDebugColor = in.getByte();
myDebugEnabled = in.getBool();
}
catch(...)
{
@ -278,5 +325,5 @@ bool Missile::load(Serializer& in)
return false;
}
return false;
return true;
}

View File

@ -102,6 +102,7 @@ class Missile : public Serializable
Int8 myRenderCounter;
const uInt8* myDecodes;
uInt8 myDecodesOffset; // needed for state saving
uInt8 myColor;
uInt8 myObjectColor, myDebugColor;

View File

@ -105,14 +105,22 @@ void PaddleReader::updateCharge(double timestamp)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool PaddleReader::save(Serializer& out) const
{
try
{
out.putString(name());
// TODO - save instance variables
out.putDouble(myUThresh);
out.putDouble(myU);
out.putDouble(myValue);
out.putDouble(myTimestamp);
out.putInt(int(myLayout));
out.putDouble(myClockFreq);
out.putBool(myIsDumped);
}
catch(...)
{
@ -120,11 +128,10 @@ bool PaddleReader::save(Serializer& out) const
return false;
}
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool PaddleReader::load(Serializer& in)
{
try
@ -132,7 +139,16 @@ bool PaddleReader::load(Serializer& in)
if(in.getString() != name())
return false;
// TODO - load instance variables
myUThresh = in.getDouble();
myU = in.getDouble();
myValue = in.getDouble();
myTimestamp = in.getDouble();
myLayout = FrameLayout(in.getInt());
myClockFreq = in.getDouble();
myIsDumped = in.getBool();
}
catch(...)
{
@ -140,5 +156,5 @@ bool PaddleReader::load(Serializer& in)
return false;
}
return false;
return true;
}

View File

@ -26,7 +26,8 @@ enum Count: Int8 {
Player::Player(uInt32 collisionMask)
: myCollisionMaskDisabled(collisionMask),
myCollisionMaskEnabled(0xFFFF),
myIsSuppressed(false)
myIsSuppressed(false),
myDecodesOffset(0)
{
reset();
}
@ -34,7 +35,7 @@ Player::Player(uInt32 collisionMask)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Player::reset()
{
myDecodes = DrawCounterDecodes::get().playerDecodes()[0];
myDecodes = DrawCounterDecodes::get().playerDecodes()[myDecodesOffset];
myHmmClocks = 0;
myCounter = 0;
myIsMoving = false;
@ -74,9 +75,9 @@ void Player::hmp(uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Player::nusiz(uInt8 value, bool hblank)
{
const uInt8 masked = value & 0x07;
myDecodesOffset = value & 0x07;
switch (masked) {
switch (myDecodesOffset) {
case 5:
myDividerPending = 2;
break;
@ -92,7 +93,7 @@ void Player::nusiz(uInt8 value, bool hblank)
const uInt8* oldDecodes = myDecodes;
myDecodes = DrawCounterDecodes::get().playerDecodes()[masked];
myDecodes = DrawCounterDecodes::get().playerDecodes()[myDecodesOffset];
if (
myDecodes != oldDecodes &&
@ -363,14 +364,42 @@ void Player::applyColors()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool Player::save(Serializer& out) const
{
try
{
out.putString(name());
// TODO - save instance variables
out.putInt(collision);
out.putInt(myCollisionMaskDisabled);
out.putInt(myCollisionMaskEnabled);
out.putByte(myColor);
out.putByte(myObjectColor); out.putByte(myDebugColor);
out.putBool(myDebugEnabled);
out.putBool(myIsSuppressed);
out.putByte(myHmmClocks);
out.putByte(myCounter);
out.putBool(myIsMoving);
out.putBool(myIsRendering);
out.putByte(myRenderCounter);
out.putByte(myRenderCounterTripPoint);
out.putByte(myDivider);
out.putByte(myDividerPending);
out.putByte(mySampleCounter);
out.putByte(myDividerChangeCounter);
out.putByte(myDecodesOffset);
out.putByte(myPatternOld);
out.putByte(myPatternNew);
out.putByte(myPattern);
out.putBool(myIsReflected);
out.putBool(myIsDelaying);
}
catch(...)
{
@ -378,11 +407,10 @@ bool Player::save(Serializer& out) const
return false;
}
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool Player::load(Serializer& in)
{
try
@ -390,7 +418,37 @@ bool Player::load(Serializer& in)
if(in.getString() != name())
return false;
// TODO - load instance variables
collision = in.getInt();
myCollisionMaskDisabled = in.getInt();
myCollisionMaskEnabled = in.getInt();
myColor = in.getByte();
myObjectColor = in.getByte(); myDebugColor = in.getByte();
myDebugEnabled = in.getBool();
myIsSuppressed = in.getBool();
myHmmClocks = in.getByte();
myCounter = in.getByte();
myIsMoving = in.getBool();
myIsRendering = in.getBool();
myRenderCounter = in.getByte();
myRenderCounterTripPoint = in.getByte();
myDivider = in.getByte();
myDividerPending = in.getByte();
mySampleCounter = in.getByte();
myDividerChangeCounter = in.getByte();
myDecodesOffset = in.getByte();
myDecodes = DrawCounterDecodes::get().playerDecodes()[myDecodesOffset];
myPatternOld = in.getByte();
myPatternNew = in.getByte();
myPattern = in.getByte();
myIsReflected = in.getBool();
myIsDelaying = in.getBool();
}
catch(...)
{
@ -398,5 +456,5 @@ bool Player::load(Serializer& in)
return false;
}
return false;
return true;
}

View File

@ -94,6 +94,7 @@ class Player : public Serializable
uInt32 myCollisionMaskDisabled;
uInt32 myCollisionMaskEnabled;
uInt8 myColor;
uInt8 myObjectColor, myDebugColor;
bool myDebugEnabled;
@ -113,6 +114,7 @@ class Player : public Serializable
Int8 myDividerChangeCounter;
const uInt8* myDecodes;
uInt8 myDecodesOffset; // needed for state saving
uInt8 myPatternOld;
uInt8 myPatternNew;

View File

@ -72,14 +72,14 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
mySound(sound),
mySettings(settings),
myDelayQueue(10, 20),
mySpriteEnabledBits(0xFF),
myCollisionsEnabledBits(0xFF),
myPlayfield(~CollisionMask::playfield & 0x7FFF),
myMissile0(~CollisionMask::missile0 & 0x7FFF),
myMissile1(~CollisionMask::missile1 & 0x7FFF),
myPlayer0(~CollisionMask::player0 & 0x7FFF),
myPlayer1(~CollisionMask::player1 & 0x7FFF),
myBall(~CollisionMask::ball & 0x7FFF)
myBall(~CollisionMask::ball & 0x7FFF),
mySpriteEnabledBits(0xFF),
myCollisionsEnabledBits(0xFF)
{
myFrameManager.setHandlers(
[this] () {
@ -196,9 +196,11 @@ bool TIA::save(Serializer& out) const
{
out.putString(name());
// TODO - save instance variables
if(!mySound.save(out)) return false;
if(!myDelayQueue.save(out)) return false;
if(!myFrameManager.save(out)) return false;
// Save the state of each graphics object
if(!myBackground.save(out)) return false;
if(!myPlayfield.save(out)) return false;
if(!myMissile0.save(out)) return false;
@ -207,16 +209,51 @@ bool TIA::save(Serializer& out) const
if(!myPlayer1.save(out)) return false;
if(!myBall.save(out)) return false;
// Save dumped input ports
for (const PaddleReader& paddleReader : myPaddleReaders)
if(!paddleReader.save(out)) return false;
// Save latched input ports
if(!myInput0.save(out)) return false;
if(!myInput1.save(out)) return false;
// Save the sound sample stuff ...
if(!mySound.save(out)) return false;
out.putBool(myTIAPinsDriven);
out.putInt(int(myHstate));
out.putBool(myIsFreshLine);
out.putInt(myHblankCtr);
out.putInt(myHctr);
out.putInt(myXDelta);
out.putBool(myCollisionUpdateRequired);
out.putInt(myCollisionMask);
out.putInt(myMovementClock);
out.putBool(myMovementInProgress);
out.putBool(myExtendedHblank);
out.putInt(myLinesSinceChange);
out.putInt(int(myPriority));
out.putByte(myCtrlPF);
out.putByte(mySubClock);
out.putInt(myLastCycle);
out.putByte(mySpriteEnabledBits);
out.putByte(myCollisionsEnabledBits);
out.putByte(myColorHBlank);
out.putDouble(myTimestamp);
out.putBool(myAutoFrameEnabled);
out.putByte(myAUDV0);
out.putByte(myAUDV1);
out.putByte(myAUDC0);
out.putByte(myAUDC1);
out.putByte(myAUDF0);
out.putByte(myAUDF1);
}
catch(...)
{
@ -224,7 +261,7 @@ bool TIA::save(Serializer& out) const
return false;
}
return false; // for now, until class is finalized
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -235,9 +272,11 @@ bool TIA::load(Serializer& in)
if(in.getString() != name())
return false;
// TODO - load instance variables
if(!mySound.load(in)) return false;
if(!myDelayQueue.load(in)) return false;
if(!myFrameManager.load(in)) return false;
// Load the state of each graphics object
if(!myBackground.load(in)) return false;
if(!myPlayfield.load(in)) return false;
if(!myMissile0.load(in)) return false;
@ -246,16 +285,51 @@ bool TIA::load(Serializer& in)
if(!myPlayer1.load(in)) return false;
if(!myBall.load(in)) return false;
// Load dumped input ports
for (PaddleReader& paddleReader : myPaddleReaders)
if(!paddleReader.load(in)) return false;
// Load latched input ports
if(!myInput0.load(in)) return false;
if(!myInput1.load(in)) return false;
// Load the sound sample stuff ...
if(!mySound.load(in)) return false;
myTIAPinsDriven = in.getBool();
myHstate = HState(in.getInt());
myIsFreshLine = in.getBool();
myHblankCtr = in.getInt();
myHctr = in.getInt();
myXDelta = in.getInt();
myCollisionUpdateRequired = in.getBool();
myCollisionMask = in.getInt();
myMovementClock = in.getInt();
myMovementInProgress = in.getBool();
myExtendedHblank = in.getBool();
myLinesSinceChange = in.getInt();
myPriority = Priority(in.getInt());
myCtrlPF = in.getByte();
mySubClock = in.getByte();
myLastCycle = in.getInt();
mySpriteEnabledBits = in.getByte();
myCollisionsEnabledBits = in.getByte();
myColorHBlank = in.getByte();
myTimestamp = in.getDouble();
myAutoFrameEnabled = in.getBool();
myAUDV0 = in.getByte();
myAUDV1 = in.getByte();
myAUDC0 = in.getByte();
myAUDC1 = in.getByte();
myAUDF0 = in.getByte();
myAUDF1 = in.getByte();
}
catch(...)
{
@ -263,7 +337,7 @@ bool TIA::load(Serializer& in)
return false;
}
return false; // for now, until class is finalized
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -409,11 +409,27 @@ class TIA : public Device
Sound& mySound;
Settings& mySettings;
bool myTIAPinsDriven;
DelayQueue myDelayQueue;
FrameManager myFrameManager;
Background myBackground;
Playfield myPlayfield;
Missile myMissile0;
Missile myMissile1;
Player myPlayer0;
Player myPlayer1;
Ball myBall;
PaddleReader myPaddleReaders[4];
LatchedInput myInput0;
LatchedInput myInput1;
// Pointer to the current and previous frame buffers
BytePtr myCurrentFrameBuffer;
BytePtr myPreviousFrameBuffer;
bool myTIAPinsDriven;
HState myHstate;
bool myIsFreshLine;
@ -446,22 +462,6 @@ class TIA : public Device
// Automatic framerate correction based on number of scanlines
bool myAutoFrameEnabled;
// Pointer to the current and previous frame buffers
BytePtr myCurrentFrameBuffer;
BytePtr myPreviousFrameBuffer;
Background myBackground;
Playfield myPlayfield;
Missile myMissile0;
Missile myMissile1;
Player myPlayer0;
Player myPlayer1;
Ball myBall;
PaddleReader myPaddleReaders[4];
LatchedInput myInput0;
LatchedInput myInput1;
//////////////////////////////////////////////////////////////
// Audio values; only used by TIADebug
// FIXME - remove this when the new sound core is implemented

View File

@ -185,14 +185,25 @@ void VblankManager::setVblankMode(VblankMode mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool VblankManager::save(Serializer& out) const
{
try
{
out.putString(name());
// TODO - save instance variables
out.putInt(myVblankLines);
out.putInt(myYstart);
out.putBool(myVblank);
out.putInt(myCurrentLine);
out.putInt(int(myMode));
out.putInt(myLastVblankLines);
out.putByte(myVblankViolations);
out.putByte(myStableVblankFrames);
out.putBool(myVblankViolated);
out.putByte(myFramesInLockedMode);
out.putBool(myIsRunning);
}
catch(...)
{
@ -200,11 +211,10 @@ bool VblankManager::save(Serializer& out) const
return false;
}
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// TODO: implement this once the class is finalized
bool VblankManager::load(Serializer& in)
{
try
@ -212,7 +222,19 @@ bool VblankManager::load(Serializer& in)
if(in.getString() != name())
return false;
// TODO - load instance variables
myVblankLines = in.getInt();
myYstart = in.getInt();
myVblank = in.getBool();
myCurrentLine = in.getInt();
myMode = VblankMode(in.getInt());
myLastVblankLines = in.getInt();
myVblankViolations = in.getByte();
myStableVblankFrames = in.getByte();
myVblankViolated = in.getBool();
myFramesInLockedMode = in.getByte();
myIsRunning = in.getBool();
}
catch(...)
{
@ -220,5 +242,5 @@ bool VblankManager::load(Serializer& in)
return false;
}
return false;
return true;
}