add hotkey to decrease current state slot

This commit is contained in:
thrust26 2020-01-20 12:11:26 +01:00
parent 59d0c7fbda
commit dd3a58d4ac
12 changed files with 43 additions and 25 deletions

View File

@ -736,13 +736,19 @@
</tr>
<tr>
<td>Switch current state slot</td>
<td>Change to previous state slot</td>
<td>Shift + F10</td>
<td>Shift + F10</td>
</tr>
<tr>
<td>Change to next state slot</td>
<td>F10</td>
<td>F10</td>
</tr>
<tr>
<td>Automatically switch state slot</td>
<td>Automatically change state slot</td>
<td>Alt + F10</td>
<td>Cmd + F10</td>
</tr>
@ -2243,7 +2249,7 @@
<tr>
<td><pre>-autoslot &lt;1|0&gt;</pre></td>
<td>Automatically switch to the next available save state slot after
<td>Automatically change to the next available save state slot after
saving a ROM state file.</td>
</tr>
@ -3395,9 +3401,9 @@
</td>
<td>-saveonexit</td>
</tr><tr>
<td>Automatically switch...</td>
<td>Automatically change...</td>
<td>
Automatically switch to the next available save state slot after saving a ROM state file.
Automatically change to the next available save state slot after saving a ROM state file.
</td>
<td>-autoslot</td>
</tr>

View File

@ -406,7 +406,8 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
{Event::ConsoleRightDiffB, KBDK_F8},
{Event::SaveState, KBDK_F9},
{Event::SaveAllStates, KBDK_F9, MOD3},
{Event::ChangeState, KBDK_F10},
{Event::PreviousState, KBDK_F10, KBDM_SHIFT},
{Event::NextState, KBDK_F10},
{Event::ToggleAutoSlot, KBDK_F10, MOD3},
{Event::LoadState, KBDK_F11},
{Event::LoadAllStates, KBDK_F11, MOD3},

View File

