mirror of https://github.com/mgba-emu/mgba.git
PSP2: Fix seeking with mapping and unmapping files
This commit is contained in:
parent
74e3826b13
commit
34fd6769e6
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue