Merge pull request #18924 from hrydgard/chd-detection-fixes

Fix a bunch of cases where we forgot to check for CHD files
This commit is contained in:
Henrik Rydgård 2024-03-13 13:12:09 +01:00 committed by GitHub
commit 0b4dfb8d20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 7 deletions

View File

@ -830,7 +830,7 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(const std::string &p
entry.name = file.name;
}
if (hideISOFiles) {
if (endsWithNoCase(entry.name, ".cso") || endsWithNoCase(entry.name, ".iso")) {
if (endsWithNoCase(entry.name, ".cso") || endsWithNoCase(entry.name, ".iso") || endsWithNoCase(entry.name, ".chd")) { // chd not really necessary, but let's hide them too.
// Workaround for DJ Max Portable, see compat.ini.
continue;
} else if (file.isDirectory) {

View File

@ -92,9 +92,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader, std::string *errorStrin
// maybe it also just happened to have that size, let's assume it's a PSP ISO and error out later if it's not.
}
return IdentifiedFileType::PSP_ISO;
} else if (extension == ".cso") {
return IdentifiedFileType::PSP_ISO;
} else if (extension == ".chd") {
} else if (extension == ".cso" || extension == ".chd") {
return IdentifiedFileType::PSP_ISO;
} else if (extension == ".ppst") {
return IdentifiedFileType::PPSSPP_SAVESTATE;
@ -170,6 +168,11 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader, std::string *errorStrin
// CISO are not used for many other kinds of ISO so let's just guess it's a PSP one and let it
// fail later...
return IdentifiedFileType::PSP_ISO;
} else if (!memcmp(&_id, "MCom", 4)) {
size_t readSize = fileLoader->ReadAt(4, 4, 1, &_id);
if (!memcmp(&_id, "prHD", 4)) {
return IdentifiedFileType::PSP_ISO; // CHD file
}
}
if (id == 'FLE\x7F') {

View File

@ -244,7 +244,7 @@ ZipFileContents DetectZipFileContents(struct zip *z, ZipFileInfo *info) {
} else {
INFO_LOG(HLE, "Wrong number of slashes (%i) in '%s'", slashCount, fn);
}
} else if (endsWith(zippedName, ".iso") || endsWith(zippedName, ".cso")) {
} else if (endsWith(zippedName, ".iso") || endsWith(zippedName, ".cso") || endsWith(zippedName, ".chd")) {
int slashCount = 0;
int slashLocation = -1;
countSlashes(zippedName, &slashLocation, &slashCount);
@ -304,7 +304,7 @@ bool GameManager::InstallGame(const Path &url, const Path &fileName, bool delete
std::string extension = url.GetFileExtension();
// Examine the URL to guess out what we're installing.
if (extension == ".cso" || extension == ".iso") {
if (extension == ".cso" || extension == ".iso" || extension == ".chd") {
// It's a raw ISO or CSO file. We just copy it to the destination.
std::string shortFilename = url.GetFilename();
bool success = InstallRawISO(fileName, shortFilename, deleteAfter);

View File

@ -502,7 +502,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
std::vector<std::string> supportedExtensions = {};
switch ((BrowseFileType)param3) {
case BrowseFileType::BOOTABLE:
supportedExtensions = { ".cso", ".bin", ".iso", ".elf", ".pbp", ".zip" };
supportedExtensions = { ".cso", ".iso", ".chd", ".elf", ".pbp", ".zip", ".prx", ".bin" }; // should .bin even be here?
break;
case BrowseFileType::INI:
supportedExtensions = { ".ini" };