PSP2: Fix seeking with mapping and unmapping files
Jeffrey Pfau jeffrey@endrift.com
Sun, 30 Aug 2015 18:42:16 -0700
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
src/platform/psp2/sce-vfs.c
→
src/platform/psp2/sce-vfs.c
@@ -98,14 +98,18 @@ struct VFileSce* vfsce = (struct VFileSce*) vf;
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); }