From e172cc106050caed8afd6c482c2c91fe1dc904f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 22 Nov 2025 16:33:58 +0100 Subject: [PATCH] Correct resetting some touch control parameters. Fixes #20993 --- Core/Config.cpp | 5 +++-- UI/TouchControlLayoutScreen.cpp | 8 +++----- UI/TouchControlLayoutScreen.h | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index b4183f5f99..781b41ef2f 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -873,8 +873,9 @@ void TouchControlConfig::ResetLayout() { } bool TouchControlConfig::ResetToDefault(std::string_view blockName) { - // We do this traditionally for now. - return false; + static const TouchControlConfig defaults = TouchControlConfig(); + *this = defaults; + return true; } static const ConfigSetting touchControlSettings[] = { diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index efe8cfb171..ac99586ce8 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -587,10 +587,6 @@ void TouchControlLayoutScreen::onFinish(DialogResult reason) { g_Config.Save("TouchControlLayoutScreen::onFinish"); } -void TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) { - screenManager()->push(new TouchControlVisibilityScreen(gamePath_)); -} - void TouchControlLayoutScreen::OnReset(UI::EventParams &e) { INFO_LOG(Log::G3D, "Resetting touch control layout to default."); @@ -670,7 +666,9 @@ void TouchControlLayoutScreen::CreateViews() { gridSize->SetEnabledPtr(&g_Config.bTouchSnapToGrid); leftColumn->Add(mode_); - leftColumn->Add(new Choice(co->T("Customize")))->OnClick.Handle(this, &TouchControlLayoutScreen::OnVisibility); + leftColumn->Add(new Choice(co->T("Customize")))->OnClick.Add([this](UI::EventParams &e) { + screenManager()->push(new TouchControlVisibilityScreen(gamePath_)); + }); leftColumn->Add(snap); leftColumn->Add(gridSize); leftColumn->Add(new Choice(di->T("Reset")))->OnClick.Handle(this, &TouchControlLayoutScreen::OnReset); diff --git a/UI/TouchControlLayoutScreen.h b/UI/TouchControlLayoutScreen.h index 50202d81a0..9f298f171c 100644 --- a/UI/TouchControlLayoutScreen.h +++ b/UI/TouchControlLayoutScreen.h @@ -38,7 +38,6 @@ public: protected: void OnReset(UI::EventParams &e); - void OnVisibility(UI::EventParams &e); void OnMode(UI::EventParams &e); private: