From 2cb04809431f0d0144c741a3a6af9b3309ab1f2c Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 17 Aug 2015 01:38:07 -0700 Subject: [PATCH] 3DS: Add _vf3dSync --- src/platform/3ds/3ds-vfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/platform/3ds/3ds-vfs.c b/src/platform/3ds/3ds-vfs.c index c1bec39c3..38e7cc55a 100644 --- a/src/platform/3ds/3ds-vfs.c +++ b/src/platform/3ds/3ds-vfs.c @@ -22,6 +22,7 @@ static void* _vf3dMap(struct VFile* vf, size_t size, int flags); static void _vf3dUnmap(struct VFile* vf, void* memory, size_t size); static void _vf3dTruncate(struct VFile* vf, size_t size); static ssize_t _vf3dSize(struct VFile* vf); +static bool _vf3dSync(struct VFile* vf, const void* buffer, size_t size); struct VFile* VFileOpen3DS(FS_archive* archive, const char* path, int flags) { struct VFile3DS* vf3d = malloc(sizeof(struct VFile3DS)); @@ -47,6 +48,7 @@ struct VFile* VFileOpen3DS(FS_archive* archive, const char* path, int flags) { vf3d->d.unmap = _vf3dUnmap; vf3d->d.truncate = _vf3dTruncate; vf3d->d.size = _vf3dSize; + vf3d->d.sync = _vf3dSync; return &vf3d->d; } @@ -126,3 +128,16 @@ ssize_t _vf3dSize(struct VFile* vf) { FSFILE_GetSize(vf3d->handle, &size); return size; } + +static bool _vf3dSync(struct VFile* vf, const void* buffer, size_t size) { + struct VFile3DS* vf3d = (struct VFile3DS*) vf; + if (buffer) { + u32 sizeWritten; + Result res = FSFILE_Write(vf3d->handle, &sizeWritten, 0, buffer, size, FS_WRITE_FLUSH); + if (res) { + return false; + } + } + FSFILE_Flush(vf3d->handle); + return true; +}