From 55974f61ad81f9cddbece0eeb9477482cb1bd761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 12 Mar 2024 22:34:17 +0100 Subject: [PATCH] Fix a bunch of cases where we forgot to check for chd files --- Core/FileSystems/DirectoryFileSystem.cpp | 2 +- Core/Loaders.cpp | 9 ++++++--- Core/Util/GameManager.cpp | 4 ++-- UWP/PPSSPP_UWPMain.cpp | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 3b90f5d9bb7f..9c39ece529e4 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -830,7 +830,7 @@ std::vector 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) { diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index b304af72bdbf..f15a07139740 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -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') { diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 7e01533a40ce..ebbcb74b6096 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -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); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 5a2d2109614a..f90e96ae50b4 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -502,7 +502,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string std::vector 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" };