From 34fd6769e6fdf27a4394783a8d57135bee25af1e Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 30 Aug 2015 18:42:16 -0700 Subject: [PATCH] PSP2: Fix seeking with mapping and unmapping files --- src/platform/psp2/sce-vfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/psp2/sce-vfs.c b/src/platform/psp2/sce-vfs.c index 88cb12119..a694763cf 100644 --- a/src/platform/psp2/sce-vfs.c +++ b/src/platform/psp2/sce-vfs.c @@ -98,14 +98,18 @@ static void* _vfsceMap(struct VFile* vf, size_t size, int flags) { UNUSED(flags); void* buffer = anonymousMemoryMap(size); if (buffer) { + SceOff cur = sceIoLseek(vfsce->fd, 0, SEEK_CUR); sceIoRead(vfsce->fd, buffer, size); + sceIoLseek(vfsce->fd, cur, SEEK_SET); } return buffer; } static void _vfsceUnmap(struct VFile* vf, void* memory, size_t size) { struct VFileSce* vfsce = (struct VFileSce*) vf; + SceOff cur = sceIoLseek(vfsce->fd, 0, SEEK_CUR); sceIoWrite(vfsce->fd, memory, size); + sceIoLseek(vfsce->fd, cur, SEEK_SET); mappedMemoryFree(memory, size); }