From 8a6f55a63e16a54c664aa6e3b0dfc8a315f4ba76 Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Tue, 7 Jun 2022 15:52:00 +0100 Subject: [PATCH] Save/Load States via hotkey in QT Addressing https://github.com/PCSX2/pcsx2/issues/6268. Adds the commands for loading/saving all numbered states via hotkeys, leaving them all unbound by default. --- pcsx2/VMManager.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index d22b1cb624..26f94be8c4 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -1712,6 +1712,38 @@ DEFINE_HOTKEY("LoadStateFromSlot", "Save States", "Load State From Selected Slot if (!pressed) VMManager::LoadStateFromSlot(s_current_save_slot); }) + +#define DEFINE_HOTKEY_SAVESTATE_X(slotnum,slotnumstr) DEFINE_HOTKEY("SaveStateToSlot" #slotnum, \ + "Save States", "Save State To Slot " #slotnumstr, [](bool pressed) { if (!pressed) VMManager::SaveStateToSlot(slotnum); }) +DEFINE_HOTKEY_SAVESTATE_X(1, 01) +DEFINE_HOTKEY_SAVESTATE_X(2, 02) +DEFINE_HOTKEY_SAVESTATE_X(3, 03) +DEFINE_HOTKEY_SAVESTATE_X(4, 04) +DEFINE_HOTKEY_SAVESTATE_X(5, 05) +DEFINE_HOTKEY_SAVESTATE_X(6, 06) +DEFINE_HOTKEY_SAVESTATE_X(7, 07) +DEFINE_HOTKEY_SAVESTATE_X(8, 08) +DEFINE_HOTKEY_SAVESTATE_X(9, 09) +DEFINE_HOTKEY_SAVESTATE_X(10, 10) +#define DEFINE_HOTKEY_LOADSTATE_X(slotnum, slotnumstr) DEFINE_HOTKEY("LoadStateFromSlot" #slotnum, \ + "Save States", "Load State From Slot " #slotnumstr , [](bool pressed) { \ + if (!pressed) \ + VMManager::LoadStateFromSlot(slotnum); \ + }) +DEFINE_HOTKEY_LOADSTATE_X(1, 01) +DEFINE_HOTKEY_LOADSTATE_X(2, 02) +DEFINE_HOTKEY_LOADSTATE_X(3, 03) +DEFINE_HOTKEY_LOADSTATE_X(4, 04) +DEFINE_HOTKEY_LOADSTATE_X(5, 05) +DEFINE_HOTKEY_LOADSTATE_X(6, 06) +DEFINE_HOTKEY_LOADSTATE_X(7, 07) +DEFINE_HOTKEY_LOADSTATE_X(8, 08) +DEFINE_HOTKEY_LOADSTATE_X(9, 09) +DEFINE_HOTKEY_LOADSTATE_X(10, 10) + +#undef DEFINE_HOTKEY_SAVESTATE_X +#undef DEFINE_HOTKEY_LOADSTATE_X + END_HOTKEY_LIST() #ifdef _WIN32