Fix loading of .rpx files by returning the correct status when a file was not found

This commit is contained in:
Maschell 2022-03-05 22:42:43 +01:00
parent 614729f9e6
commit f5d8fced32

View File

@ -364,13 +364,16 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path,
sscanf(id, "%08X", &lowerTitleID); sscanf(id, "%08X", &lowerTitleID);
int32_t idVal = getIDByLowerTitleID(lowerTitleID); int32_t idVal = getIDByLowerTitleID(lowerTitleID);
if (idVal >= 0) { if (idVal >= 0) {
if (StringTools::EndsWith(gFileInfos[idVal].filename, ".wuhb") && OpenFileForID(idVal, ending, handle) < 0) { if (!StringTools::EndsWith(gFileInfos[idVal].filename, ".wuhb")) {
return res; return res;
} }
if (OpenFileForID(idVal, ending, handle) >= 0) {
return FS_STATUS_OK;
}
} else { } else {
DEBUG_FUNCTION_LINE("Failed to find id for titleID %08X", lowerTitleID); DEBUG_FUNCTION_LINE("Failed to find id for titleID %08X", lowerTitleID);
} }
return FS_STATUS_OK; return res;
} }
} }