all repos — mgba @ 211616e4f139d90870f5bcfb798485e493e5bd8d

mGBA Game Boy Advance Emulator

3DS: 3DS-capable version of _vfdMap and _vfdUnmap
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Dec 2014 18:58:19 -0800
commit

211616e4f139d90870f5bcfb798485e493e5bd8d

parent

461eb3bae0b228fc546c41202e5a14ec15bd3247

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

jump to
M src/util/vfs.csrc/util/vfs.c

@@ -15,6 +15,7 @@ #include <io.h>

#include <windows.h> #define PATH_SEP '\\' #elif defined(_3DS) +#include "util/memory.h" #define PATH_SEP '/' #else #include <sys/mman.h>

@@ -143,6 +144,18 @@ CloseHandle(vfd->hMap);

vfd->hMap = 0; } #elif defined(_3DS) +static void* _vfdMap(struct VFile* vf, size_t size, int flags) { + UNUSED(flags); + void* buffer = anonymousMemoryMap(size); + vf->read(vf, buffer, size); + vf->seek(vf, -(off_t) size, SEEK_CUR); + return buffer; +} + +static void _vfdUnmap(struct VFile* vf, void* memory, size_t size) { + UNUSED(vf); + mappedMemoryFree(memory, size); +} #else static void* _vfdMap(struct VFile* vf, size_t size, int flags) { struct VFileFD* vfd = (struct VFileFD*) vf;