PSP2: Fix seeking with mapping and unmapping files

This commit is contained in:
Jeffrey Pfau 2015-08-30 18:42:16 -07:00
parent 74e3826b13
commit 34fd6769e6
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}