Merge pull request #8615 from unknownbrackets/savestates

Fix save state icons when in a different path than PPSSPP
This commit is contained in:
Henrik Rydgård committed 2016-02-29 09:39:19 +01:00
commit 9bde45d6f9
6 files changed
+25 -22

No files matched your search

+2 -4
View File
@@ -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;
+3 -1
View File
@@ -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();
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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));
+2 -2
View File
@@ -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));
+16 -13
View File
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <set>
#include <algorithm>
#include <ctype.h>
#include <set>
#include <stdio.h>
#ifdef USING_QT_UI
#include <QFileInfo>
@@ -331,8 +332,18 @@ void VFSShutdown() {
num_entries = 0;
}
static bool IsLocalPath(const char *path) {
bool isUnixLocal = path[0] == '/';
#ifdef _WIN32
bool isWindowsLocal = isalpha(path[0]) && path[1] == ':';
#else
bool isWindowsLocal = false;
#endif
return isUnixLocal || isWindowsLocal;
}
uint8_t *VFSReadFile(const char *filename, size_t *size) {
if (filename[0] == '/') {
if (IsLocalPath(filename)) {
// Local path, not VFS.
ILOG("Not a VFS path: %s . Reading local file.", filename);
return ReadLocalFile(filename, size);
@@ -361,11 +372,7 @@ uint8_t *VFSReadFile(const char *filename, size_t *size) {
}
bool VFSGetFileListing(const char *path, std::vector<FileInfo> *listing, const char *filter) {
#ifdef _WIN32
if (path[1] == ':') {
#else
if (path[0] == '/') {
#endif
if (IsLocalPath(path)) {
// Local path, not VFS.
ILOG("Not a VFS path: %s . Reading local directory.", path);
getFilesInDir(path, listing, filter);
@@ -392,11 +399,7 @@ bool VFSGetFileListing(const char *path, std::vector<FileInfo> *listing, const c
}
bool VFSGetFileInfo(const char *path, FileInfo *info) {
#ifdef _WIN32
if (path[1] == ':') {
#else
if (path[0] == '/') {
#endif
if (IsLocalPath(path)) {
// Local path, not VFS.
ILOG("Not a VFS path: %s . Getting local file info.", path);
return getFileInfo(path, info);