diff --git a/src/platform/3ds/3ds-vfs.c b/src/platform/3ds/3ds-vfs.c index a0e4defba..6965a51a5 100644 --- a/src/platform/3ds/3ds-vfs.c +++ b/src/platform/3ds/3ds-vfs.c @@ -33,19 +33,9 @@ struct VFile* VFileOpen3DS(FS_archive archive, const char* path, int flags) { 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; } diff --git a/src/platform/3ds/main.c b/src/platform/3ds/main.c index e9dc69f2c..8114aecb5 100644 --- a/src/platform/3ds/main.c +++ b/src/platform/3ds/main.c @@ -41,9 +41,10 @@ int main() { (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);