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);
|
UNUSED(flags);
|
||||||
void* buffer = anonymousMemoryMap(size);
|
void* buffer = anonymousMemoryMap(size);
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
|
SceOff cur = sceIoLseek(vfsce->fd, 0, SEEK_CUR);
|
||||||
sceIoRead(vfsce->fd, buffer, size);
|
sceIoRead(vfsce->fd, buffer, size);
|
||||||
|
sceIoLseek(vfsce->fd, cur, SEEK_SET);
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _vfsceUnmap(struct VFile* vf, void* memory, size_t size) {
|
static void _vfsceUnmap(struct VFile* vf, void* memory, size_t size) {
|
||||||
struct VFileSce* vfsce = (struct VFileSce*) vf;
|
struct VFileSce* vfsce = (struct VFileSce*) vf;
|
||||||
|
SceOff cur = sceIoLseek(vfsce->fd, 0, SEEK_CUR);
|
||||||
sceIoWrite(vfsce->fd, memory, size);
|
sceIoWrite(vfsce->fd, memory, size);
|
||||||
|
sceIoLseek(vfsce->fd, cur, SEEK_SET);
|
||||||
mappedMemoryFree(memory, size);
|
mappedMemoryFree(memory, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue