mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-20 15:25:38 +00:00
Hotkeys: Add OSD toggle hotkey
This commit is contained in:
parent
3b8afb39f6
commit
eb91fe31e2
|
@ -117,6 +117,21 @@ static void HotkeySaveStateSlot(bool global, s32 slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HotkeyToggleOSD()
|
||||||
|
{
|
||||||
|
g_settings.display_show_fps ^= Host::GetBoolSettingValue("Display", "ShowFPS", false);
|
||||||
|
g_settings.display_show_speed ^= Host::GetBoolSettingValue("Display", "ShowSpeed", false);
|
||||||
|
g_settings.display_show_gpu_stats ^= Host::GetBoolSettingValue("Display", "ShowGPUStatistics", false);
|
||||||
|
g_settings.display_show_resolution ^= Host::GetBoolSettingValue("Display", "ShowResolution", false);
|
||||||
|
g_settings.display_show_latency_stats ^= Host::GetBoolSettingValue("Display", "ShowLatencyStatistics", false);
|
||||||
|
g_settings.display_show_cpu_usage ^= Host::GetBoolSettingValue("Display", "ShowCPU", false);
|
||||||
|
g_settings.display_show_gpu_usage ^= Host::GetBoolSettingValue("Display", "ShowGPU", false);
|
||||||
|
g_settings.display_show_frame_times ^= Host::GetBoolSettingValue("Display", "ShowFrameTimes", false);
|
||||||
|
g_settings.display_show_status_indicators ^= Host::GetBoolSettingValue("Display", "ShowStatusIndicators", true);
|
||||||
|
g_settings.display_show_inputs ^= Host::GetBoolSettingValue("Display", "ShowInputs", false);
|
||||||
|
g_settings.display_show_enhancements ^= Host::GetBoolSettingValue("Display", "ShowEnhancements", false);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
|
|
||||||
static bool CanPause()
|
static bool CanPause()
|
||||||
|
@ -460,6 +475,12 @@ DEFINE_HOTKEY("TogglePGXPCPU", TRANSLATE_NOOP("Hotkeys", "Graphics"), TRANSLATE_
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
DEFINE_HOTKEY("ToggleOSD", TRANSLATE_NOOP("Hotkeys", "Graphics"), TRANSLATE_NOOP("Hotkeys", "Toggle On-Screen Display"),
|
||||||
|
[](s32 pressed) {
|
||||||
|
if (!pressed)
|
||||||
|
HotkeyToggleOSD();
|
||||||
|
})
|
||||||
|
|
||||||
DEFINE_HOTKEY("AudioMute", TRANSLATE_NOOP("Hotkeys", "Audio"), TRANSLATE_NOOP("Hotkeys", "Toggle Mute"),
|
DEFINE_HOTKEY("AudioMute", TRANSLATE_NOOP("Hotkeys", "Audio"), TRANSLATE_NOOP("Hotkeys", "Toggle Mute"),
|
||||||
[](s32 pressed) {
|
[](s32 pressed) {
|
||||||
if (!pressed && System::IsValid())
|
if (!pressed && System::IsValid())
|
||||||
|
@ -522,39 +543,42 @@ DEFINE_HOTKEY("AudioVolumeDown", TRANSLATE_NOOP("Hotkeys", "Audio"), TRANSLATE_N
|
||||||
|
|
||||||
// NOTE: All save/load state hotkeys are deferred, because it can trigger setting reapply, which reloads bindings.
|
// NOTE: All save/load state hotkeys are deferred, because it can trigger setting reapply, which reloads bindings.
|
||||||
DEFINE_HOTKEY("LoadSelectedSaveState", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
DEFINE_HOTKEY("LoadSelectedSaveState", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
||||||
TRANSLATE_NOOP("Hotkeys", "Load From Selected Slot"), [](s32 pressed) {
|
TRANSLATE_NOOP("Hotkeys", "Load From Selected Slot"),
|
||||||
|
[](s32 pressed) {
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
Host::RunOnCPUThread(SaveStateSelectorUI::LoadCurrentSlot);
|
Host::RunOnCPUThread(SaveStateSelectorUI::LoadCurrentSlot);
|
||||||
})
|
})
|
||||||
DEFINE_HOTKEY("SaveSelectedSaveState", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
DEFINE_HOTKEY(
|
||||||
TRANSLATE_NOOP("Hotkeys", "Save To Selected Slot"), [](s32 pressed) {
|
"SaveSelectedSaveState", TRANSLATE_NOOP("Hotkeys", "Save States"), TRANSLATE_NOOP("Hotkeys", "Save To Selected Slot"),
|
||||||
if (!pressed)
|
[](s32 pressed) {
|
||||||
Host::RunOnCPUThread(SaveStateSelectorUI::SaveCurrentSlot);
|
if (!pressed)
|
||||||
})
|
Host::RunOnCPUThread(SaveStateSelectorUI::SaveCurrentSlot);
|
||||||
DEFINE_HOTKEY("SelectPreviousSaveStateSlot", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
}) DEFINE_HOTKEY("SelectPreviousSaveStateSlot", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
||||||
TRANSLATE_NOOP("Hotkeys", "Select Previous Save Slot"), [](s32 pressed) {
|
TRANSLATE_NOOP("Hotkeys", "Select Previous Save Slot"),
|
||||||
if (!pressed)
|
[](s32 pressed) {
|
||||||
Host::RunOnCPUThread([]() { SaveStateSelectorUI::SelectPreviousSlot(true); });
|
if (!pressed)
|
||||||
})
|
Host::RunOnCPUThread([]() { SaveStateSelectorUI::SelectPreviousSlot(true); });
|
||||||
DEFINE_HOTKEY("SelectNextSaveStateSlot", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
}) DEFINE_HOTKEY("SelectNextSaveStateSlot", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
||||||
TRANSLATE_NOOP("Hotkeys", "Select Next Save Slot"), [](s32 pressed) {
|
TRANSLATE_NOOP("Hotkeys", "Select Next Save Slot"),
|
||||||
if (!pressed)
|
[](s32 pressed) {
|
||||||
Host::RunOnCPUThread([]() { SaveStateSelectorUI::SelectNextSlot(true); });
|
if (!pressed)
|
||||||
})
|
Host::RunOnCPUThread([]() { SaveStateSelectorUI::SelectNextSlot(true); });
|
||||||
DEFINE_HOTKEY("SaveStateAndSelectNextSlot", TRANSLATE_NOOP("Hotkeys", "Save States"),
|
}) DEFINE_HOTKEY("SaveStateAndSelectNextSlot",
|
||||||
TRANSLATE_NOOP("Hotkeys", "Save State and Select Next Slot"), [](s32 pressed) {
|
TRANSLATE_NOOP("Hotkeys", "Save States"),
|
||||||
if (!pressed && System::IsValid())
|
TRANSLATE_NOOP("Hotkeys", "Save State and Select Next Slot"),
|
||||||
{
|
[](s32 pressed) {
|
||||||
SaveStateSelectorUI::SaveCurrentSlot();
|
if (!pressed && System::IsValid())
|
||||||
SaveStateSelectorUI::SelectNextSlot(false);
|
{
|
||||||
}
|
SaveStateSelectorUI::SaveCurrentSlot();
|
||||||
})
|
SaveStateSelectorUI::SelectNextSlot(false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
DEFINE_HOTKEY("UndoLoadState", TRANSLATE_NOOP("Hotkeys", "Save States"), TRANSLATE_NOOP("Hotkeys", "Undo Load State"),
|
DEFINE_HOTKEY("UndoLoadState", TRANSLATE_NOOP("Hotkeys", "Save States"), TRANSLATE_NOOP("Hotkeys", "Undo Load State"),
|
||||||
[](s32 pressed) {
|
[](s32 pressed) {
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
Host::RunOnCPUThread(System::UndoLoadState);
|
Host::RunOnCPUThread(System::UndoLoadState);
|
||||||
})
|
})
|
||||||
|
|
||||||
#define MAKE_LOAD_STATE_HOTKEY(global, slot, name) \
|
#define MAKE_LOAD_STATE_HOTKEY(global, slot, name) \
|
||||||
DEFINE_HOTKEY(global ? "LoadGameState" #slot : "LoadGlobalState" #slot, TRANSLATE_NOOP("Hotkeys", "Save States"), \
|
DEFINE_HOTKEY(global ? "LoadGameState" #slot : "LoadGlobalState" #slot, TRANSLATE_NOOP("Hotkeys", "Save States"), \
|
||||||
|
@ -569,49 +593,71 @@ DEFINE_HOTKEY("UndoLoadState", TRANSLATE_NOOP("Hotkeys", "Save States"), TRANSLA
|
||||||
Host::RunOnCPUThread([]() { HotkeySaveStateSlot(global, slot); }); \
|
Host::RunOnCPUThread([]() { HotkeySaveStateSlot(global, slot); }); \
|
||||||
})
|
})
|
||||||
|
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 1, TRANSLATE_NOOP("Hotkeys", "Load Game State 1"))
|
MAKE_LOAD_STATE_HOTKEY(false, 1, TRANSLATE_NOOP("Hotkeys", "Load Game State 1")) MAKE_SAVE_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 1, TRANSLATE_NOOP("Hotkeys", "Save Game State 1"))
|
false, 1, TRANSLATE_NOOP("Hotkeys", "Save Game State 1"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 2, TRANSLATE_NOOP("Hotkeys", "Load Game State 2"))
|
MAKE_LOAD_STATE_HOTKEY(false, 2, TRANSLATE_NOOP("Hotkeys", "Load Game State 2")) MAKE_SAVE_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 2, TRANSLATE_NOOP("Hotkeys", "Save Game State 2"))
|
false, 2, TRANSLATE_NOOP("Hotkeys", "Save Game State 2"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 3, TRANSLATE_NOOP("Hotkeys", "Load Game State 3"))
|
MAKE_LOAD_STATE_HOTKEY(false, 3, TRANSLATE_NOOP("Hotkeys", "Load Game State 3")) MAKE_SAVE_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 3, TRANSLATE_NOOP("Hotkeys", "Save Game State 3"))
|
false, 3, TRANSLATE_NOOP("Hotkeys", "Save Game State 3"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 4, TRANSLATE_NOOP("Hotkeys", "Load Game State 4"))
|
MAKE_LOAD_STATE_HOTKEY(false, 4, TRANSLATE_NOOP("Hotkeys", "Load Game State 4")) MAKE_SAVE_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 4, TRANSLATE_NOOP("Hotkeys", "Save Game State 4"))
|
false, 4,
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 5, TRANSLATE_NOOP("Hotkeys", "Load Game State 5"))
|
TRANSLATE_NOOP("Hotkeys", "Save Game State 4")) MAKE_LOAD_STATE_HOTKEY(false, 5,
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 5, TRANSLATE_NOOP("Hotkeys", "Save Game State 5"))
|
TRANSLATE_NOOP("Hotkeys",
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 6, TRANSLATE_NOOP("Hotkeys", "Load Game State 6"))
|
"Load Game State 5"))
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 6, TRANSLATE_NOOP("Hotkeys", "Save Game State 6"))
|
MAKE_SAVE_STATE_HOTKEY(false, 5, TRANSLATE_NOOP("Hotkeys", "Save Game State 5")) MAKE_LOAD_STATE_HOTKEY(
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 7, TRANSLATE_NOOP("Hotkeys", "Load Game State 7"))
|
false, 6,
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 7, TRANSLATE_NOOP("Hotkeys", "Save Game State 7"))
|
TRANSLATE_NOOP("Hotkeys", "Load Game State 6"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 8, TRANSLATE_NOOP("Hotkeys", "Load Game State 8"))
|
MAKE_SAVE_STATE_HOTKEY(false, 6, TRANSLATE_NOOP("Hotkeys", "Save Game State 6")) MAKE_LOAD_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 8, TRANSLATE_NOOP("Hotkeys", "Save Game State 8"))
|
false, 7,
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 9, TRANSLATE_NOOP("Hotkeys", "Load Game State 9"))
|
TRANSLATE_NOOP("Hotkeys", "Load Game State 7"))
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 9, TRANSLATE_NOOP("Hotkeys", "Save Game State 9"))
|
MAKE_SAVE_STATE_HOTKEY(false, 7, TRANSLATE_NOOP("Hotkeys", "Save Game State 7")) MAKE_LOAD_STATE_HOTKEY(
|
||||||
MAKE_LOAD_STATE_HOTKEY(false, 10, TRANSLATE_NOOP("Hotkeys", "Load Game State 10"))
|
false, 8,
|
||||||
MAKE_SAVE_STATE_HOTKEY(false, 10, TRANSLATE_NOOP("Hotkeys", "Save Game State 10"))
|
TRANSLATE_NOOP("Hotkeys", "Load Game State 8"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(false, 8, TRANSLATE_NOOP("Hotkeys", "Save Game State 8"))
|
||||||
|
MAKE_LOAD_STATE_HOTKEY(false, 9, TRANSLATE_NOOP("Hotkeys", "Load Game State 9"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(false, 9, TRANSLATE_NOOP("Hotkeys", "Save Game State 9"))
|
||||||
|
MAKE_LOAD_STATE_HOTKEY(false, 10, TRANSLATE_NOOP("Hotkeys", "Load Game State 10"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(false, 10, TRANSLATE_NOOP("Hotkeys", "Save Game State 10"))
|
||||||
|
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 1, TRANSLATE_NOOP("Hotkeys", "Load Global State 1"))
|
MAKE_LOAD_STATE_HOTKEY(true, 1, TRANSLATE_NOOP("Hotkeys", "Load Global State 1"))
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 1, TRANSLATE_NOOP("Hotkeys", "Save Global State 1"))
|
MAKE_SAVE_STATE_HOTKEY(true, 1, TRANSLATE_NOOP("Hotkeys", "Save Global State 1"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 2, TRANSLATE_NOOP("Hotkeys", "Load Global State 2"))
|
MAKE_LOAD_STATE_HOTKEY(true, 2, TRANSLATE_NOOP("Hotkeys", "Load Global State 2"))
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 2, TRANSLATE_NOOP("Hotkeys", "Save Global State 2"))
|
MAKE_SAVE_STATE_HOTKEY(true, 2, TRANSLATE_NOOP("Hotkeys", "Save Global State 2"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 3, TRANSLATE_NOOP("Hotkeys", "Load Global State 3"))
|
MAKE_LOAD_STATE_HOTKEY(true, 3, TRANSLATE_NOOP("Hotkeys", "Load Global State 3"))
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 3, TRANSLATE_NOOP("Hotkeys", "Save Global State 3"))
|
MAKE_SAVE_STATE_HOTKEY(true, 3, TRANSLATE_NOOP("Hotkeys", "Save Global State 3"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 4, TRANSLATE_NOOP("Hotkeys", "Load Global State 4"))
|
MAKE_LOAD_STATE_HOTKEY(true,
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 4, TRANSLATE_NOOP("Hotkeys", "Save Global State 4"))
|
4, TRANSLATE_NOOP("Hotkeys", "Load Global State 4"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 5, TRANSLATE_NOOP("Hotkeys", "Load Global State 5"))
|
MAKE_SAVE_STATE_HOTKEY(true,
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 5, TRANSLATE_NOOP("Hotkeys", "Save Global State 5"))
|
4, TRANSLATE_NOOP("Hotkeys", "Save Global State 4"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 6, TRANSLATE_NOOP("Hotkeys", "Load Global State 6"))
|
MAKE_LOAD_STATE_HOTKEY(true,
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 6, TRANSLATE_NOOP("Hotkeys", "Save Global State 6"))
|
5, TRANSLATE_NOOP("Hotkeys", "Load Global State 5"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 7, TRANSLATE_NOOP("Hotkeys", "Load Global State 7"))
|
MAKE_SAVE_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 7, TRANSLATE_NOOP("Hotkeys", "Save Global State 7"))
|
true, 5, TRANSLATE_NOOP("Hotkeys", "Save Global State 5"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 8, TRANSLATE_NOOP("Hotkeys", "Load Global State 8"))
|
MAKE_LOAD_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 8, TRANSLATE_NOOP("Hotkeys", "Save Global State 8"))
|
true, 6, TRANSLATE_NOOP("Hotkeys", "Load Global State 6"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 9, TRANSLATE_NOOP("Hotkeys", "Load Global State 9"))
|
MAKE_SAVE_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 9, TRANSLATE_NOOP("Hotkeys", "Save Global State 9"))
|
true, 6, TRANSLATE_NOOP("Hotkeys", "Save Global State 6"))
|
||||||
MAKE_LOAD_STATE_HOTKEY(true, 10, TRANSLATE_NOOP("Hotkeys", "Load Global State 10"))
|
MAKE_LOAD_STATE_HOTKEY(
|
||||||
MAKE_SAVE_STATE_HOTKEY(true, 10, TRANSLATE_NOOP("Hotkeys", "Save Global State 10"))
|
true, 7, TRANSLATE_NOOP("Hotkeys", "Load Global State 7"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(
|
||||||
|
true, 7, TRANSLATE_NOOP("Hotkeys", "Save Global State 7"))
|
||||||
|
MAKE_LOAD_STATE_HOTKEY(
|
||||||
|
true, 8, TRANSLATE_NOOP("Hotkeys", "Load Global State 8"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(
|
||||||
|
true, 8, TRANSLATE_NOOP("Hotkeys", "Save Global State 8"))
|
||||||
|
MAKE_LOAD_STATE_HOTKEY(
|
||||||
|
true, 9, TRANSLATE_NOOP("Hotkeys", "Load Global State 9"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(
|
||||||
|
true, 9,
|
||||||
|
TRANSLATE_NOOP("Hotkeys", "Save Global State 9"))
|
||||||
|
MAKE_LOAD_STATE_HOTKEY(
|
||||||
|
true, 10,
|
||||||
|
TRANSLATE_NOOP("Hotkeys", "Load Global State 10"))
|
||||||
|
MAKE_SAVE_STATE_HOTKEY(
|
||||||
|
true, 10,
|
||||||
|
TRANSLATE_NOOP("Hotkeys", "Save Global State 10"))
|
||||||
|
|
||||||
#undef MAKE_SAVE_STATE_HOTKEY
|
#undef MAKE_SAVE_STATE_HOTKEY
|
||||||
#undef MAKE_LOAD_STATE_HOTKEY
|
#undef MAKE_LOAD_STATE_HOTKEY
|
||||||
|
|
||||||
END_HOTKEY_LIST()
|
END_HOTKEY_LIST()
|
||||||
|
|
|
@ -1495,20 +1495,20 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
|
||||||
if (CDROM::HasMedia() && (parameters.override_fast_boot.has_value() ? parameters.override_fast_boot.value() :
|
if (CDROM::HasMedia() && (parameters.override_fast_boot.has_value() ? parameters.override_fast_boot.value() :
|
||||||
g_settings.bios_patch_fast_boot))
|
g_settings.bios_patch_fast_boot))
|
||||||
{
|
{
|
||||||
if (CDROM::IsMediaPS1Disc())
|
if (!CDROM::IsMediaPS1Disc())
|
||||||
{
|
{
|
||||||
Log_ErrorPrint("Not fast booting non-PS1 disc.");
|
Log_ErrorPrint("Not fast booting non-PS1 disc.");
|
||||||
}
|
}
|
||||||
else if (s_bios_image_info && s_bios_image_info->patch_compatible)
|
else if (!s_bios_image_info || !s_bios_image_info->patch_compatible)
|
||||||
|
{
|
||||||
|
Log_ErrorPrint("Not patching fast boot, as BIOS is not patch compatible.");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// TODO: Fast boot without patches...
|
// TODO: Fast boot without patches...
|
||||||
BIOS::PatchBIOSFastBoot(Bus::g_bios, Bus::BIOS_SIZE);
|
BIOS::PatchBIOSFastBoot(Bus::g_bios, Bus::BIOS_SIZE);
|
||||||
s_was_fast_booted = true;
|
s_was_fast_booted = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Log_ErrorPrint("Not patching fast boot, as BIOS is not patch compatible.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Texture replacement preloading.
|
// Texture replacement preloading.
|
||||||
|
|
Loading…
Reference in a new issue