From c984897b2ec8dad8b06c1b7ace08f2871ff79e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 13 May 2025 10:46:06 +0200 Subject: [PATCH] Minor cleanup, check --- UI/EmuScreen.cpp | 34 ++++++++++++++++------------------ UI/EmuScreen.h | 2 -- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 894c52cd29..b9cdebc15a 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -440,8 +440,10 @@ void EmuScreen::bootComplete() { saveStateSlot_ = SaveState::GetCurrentSlot(); - loadingViewColor_->Divert(0x00FFFFFF, 0.2f); - loadingViewVisible_->Divert(UI::V_INVISIBLE, 0.2f); + if (loadingViewColor_) + loadingViewColor_->Divert(0x00FFFFFF, 0.2f); + if (loadingViewVisible_) + loadingViewVisible_->Divert(UI::V_INVISIBLE, 0.2f); std::string gameID = g_paramSFO.GetValueString("DISC_ID"); g_Config.TimeTracker().Start(gameID); @@ -1217,7 +1219,14 @@ void EmuScreen::CreateViews() { root_->Add(buttons); resumeButton_ = buttons->Add(new Button(dev->T("Resume"))); - resumeButton_->OnClick.Handle(this, &EmuScreen::OnResume); + resumeButton_->OnClick.Add([this](UI::EventParams &) { + if (coreState == CoreState::CORE_RUNTIME_ERROR) { + // Force it! + Memory::MemFault_IgnoreLastCrash(); + coreState = CoreState::CORE_RUNNING_CPU; + } + return UI::EVENT_DONE; + }); resumeButton_->SetVisibility(V_GONE); resetButton_ = buttons->Add(new Button(dev->T("Reset"))); @@ -1237,7 +1246,10 @@ void EmuScreen::CreateViews() { 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_->OnClick.Add([](UI::EventParams &) { + g_Config.bEnableCardboardVR = false; + return UI::EVENT_DONE; + }); cardboardDisableButton_->SetVisibility(V_GONE); cardboardDisableButton_->SetScale(0.65f); // make it smaller - this button can be in the way otherwise. @@ -1331,11 +1343,6 @@ UI::EventReturn EmuScreen::OnDevTools(UI::EventParams ¶ms) { return UI::EVENT_DONE; } -UI::EventReturn EmuScreen::OnDisableCardboard(UI::EventParams ¶ms) { - g_Config.bEnableCardboardVR = false; - return UI::EVENT_DONE; -} - UI::EventReturn EmuScreen::OnChat(UI::EventParams ¶ms) { if (chatButton_ != nullptr && chatButton_->GetVisibility() == UI::V_VISIBLE) { chatButton_->SetVisibility(UI::V_GONE); @@ -1357,15 +1364,6 @@ UI::EventReturn EmuScreen::OnChat(UI::EventParams ¶ms) { return UI::EVENT_DONE; } -UI::EventReturn EmuScreen::OnResume(UI::EventParams ¶ms) { - if (coreState == CoreState::CORE_RUNTIME_ERROR) { - // Force it! - Memory::MemFault_IgnoreLastCrash(); - coreState = CoreState::CORE_RUNNING_CPU; - } - return UI::EVENT_DONE; -} - // To avoid including proAdhoc.h, which includes a lot of stuff. int GetChatMessageCount(); diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index a18d2866c6..17c5d64eaa 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -74,9 +74,7 @@ protected: private: void CreateViews() override; UI::EventReturn OnDevTools(UI::EventParams ¶ms); - UI::EventReturn OnDisableCardboard(UI::EventParams ¶ms); UI::EventReturn OnChat(UI::EventParams ¶ms); - UI::EventReturn OnResume(UI::EventParams ¶ms); void ProcessGameBoot(const Path &filename); bool bootAllowStorage(const Path &filename);