From 931eafd565a6f4f7da5bc82bb238da34ea12e2ea Mon Sep 17 00:00:00 2001 From: Giovanni Cocco Date: Thu, 26 Sep 2024 19:15:17 +0200 Subject: [PATCH] Keep only the LUT addition --- Common/UI/PopupScreens.cpp | 15 --------------- Common/UI/PopupScreens.h | 2 -- Common/UI/View.cpp | 5 ----- Common/UI/View.h | 1 - Core/ConfigSettings.cpp | 4 ++-- Core/ConfigSettings.h | 3 ++- 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Common/UI/PopupScreens.cpp b/Common/UI/PopupScreens.cpp index cb737cc348..a8715591d1 100644 --- a/Common/UI/PopupScreens.cpp +++ b/Common/UI/PopupScreens.cpp @@ -10,7 +10,6 @@ #include "Common/Data/Text/I18n.h" #include "Common/System/System.h" #include "Common/System/Request.h" -#include "Core/ConfigSettings.h" namespace UI { @@ -200,14 +199,6 @@ void PopupSliderChoiceFloat::SetFormat(std::string_view fmt) { } } -bool PopupSliderChoiceFloat::perGame() const { - return ConfigSetting::perGame(value_); -} - -bool PopupSliderChoice::perGame() const { - return ConfigSetting::perGame(value_); -} - EventReturn PopupSliderChoice::HandleClick(EventParams &e) { restoreFocus_ = HasFocus(); @@ -653,13 +644,7 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) { dc.MeasureTextRect(dc.theme->uiFont, scale, scale, valueText, availBounds, &w, &h, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT); textPadding_.right = w + paddingX; - if (perGame()) { - textPadding_.left = 30; - } Choice::Draw(dc); - if (perGame()) { - dc.Draw()->DrawImage(ImageID("I_GEAR"), bounds_.x + 22, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_CENTER); - } int imagePadding = 0; if (rightIconImage_.isValid()) { imagePadding = bounds_.h; diff --git a/Common/UI/PopupScreens.h b/Common/UI/PopupScreens.h index 9251beb9c8..1eab264abf 100644 --- a/Common/UI/PopupScreens.h +++ b/Common/UI/PopupScreens.h @@ -297,7 +297,6 @@ public: protected: std::string ValueText() const override; - bool perGame() const override; private: EventReturn HandleClick(EventParams &e); @@ -336,7 +335,6 @@ public: protected: std::string ValueText() const override; - bool perGame() const override; private: EventReturn HandleClick(EventParams &e); diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index b18a5707b4..0ee17eaa82 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -18,7 +18,6 @@ #include "Common/TimeUtil.h" #include "Common/StringUtils.h" #include "Common/Log.h" -#include "Core/ConfigSettings.h" namespace UI { @@ -799,10 +798,6 @@ void CheckBox::Draw(UIContext &dc) { if (!text_.empty()) { Bounds textBounds(bounds_.x + paddingX, bounds_.y, availWidth, bounds_.h); - if (ConfigSetting::perGame(toggle_)) { - dc.Draw()->DrawImage(ImageID("I_GEAR"), bounds_.x + 22, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_CENTER); - textBounds.x += 30; - } dc.DrawTextRectSqueeze(text_, textBounds, style.fgColor, ALIGN_VCENTER | FLAG_WRAP_TEXT); } dc.Draw()->DrawImage(image, bounds_.x2() - paddingX, bounds_.centerY(), 1.0f, style.fgColor, ALIGN_RIGHT | ALIGN_VCENTER); diff --git a/Common/UI/View.h b/Common/UI/View.h index f17552c154..c39cd4538a 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -829,7 +829,6 @@ public: } protected: virtual std::string ValueText() const = 0; - virtual bool perGame() const { return false; } float CalculateValueScale(const UIContext &dc, std::string_view valueText, float availWidth) const; diff --git a/Core/ConfigSettings.cpp b/Core/ConfigSettings.cpp index 7739a1cb88..6de81dc3a0 100644 --- a/Core/ConfigSettings.cpp +++ b/Core/ConfigSettings.cpp @@ -11,8 +11,8 @@ std::unordered_map& ConfigSetting::getPtrLUT() { return lut; } -bool ConfigSetting::perGame(void* ptr) { - return g_Config.bGameSpecific && ConfigSetting::getPtrLUT().count(ptr) > 0 && ConfigSetting::getPtrLUT()[ptr]->PerGame(); +bool ConfigSetting::perGame(void *ptr) { + return g_Config.bGameSpecific && getPtrLUT().count(ptr) > 0 && getPtrLUT()[ptr]->PerGame(); } bool ConfigSetting::Get(const Section *section) const { diff --git a/Core/ConfigSettings.h b/Core/ConfigSettings.h index 7cf71d475e..a643138101 100644 --- a/Core/ConfigSettings.h +++ b/Core/ConfigSettings.h @@ -227,7 +227,8 @@ struct ConfigSetting { const Type type_; - static bool perGame(void* ptr); + // Returns false if per-game settings are not currently used + static bool perGame(void *ptr); private: CfgFlag flags_;