diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 5e67c10509..ec6b47b6e0 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1020,6 +1020,7 @@ static UI::AnchorLayoutParams *AnchorInCorner(const Bounds &bounds, int corner, void EmuScreen::CreateViews() { using namespace UI; + auto di = GetI18NCategory(I18NCat::DIALOG); auto dev = GetI18NCategory(I18NCat::DEVELOPER); auto sc = GetI18NCategory(I18NCat::SCREEN); @@ -1043,9 +1044,21 @@ void EmuScreen::CreateViews() { resumeButton_->SetVisibility(V_GONE); resetButton_ = buttons->Add(new Button(dev->T("Reset"))); - resetButton_->OnClick.Handle(this, &EmuScreen::OnReset); + resetButton_->OnClick.Add([](UI::EventParams &) { + if (coreState == CoreState::CORE_RUNTIME_ERROR) { + System_PostUIMessage(UIMessage::REQUEST_GAME_RESET); + } + return UI::EVENT_DONE; + }); resetButton_->SetVisibility(V_GONE); + backButton_ = buttons->Add(new Button(dev->T("Back"))); + backButton_->OnClick.Add([this](UI::EventParams &) { + this->pauseTrigger_ = true; + return UI::EVENT_DONE; + }); + backButton_->SetVisibility(V_GONE); + cardboardDisableButton_ = root_->Add(new Button(sc->T("Cardboard VR OFF"), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 30, true))); cardboardDisableButton_->OnClick.Handle(this, &EmuScreen::OnDisableCardboard); cardboardDisableButton_->SetVisibility(V_GONE); @@ -1166,19 +1179,13 @@ UI::EventReturn EmuScreen::OnResume(UI::EventParams ¶ms) { return UI::EVENT_DONE; } -UI::EventReturn EmuScreen::OnReset(UI::EventParams ¶ms) { - if (coreState == CoreState::CORE_RUNTIME_ERROR) { - System_PostUIMessage(UIMessage::REQUEST_GAME_RESET); - } - return UI::EVENT_DONE; -} - void EmuScreen::update() { using namespace UI; UIScreen::update(); resumeButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR && Memory::MemFault_MayBeResumable() ? V_VISIBLE : V_GONE); resetButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR ? V_VISIBLE : V_GONE); + backButton_->SetVisibility(coreState == CoreState::CORE_RUNTIME_ERROR ? V_VISIBLE : V_GONE); if (chatButton_ && chatMenu_) { if (chatMenu_->GetVisibility() != V_GONE) { diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index a80e684019..4637d6fe5f 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -67,7 +67,6 @@ private: UI::EventReturn OnDisableCardboard(UI::EventParams ¶ms); UI::EventReturn OnChat(UI::EventParams ¶ms); UI::EventReturn OnResume(UI::EventParams ¶ms); - UI::EventReturn OnReset(UI::EventParams ¶ms); void bootGame(const Path &filename); bool bootAllowStorage(const Path &filename); @@ -114,6 +113,7 @@ private: UI::TextView *loadingTextView_ = nullptr; UI::Button *resumeButton_ = nullptr; UI::Button *resetButton_ = nullptr; + UI::Button *backButton_ = nullptr; UI::View *chatButton_ = nullptr; ChatMenu *chatMenu_ = nullptr;