FullscreenUI: Only show debug menu bar in NoGUI

This commit is contained in:
Connor McLaughlin 2021-02-24 18:56:41 +10:00
parent 85ad091c22
commit b56b438f1f
3 changed files with 24 additions and 10 deletions

View File

@ -61,7 +61,10 @@ bool NoGUIHostInterface::Initialize()
}
if (m_fullscreen_ui_enabled)
{
FullscreenUI::SetDebugMenuAllowed(true);
FullscreenUI::QueueGameListRefresh();
}
// process events to pick up controllers before updating input map
PollAndUpdate();

View File

@ -85,11 +85,14 @@ static void DrawStatsOverlay();
static void DrawOSDMessages();
static void DrawAboutWindow();
static void OpenAboutWindow();
static void SetDebugMenuEnabled(bool enabled);
static void UpdateDebugMenuVisibility();
static CommonHostInterface* s_host_interface;
static MainWindowType s_current_main_window = MainWindowType::Landing;
static std::bitset<static_cast<u32>(FrontendCommon::ControllerNavigationButton::Count)> s_nav_input_values{};
static bool s_debug_menu_enabled = false;
static bool s_debug_menu_allowed = false;
static bool s_quick_menu_was_open = false;
static bool s_was_paused_on_quick_menu_open = false;
static bool s_about_window_open = false;
@ -195,7 +198,7 @@ bool Initialize(CommonHostInterface* host_interface)
return false;
s_settings_copy.Load(*s_host_interface->GetSettingsInterface());
SetDebugMenuEnabled(s_host_interface->GetSettingsInterface()->GetBoolValue("Main", "ShowDebugMenu", false));
UpdateDebugMenuVisibility();
ImGuiFullscreen::UpdateLayoutScale();
ImGuiFullscreen::UpdateFonts();
@ -1937,7 +1940,7 @@ void DrawSettingsWindow()
if (ToggleButton("Enable Debug Menu", "Shows a debug menu bar with additional statistics and quick settings.",
&debug_menu))
{
s_host_interface->RunLater([debug_menu]() { SetDebugMenuEnabled(debug_menu, true); });
s_host_interface->RunLater([debug_menu]() { SetDebugMenuEnabled(debug_menu); });
}
settings_changed |=
@ -2982,8 +2985,22 @@ bool DrawConfirmWindow(const char* message, bool* result)
// Debug Menu
//////////////////////////////////////////////////////////////////////////
void SetDebugMenuEnabled(bool enabled, bool save_to_ini)
void SetDebugMenuAllowed(bool allowed)
{
s_debug_menu_enabled = allowed;
UpdateDebugMenuVisibility();
}
void SetDebugMenuEnabled(bool enabled)
{
s_host_interface->GetSettingsInterface()->SetBoolValue("Main", "ShowDebugMenu", enabled);
s_host_interface->GetSettingsInterface()->Save();
}
void UpdateDebugMenuVisibility()
{
const bool enabled =
s_debug_menu_allowed && s_host_interface->GetSettingsInterface()->GetBoolValue("Main", "ShowDebugMenu", false);
if (s_debug_menu_enabled == enabled)
return;
@ -2994,12 +3011,6 @@ void SetDebugMenuEnabled(bool enabled, bool save_to_ini)
if (ImGuiFullscreen::UpdateFonts())
s_host_interface->GetDisplay()->UpdateImGuiFontTexture();
s_debug_menu_enabled = enabled;
if (save_to_ini)
{
s_host_interface->GetSettingsInterface()->SetBoolValue("Main", "ShowDebugMenu", enabled);
s_host_interface->GetSettingsInterface()->Save();
}
}
static void DrawDebugStats();

View File

@ -60,7 +60,7 @@ void EnsureGameListLoaded();
Settings& GetSettingsCopy();
void SaveAndApplySettings();
void SetDebugMenuEnabled(bool enabled, bool save_to_ini = false);
void SetDebugMenuAllowed(bool allowed);
/// Only ImGuiNavInput_Activate, ImGuiNavInput_Cancel, and DPad should be forwarded.
/// Returns true if the UI consumed the event, and it should not execute the normal handler.