mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-29 12:52:34 +00:00
SaveState: Clean up some constant usage.
This commit is contained in:
parent
2f96dda185
commit
ef566a3adf
@ -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;
|
||||
|
@ -25,7 +25,9 @@ namespace SaveState
|
||||
{
|
||||
typedef std::function<void(bool status, void *cbUserData)> 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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user