3DS: Clean out unnecessary abstraction in VFS

This commit is contained in:
Jeffrey Pfau 2014-12-09 03:46:34 -08:00
parent 4b5822a8ec
commit da3c45a0e7
2 changed files with 7 additions and 16 deletions

View File

@ -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;
}

View File

@ -41,9 +41,10 @@ int main() {
(FS_path) { PATH_EMPTY, 1, (u8*)"" },
0, 0
};
FSUSER_OpenArchive(0, &sdmcArchive);
struct VFile* rom = VFileOpen3DS(sdmcArchive, "/rom.gba", O_RDONLY);
struct VFile* save = VFileOpen3DS(sdmcArchive, "/rom.sav", O_RDWR | O_CREAT);
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);