From 46cd875a16c6289b0b2d362b911386828a163bd9 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 20 Jun 2015 03:24:26 -0700 Subject: [PATCH] PSP: Hook use VFileOpenSce for VFileOpen --- src/gba/serialize.c | 4 ---- src/platform/psp/sce-vfs.c | 4 ---- src/util/vfs.c | 6 ++++++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gba/serialize.c b/src/gba/serialize.c index 086409f34..11a2a67cc 100644 --- a/src/gba/serialize.c +++ b/src/gba/serialize.c @@ -173,13 +173,11 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) { return true; } -#ifndef PSP struct VFile* GBAGetState(struct GBA* gba, struct VDir* dir, int slot, bool write) { char suffix[5] = { '\0' }; snprintf(suffix, sizeof(suffix), ".ss%d", slot); return VDirOptionalOpenFile(dir, gba->activeFile, "savestate", suffix, write ? (O_CREAT | O_TRUNC | O_RDWR) : O_RDONLY); } -#endif #ifdef USE_PNG static bool _savePNGState(struct GBA* gba, struct VFile* vf) { @@ -251,7 +249,6 @@ static bool _loadPNGState(struct GBA* gba, struct VFile* vf) { } #endif -#ifndef PSP bool GBASaveState(struct GBAThread* threadContext, struct VDir* dir, int slot, bool screenshot) { struct VFile* vf = GBAGetState(threadContext->gba, dir, slot, true); if (!vf) { @@ -282,7 +279,6 @@ bool GBALoadState(struct GBAThread* threadContext, struct VDir* dir, int slot) { } return success; } -#endif bool GBASaveStateNamed(struct GBA* gba, struct VFile* vf, bool screenshot) { if (!screenshot) { diff --git a/src/platform/psp/sce-vfs.c b/src/platform/psp/sce-vfs.c index 989e60218..59d31257b 100644 --- a/src/platform/psp/sce-vfs.c +++ b/src/platform/psp/sce-vfs.c @@ -23,10 +23,6 @@ static void _vfsceUnmap(struct VFile* vf, void* memory, size_t size); static void _vfsceTruncate(struct VFile* vf, size_t size); static ssize_t _vfsceSize(struct VFile* vf); -struct VFile* VFileOpen(const char* path, int flags) { - return VFileOpenSce(path, flags, 0666); -} - struct VFile* VFileOpenSce(const char* path, int flags, SceMode mode) { struct VFileSce* vfsce = malloc(sizeof(struct VFileSce)); if (!vfsce) { diff --git a/src/util/vfs.c b/src/util/vfs.c index e56f8bfb9..4cf207e34 100644 --- a/src/util/vfs.c +++ b/src/util/vfs.c @@ -5,6 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "vfs.h" +#ifdef PSP +#include "platform/psp/sce-vfs.h" +#endif + struct VFile* VFileOpen(const char* path, int flags) { #ifdef USE_VFS_FILE const char* chflags; @@ -30,6 +34,8 @@ struct VFile* VFileOpen(const char* path, int flags) { break; } return VFileFOpen(path, chflags); +#elif defined(PSP) + return VFileOpenSce(path, flags, 0666); #else return VFileOpenFD(path, flags); #endif