Handle file type detection of extracted ISO directories better. Reported by Nemoumbra.

This commit is contained in:
Henrik Rydgård committed 2024-01-12 15:37:53 +01:00
1 parent 83999b854b
commit 00f53ad767
3 files changed
+14 -8

No files matched your search

+8 -2
View File
@@ -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);
}