all repos — mgba @ 34fd6769e6fdf27a4394783a8d57135bee25af1e

mGBA Game Boy Advance Emulator

PSP2: Fix seeking with mapping and unmapping files
Jeffrey Pfau jeffrey@endrift.com
Sun, 30 Aug 2015 18:42:16 -0700
commit

34fd6769e6fdf27a4394783a8d57135bee25af1e

parent

74e3826b13c76a1cc4e8088a65968bd177050760

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M src/platform/psp2/sce-vfs.csrc/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); }