Skip to content

Commit

Permalink
Fix a bunch of cases where we forgot to check for chd files
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Mar 13, 2024
1 parent a0aaab9 commit 55974f6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Core/FileSystems/DirectoryFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions Core/Loaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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') {
Expand Down
4 changes: 2 additions & 2 deletions Core/Util/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion UWP/PPSSPP_UWPMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" };
Expand Down

0 comments on commit 55974f6

Please sign in to comment.