PSP2: Translate POSIX open modes to SCE open modes
Jeffrey Pfau jeffrey@endrift.com
Sat, 22 Aug 2015 00:31:12 -0700
1 files changed,
23 insertions(+),
1 deletions(-)
jump to
M
src/util/vfs.c
→
src/util/vfs.c
@@ -35,7 +35,29 @@ break;
} return VFileFOpen(path, chflags); #elif defined(PSP2) - return VFileOpenSce(path, flags, 0666); + int sceFlags = PSP2_O_RDONLY; + switch (flags & O_ACCMODE) { + case O_WRONLY: + sceFlags = PSP2_O_WRONLY; + break; + case O_RDWR: + sceFlags = PSP2_O_RDWR; + break; + case O_RDONLY: + sceFlags = PSP2_O_RDONLY; + break; + } + + if (flags & O_APPEND) { + sceFlags |= PSP2_O_APPEND; + } + if (flags & O_TRUNC) { + sceFlags |= PSP2_O_TRUNC; + } + if (flags & O_CREAT) { + sceFlags |= PSP2_O_CREAT; + } + return VFileOpenSce(path, sceFlags, 0666); #else return VFileOpenFD(path, flags); #endif