mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #18683 from hrydgard/iso-directory-bugfix
Handle file type detection of extracted ISO directories better
This commit is contained in:
commit
1d076e28b3
3 changed files with 14 additions and 8 deletions
|
@ -117,7 +117,7 @@ void HTTPFileLoader::Prepare() {
|
|||
|
||||
int HTTPFileLoader::SendHEAD(const Url &url, std::vector<std::string> &responseHeaders) {
|
||||
if (!url.Valid()) {
|
||||
ERROR_LOG(LOADER, "HTTP request failed, invalid URL");
|
||||
ERROR_LOG(LOADER, "HTTP request failed, invalid URL: '%s'", url.ToString().c_str());
|
||||
latestError_ = "Invalid URL";
|
||||
return -400;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ int HTTPFileLoader::SendHEAD(const Url &url, std::vector<std::string> &responseH
|
|||
client_.SetDataTimeout(20.0);
|
||||
Connect();
|
||||
if (!connected_) {
|
||||
ERROR_LOG(LOADER, "HTTP request failed, failed to connect: %s port %d", url.Host().c_str(), url.Port());
|
||||
ERROR_LOG(LOADER, "HTTP request failed, failed to connect: %s port %d (resource: '%s')", url.Host().c_str(), url.Port(), url.Resource().c_str());
|
||||
latestError_ = "Could not connect (refused to connect)";
|
||||
return -400;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,14 @@ extern "C"
|
|||
std::mutex NPDRMDemoBlockDevice::mutex_;
|
||||
|
||||
BlockDevice *constructBlockDevice(FileLoader *fileLoader) {
|
||||
if (!fileLoader->Exists())
|
||||
if (!fileLoader->Exists()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (fileLoader->IsDirectory()) {
|
||||
ERROR_LOG(LOADER, "Can't open directory directly as block device: %s", fileLoader->GetPath().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char buffer[8]{};
|
||||
size_t size = fileLoader->ReadAt(0, 1, 8, buffer);
|
||||
if (size != 8) {
|
||||
|
@ -61,7 +67,7 @@ BlockDevice *constructBlockDevice(FileLoader *fileLoader) {
|
|||
return new CHDFileBlockDevice(fileLoader);
|
||||
}
|
||||
|
||||
// Should be just a regular ISO. Let's open it as a plain block device and let the other systems take over.
|
||||
// Should be just a regular ISO file. Let's open it as a plain block device and let the other systems take over.
|
||||
return new FileBlockDevice(fileLoader);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,8 @@ u64 GameInfo::GetGameSizeOnDiskInBytes() {
|
|||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
return File::ComputeRecursiveDirectorySize(ResolvePBPDirectory(filePath_));
|
||||
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
return File::ComputeRecursiveDirectorySize(GetFileLoader()->GetPath());
|
||||
default:
|
||||
return GetFileLoader()->FileSize();
|
||||
}
|
||||
|
@ -138,7 +139,8 @@ u64 GameInfo::GetGameSizeUncompressedInBytes() {
|
|||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
return File::ComputeRecursiveDirectorySize(ResolvePBPDirectory(filePath_));
|
||||
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
return File::ComputeRecursiveDirectorySize(GetFileLoader()->GetPath());
|
||||
default:
|
||||
{
|
||||
BlockDevice *blockDevice = constructBlockDevice(GetFileLoader().get());
|
||||
|
@ -576,7 +578,6 @@ handleELF:
|
|||
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
{
|
||||
info_->fileType = IdentifiedFileType::PSP_ISO;
|
||||
SequentialHandleAllocator handles;
|
||||
VirtualDiscFileSystem umd(&handles, gamePath_);
|
||||
|
||||
|
@ -606,7 +607,6 @@ handleELF:
|
|||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
{
|
||||
info_->fileType = IdentifiedFileType::PSP_ISO;
|
||||
SequentialHandleAllocator handles;
|
||||
// Let's assume it's an ISO.
|
||||
// TODO: This will currently read in the whole directory tree. Not really necessary for just a
|
||||
|
|
Loading…
Add table
Reference in a new issue