all repos — mgba @ b278bbb23d0f2ffcc93b598935532ed412babbdc

mGBA Game Boy Advance Emulator

PSP2: Translate POSIX open modes to SCE open modes
Jeffrey Pfau jeffrey@endrift.com
Sat, 22 Aug 2015 00:31:12 -0700
commit

b278bbb23d0f2ffcc93b598935532ed412babbdc

parent

2dbf207f9b2257ad03b4349971c26c48aec4b564

1 files changed, 23 insertions(+), 1 deletions(-)

jump to
M src/util/vfs.csrc/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