FullscreenUI: Make show status indicator setting local

This commit is contained in:
Connor McLaughlin 2021-05-13 03:37:06 +10:00
parent 172ba1fc32
commit 08a815ad7b
8 changed files with 44 additions and 37 deletions

View File

@ -492,7 +492,6 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetBoolValue("Main", "ApplyGameSettings", true); si.SetBoolValue("Main", "ApplyGameSettings", true);
si.SetBoolValue("Main", "AutoLoadCheats", true); si.SetBoolValue("Main", "AutoLoadCheats", true);
si.SetBoolValue("Main", "DisableAllEnhancements", false); si.SetBoolValue("Main", "DisableAllEnhancements", false);
si.SetBoolValue("Main", "ShowSpeedIcons", true);
si.SetBoolValue("Main", "RewindEnable", false); si.SetBoolValue("Main", "RewindEnable", false);
si.SetFloatValue("Main", "RewindFrequency", 10.0f); si.SetFloatValue("Main", "RewindFrequency", 10.0f);
si.SetIntValue("Main", "RewindSaveSlots", 10); si.SetIntValue("Main", "RewindSaveSlots", 10);

View File

@ -166,7 +166,6 @@ void Settings::Load(SettingsInterface& si)
apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true); apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true);
auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true); auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true);
disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false); disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false);
show_speed_icons = si.GetBoolValue("Main", "ShowSpeedIcons", true);
rewind_enable = si.GetBoolValue("Main", "RewindEnable", false); rewind_enable = si.GetBoolValue("Main", "RewindEnable", false);
rewind_save_frequency = si.GetFloatValue("Main", "RewindFrequency", 10.0f); rewind_save_frequency = si.GetFloatValue("Main", "RewindFrequency", 10.0f);
rewind_save_slots = static_cast<u32>(si.GetIntValue("Main", "RewindSaveSlots", 10)); rewind_save_slots = static_cast<u32>(si.GetIntValue("Main", "RewindSaveSlots", 10));
@ -359,7 +358,6 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings); si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings);
si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats); si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats);
si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements); si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements);
si.SetBoolValue("Main", "ShowSpeedIcons", show_speed_icons);
si.SetBoolValue("Main", "RewindEnable", rewind_enable); si.SetBoolValue("Main", "RewindEnable", rewind_enable);
si.SetFloatValue("Main", "RewindFrequency", rewind_save_frequency); si.SetFloatValue("Main", "RewindFrequency", rewind_save_frequency);
si.SetIntValue("Main", "RewindSaveSlots", rewind_save_slots); si.SetIntValue("Main", "RewindSaveSlots", rewind_save_slots);

View File

@ -96,7 +96,6 @@ struct Settings
bool apply_game_settings = true; bool apply_game_settings = true;
bool auto_load_cheats = false; bool auto_load_cheats = false;
bool disable_all_enhancements = false; bool disable_all_enhancements = false;
bool show_speed_icons = false;
bool rewind_enable = false; bool rewind_enable = false;
float rewind_save_frequency = 10.0f; float rewind_save_frequency = 10.0f;

View File