@ -297,9 +297,13 @@ void StateManager::saveState(int slot)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StateManager::changeState()
void StateManager::changeState(int direction)
{
myCurrentSlot = (myCurrentSlot + 1) % 10;
myCurrentSlot += direction;
if (myCurrentSlot < 0)
myCurrentSlot = 9;
else
myCurrentSlot %= 10;
// Print appropriate message
ostringstream buf;

View File

@ -114,9 +114,9 @@ class StateManager
void saveState(int slot = -1);
/**
Switches to the next higher state slot (circular queue style).
Switches to the next higher or lower state slot (circular queue style).
*/
void changeState();
void changeState(int direction);
/**
Toggles auto slot mode.

View File

@ -144,7 +144,8 @@ void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
case Event::SaveState:
case Event::SaveAllStates:
case Event::ChangeState:
case Event::PreviousState :
case Event::NextState:
case Event::LoadState:
case Event::LoadAllStates:

View File

@ -93,7 +93,7 @@ class Event
OptionsMenuMode, CmdMenuMode, DebuggerMode, ExitMode,
TakeSnapshot, ToggleContSnapshots, ToggleContSnapshotsFrame,
ChangeState, LoadState, SaveState,
NextState, PreviousState, LoadState, SaveState,
SaveAllStates, LoadAllStates,
ToggleAutoSlot, ToggleTimeMachine, TimeMachineMode,
Rewind1Menu, Rewind10Menu, RewindAllMenu,
@ -134,7 +134,7 @@ class Event
};
// Event list version, update only if the id of existing(!) event types changed
static constexpr Int32 VERSION = 2;
static constexpr Int32 VERSION = 3;
using EventSet = std::set<Event::Type>;

View File

@ -656,8 +656,12 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
myOSystem.frameBuffer().showMessage(myOSystem.state().rewindManager().saveAllStates());
return;
case Event::ChangeState:
if(pressed) myOSystem.state().changeState();
case Event::NextState:
if(pressed) myOSystem.state().changeState(1);
return;
case Event::PreviousState:
if (pressed) myOSystem.state().changeState(-1);
return;
case Event::ToggleAutoSlot:
@ -1810,9 +1814,13 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::ConsoleRightDiffB, "P1 Difficulty B", "" },
{ Event::ConsoleRightDiffToggle, "P1 Toggle Difficulty", "" },
{ Event::SaveState, "Save state", "" },
{ Event::ChangeState, "Change state slot", "" },
{ Event::SaveAllStates, "Save all TM states of current game", "" },
{ Event::PreviousState, "Change to previous state slot", "" },
{ Event::NextState, "Change to next state slot", "" },
{ Event::ToggleAutoSlot, "Toggle automatic state slot change", "" },
{ Event::LoadState, "Load state", "" },
{ Event::LoadAllStates, "Load saved TM states for current game", "" },
#ifdef PNG_SUPPORT
{ Event::TakeSnapshot, "Snapshot", "" },
{ Event::ToggleContSnapshots, "Save continuous snapsh. (as defined)", "" },
@ -1939,8 +1947,6 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::ToggleGrabMouse, "Toggle grab mouse", "" },
{ Event::ToggleSAPortOrder, "Swap Stelladaptor port ordering", "" },
{ Event::SaveAllStates, "Save all TM states of current game", "" },
{ Event::LoadAllStates, "Load saved TM states for current game", "" },
{ Event::ToggleTimeMachine, "Toggle 'Time Machine' mode", "" },
{ Event::TimeMachineMode, "Toggle 'Time Machine' UI", "" },
{ Event::RewindPause, "Rewind one state & enter Pause mode", "" },
@ -2026,8 +2032,8 @@ const Event::EventSet EventHandler::AudioVideoEvents = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Event::EventSet EventHandler::StateEvents = {
Event::ChangeState, Event::LoadState, Event::SaveState, Event::TimeMachineMode,
Event::RewindPause, Event::UnwindPause, Event::ToggleTimeMachine,
Event::NextState, Event::PreviousState, Event::LoadState, Event::SaveState,
Event::TimeMachineMode, Event::RewindPause, Event::UnwindPause, Event::ToggleTimeMachine,
Event::Rewind1Menu, Event::Rewind10Menu, Event::RewindAllMenu,
Event::Unwind1Menu, Event::Unwind10Menu, Event::UnwindAllMenu,
Event::SaveAllStates, Event::LoadAllStates, Event::ToggleAutoSlot,

View File

@ -468,7 +468,7 @@ class EventHandler
#else
PNG_SIZE = 0,
#endif
EMUL_ACTIONLIST_SIZE = 143 + PNG_SIZE + COMBO_SIZE,
EMUL_ACTIONLIST_SIZE = 144 + PNG_SIZE + COMBO_SIZE,
MENU_ACTIONLIST_SIZE = 18
;

View File

@ -469,7 +469,7 @@ void Settings::usage() const
<< endl
<< " -saveonexit <none|current Automatically save state(s) when exiting emulation\n"
<< " all>\n"
<< " -autoslot <1|0> Automatically switch to next save slot when\n"
<< " -autoslot <1|0> Automatically change to next save slot when\n"
<< " state saving\n"
<< endl
<< " -rominfo <rom> Display detailed information for the given ROM\n"

View File

@ -168,7 +168,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
case kStateSlotCmd:
{
event = Event::ChangeState;
event = Event::NextState;
stateCmd = true;
int slot = (instance().state().currentSlot() + 1) % 10;
updateSlot(slot);

View File

@ -495,7 +495,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
ypos += lineHeight + VGAP;
myAutoSlotWidget = new CheckboxWidget(myTab, font, HBORDER, ypos + 1, "Automatically switch save state slots");
myAutoSlotWidget = new CheckboxWidget(myTab, font, HBORDER, ypos + 1, "Automatically change save state slots");
wid.push_back(myAutoSlotWidget);
ypos += lineHeight + VGAP;

View File

@ -191,7 +191,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
case kStateSlotCmd:
{
event = Event::ChangeState;
event = Event::NextState;
stateCmd = true;
int slot = (instance().state().currentSlot() + 1) % 10;
updateSlot(slot);