From 42dda2b0cc7b86930a092a136f1863380ec63509 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 29 Dec 2024 12:14:52 +0100 Subject: [PATCH] eliminated cycles() method in TIA.hxx --- src/common/RewindManager.cxx | 8 ++++---- src/debugger/Debugger.cxx | 4 ++-- src/debugger/TIADebug.cxx | 4 ++-- src/emucore/tia/TIA.cxx | 4 ++-- src/emucore/tia/TIA.hxx | 5 ----- src/gui/TimeMachineDialog.cxx | 2 +- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx index da5b4568f..8364237dc 100644 --- a/src/common/RewindManager.cxx +++ b/src/common/RewindManager.cxx @@ -114,7 +114,7 @@ bool RewindManager::addState(string_view message, bool timeMachine) interval = interval * scanlines / 262; } - if(myOSystem.console().tia().cycles() - lastState.cycles < interval) + if(myOSystem.console().system().cycles() - lastState.cycles < interval) return false; } @@ -135,7 +135,7 @@ bool RewindManager::addState(string_view message, bool timeMachine) if(myStateManager.saveState(s) && myOSystem.console().tia().saveDisplay(s)) { state.message = message; - state.cycles = myOSystem.console().tia().cycles(); + state.cycles = myOSystem.console().system().cycles(); myLastTimeMachineAdd = timeMachine; return true; } @@ -145,7 +145,7 @@ bool RewindManager::addState(string_view message, bool timeMachine) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt32 RewindManager::rewindStates(uInt32 numStates) { - const uInt64 startCycles = myOSystem.console().tia().cycles(); + const uInt64 startCycles = myOSystem.console().system().cycles(); uInt32 i{0}; string message; @@ -185,7 +185,7 @@ uInt32 RewindManager::rewindStates(uInt32 numStates) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt32 RewindManager::unwindStates(uInt32 numStates) { - const uInt64 startCycles = myOSystem.console().tia().cycles(); + const uInt64 startCycles = myOSystem.console().system().cycles(); uInt32 i{0}; string message; diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 0df47bcd0..c1ae24bc4 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -670,9 +670,9 @@ uInt16 Debugger::windStates(uInt16 numStates, bool unwind, string& message) unlockSystem(); - const uInt64 startCycles = myOSystem.console().tia().cycles(); + const uInt64 startCycles = myOSystem.console().system().cycles(); const uInt16 winds = r.windStates(numStates, unwind); - message = r.getUnitString(myOSystem.console().tia().cycles() - startCycles); + message = r.getUnitString(myOSystem.console().system().cycles() - startCycles); lockSystem(); diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index dde9d5247..e0b161a75 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -927,13 +927,13 @@ int TIADebug::frameWsyncCycles() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int TIADebug::cyclesLo() const { - return static_cast(myTIA.cycles()); + return static_cast(mySystem.cycles()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int TIADebug::cyclesHi() const { - return static_cast(myTIA.cycles() >> 32); + return static_cast(mySystem.cycles() >> 32); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index e11d73190..974e51d3b 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -570,7 +570,7 @@ bool TIA::poke(uInt16 address, uInt8 value) break; case VSYNC: - myFrameManager->setVsync(value & 0x02, mySystem->cycles()); + myFrameManager->setVsync(value & 0x02, myTimestamp / 3); myShadowRegisters[address] = value; break; @@ -1935,7 +1935,7 @@ void TIA::delayedWrite(uInt8 address, uInt8 value) { case VBLANK: flushLineCache(); - myFrameManager->setVblank(value & 0x02, mySystem->cycles()); + myFrameManager->setVblank(value & 0x02, myTimestamp / 3); break; case HMOVE: diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index bcc87cb19..cf2d3f305 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -339,11 +339,6 @@ class TIA : public Device */ uInt32 frameBufferScanlinesLastFrame() const { return myFrameBufferScanlines; } - /** - Answers the total system cycles from the start of the emulation. - */ - uInt64 cycles() const { return mySystem->cycles(); } - #ifdef DEBUGGER_SUPPORT /** Answers the frame count from the start of the emulation. diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index 58dd88d06..ad655307c 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -529,7 +529,7 @@ void TimeMachineDialog::handleWinds(Int32 numWinds) if(numWinds < 0) r.rewindStates(-numWinds); else if(numWinds > 0) r.unwindStates(numWinds); - const uInt64 elapsed = instance().console().tia().cycles() - startCycles; + const uInt64 elapsed = instance().console().system().cycles() - startCycles; if(elapsed > 0) { const string message = r.getUnitString(elapsed);