Skip to content
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

Merged

Conversation

askew-etc
Copy link
Contributor

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.

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);
Copy link
Contributor

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)

Copy link
Contributor

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.

Copy link
Contributor Author

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.

_trans("Increase Select State Slot"),
_trans("Decrease Select State Slot"),
Copy link
Contributor

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).

Copy link
Contributor Author

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.

@AdmiralCurtiss
Copy link
Contributor

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.

@askew-etc askew-etc force-pushed the inc-dec-select-state-hotkeys branch from 1d21c9e to 914f387 Compare August 7, 2022 17:20
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested.

@AdmiralCurtiss
Copy link
Contributor

Seems to work correctly, too.

@AdmiralCurtiss AdmiralCurtiss merged commit dcdba11 into dolphin-emu:master Aug 9, 2022
11 checks passed
@askew-etc askew-etc deleted the inc-dec-select-state-hotkeys branch August 10, 2022 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants