diff --git a/src/32x/Platform_32x.c b/src/32x/Platform_32x.c index e7027eb18..d288fefc0 100644 --- a/src/32x/Platform_32x.c +++ b/src/32x/Platform_32x.c @@ -22,6 +22,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = 99999; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = 99999; const cc_result ReturnCode_SocketInProgess = -1; diff --git a/src/3ds/Platform_3DS.c b/src/3ds/Platform_3DS.c index 11b341ded..90dbb7646 100644 --- a/src/3ds/Platform_3DS.c +++ b/src/3ds/Platform_3DS.c @@ -35,6 +35,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/Graphics_SoftMin.c b/src/Graphics_SoftMin.c index df8095015..4840b366e 100644 --- a/src/Graphics_SoftMin.c +++ b/src/Graphics_SoftMin.c @@ -130,7 +130,7 @@ static void ClearColorBuffer(void) { int i, x, y, size = fb_width * fb_height; #ifdef CC_BUILD_GBA - /* in mGBA, fast clear takes ~2ms compared to ~52ms of code below */ + /* in mGBA, fast clear takes ~3ms compared to ~52ms of standard code below */ extern void VRAM_FastClear(BitmapCol color); VRAM_FastClear(clearColor); #else diff --git a/src/Launcher.c b/src/Launcher.c index 9d16b200d..2a6acf4a7 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -465,7 +465,8 @@ static cc_result ExtractTexturePack(const cc_string* path) { Platform_EncodePath(&raw_path, path); res = Stream_OpenPath(&stream, &raw_path); - if (res == ReturnCode_FileNotFound) return res; + + if (ReturnCode_IsNotFound(res)) return res; if (res) { Logger_SysWarn(res, "opening texture pack"); return res; } res = Zip_Extract(&stream, diff --git a/src/Platform.h b/src/Platform.h index 5a7bc18fc..b5cd5538f 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -264,8 +264,11 @@ extern cc_bool Platform_ReadonlyFilesystem; extern const cc_result ReturnCode_FileShareViolation; /* Result code for when trying to open a non-existent file */ extern const cc_result ReturnCode_FileNotFound; +/* Result code for when trying to open a file in a non-existent path */ +extern const cc_result ReturnCode_PathNotFound; /* Result code for when trying to create an already existent directory */ extern const cc_result ReturnCode_DirectoryExists; +#define ReturnCode_IsNotFound(res) ((res) == ReturnCode_FileNotFound || (res) == ReturnCode_PathNotFound) /* Attempts to create a new directory. */ cc_result Directory_Create(const cc_filepath* path); diff --git a/src/Platform_MacClassic.c b/src/Platform_MacClassic.c index 56989fd45..b147d1083 100644 --- a/src/Platform_MacClassic.c +++ b/src/Platform_MacClassic.c @@ -27,6 +27,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; const cc_result ReturnCode_FileNotFound = fnfErr; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = dupFNErr; const cc_result ReturnCode_SocketInProgess = 1000000; const cc_result ReturnCode_SocketWouldBlock = 1000000; diff --git a/src/Platform_N64.c b/src/Platform_N64.c index b54469376..b056fdfd0 100644 --- a/src/Platform_N64.c +++ b/src/Platform_N64.c @@ -28,6 +28,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/Platform_Posix.c b/src/Platform_Posix.c index 89f0298f5..2c4a01e9b 100644 --- a/src/Platform_Posix.c +++ b/src/Platform_Posix.c @@ -33,6 +33,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/Platform_WinCE.c b/src/Platform_WinCE.c index e80fb247c..a1d7e1108 100644 --- a/src/Platform_WinCE.c +++ b/src/Platform_WinCE.c @@ -25,6 +25,7 @@ static HANDLE heap; const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND; +const cc_result ReturnCode_PathNotFound = ERROR_PATH_NOT_FOUND; const cc_result ReturnCode_DirectoryExists = ERROR_ALREADY_EXISTS; const cc_result ReturnCode_SocketInProgess = WSAEINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = WSAEWOULDBLOCK; diff --git a/src/Platform_Windows.c b/src/Platform_Windows.c index 63ce5ac6b..3a8c505b1 100644 --- a/src/Platform_Windows.c +++ b/src/Platform_Windows.c @@ -27,6 +27,7 @@ static HANDLE heap; const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND; +const cc_result ReturnCode_PathNotFound = ERROR_PATH_NOT_FOUND; const cc_result ReturnCode_DirectoryExists = ERROR_ALREADY_EXISTS; const cc_result ReturnCode_SocketInProgess = WSAEINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = WSAEWOULDBLOCK; diff --git a/src/Resources.c b/src/Resources.c index 9c0eca604..c951b3e56 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -69,7 +69,8 @@ static void ZipFile_InspectEntries(const cc_string* path, Zip_SelectEntry select Platform_EncodePath(&raw_path, path); res = Stream_OpenPath(&stream, &raw_path); - if (res == ReturnCode_FileNotFound) return; + + if (ReturnCode_IsNotFound(res)) return; if (res) { Logger_IOWarn2(res, "opening", &raw_path); return; } res = Zip_Extract(&stream, selector, NULL, diff --git a/src/UWP/Platform_UWP.cpp b/src/UWP/Platform_UWP.cpp index c8f15ccbf..f82f01450 100644 --- a/src/UWP/Platform_UWP.cpp +++ b/src/UWP/Platform_UWP.cpp @@ -31,6 +31,7 @@ using namespace Windows::System; static HANDLE heap; const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND; +const cc_result ReturnCode_PathNotFound = ERROR_PATH_NOT_FOUND; const cc_result ReturnCode_DirectoryExists = ERROR_ALREADY_EXISTS; const cc_result ReturnCode_SocketInProgess = WSAEINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = WSAEWOULDBLOCK; diff --git a/src/amiga/Platform_Amiga.c b/src/amiga/Platform_Amiga.c index 070ca5ba6..99a7e1071 100644 --- a/src/amiga/Platform_Amiga.c +++ b/src/amiga/Platform_Amiga.c @@ -22,6 +22,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; const cc_result ReturnCode_FileNotFound = 1000000; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = 1000000; const cc_result ReturnCode_SocketInProgess = 1000000; const cc_result ReturnCode_SocketWouldBlock = 1000000; diff --git a/src/atari_st/Platform_Atari.c b/src/atari_st/Platform_Atari.c index 88a641c92..0798a0bb2 100644 --- a/src/atari_st/Platform_Atari.c +++ b/src/atari_st/Platform_Atari.c @@ -25,6 +25,7 @@ typedef volatile uint32_t vu32; const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = -1; +const cc_result ReturnCode_PathNotFound = -1; const cc_result ReturnCode_DirectoryExists = -1; const cc_result ReturnCode_SocketInProgess = -1; const cc_result ReturnCode_SocketWouldBlock = -1; diff --git a/src/dreamcast/Platform_Dreamcast.c b/src/dreamcast/Platform_Dreamcast.c index 83689dc84..83089408b 100644 --- a/src/dreamcast/Platform_Dreamcast.c +++ b/src/dreamcast/Platform_Dreamcast.c @@ -31,6 +31,7 @@ KOS_INIT_FLAGS(INIT_CONTROLLER | INIT_KEYBOARD | INIT_MOUSE | const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/gba/Platform_GBA.c b/src/gba/Platform_GBA.c index 934e94b89..55ca7173a 100644 --- a/src/gba/Platform_GBA.c +++ b/src/gba/Platform_GBA.c @@ -25,6 +25,7 @@ typedef volatile uint32_t vu32; const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = -1; +const cc_result ReturnCode_PathNotFound = -1; const cc_result ReturnCode_DirectoryExists = -1; const cc_result ReturnCode_SocketInProgess = -1; const cc_result ReturnCode_SocketWouldBlock = -1; diff --git a/src/gcwii/Platform_Gamecube.c b/src/gcwii/Platform_Gamecube.c index b502007b5..4c393c897 100644 --- a/src/gcwii/Platform_Gamecube.c +++ b/src/gcwii/Platform_Gamecube.c @@ -31,6 +31,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = -EINPROGRESS; // net_XYZ error results are negative const cc_result ReturnCode_SocketWouldBlock = -EWOULDBLOCK; diff --git a/src/gcwii/Platform_Wii.c b/src/gcwii/Platform_Wii.c index a56ce9407..8000c4ca0 100644 --- a/src/gcwii/Platform_Wii.c +++ b/src/gcwii/Platform_Wii.c @@ -33,6 +33,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = -EINPROGRESS; // net_XYZ error results are negative const cc_result ReturnCode_SocketWouldBlock = -EWOULDBLOCK; diff --git a/src/msdos/Platform_MSDOS.c b/src/msdos/Platform_MSDOS.c index 3672ec24f..10aff0b80 100644 --- a/src/msdos/Platform_MSDOS.c +++ b/src/msdos/Platform_MSDOS.c @@ -29,6 +29,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = -10002; const cc_result ReturnCode_SocketWouldBlock = -10002; diff --git a/src/nds/Platform_NDS.c b/src/nds/Platform_NDS.c index 8486f3663..8aef7c25a 100644 --- a/src/nds/Platform_NDS.c +++ b/src/nds/Platform_NDS.c @@ -45,6 +45,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/ps1/Platform_PS1.c b/src/ps1/Platform_PS1.c index e1a6dd2ad..eb6182291 100644 --- a/src/ps1/Platform_PS1.c +++ b/src/ps1/Platform_PS1.c @@ -30,6 +30,7 @@ void* calloc(size_t num, size_t size) { const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = 99999; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = 99999; const cc_result ReturnCode_SocketInProgess = -1; diff --git a/src/ps2/Platform_PS2.c b/src/ps2/Platform_PS2.c index 19b2f78ed..13b8c05d9 100644 --- a/src/ps2/Platform_PS2.c +++ b/src/ps2/Platform_PS2.c @@ -43,6 +43,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = -4; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = -8; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; diff --git a/src/ps3/Platform_PS3.c b/src/ps3/Platform_PS3.c index a581f7391..1215edd51 100644 --- a/src/ps3/Platform_PS3.c +++ b/src/ps3/Platform_PS3.c @@ -36,6 +36,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = 0x80010006; // ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = 0x80010014; // EEXIST const cc_result ReturnCode_SocketInProgess = NET_EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = NET_EWOULDBLOCK; diff --git a/src/ps4/Platform_PS4.c b/src/ps4/Platform_PS4.c index 04b4e22a1..54f81a4a2 100644 --- a/src/ps4/Platform_PS4.c +++ b/src/ps4/Platform_PS4.c @@ -35,6 +35,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/psp/Platform_PSP.c b/src/psp/Platform_PSP.c index 155a602c5..4124dfa27 100644 --- a/src/psp/Platform_PSP.c +++ b/src/psp/Platform_PSP.c @@ -25,6 +25,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/psvita/Platform_PSVita.c b/src/psvita/Platform_PSVita.c index 68b89cc48..872a2db19 100644 --- a/src/psvita/Platform_PSVita.c +++ b/src/psvita/Platform_PSVita.c @@ -17,6 +17,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = SCE_NET_ERROR_EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = SCE_NET_ERROR_EWOULDBLOCK; diff --git a/src/saturn/Platform_Saturn.c b/src/saturn/Platform_Saturn.c index c7cb5fe5f..60d19cee3 100644 --- a/src/saturn/Platform_Saturn.c +++ b/src/saturn/Platform_Saturn.c @@ -28,6 +28,7 @@ void* calloc(size_t num, size_t size) { const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = 99999; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = 99999; const cc_result ReturnCode_SocketInProgess = -1; diff --git a/src/switch/Platform_Switch.c b/src/switch/Platform_Switch.c index a9d6962ac..af2da842b 100644 --- a/src/switch/Platform_Switch.c +++ b/src/switch/Platform_Switch.c @@ -30,6 +30,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/symbian/Platform_Symbian.cpp b/src/symbian/Platform_Symbian.cpp index f23f2fef1..a50dc66e2 100644 --- a/src/symbian/Platform_Symbian.cpp +++ b/src/symbian/Platform_Symbian.cpp @@ -44,6 +44,7 @@ extern "C" { const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/webclient/Platform_Web.c b/src/webclient/Platform_Web.c index 6d2796349..0b81c7117 100644 --- a/src/webclient/Platform_Web.c +++ b/src/webclient/Platform_Web.c @@ -30,6 +30,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; // Not used in web filesystem backend const cc_result ReturnCode_FileNotFound = _ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_SocketInProgess = _EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = _EAGAIN; const cc_result ReturnCode_DirectoryExists = _EEXIST; diff --git a/src/wiiu/Platform_WiiU.c b/src/wiiu/Platform_WiiU.c index bdfb75afe..e30c0c8b6 100644 --- a/src/wiiu/Platform_WiiU.c +++ b/src/wiiu/Platform_WiiU.c @@ -44,6 +44,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/xbox/Platform_Xbox.c b/src/xbox/Platform_Xbox.c index a38a116a2..4d78b9617 100644 --- a/src/xbox/Platform_Xbox.c +++ b/src/xbox/Platform_Xbox.c @@ -20,6 +20,7 @@ const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND; +const cc_result ReturnCode_PathNotFound = ERROR_PATH_NOT_FOUND; const cc_result ReturnCode_DirectoryExists = ERROR_ALREADY_EXISTS; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK; diff --git a/src/xbox360/Platform_Xbox360.c b/src/xbox360/Platform_Xbox360.c index 94f1c4178..87d11db22 100644 --- a/src/xbox360/Platform_Xbox360.c +++ b/src/xbox360/Platform_Xbox360.c @@ -29,6 +29,7 @@ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; +const cc_result ReturnCode_PathNotFound = 99999; const cc_result ReturnCode_DirectoryExists = EEXIST; const cc_result ReturnCode_SocketInProgess = EINPROGRESS; const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;