From 26fbb4c32c1fd8e9da1f76b239c109db5b09aa95 Mon Sep 17 00:00:00 2001 From: zack-vii Date: Tue, 7 Jan 2014 15:56:04 +0100 Subject: [PATCH] "Next Slot" control mapping -added "Next Slot" to control mapping menu -added VIRTKEY_NEXT_SLOT -> incremented VIRTKEY_TOGGLE_FULLSCREEN -added SaveState::NextSlot(); as replacement for code in WndMainWindow -added entry in EmuScreen using SaveState::NextSlot(); --- Common/KeyMap.cpp | 1 + Common/KeyMap.h | 3 ++- Core/SaveState.cpp | 9 +++++++++ Core/SaveState.h | 2 ++ UI/EmuScreen.cpp | 3 +++ Windows/WndMainWindow.cpp | 6 +----- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index f93edd10ea..057bb4e397 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -611,6 +611,7 @@ const KeyMap_IntStrPair psp_button_names[] = { #endif {VIRTKEY_SAVE_STATE, "Save State"}, {VIRTKEY_LOAD_STATE, "Load State"}, + {VIRTKEY_NEXT_SLOT, "Next Slot"}, #if !defined(_WIN32) && !defined(USING_GLES2) {VIRTKEY_TOGGLE_FULLSCREEN, "Toggle Fullscreen"}, #endif diff --git a/Common/KeyMap.h b/Common/KeyMap.h index 4dbdead983..b8c96ee9c2 100644 --- a/Common/KeyMap.h +++ b/Common/KeyMap.h @@ -43,7 +43,8 @@ enum { VIRTKEY_REWIND = 0x1000c, VIRTKEY_SAVE_STATE = 0x1000d, VIRTKEY_LOAD_STATE = 0x1000e, - VIRTKEY_TOGGLE_FULLSCREEN = 0x1000f, + VIRTKEY_NEXT_SLOT = 0x1000f, + VIRTKEY_TOGGLE_FULLSCREEN = 0x10010, VIRTKEY_LAST, VIRTKEY_COUNT = VIRTKEY_LAST - VIRTKEY_FIRST }; diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index e31e9260f1..70c946ac5e 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -224,6 +224,15 @@ namespace SaveState } } + void NextSlot() + { + I18NCategory *sy = GetI18NCategory("System"); + g_Config.iCurrentStateSlot = (g_Config.iCurrentStateSlot + 1) % SaveState::SAVESTATESLOTS; + char msg[30]; + sprintf(msg, "%s: %d", sy->T("Savestate Slot"), g_Config.iCurrentStateSlot + 1); + osm.Show(msg); + } + void LoadSlot(int slot, Callback callback, void *cbUserData) { std::string fn = GenerateSaveSlotFilename(slot, STATE_EXTENSION); diff --git a/Core/SaveState.h b/Core/SaveState.h index 088600b904..1244bb3b8e 100644 --- a/Core/SaveState.h +++ b/Core/SaveState.h @@ -29,6 +29,8 @@ namespace SaveState void Init(); + // Cycle through the 5 savestate slots + void NextSlot(); void SaveSlot(int slot, Callback callback, void *cbUserData = 0); void LoadSlot(int slot, Callback callback, void *cbUserData = 0); // Checks whether there's an existing save in the specified slot. diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 92d7e1d111..4ec5bf6a1f 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -277,6 +277,9 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) { SaveState::LoadSlot(g_Config.iCurrentStateSlot, 0); } break; + case VIRTKEY_NEXT_SLOT: + SaveState::NextSlot(); + break; case VIRTKEY_TOGGLE_FULLSCREEN: System_SendMessage("toggle_fullscreen", ""); break; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 982bc6ab8f..b4184bee9c 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -1229,11 +1229,7 @@ namespace MainWindow case ID_FILE_SAVESTATE_NEXT_SLOT: { - I18NCategory *sy = GetI18NCategory("System"); - g_Config.iCurrentStateSlot = (g_Config.iCurrentStateSlot + 1) % SaveState::SAVESTATESLOTS; - char msg[30]; - sprintf(msg, "%s: %d", sy->T("Savestate Slot"), g_Config.iCurrentStateSlot + 1); - osm.Show(msg); + SaveState::NextSlot(); break; }