diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 7b3391d903..0186dd7ff9 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -20,7 +20,6 @@ #include "base/mutex.h" #include "base/timeutil.h" -#include "base/NativeApp.h" #include "i18n/i18n.h" #include "Common/FileUtil.h" @@ -384,7 +383,6 @@ namespace SaveState 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); - NativeMessageReceived("slotchanged", ""); } void LoadSlot(const std::string &gameFilename, int slot, Callback callback, void *cbUserData) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 06a3446eb6..b33b42e9ef 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -73,6 +73,7 @@ EmuScreen::EmuScreen(const std::string &filename) : bootPending_(true), gamePath_(filename), invalid_(true), quit_(false), pauseTrigger_(false), saveStatePreviewShownTime_(0.0), saveStatePreview_(nullptr) { memset(axisState_, 0, sizeof(axisState_)); + saveStateSlot_ = SaveState::GetCurrentSlot(); } void EmuScreen::bootGame(const std::string &filename) { @@ -290,22 +291,6 @@ void EmuScreen::sendMessage(const char *message, const char *value) { } else { gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED; } - } else if (!strcmp(message, "slotchanged")) { - if (saveStatePreview_) { - int curSlot = SaveState::GetCurrentSlot(); - std::string fn; - if (SaveState::HasSaveInSlot(gamePath_, curSlot)) { - fn = SaveState::GenerateSaveSlotFilename(gamePath_, curSlot, SaveState::SCREENSHOT_EXTENSION); - } - - saveStatePreview_->SetFilename(fn); - if (!fn.empty()) { - saveStatePreview_->SetVisibility(UI::V_VISIBLE); - saveStatePreviewShownTime_ = time_now_d(); - } else { - saveStatePreview_->SetVisibility(UI::V_GONE); - } - } } } @@ -806,8 +791,28 @@ void EmuScreen::update(InputState &input) { screenManager()->push(new GamePauseScreen(gamePath_)); } - if (time_now_d() - saveStatePreviewShownTime_ > 2 && saveStatePreview_->GetVisibility() == UI::V_VISIBLE) { - saveStatePreview_->SetVisibility(UI::V_GONE); + if (saveStatePreview_) { + int currentSlot = SaveState::GetCurrentSlot(); + if (saveStateSlot_ != currentSlot) { + saveStateSlot_ = currentSlot; + + std::string fn; + if (SaveState::HasSaveInSlot(gamePath_, currentSlot)) { + fn = SaveState::GenerateSaveSlotFilename(gamePath_, currentSlot, SaveState::SCREENSHOT_EXTENSION); + } + + saveStatePreview_->SetFilename(fn); + if (!fn.empty()) { + saveStatePreview_->SetVisibility(UI::V_VISIBLE); + saveStatePreviewShownTime_ = time_now_d(); + } else { + saveStatePreview_->SetVisibility(UI::V_GONE); + } + } + + if (time_now_d() - saveStatePreviewShownTime_ > 2 && saveStatePreview_->GetVisibility() == UI::V_VISIBLE) { + saveStatePreview_->SetVisibility(UI::V_GONE); + } } } diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index 690f86261a..f530b7e4d5 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -89,4 +89,5 @@ private: double saveStatePreviewShownTime_; AsyncImageFileView *saveStatePreview_; + int saveStateSlot_; }; diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 743a5fc8dc..19bf4bea1f 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -69,7 +69,6 @@ struct InputState; void NativeUpdate(InputState &input_state) { } void NativeRender(GraphicsContext *graphicsContext) { } void NativeResized() { } -void NativeMessageReceived(const char *message, const char *value) {} std::string System_GetProperty(SystemProperty prop) { return ""; } int System_GetPropertyInt(SystemProperty prop) { return -1; } diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index 6821bc2d51..f1716ab2bd 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -50,7 +50,6 @@ std::string System_GetProperty(SystemProperty prop) { return ""; } int System_GetPropertyInt(SystemProperty prop) { return -1; } -void NativeMessageReceived(const char *message, const char *value) {} #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923