diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx index 5debdfc1e..dcfc1bf2a 100644 --- a/src/common/RewindManager.cxx +++ b/src/common/RewindManager.cxx @@ -29,6 +29,7 @@ RewindManager::RewindManager(OSystem& system, StateManager& statemgr) : myOSystem(system), myStateManager(statemgr), myIsNTSC(true) // TODO + // TODO: current is not valid { } @@ -42,6 +43,7 @@ bool RewindManager::addState(const string& message) compressStates(); RewindState& state = myStateList.addFirst(); + // TODO: addFirst() must set current() to the just added element Serializer& s = state.data; s.reset(); // rewind Serializer internal buffers @@ -60,7 +62,9 @@ bool RewindManager::rewindState() if(!myStateList.empty()) { // TODO: get state previous to the current state instead of first() - RewindState& state = myStateList.first(); + // RewindState& state = myStateList.current(); + // myStateList.prev(); // moves current to the previous (older) element + RewindState& state = myStateList.first(); // TOOD: remove Serializer& s = state.data; string message = getMessage(state); @@ -71,8 +75,8 @@ bool RewindManager::rewindState() // Show message indicating the rewind state myOSystem.frameBuffer().showMessage(message); - // TODO: Do NOT remove state (TODO later somewhere else: stop emulation) - myStateList.removeFirst(); + // TODO: Do NOT remove state (TODO later somewhere else: stop emulation) + myStateList.removeFirst(); // TODO: delete this return true; } diff --git a/src/common/RewindManager.hxx b/src/common/RewindManager.hxx index d964b1297..3b421ec6b 100644 --- a/src/common/RewindManager.hxx +++ b/src/common/RewindManager.hxx @@ -49,7 +49,7 @@ class RewindManager */ bool rewindState(); - /** + /** Unwind one level of the state list, and display the message associated with that state. */ diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 372658036..da938dbda 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -528,10 +528,7 @@ void Debugger::setStartState() // Lock the bus each time the debugger is entered, so we don't disturb anything lockBankswitchState(); - // If rewinding is not enabled, always start the debugger with a clean list RewindManager& r = myOSystem.state().rewindManager(); - if(myOSystem.state().mode() == StateManager::Mode::Off) - r.clear(); myDialog->rewindButton().setEnabled(!r.atLast()); myDialog->unwindButton().setEnabled(!r.atFirst()); @@ -548,6 +545,9 @@ void Debugger::setQuitState() // Bus must be unlocked for normal operation when leaving debugger mode unlockBankswitchState(); + // Save state when leaving the debugger + saveOldState("exit debugger"); + // execute one instruction on quit. If we're // sitting at a breakpoint/trap, this will get us past it. // Somehow this feels like a hack to me, but I don't know why