mirror of https://github.com/stella-emu/stella.git
In the TIA class, isolate developer settings and re-apply them on each state load.
Eliminates saving of certain variables into the state file which really don't belong there.
This commit is contained in:
parent
ea89ef01b4
commit
dd09187fc0
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "StateManager.hxx"
|
#include "StateManager.hxx"
|
||||||
|
|
||||||
#define STATE_HEADER "06000002state"
|
#define STATE_HEADER "06000003state"
|
||||||
// #define MOVIE_HEADER "03030000movie"
|
// #define MOVIE_HEADER "03030000movie"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -80,9 +80,6 @@ TIA::TIA(ConsoleIO& console, ConsoleTimingProvider timingProvider, Settings& set
|
||||||
mySpriteEnabledBits(0xFF),
|
mySpriteEnabledBits(0xFF),
|
||||||
myCollisionsEnabledBits(0xFF)
|
myCollisionsEnabledBits(0xFF)
|
||||||
{
|
{
|
||||||
bool devSettings = mySettings.getBool("dev.settings");
|
|
||||||
myTIAPinsDriven = devSettings ? mySettings.getBool("dev.tiadriven") : false;
|
|
||||||
|
|
||||||
myBackground.setTIA(this);
|
myBackground.setTIA(this);
|
||||||
myPlayfield.setTIA(this);
|
myPlayfield.setTIA(this);
|
||||||
myPlayer0.setTIA(this);
|
myPlayer0.setTIA(this);
|
||||||
|
@ -91,9 +88,6 @@ TIA::TIA(ConsoleIO& console, ConsoleTimingProvider timingProvider, Settings& set
|
||||||
myMissile1.setTIA(this);
|
myMissile1.setTIA(this);
|
||||||
myBall.setTIA(this);
|
myBall.setTIA(this);
|
||||||
|
|
||||||
myEnableJitter = mySettings.getBool(devSettings ? "dev.tv.jitter" : "plr.tv.jitter");
|
|
||||||
myJitterFactor = mySettings.getInt(devSettings ? "dev.tv.jitter_recovery" : "plr.tv.jitter_recovery");
|
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,62 +165,29 @@ void TIA::reset()
|
||||||
for (PaddleReader& paddleReader : myPaddleReaders)
|
for (PaddleReader& paddleReader : myPaddleReaders)
|
||||||
paddleReader.reset(myTimestamp);
|
paddleReader.reset(myTimestamp);
|
||||||
|
|
||||||
bool devSettings = mySettings.getBool("dev.settings");
|
|
||||||
if(devSettings)
|
|
||||||
{
|
|
||||||
bool custom = BSPF::equalsIgnoreCase("custom", mySettings.getString("dev.tia.type"));
|
|
||||||
|
|
||||||
setPlInvertedPhaseClock(custom
|
|
||||||
? mySettings.getBool("dev.tia.plinvphase")
|
|
||||||
: BSPF::equalsIgnoreCase("koolaidman", mySettings.getString("dev.tia.type")));
|
|
||||||
setMsInvertedPhaseClock(custom
|
|
||||||
? mySettings.getBool("dev.tia.msinvphase")
|
|
||||||
: BSPF::equalsIgnoreCase("cosmicark", mySettings.getString("dev.tia.type")));
|
|
||||||
setBlInvertedPhaseClock(custom ? mySettings.getBool("dev.tia.blinvphase") : false);
|
|
||||||
setPFBitsDelay(custom
|
|
||||||
? mySettings.getBool("dev.tia.delaypfbits")
|
|
||||||
: BSPF::equalsIgnoreCase("pesco", mySettings.getString("dev.tia.type")));
|
|
||||||
setPFColorDelay(custom
|
|
||||||
? mySettings.getBool("dev.tia.delaypfcolor")
|
|
||||||
: BSPF::equalsIgnoreCase("quickstep", mySettings.getString("dev.tia.type")));
|
|
||||||
setPlSwapDelay(custom
|
|
||||||
? mySettings.getBool("dev.tia.delayplswap")
|
|
||||||
: BSPF::equalsIgnoreCase("heman", mySettings.getString("dev.tia.type")));
|
|
||||||
setBlSwapDelay(custom ? mySettings.getBool("dev.tia.delayblswap") : false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setPlInvertedPhaseClock(false);
|
|
||||||
setMsInvertedPhaseClock(false);
|
|
||||||
setBlInvertedPhaseClock(false);
|
|
||||||
setPFBitsDelay(false);
|
|
||||||
setPFColorDelay(false);
|
|
||||||
setPlSwapDelay(false);
|
|
||||||
setBlSwapDelay(false);
|
|
||||||
}
|
|
||||||
myDelayQueue.reset();
|
myDelayQueue.reset();
|
||||||
|
|
||||||
myCyclesAtFrameStart = 0;
|
myCyclesAtFrameStart = 0;
|
||||||
|
|
||||||
if (myFrameManager)
|
if (myFrameManager)
|
||||||
{
|
|
||||||
myFrameManager->reset();
|
myFrameManager->reset();
|
||||||
enableColorLoss(mySettings.getBool(devSettings ? "dev.colorloss" : "plr.colorloss"));
|
|
||||||
}
|
|
||||||
|
|
||||||
myFrontBufferScanlines = myFrameBufferScanlines = 0;
|
myFrontBufferScanlines = myFrameBufferScanlines = 0;
|
||||||
|
|
||||||
myFramesSinceLastRender = 0;
|
myFramesSinceLastRender = 0;
|
||||||
|
|
||||||
// Must be done last, after all other items have reset
|
|
||||||
enableFixedColors(mySettings.getBool(devSettings ? "dev.debugcolors" : "plr.debugcolors"));
|
|
||||||
setFixedColorPalette(mySettings.getString("tia.dbgcolors"));
|
|
||||||
|
|
||||||
// Blank the various framebuffers; they may contain graphical garbage
|
// Blank the various framebuffers; they may contain graphical garbage
|
||||||
memset(myBackBuffer, 0, TIAConstants::H_PIXEL * TIAConstants::frameBufferHeight);
|
memset(myBackBuffer, 0, TIAConstants::H_PIXEL * TIAConstants::frameBufferHeight);
|
||||||
memset(myFrontBuffer, 0, TIAConstants::H_PIXEL * TIAConstants::frameBufferHeight);
|
memset(myFrontBuffer, 0, TIAConstants::H_PIXEL * TIAConstants::frameBufferHeight);
|
||||||
memset(myFramebuffer, 0, TIAConstants::H_PIXEL * TIAConstants::frameBufferHeight);
|
memset(myFramebuffer, 0, TIAConstants::H_PIXEL * TIAConstants::frameBufferHeight);
|
||||||
|
|
||||||
|
applyDeveloperSettings();
|
||||||
|
|
||||||
|
// Must be done last, after all other items have reset
|
||||||
|
bool devSettings = mySettings.getBool("dev.settings");
|
||||||
|
enableFixedColors(mySettings.getBool(devSettings ? "dev.debugcolors" : "plr.debugcolors"));
|
||||||
|
setFixedColorPalette(mySettings.getString("tia.dbgcolors"));
|
||||||
|
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
createAccessBase();
|
createAccessBase();
|
||||||
#endif // DEBUGGER_SUPPORT
|
#endif // DEBUGGER_SUPPORT
|
||||||
|
@ -284,8 +245,6 @@ bool TIA::save(Serializer& out) const
|
||||||
if(!myInput0.save(out)) return false;
|
if(!myInput0.save(out)) return false;
|
||||||
if(!myInput1.save(out)) return false;
|
if(!myInput1.save(out)) return false;
|
||||||
|
|
||||||
out.putBool(myTIAPinsDriven);
|
|
||||||
|
|
||||||
out.putInt(int(myHstate));
|
out.putInt(int(myHstate));
|
||||||
|
|
||||||
out.putInt(myHctr);
|
out.putInt(myHctr);
|
||||||
|
@ -357,8 +316,6 @@ bool TIA::load(Serializer& in)
|
||||||
if(!myInput0.load(in)) return false;
|
if(!myInput0.load(in)) return false;
|
||||||
if(!myInput1.load(in)) return false;
|
if(!myInput1.load(in)) return false;
|
||||||
|
|
||||||
myTIAPinsDriven = in.getBool();
|
|
||||||
|
|
||||||
myHstate = HState(in.getInt());
|
myHstate = HState(in.getInt());
|
||||||
|
|
||||||
myHctr = in.getInt();
|
myHctr = in.getInt();
|
||||||
|
@ -397,6 +354,9 @@ bool TIA::load(Serializer& in)
|
||||||
myPFBitsDelay = in.getByte();
|
myPFBitsDelay = in.getByte();
|
||||||
myPFColorDelay = in.getByte();
|
myPFColorDelay = in.getByte();
|
||||||
myPlSwapDelay = in.getByte();
|
myPlSwapDelay = in.getByte();
|
||||||
|
|
||||||
|
// Re-apply dev settings
|
||||||
|
applyDeveloperSettings();
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
@ -864,6 +824,52 @@ bool TIA::loadDisplay(Serializer& in)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void TIA::applyDeveloperSettings()
|
||||||
|
{
|
||||||
|
bool devSettings = mySettings.getBool("dev.settings");
|
||||||
|
if(devSettings)
|
||||||
|
{
|
||||||
|
bool custom = BSPF::equalsIgnoreCase("custom", mySettings.getString("dev.tia.type"));
|
||||||
|
|
||||||
|
setPlInvertedPhaseClock(custom
|
||||||
|
? mySettings.getBool("dev.tia.plinvphase")
|
||||||
|
: BSPF::equalsIgnoreCase("koolaidman", mySettings.getString("dev.tia.type")));
|
||||||
|
setMsInvertedPhaseClock(custom
|
||||||
|
? mySettings.getBool("dev.tia.msinvphase")
|
||||||
|
: BSPF::equalsIgnoreCase("cosmicark", mySettings.getString("dev.tia.type")));
|
||||||
|
setBlInvertedPhaseClock(custom ? mySettings.getBool("dev.tia.blinvphase") : false);
|
||||||
|
setPFBitsDelay(custom
|
||||||
|
? mySettings.getBool("dev.tia.delaypfbits")
|
||||||
|
: BSPF::equalsIgnoreCase("pesco", mySettings.getString("dev.tia.type")));
|
||||||
|
setPFColorDelay(custom
|
||||||
|
? mySettings.getBool("dev.tia.delaypfcolor")
|
||||||
|
: BSPF::equalsIgnoreCase("quickstep", mySettings.getString("dev.tia.type")));
|
||||||
|
setPlSwapDelay(custom
|
||||||
|
? mySettings.getBool("dev.tia.delayplswap")
|
||||||
|
: BSPF::equalsIgnoreCase("heman", mySettings.getString("dev.tia.type")));
|
||||||
|
setBlSwapDelay(custom ? mySettings.getBool("dev.tia.delayblswap") : false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPlInvertedPhaseClock(false);
|
||||||
|
setMsInvertedPhaseClock(false);
|
||||||
|
setBlInvertedPhaseClock(false);
|
||||||
|
setPFBitsDelay(false);
|
||||||
|
setPFColorDelay(false);
|
||||||
|
setPlSwapDelay(false);
|
||||||
|
setBlSwapDelay(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
myTIAPinsDriven = devSettings ? mySettings.getBool("dev.tiadriven") : false;
|
||||||
|
|
||||||
|
myEnableJitter = mySettings.getBool(devSettings ? "dev.tv.jitter" : "plr.tv.jitter");
|
||||||
|
myJitterFactor = mySettings.getInt(devSettings ? "dev.tv.jitter_recovery" : "plr.tv.jitter_recovery");
|
||||||
|
|
||||||
|
if(myFrameManager)
|
||||||
|
enableColorLoss(mySettings.getBool(devSettings ? "dev.colorloss" : "plr.colorloss"));
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void TIA::update(DispatchResult& result, uInt64 maxCycles)
|
void TIA::update(DispatchResult& result, uInt64 maxCycles)
|
||||||
{
|
{
|
||||||
|
|
|
@ -548,7 +548,6 @@ class TIA : public Device
|
||||||
string myFixedColorNames[7];
|
string myFixedColorNames[7];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This callback is invoked by FrameManager when a new frame starts.
|
* This callback is invoked by FrameManager when a new frame starts.
|
||||||
*/
|
*/
|
||||||
|
@ -646,7 +645,7 @@ class TIA : public Device
|
||||||
uInt8 collCXBLPF() const;
|
uInt8 collCXBLPF() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Toggle the specified collision bits
|
* Toggle the specified collision bits
|
||||||
*/
|
*/
|
||||||
void toggleCollP0PF();
|
void toggleCollP0PF();
|
||||||
void toggleCollP0BL();
|
void toggleCollP0BL();
|
||||||
|
@ -664,6 +663,13 @@ class TIA : public Device
|
||||||
void toggleCollM1BL();
|
void toggleCollM1BL();
|
||||||
void toggleCollBLPF();
|
void toggleCollBLPF();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-apply developer settings from the settings object.
|
||||||
|
* This should be done each time the device is reset, or after
|
||||||
|
* a state load occurs.
|
||||||
|
*/
|
||||||
|
void applyDeveloperSettings();
|
||||||
|
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
void createAccessBase();
|
void createAccessBase();
|
||||||
|
|
||||||
|
@ -683,7 +689,6 @@ class TIA : public Device
|
||||||
#endif // DEBUGGER_SUPPORT
|
#endif // DEBUGGER_SUPPORT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ConsoleIO& myConsole;
|
ConsoleIO& myConsole;
|
||||||
ConsoleTimingProvider myTimingProvider;
|
ConsoleTimingProvider myTimingProvider;
|
||||||
Settings& mySettings;
|
Settings& mySettings;
|
||||||
|
@ -771,13 +776,14 @@ class TIA : public Device
|
||||||
/**
|
/**
|
||||||
* Master line counter
|
* Master line counter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uInt8 myHctr;
|
uInt8 myHctr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delta between master line counter and actual color clock. Nonzero after
|
* Delta between master line counter and actual color clock. Nonzero after
|
||||||
* RSYNC (before the scanline terminates)
|
* RSYNC (before the scanline terminates)
|
||||||
*/
|
*/
|
||||||
Int32 myHctrDelta;
|
Int32 myHctrDelta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Electron beam x at rendering start (used for blanking out any pixels from
|
* Electron beam x at rendering start (used for blanking out any pixels from
|
||||||
* the last frame that are not overwritten)
|
* the last frame that are not overwritten)
|
||||||
|
@ -804,10 +810,12 @@ class TIA : public Device
|
||||||
* movement.
|
* movement.
|
||||||
*/
|
*/
|
||||||
uInt32 myMovementClock;
|
uInt32 myMovementClock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Movement mode --- are we sending movement clocks?
|
* Movement mode --- are we sending movement clocks?
|
||||||
*/
|
*/
|
||||||
bool myMovementInProgress;
|
bool myMovementInProgress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do we have an extended hblank this line? Get set by strobing HMOVE and
|
* Do we have an extended hblank this line? Get set by strobing HMOVE and
|
||||||
* cleared when the line wraps.
|
* cleared when the line wraps.
|
||||||
|
@ -830,6 +838,7 @@ class TIA : public Device
|
||||||
* The index of the last CPU cycle that was included in the simulation.
|
* The index of the last CPU cycle that was included in the simulation.
|
||||||
*/
|
*/
|
||||||
uInt64 myLastCycle;
|
uInt64 myLastCycle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of a possible fractional number of clocks that still need
|
* Keeps track of a possible fractional number of clocks that still need
|
||||||
* to be simulated.
|
* to be simulated.
|
||||||
|
|
Loading…
Reference in New Issue