From e6cf296d1a331ae7728f35857b77a0c550edae98 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 27 May 2016 20:53:20 -0700 Subject: [PATCH] Trigger save slot display from UI code. Core shouldn't be calling UI code. --- Core/SaveState.cpp | 3 --- UI/EmuScreen.cpp | 1 + UI/NativeApp.cpp | 5 +++++ Windows/MainWindowMenu.cpp | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 0186dd7ff9..b95072658c 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -379,10 +379,7 @@ namespace SaveState void NextSlot() { - I18NCategory *sy = GetI18NCategory("System"); g_Config.iCurrentStateSlot = (g_Config.iCurrentStateSlot + 1) % NUM_SLOTS; - std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), g_Config.iCurrentStateSlot + 1); - osm.Show(msg); } void LoadSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index b33b42e9ef..960591577e 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -398,6 +398,7 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) { break; case VIRTKEY_NEXT_SLOT: SaveState::NextSlot(); + NativeMessageReceived("savestate_displayslot", ""); break; case VIRTKEY_TOGGLE_FULLSCREEN: System_SendMessage("toggle_fullscreen", ""); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 9aea371320..0698572833 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -766,6 +766,11 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) { g_Config.sNickName = inputboxValue[1]; inputboxValue.clear(); } + if (msg == "savestate_displayslot") { + I18NCategory *sy = GetI18NCategory("System"); + std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), SaveState::GetCurrentSlot() + 1); + osm.Show(msg); + } } void NativeUpdate(InputState &input) { diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index a78d3b784f..133dafee32 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -580,6 +580,7 @@ namespace MainWindow { case ID_FILE_SAVESTATE_NEXT_SLOT: { SaveState::NextSlot(); + NativeMessageReceived("savestate_displayslot", ""); break; } @@ -588,6 +589,7 @@ namespace MainWindow { if (KeyMap::g_controllerMap[VIRTKEY_NEXT_SLOT].empty()) { SaveState::NextSlot(); + NativeMessageReceived("savestate_displayslot", ""); } break; }