SaveState: Clean up some constant usage.
This commit is contained in:
parent
2f96dda185
commit
ef566a3adf
5 changed files with 9 additions and 9 deletions
|
@ -289,8 +289,6 @@ namespace SaveState
|
||||||
return !rewindStates.Empty();
|
return !rewindStates.Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *STATE_EXTENSION = "ppst";
|
|
||||||
static const char *SCREENSHOT_EXTENSION = "jpg";
|
|
||||||
// Slot utilities
|
// Slot utilities
|
||||||
|
|
||||||
std::string AppendSlotTitle(const std::string &filename, const std::string &title) {
|
std::string AppendSlotTitle(const std::string &filename, const std::string &title) {
|
||||||
|
@ -381,7 +379,7 @@ namespace SaveState
|
||||||
void NextSlot()
|
void NextSlot()
|
||||||
{
|
{
|
||||||
I18NCategory *sy = GetI18NCategory("System");
|
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);
|
std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), g_Config.iCurrentStateSlot + 1);
|
||||||
osm.Show(msg);
|
osm.Show(msg);
|
||||||
NativeMessageReceived("slotchanged", "");
|
NativeMessageReceived("slotchanged", "");
|
||||||
|
@ -458,7 +456,7 @@ namespace SaveState
|
||||||
int GetNewestSlot(const std::string &gameFilename) {
|
int GetNewestSlot(const std::string &gameFilename) {
|
||||||
int newestSlot = -1;
|
int newestSlot = -1;
|
||||||
tm newestDate = {0};
|
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);
|
std::string fn = GenerateSaveSlotFilename(gameFilename, i, STATE_EXTENSION);
|
||||||
if (File::Exists(fn)) {
|
if (File::Exists(fn)) {
|
||||||
tm time;
|
tm time;
|
||||||
|
|
|
@ -25,7 +25,9 @@ namespace SaveState
|
||||||
{
|
{
|
||||||
typedef std::function<void(bool status, void *cbUserData)> Callback;
|
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();
|
void Init();
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
||||||
int curSlot = SaveState::GetCurrentSlot();
|
int curSlot = SaveState::GetCurrentSlot();
|
||||||
std::string fn;
|
std::string fn;
|
||||||
if (SaveState::HasSaveInSlot(gamePath_, curSlot)) {
|
if (SaveState::HasSaveInSlot(gamePath_, curSlot)) {
|
||||||
fn = SaveState::GenerateSaveSlotFilename(gamePath_, curSlot, "jpg");
|
fn = SaveState::GenerateSaveSlotFilename(gamePath_, curSlot, SaveState::SCREENSHOT_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveStatePreview_->SetFilename(fn);
|
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) {
|
SaveSlotView::SaveSlotView(const std::string &gameFilename, int slot, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), gamePath_(gameFilename), slot_(slot) {
|
||||||
using namespace UI;
|
using namespace UI;
|
||||||
|
|
||||||
screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, "jpg");
|
screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, SaveState::SCREENSHOT_EXTENSION);
|
||||||
PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue();
|
PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue();
|
||||||
Add(new Spacer(5));
|
Add(new Spacer(5));
|
||||||
|
|
||||||
|
|
|
@ -1139,8 +1139,8 @@ namespace MainWindow {
|
||||||
if (g_Config.iCurrentStateSlot < 0)
|
if (g_Config.iCurrentStateSlot < 0)
|
||||||
g_Config.iCurrentStateSlot = 0;
|
g_Config.iCurrentStateSlot = 0;
|
||||||
|
|
||||||
else if (g_Config.iCurrentStateSlot >= SaveState::SAVESTATESLOTS)
|
else if (g_Config.iCurrentStateSlot >= SaveState::NUM_SLOTS)
|
||||||
g_Config.iCurrentStateSlot = SaveState::SAVESTATESLOTS - 1;
|
g_Config.iCurrentStateSlot = SaveState::NUM_SLOTS - 1;
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(savestateSlot); i++) {
|
for (int i = 0; i < ARRAY_SIZE(savestateSlot); i++) {
|
||||||
CheckMenuItem(menu, savestateSlot[i], MF_BYCOMMAND | ((i == g_Config.iCurrentStateSlot) ? MF_CHECKED : MF_UNCHECKED));
|
CheckMenuItem(menu, savestateSlot[i], MF_BYCOMMAND | ((i == g_Config.iCurrentStateSlot) ? MF_CHECKED : MF_UNCHECKED));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue