New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hotkeys for incrementing/decrementing select state slot #10962
Add hotkeys for incrementing/decrementing select state slot #10962
Conversation
Source/Core/DolphinQt/MainWindow.cpp
Outdated
| int state_slot = Settings::Instance().GetStateSlot(); | ||
| state_slot++; | ||
| if (state_slot > 10) | ||
| { | ||
| state_slot = 1; | ||
| } | ||
| m_state_slot = state_slot; | ||
| m_menu_bar->SetStateSlot(m_state_slot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're overcomplicating this, it should be enough to just do
int state_slot = m_state_slot + 1;
if (state_slot > 10)
state_slot = 1;
SetStateSlot(state_slot);
(similar for the decrement case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably should also use State::NUM_STATES instead of 10 for the max state number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I made the changes to the code per your recommendations.
Source/Core/Core/HotkeyManager.cpp
Outdated
| _trans("Increase Select State Slot"), | ||
| _trans("Decrease Select State Slot"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatically, I think these should be "Increase Selected State Slot"/"Decrease Selected State Slot" (and the same for HK_INCREMENT_SELECT_STATE_SLOT/IncrementSelectStateSlotHotkey/IncrementSelectStateSlot and the decrement ones).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've made the changes you requested.
|
You should squash the fixup commits but otherwise this looks good to me. Your first commit also has a weird author that's not associated with any GitHub account. |
1d21c9e
to
914f387
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested.
|
Seems to work correctly, too. |
RetroArch has hotkeys you can assign to increment/decrement the currently selected save state slot. This is convenient for controller users since you can change the save state slot and then save to or load from different slots without having to touch the keyboard. This functionality could be desirable in Dolphin.