diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index f0e0e3aaf8..b9a0321ba0 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -289,8 +289,6 @@ namespace SaveState return !rewindStates.Empty(); } - static const char *STATE_EXTENSION = "ppst"; - static const char *SCREENSHOT_EXTENSION = "jpg"; // Slot utilities std::string AppendSlotTitle(const std::string &filename, const std::string &title) { @@ -381,7 +379,7 @@ namespace SaveState void NextSlot() { I18NCategory *sy = GetI18NCategory("System"); - g_Config.iCurrentStateSlot = (g_Config.iCurrentStateSlot + 1) % SaveState::SAVESTATESLOTS; + 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", ""); @@ -458,7 +456,7 @@ namespace SaveState int GetNewestSlot(const std::string &gameFilename) { int newestSlot = -1; tm newestDate = {0}; - for (int i = 0; i < SAVESTATESLOTS; i++) { + for (int i = 0; i < NUM_SLOTS; i++) { std::string fn = GenerateSaveSlotFilename(gameFilename, i, STATE_EXTENSION); if (File::Exists(fn)) { tm time; diff --git a/Core/SaveState.h b/Core/SaveState.h index 6b09c566d1..fa6220b224 100644 --- a/Core/SaveState.h +++ b/Core/SaveState.h @@ -25,7 +25,9 @@ namespace SaveState { typedef std::function Callback; - const int SAVESTATESLOTS = 5; + static const int NUM_SLOTS = 5; + static const char *STATE_EXTENSION = "ppst"; + static const char *SCREENSHOT_EXTENSION = "jpg"; void Init(); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 65d9297058..e01fed3431 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -266,7 +266,7 @@ void EmuScreen::sendMessage(const char *message, const char *value) { int curSlot = SaveState::GetCurrentSlot(); std::string fn; if (SaveState::HasSaveInSlot(gamePath_, curSlot)) { - fn = SaveState::GenerateSaveSlotFilename(gamePath_, curSlot, "jpg"); + fn = SaveState::GenerateSaveSlotFilename(gamePath_, curSlot, SaveState::SCREENSHOT_EXTENSION); } saveStatePreview_->SetFilename(fn); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index ca43c32fd9..abce83ca07 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -180,7 +180,7 @@ private: SaveSlotView::SaveSlotView(const std::string &gameFilename, int slot, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), gamePath_(gameFilename), slot_(slot) { using namespace UI; - screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, "jpg"); + screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, SaveState::SCREENSHOT_EXTENSION); PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue(); Add(new Spacer(5)); diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index bfb1059e9b..47c737821c 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -1139,8 +1139,8 @@ namespace MainWindow { if (g_Config.iCurrentStateSlot < 0) g_Config.iCurrentStateSlot = 0; - else if (g_Config.iCurrentStateSlot >= SaveState::SAVESTATESLOTS) - g_Config.iCurrentStateSlot = SaveState::SAVESTATESLOTS - 1; + else if (g_Config.iCurrentStateSlot >= SaveState::NUM_SLOTS) + g_Config.iCurrentStateSlot = SaveState::NUM_SLOTS - 1; for (int i = 0; i < ARRAY_SIZE(savestateSlot); i++) { CheckMenuItem(menu, savestateSlot[i], MF_BYCOMMAND | ((i == g_Config.iCurrentStateSlot) ? MF_CHECKED : MF_UNCHECKED));