3DS: Clean out unnecessary abstraction in VFS
Jeffrey Pfau jeffrey@endrift.com
Tue, 09 Dec 2014 03:46:34 -0800
2 files changed,
7 insertions(+),
16 deletions(-)
M
src/platform/3ds/3ds-vfs.c
→
src/platform/3ds/3ds-vfs.c
@@ -33,19 +33,9 @@ if (!vf3d) {
return 0; } - int newFlags = 0; - if (flags & O_RDONLY) { - newFlags |= FS_OPEN_READ; - } - if (flags & O_WRONLY) { - newFlags |= FS_OPEN_WRITE; - } - if (flags & O_CREAT) { - newFlags |= FS_OPEN_CREATE; - } - - FS_path lowPath = FS_makePath(PATH_CHAR, path); - if (FSUSER_OpenFileDirectly(0, &vf3d->handle, archive, lowPath, newFlags, FS_ATTRIBUTE_NONE)) { + FS_path newPath = FS_makePath(PATH_CHAR, path); + Result res = FSUSER_OpenFile(0, &vf3d->handle, archive, newPath, flags, FS_ATTRIBUTE_NONE); + if (res & 0xFFFC03FF) { free(vf3d); return 0; }
M
src/platform/3ds/main.c
→
src/platform/3ds/main.c
@@ -41,9 +41,10 @@ ARCH_SDMC,
(FS_path) { PATH_EMPTY, 1, (u8*)"" }, 0, 0 }; - - struct VFile* rom = VFileOpen3DS(sdmcArchive, "/rom.gba", O_RDONLY); - struct VFile* save = VFileOpen3DS(sdmcArchive, "/rom.sav", O_RDWR | O_CREAT); + FSUSER_OpenArchive(0, &sdmcArchive); + + struct VFile* rom = VFileOpen3DS(sdmcArchive, "/rom.gba", FS_OPEN_READ); + struct VFile* save = VFileOpen3DS(sdmcArchive, "/rom.sav", FS_OPEN_WRITE | FS_OPEN_CREATE); GBACreate(gba); ARMSetComponents(cpu, &gba->d, 0, 0);