@ -136,7 +136,6 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface,
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, "Logging", "LogToFile"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, "Logging", "LogToFile");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showSpeedIcons, "Main", "ShowSpeedIcons", true);
connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked); connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked);
connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(), connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(),
@ -146,6 +145,8 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface,
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main", addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main",
"DisableAllEnhancements", false); "DisableAllEnhancements", false);
addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Show Fullscreen Status Indicators"), "Display",
"ShowStatusIndicators", true);
addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000, addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000,
0); 0);
@ -209,8 +210,6 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface,
tr("Logs messages to duckstation.log in the user directory.")); tr("Logs messages to duckstation.log in the user directory."));
dialog->registerWidgetHelp(m_ui.showDebugMenu, tr("Show Debug Menu"), tr("Unchecked"), dialog->registerWidgetHelp(m_ui.showDebugMenu, tr("Show Debug Menu"), tr("Unchecked"),
tr("Shows a debug menu bar with additional statistics and quick settings.")); tr("Shows a debug menu bar with additional statistics and quick settings."));
dialog->registerWidgetHelp(m_ui.showSpeedIcons, tr("Show Speed Icons"), tr("Checked"),
tr("Shows persistent icons when turbo is active or when paused while using the fullscreen UI."));
} }
AdvancedSettingsWidget::~AdvancedSettingsWidget() = default; AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
@ -218,24 +217,25 @@ AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
void AdvancedSettingsWidget::onResetToDefaultClicked() void AdvancedSettingsWidget::onResetToDefaultClicked()
{ {
setBooleanTweakOption(m_ui.tweakOptionTable, 0, false); setBooleanTweakOption(m_ui.tweakOptionTable, 0, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 1, 0); setBooleanTweakOption(m_ui.tweakOptionTable, 1, true);
setBooleanTweakOption(m_ui.tweakOptionTable, 2, false); setIntRangeTweakOption(m_ui.tweakOptionTable, 2, 0);
setFloatRangeTweakOption(m_ui.tweakOptionTable, 3, -1.0f); setBooleanTweakOption(m_ui.tweakOptionTable, 3, false);
setFloatRangeTweakOption(m_ui.tweakOptionTable, 4, Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD); setFloatRangeTweakOption(m_ui.tweakOptionTable, 4, -1.0f);
setBooleanTweakOption(m_ui.tweakOptionTable, 5, false); setFloatRangeTweakOption(m_ui.tweakOptionTable, 5, Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD);
setChoiceTweakOption(m_ui.tweakOptionTable, 6, Settings::DEFAULT_CPU_FASTMEM_MODE); setBooleanTweakOption(m_ui.tweakOptionTable, 6, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 7, false); setChoiceTweakOption(m_ui.tweakOptionTable, 7, Settings::DEFAULT_CPU_FASTMEM_MODE);
setBooleanTweakOption(m_ui.tweakOptionTable, 8, false); setBooleanTweakOption(m_ui.tweakOptionTable, 8, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 9, false); setBooleanTweakOption(m_ui.tweakOptionTable, 9, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 10, false); setBooleanTweakOption(m_ui.tweakOptionTable, 10, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 11, false); setBooleanTweakOption(m_ui.tweakOptionTable, 11, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 12, Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD); setBooleanTweakOption(m_ui.tweakOptionTable, 12, false);
setIntRangeTweakOption(m_ui.tweakOptionTable, 13, Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD); setIntRangeTweakOption(m_ui.tweakOptionTable, 13, Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
setIntRangeTweakOption(m_ui.tweakOptionTable, 14, static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS)); setIntRangeTweakOption(m_ui.tweakOptionTable, 14, Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
setIntRangeTweakOption(m_ui.tweakOptionTable, 15, static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS)); setIntRangeTweakOption(m_ui.tweakOptionTable, 15, static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS));
setIntRangeTweakOption(m_ui.tweakOptionTable, 16, static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE)); setIntRangeTweakOption(m_ui.tweakOptionTable, 16, static_cast<int>(Settings::DEFAULT_DMA_HALT_TICKS));
setIntRangeTweakOption(m_ui.tweakOptionTable, 17, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD)); setIntRangeTweakOption(m_ui.tweakOptionTable, 17, static_cast<int>(Settings::DEFAULT_GPU_FIFO_SIZE));
setBooleanTweakOption(m_ui.tweakOptionTable, 18, false); setIntRangeTweakOption(m_ui.tweakOptionTable, 18, static_cast<int>(Settings::DEFAULT_GPU_MAX_RUN_AHEAD));
setBooleanTweakOption(m_ui.tweakOptionTable, 19, true); setBooleanTweakOption(m_ui.tweakOptionTable, 19, false);
setBooleanTweakOption(m_ui.tweakOptionTable, 20, false); setBooleanTweakOption(m_ui.tweakOptionTable, 20, true);
setBooleanTweakOption(m_ui.tweakOptionTable, 21, false);
} }

View File

@ -104,13 +104,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QCheckBox" name="showSpeedIcons">
<property name="text">
<string>Show Speed Icons</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -2616,6 +2616,7 @@ void CommonHostInterface::SetDefaultSettings(SettingsInterface& si)
ControllerInterface::GetBackendName(ControllerInterface::GetDefaultBackend())); ControllerInterface::GetBackendName(ControllerInterface::GetDefaultBackend()));
si.SetBoolValue("Display", "InternalResolutionScreenshots", false); si.SetBoolValue("Display", "InternalResolutionScreenshots", false);
si.SetBoolValue("Display", "ShowStatusIndicators", true);
#ifdef WITH_DISCORD_PRESENCE #ifdef WITH_DISCORD_PRESENCE
si.SetBoolValue("Main", "EnableDiscordPresence", false); si.SetBoolValue("Main", "EnableDiscordPresence", false);
@ -2699,6 +2700,10 @@ void CommonHostInterface::LoadSettings(SettingsInterface& si)
} }
} }
} }
else if (m_fullscreen_ui_enabled)
{
FullscreenUI::UpdateSettings();
}
const bool input_display_enabled = si.GetBoolValue("Display", "ShowInputs", false); const bool input_display_enabled = si.GetBoolValue("Display", "ShowInputs", false);
const bool input_display_state = static_cast<bool>(s_input_overlay_ui); const bool input_display_state = static_cast<bool>(s_input_overlay_ui);

View File

@ -79,6 +79,7 @@ namespace FullscreenUI {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Main // Main
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static void LoadSettings();
static void ClearImGuiFocus(); static void ClearImGuiFocus();
static void ReturnToMainWindow(); static void ReturnToMainWindow();
static void DrawLandingWindow(); static void DrawLandingWindow();
@ -106,6 +107,7 @@ static MainWindowType s_current_main_window = MainWindowType::Landing;
static std::bitset<static_cast<u32>(FrontendCommon::ControllerNavigationButton::Count)> s_nav_input_values{}; 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_enabled = false;
static bool s_debug_menu_allowed = false; static bool s_debug_menu_allowed = false;
static bool s_show_status_indicators = false;
static bool s_quick_menu_was_open = false; static bool s_quick_menu_was_open = false;
static bool s_was_paused_on_quick_menu_open = false; static bool s_was_paused_on_quick_menu_open = false;
static bool s_about_window_open = false; static bool s_about_window_open = false;
@ -214,6 +216,7 @@ bool Initialize(CommonHostInterface* host_interface)
return false; return false;
s_settings_copy.Load(*s_host_interface->GetSettingsInterface()); s_settings_copy.Load(*s_host_interface->GetSettingsInterface());
LoadSettings();
UpdateDebugMenuVisibility(); UpdateDebugMenuVisibility();
ImGuiFullscreen::UpdateLayoutScale(); ImGuiFullscreen::UpdateLayoutScale();
@ -234,6 +237,16 @@ bool HasActiveWindow()
ImGuiFullscreen::IsChoiceDialogOpen() || ImGuiFullscreen::IsFileSelectorOpen(); ImGuiFullscreen::IsChoiceDialogOpen() || ImGuiFullscreen::IsFileSelectorOpen();
} }
void LoadSettings()
{
s_show_status_indicators = s_host_interface->GetBoolSettingValue("Display", "ShowStatusIndicators", true);
}
void UpdateSettings()
{
LoadSettings();
}
void SystemCreated() void SystemCreated()
{ {
s_current_main_window = MainWindowType::None; s_current_main_window = MainWindowType::None;
@ -353,6 +366,7 @@ void SaveAndApplySettings()
s_settings_copy.Save(*s_host_interface->GetSettingsInterface()); s_settings_copy.Save(*s_host_interface->GetSettingsInterface());
s_host_interface->GetSettingsInterface()->Save(); s_host_interface->GetSettingsInterface()->Save();
s_host_interface->ApplySettings(false); s_host_interface->ApplySettings(false);
UpdateSettings();
} }
void ClearImGuiFocus() void ClearImGuiFocus()
@ -2280,10 +2294,6 @@ void DrawSettingsWindow()
s_host_interface->RunLater([debug_menu]() { SetDebugMenuEnabled(debug_menu); }); s_host_interface->RunLater([debug_menu]() { SetDebugMenuEnabled(debug_menu); });
} }
settings_changed |= ToggleButton("Show Speed Icons",
"Shows persistent icons when turbo is active or when paused.",
&s_settings_copy.show_speed_icons);
settings_changed |= settings_changed |=
ToggleButton("Disable All Enhancements", "Temporarily disables all enhancements, useful when testing.", ToggleButton("Disable All Enhancements", "Temporarily disables all enhancements, useful when testing.",
&s_settings_copy.disable_all_enhancements); &s_settings_copy.disable_all_enhancements);
@ -2299,6 +2309,9 @@ void DrawSettingsWindow()
#endif #endif
MenuHeading("Display Settings"); MenuHeading("Display Settings");
settings_changed |= ToggleButtonForNonSetting("Show Status Indicators",
"Shows persistent icons when turbo is active or when paused.",
"Display", "ShowStatusIndicators", true);
settings_changed |= RangeButton( settings_changed |= RangeButton(
"Display FPS Limit", "Limits how many frames are displayed to the screen. These frames are still rendered.", "Display FPS Limit", "Limits how many frames are displayed to the screen. These frames are still rendered.",
&s_settings_copy.display_max_fps, 0.0f, 500.0f, 1.0f, "%.2f FPS"); &s_settings_copy.display_max_fps, 0.0f, 500.0f, 1.0f, "%.2f FPS");
@ -3126,14 +3139,13 @@ void DrawStatsOverlay()
DRAW_LINE(g_large_font, g_large_font->FontSize, 0.0f, IM_COL32(255, 255, 255, 255)); DRAW_LINE(g_large_font, g_large_font->FontSize, 0.0f, IM_COL32(255, 255, 255, 255));
} }
if (g_settings.show_speed_icons && if (s_show_status_indicators && (s_host_interface->IsFastForwardEnabled() || s_host_interface->IsTurboEnabled()))
(s_host_interface->IsFastForwardEnabled() || s_host_interface->IsTurboEnabled()))
{ {
text.Assign(ICON_FA_FAST_FORWARD); text.Assign(ICON_FA_FAST_FORWARD);
DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255)); DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255));
} }
} }
else if (g_settings.show_speed_icons && state == System::State::Paused) else if (s_show_status_indicators && state == System::State::Paused)
{ {
text.Assign(ICON_FA_PAUSE); text.Assign(ICON_FA_PAUSE);
DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255)); DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255));

View File

@ -41,6 +41,7 @@ enum class SettingsPage
bool Initialize(CommonHostInterface* host_interface); bool Initialize(CommonHostInterface* host_interface);
bool HasActiveWindow(); bool HasActiveWindow();
void UpdateSettings();
void SystemCreated(); void SystemCreated();
void SystemDestroyed(); void SystemDestroyed();
void SystemPaused(bool paused); void SystemPaused(bool paused);