some refinements for additional save states creation

This commit is contained in:
thrust26 2018-01-28 11:21:52 +01:00
parent d2177ea610
commit d7cc2036df
4 changed files with 20 additions and 14 deletions

View File

@ -142,10 +142,14 @@ void StateManager::toggleTimeMachine()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StateManager::addState(const string& message, bool timeMachine)
bool StateManager::addExtraState(const string& message)
{
RewindManager& r = myOSystem.state().rewindManager();
return r.addState(message, timeMachine);
if(myActiveMode == Mode::TimeMachine)
{
RewindManager& r = myOSystem.state().rewindManager();
return r.addState(message);
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -72,9 +72,10 @@ class StateManager
void setRewindMode(Mode mode) { myActiveMode = mode; }
/**
Adds one state ; this uses the RewindManager for its functionality.
Optionally adds one extra state when entering the Time Machine dialog;
this uses the RewindManager for its functionality.
*/
bool addState(const string& message, bool timeMachine = false);
bool addExtraState(const string& message);
/**
Rewinds states; this uses the RewindManager for its functionality.

View File

@ -620,7 +620,8 @@ void Debugger::setStartState()
// Save initial state and add it to the rewind list (except when in currently rewinding)
RewindManager& r = myOSystem.state().rewindManager();
// avoid invalidating future states when entering the debugger e.g. during rewind
if(myOSystem.eventHandler().state() == EventHandlerState::EMULATION)
if(r.atLast() && (myOSystem.eventHandler().state() != EventHandlerState::TIMEMACHINE
|| myOSystem.state().mode() == StateManager::Mode::Off))
addState("enter debugger");
else
updateRewindbuttons(r);

View File

@ -1232,7 +1232,7 @@ bool EventHandler::eventStateChange(Event::Type type)
case Event::TimeMachineMode:
if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE)
enterMenuMode(EventHandlerState::TIMEMACHINE);
enterTimeMachineMenuMode(0, false);
else if(myState == EventHandlerState::TIMEMACHINE)
leaveMenuMode();
else
@ -2135,14 +2135,14 @@ void EventHandler::leaveDebugMode()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::enterTimeMachineMenuMode(uInt32 numWinds, bool unwind)
{
// TODO: maybe remove this state if we leave the menu at the last state
myOSystem.state().addState("enter Time Machine menu", false); // force new state
myOSystem.state().windStates(numWinds, unwind);
// add one extra state if we are in Time Machine mode
// TODO: maybe remove this state if we leave the menu at this new state
myOSystem.state().addExtraState("enter Time Machine menu"); // force new state
if (numWinds)
myOSystem.state().windStates(numWinds, unwind);
// TODO: probably this check is not necessary
if(myState != EventHandlerState::TIMEMACHINE)
// TODO: display last wind message in time machine dialog
enterMenuMode(EventHandlerState::TIMEMACHINE);
// TODO: display last wind message (numWinds != 0) in time machine dialog
enterMenuMode(EventHandlerState::TIMEMACHINE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -