Skip to content

Commit

Permalink
Merge pull request #9627 from unknownbrackets/devmenu
Browse files Browse the repository at this point in the history
UI: Proxy devmenu keypress through an event
  • Loading branch information
hrydgard authored Apr 18, 2017
2 parents 87ca5cd + 7589839 commit 6f58d4d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ EmuScreen::EmuScreen(const std::string &filename)
frameStep_ = false;
lastNumFlips = gpuStats.numFlips;
startDumping = false;

OnDevMenu.Handle(this, &EmuScreen::OnDevTools);
}

void EmuScreen::bootGame(const std::string &filename) {
Expand Down Expand Up @@ -453,9 +455,11 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) {
break;

case VIRTKEY_DEVMENU:
releaseButtons();
screenManager()->push(new DevMenu());
{
UI::EventParams e{};
OnDevMenu.Trigger(e);
break;
}

case VIRTKEY_AXIS_X_MIN:
case VIRTKEY_AXIS_X_MAX:
Expand Down
2 changes: 2 additions & 0 deletions UI/EmuScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class EmuScreen : public UIScreen {
void autoLoad();
void checkPowerDown();

UI::Event OnDevMenu;

bool bootPending_;
std::string gamePath_;

Expand Down
4 changes: 2 additions & 2 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ void GameSettingsScreen::CreateViews() {

// Combo key setup
Choice *comboKey = controlsSettings->Add(new Choice(co->T("Combo Key Setup")));
comboKey->OnClick.Handle(this, &GameSettingsScreen::OnCombo_key);
comboKey->OnClick.Handle(this, &GameSettingsScreen::OnComboKey);
comboKey->SetEnabledPtr(&g_Config.bShowTouchControls);

// On non iOS systems, offer to let the user see this button.
Expand Down Expand Up @@ -1122,7 +1122,7 @@ UI::EventReturn GameSettingsScreen::OnChangeMacAddress(UI::EventParams &e) {
return UI::EVENT_DONE;
}

UI::EventReturn GameSettingsScreen::OnCombo_key(UI::EventParams &e) {
UI::EventReturn GameSettingsScreen::OnComboKey(UI::EventParams &e) {
screenManager()->push(new Combo_keyScreen(&g_Config.iComboMode));
return UI::EVENT_DONE;
}
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GameSettingsScreen : public UIDialogScreenWithGameBackground {
UI::EventReturn OnReloadCheats(UI::EventParams &e);
UI::EventReturn OnTiltTypeChange(UI::EventParams &e);
UI::EventReturn OnTiltCustomize(UI::EventParams &e);
UI::EventReturn OnCombo_key(UI::EventParams &e);
UI::EventReturn OnComboKey(UI::EventParams &e);

// Global settings handlers
UI::EventReturn OnLanguage(UI::EventParams &e);
Expand Down
1 change: 0 additions & 1 deletion UI/MainScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,6 @@ UI::EventReturn MainScreen::OnGameSelectedInstant(UI::EventParams &e) {
}

UI::EventReturn MainScreen::OnGameSettings(UI::EventParams &e) {
// screenManager()->push(new SettingsScreen());
auto gameSettings = new GameSettingsScreen("", "");
gameSettings->OnRecentChanged.Handle(this, &MainScreen::OnRecentChange);
screenManager()->push(gameSettings);
Expand Down

0 comments on commit 6f58d4d

Please sign in to comment.