From 1640a39de87ea830c290fb3241abf3bd5239cee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 22 Nov 2020 19:08:14 +0100 Subject: [PATCH] Add developer setting "Show on screen messages". Uncheck to hide them. Fixes #13682. Might move to system settings or something next release, don't want to cause a mess in translations. --- Core/Config.cpp | 1 + Core/Config.h | 1 + UI/EmuScreen.cpp | 7 ++++--- UI/EmuScreen.h | 3 +++ UI/GameSettingsScreen.cpp | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 2ef04d1cb8..e6e0c0adf1 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -461,6 +461,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("EnableStateUndo", &g_Config.bEnableStateUndo, &DefaultEnableStateUndo, true, true), ConfigSetting("RewindFlipFrequency", &g_Config.iRewindFlipFrequency, 0, true, true), + ConfigSetting("ShowOnScreenMessage", &g_Config.bShowOnScreenMessages, true, true, false), ConfigSetting("ShowRegionOnGameIcon", &g_Config.bShowRegionOnGameIcon, false), ConfigSetting("ShowIDOnGameIcon", &g_Config.bShowIDOnGameIcon, false), ConfigSetting("GameGridScale", &g_Config.fGameGridScale, 1.0), diff --git a/Core/Config.h b/Core/Config.h index 8a1f7bd7a0..e876e40227 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -238,6 +238,7 @@ public: bool bShowRegionOnGameIcon; bool bShowIDOnGameIcon; float fGameGridScale; + bool bShowOnScreenMessages; // TODO: Maybe move to a separate theme system. uint32_t uItemStyleFg; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 3a3c5ddb45..7ddf06d161 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1071,7 +1071,7 @@ void EmuScreen::CreateViews() { saveStatePreview_->SetVisibility(V_GONE); saveStatePreview_->SetCanBeFocused(false); root_->Add(saveStatePreview_); - root_->Add(new OnScreenMessagesView(new AnchorLayoutParams((Size)bounds.w, (Size)bounds.h))); + onScreenMessagesView_ = root_->Add(new OnScreenMessagesView(new AnchorLayoutParams((Size)bounds.w, (Size)bounds.h))); GameInfoBGView *loadingBG = root_->Add(new GameInfoBGView(gamePath_, new AnchorLayoutParams(FILL_PARENT, FILL_PARENT))); TextView *loadingTextView = root_->Add(new TextView(sc->T(PSP_GetLoading()), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 40, true))); @@ -1142,11 +1142,12 @@ UI::EventReturn EmuScreen::OnChat(UI::EventParams& params) { } void EmuScreen::update() { - UIScreen::update(); + onScreenMessagesView_->SetVisibility(g_Config.bShowOnScreenMessages ? UI::Visibility::V_VISIBLE : UI::Visibility::V_GONE); - if (bootPending_) + if (bootPending_) { bootGame(gamePath_); + } // Simply forcibly update to the current screen size every frame. Doesn't cost much. // If bounds is set to be smaller than the actual pixel resolution of the display, respect that. diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 77a072f433..69befa43b0 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -30,6 +30,7 @@ struct AxisInput; class AsyncImageFileView; +class OnScreenMessagesView; class EmuScreen : public UIScreen { public: @@ -106,6 +107,8 @@ private: UI::TextView *loadingTextView_ = nullptr; UI::Button *cardboardDisableButton_ = nullptr; + OnScreenMessagesView *onScreenMessagesView_ = nullptr; + bool autoRotatingAnalogCW_ = false; bool autoRotatingAnalogCCW_ = false; }; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 3bb7820ec9..a19a6620d4 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1650,6 +1650,7 @@ void DeveloperToolsScreen::CreateViews() { list->Add(allowDebugger)->OnClick.Handle(this, &DeveloperToolsScreen::OnRemoteDebugger); allowDebugger->SetEnabledPtr(&canAllowDebugger_); + list->Add(new CheckBox(&g_Config.bShowOnScreenMessages, dev->T("Show on-screen messages"))); list->Add(new CheckBox(&g_Config.bEnableLogging, dev->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged); list->Add(new CheckBox(&g_Config.bLogFrameDrops, dev->T("Log Dropped Frame Statistics"))); list->Add(new Choice(dev->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig);