mirror of https://github.com/stella-emu/stella.git
save state handling for entering and leaving the debugger modified.
This commit is contained in:
parent
44f7029573
commit
cdb2e18324
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class RewindManager
|
|||
*/
|
||||
bool rewindState();
|
||||
|
||||
/**
|
||||
/**
|
||||
Unwind one level of the state list, and display the message associated
|
||||
with that state.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue