mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-31 03:45:38 +00:00
FullscreenUI: Add 'Pause on Menu' option
This commit is contained in:
parent
b56b438f1f
commit
f023c1bcde
|
@ -494,6 +494,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||||
si.SetBoolValue("Main", "StartPaused", false);
|
si.SetBoolValue("Main", "StartPaused", false);
|
||||||
si.SetBoolValue("Main", "StartFullscreen", false);
|
si.SetBoolValue("Main", "StartFullscreen", false);
|
||||||
si.SetBoolValue("Main", "PauseOnFocusLoss", false);
|
si.SetBoolValue("Main", "PauseOnFocusLoss", false);
|
||||||
|
si.SetBoolValue("Main", "PauseOnMenu", true);
|
||||||
si.SetBoolValue("Main", "SaveStateOnExit", true);
|
si.SetBoolValue("Main", "SaveStateOnExit", true);
|
||||||
si.SetBoolValue("Main", "ConfirmPowerOff", true);
|
si.SetBoolValue("Main", "ConfirmPowerOff", true);
|
||||||
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
||||||
|
|
|
@ -117,6 +117,7 @@ void Settings::Load(SettingsInterface& si)
|
||||||
start_paused = si.GetBoolValue("Main", "StartPaused", false);
|
start_paused = si.GetBoolValue("Main", "StartPaused", false);
|
||||||
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
|
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
|
||||||
pause_on_focus_loss = si.GetBoolValue("Main", "PauseOnFocusLoss", false);
|
pause_on_focus_loss = si.GetBoolValue("Main", "PauseOnFocusLoss", false);
|
||||||
|
pause_on_menu = si.GetBoolValue("Main", "PauseOnMenu", true);
|
||||||
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
||||||
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
||||||
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
||||||
|
@ -294,6 +295,7 @@ void Settings::Save(SettingsInterface& si) const
|
||||||
si.SetBoolValue("Main", "StartPaused", start_paused);
|
si.SetBoolValue("Main", "StartPaused", start_paused);
|
||||||
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);
|
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);
|
||||||
si.SetBoolValue("Main", "PauseOnFocusLoss", pause_on_focus_loss);
|
si.SetBoolValue("Main", "PauseOnFocusLoss", pause_on_focus_loss);
|
||||||
|
si.SetBoolValue("Main", "PauseOnMenu", pause_on_menu);
|
||||||
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
||||||
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
||||||
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
|
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
|
||||||
|
|
|
@ -88,6 +88,7 @@ struct Settings
|
||||||
bool start_paused = false;
|
bool start_paused = false;
|
||||||
bool start_fullscreen = false;
|
bool start_fullscreen = false;
|
||||||
bool pause_on_focus_loss = false;
|
bool pause_on_focus_loss = false;
|
||||||
|
bool pause_on_menu = true;
|
||||||
bool save_state_on_exit = true;
|
bool save_state_on_exit = true;
|
||||||
bool confim_power_off = true;
|
bool confim_power_off = true;
|
||||||
bool load_devices_from_save_states = false;
|
bool load_devices_from_save_states = false;
|
||||||
|
|
|
@ -242,7 +242,7 @@ void OpenQuickMenu()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_was_paused_on_quick_menu_open = System::IsPaused();
|
s_was_paused_on_quick_menu_open = System::IsPaused();
|
||||||
if (s_settings_copy.pause_on_focus_loss && !s_was_paused_on_quick_menu_open)
|
if (s_settings_copy.pause_on_menu && !s_was_paused_on_quick_menu_open)
|
||||||
s_host_interface->RunLater([]() { s_host_interface->PauseSystem(true); });
|
s_host_interface->RunLater([]() { s_host_interface->PauseSystem(true); });
|
||||||
|
|
||||||
s_current_main_window = MainWindowType::QuickMenu;
|
s_current_main_window = MainWindowType::QuickMenu;
|
||||||
|
@ -343,10 +343,10 @@ void ClearImGuiFocus()
|
||||||
|
|
||||||
void ReturnToMainWindow()
|
void ReturnToMainWindow()
|
||||||
{
|
{
|
||||||
if (System::IsValid())
|
if (s_quick_menu_was_open)
|
||||||
s_current_main_window = s_quick_menu_was_open ? MainWindowType::QuickMenu : MainWindowType::None;
|
CloseQuickMenu();
|
||||||
else
|
|
||||||
s_current_main_window = MainWindowType::Landing;
|
s_current_main_window = System::IsValid() ? MainWindowType::None : MainWindowType::Landing;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadResources()
|
bool LoadResources()
|
||||||
|
@ -592,7 +592,10 @@ static void DoCheatsMenu()
|
||||||
|
|
||||||
auto callback = [](s32 index, const std::string& title, bool checked) {
|
auto callback = [](s32 index, const std::string& title, bool checked) {
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
{
|
||||||
|
ReturnToMainWindow();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CheatList* cl = System::GetCheatList();
|
CheatList* cl = System::GetCheatList();
|
||||||
if (!cl)
|
if (!cl)
|
||||||
|
@ -633,6 +636,7 @@ static void DoChangeDiscFromFile()
|
||||||
|
|
||||||
ClearImGuiFocus();
|
ClearImGuiFocus();
|
||||||
CloseFileSelector();
|
CloseFileSelector();
|
||||||
|
ReturnToMainWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
OpenFileSelector(ICON_FA_COMPACT_DISC " Select Disc Image", false, std::move(callback), GetDiscImageFilters(),
|
OpenFileSelector(ICON_FA_COMPACT_DISC " Select Disc Image", false, std::move(callback), GetDiscImageFilters(),
|
||||||
|
@ -1100,6 +1104,9 @@ void DrawSettingsWindow()
|
||||||
"Pauses the emulator when you minimize the window or switch to another "
|
"Pauses the emulator when you minimize the window or switch to another "
|
||||||
"application, and unpauses when you switch back.",
|
"application, and unpauses when you switch back.",
|
||||||
&s_settings_copy.pause_on_focus_loss);
|
&s_settings_copy.pause_on_focus_loss);
|
||||||
|
settings_changed |= ToggleButton(
|
||||||
|
"Pause On Menu", "Pauses the emulator when you open the quick menu, and unpauses when you close it.",
|
||||||
|
&s_settings_copy.pause_on_menu);
|
||||||
settings_changed |=
|
settings_changed |=
|
||||||
ToggleButton("Confirm Power Off",
|
ToggleButton("Confirm Power Off",
|
||||||
"Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
|
"Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
|
||||||
|
@ -1888,7 +1895,7 @@ void DrawSettingsWindow()
|
||||||
&s_settings_copy.audio_output_volume, 0, 100, 1, "%d%%");
|
&s_settings_copy.audio_output_volume, 0, 100, 1, "%d%%");
|
||||||
settings_changed |= RangeButton("Fast Forward Volume",
|
settings_changed |= RangeButton("Fast Forward Volume",
|
||||||
"Controls the volume of the audio played on the host when fast forwarding.",
|
"Controls the volume of the audio played on the host when fast forwarding.",
|
||||||
&s_settings_copy.audio_output_volume, 0, 100, 1, "%d%%");
|
&s_settings_copy.audio_fast_forward_volume, 0, 100, 1, "%d%%");
|
||||||
settings_changed |= ToggleButton("Mute All Sound", "Prevents the emulator from producing any audible sound.",
|
settings_changed |= ToggleButton("Mute All Sound", "Prevents the emulator from producing any audible sound.",
|
||||||
&s_settings_copy.audio_output_muted);
|
&s_settings_copy.audio_output_muted);
|
||||||
settings_changed |= ToggleButton("Mute CD Audio",
|
settings_changed |= ToggleButton("Mute CD Audio",
|
||||||
|
@ -2082,19 +2089,19 @@ void DrawQuickMenu(MainWindowType type)
|
||||||
|
|
||||||
if (ActiveButton(ICON_FA_UNDO " Load State", false))
|
if (ActiveButton(ICON_FA_UNDO " Load State", false))
|
||||||
{
|
{
|
||||||
|
s_current_main_window = MainWindowType::None;
|
||||||
OpenSaveStateSelector(true);
|
OpenSaveStateSelector(true);
|
||||||
CloseQuickMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActiveButton(ICON_FA_SAVE " Save State", false))
|
if (ActiveButton(ICON_FA_SAVE " Save State", false))
|
||||||
{
|
{
|
||||||
|
s_current_main_window = MainWindowType::None;
|
||||||
OpenSaveStateSelector(false);
|
OpenSaveStateSelector(false);
|
||||||
CloseQuickMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActiveButton(ICON_FA_FROWN_OPEN " Cheat List", false))
|
if (ActiveButton(ICON_FA_FROWN_OPEN " Cheat List", false))
|
||||||
{
|
{
|
||||||
CloseQuickMenu();
|
s_current_main_window = MainWindowType::None;
|
||||||
DoCheatsMenu();
|
DoCheatsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2106,15 +2113,12 @@ void DrawQuickMenu(MainWindowType type)
|
||||||
|
|
||||||
if (ActiveButton(ICON_FA_COMPACT_DISC " Change Disc", false))
|
if (ActiveButton(ICON_FA_COMPACT_DISC " Change Disc", false))
|
||||||
{
|
{
|
||||||
CloseQuickMenu();
|
s_current_main_window = MainWindowType::None;
|
||||||
DoChangeDisc();
|
DoChangeDisc();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActiveButton(ICON_FA_SLIDERS_H " Settings", false))
|
if (ActiveButton(ICON_FA_SLIDERS_H " Settings", false))
|
||||||
{
|
|
||||||
CloseQuickMenu();
|
|
||||||
s_current_main_window = MainWindowType::Settings;
|
s_current_main_window = MainWindowType::Settings;
|
||||||
}
|
|
||||||
|
|
||||||
if (ActiveButton(ICON_FA_SYNC " Reset System", false))
|
if (ActiveButton(ICON_FA_SYNC " Reset System", false))
|
||||||
{
|
{
|
||||||
|
@ -2290,6 +2294,7 @@ void CloseSaveStateSelector()
|
||||||
{
|
{
|
||||||
s_save_state_selector_slots.clear();
|
s_save_state_selector_slots.clear();
|
||||||
s_save_state_selector_open = false;
|
s_save_state_selector_open = false;
|
||||||
|
ReturnToMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSaveStateSelector(bool is_loading, bool fullscreen)
|
void DrawSaveStateSelector(bool is_loading, bool fullscreen)
|
||||||
|
|
Loading…
Reference in a new issue