Avoid some unnecessary error reporting while loading ISOs for the file browser

This commit is contained in:
Henrik Rydgård committed 2026-05-31 23:31:06 +02:00
1 parent 21e4677305
commit e9d5e451fb
3 files changed
+22 -10

No files matched your search

+5
View File
@@ -411,6 +411,11 @@ ISOContainerFileBlockDevice::ISOContainerFileBlockDevice(FileLoader *fileLoader)
SequentialHandleAllocator alloc;
ISOFileSystem iso(&alloc, outerBlockDevice_);
if (!iso.Error().empty()) {
errorString_ = iso.Error();
outerBlockDevice_.reset();
return;
}
PSPFileInfo layer0Info = iso.GetFileInfo("/USER_L0.IMG");
if (!layer0Info.exists) {
+10 -6
View File
@@ -154,8 +154,17 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, std::shared_ptr<BlockDev
hAlloc = _hAlloc;
VolDescriptor desc;
if (!blockDevice->ReadBlock(16, (u8*)&desc))
if (!blockDevice->ReadBlock(16, (u8*)&desc)) {
// TODO: This is kinda wacky.
blockDevice->NotifyReadError();
errorString_ = "ISO: error reading volume descriptor";
return;
}
if (memcmp(desc.cd001, "CD001", 5)) {
errorString_ = "ISO: missing CD001 signature";
return;
}
entireISO.name.clear();
entireISO.isDirectory = false;
@@ -172,11 +181,6 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, std::shared_ptr<BlockDev
treeroot->parent = NULL;
treeroot->valid = false;
if (memcmp(desc.cd001, "CD001", 5)) {
ERROR_LOG(Log::FileSystem, "ISO looks bogus, expected CD001 signature not present? Giving up...");
return;
}
treeroot->startsector = desc.root.firstDataSector;
treeroot->dirsize = desc.root.dataLength;
}
+7 -4
View File
@@ -58,6 +58,8 @@ public:
void Describe(char *buf, size_t size) const override { snprintf(buf, size, "ISO"); } // TODO: Ask the fileLoader about the origins
std::shared_ptr<BlockDevice> GetBlockDevice() override { return blockDevice; }
const std::string &Error() const { return errorString_; }
private:
struct TreeEntry {
~TreeEntry();
@@ -91,12 +93,13 @@ private:
typedef std::map<u32, OpenFileEntry> EntryMap;
EntryMap entries;
IHandleAllocator *hAlloc;
TreeEntry *treeroot;
IHandleAllocator *hAlloc = nullptr;
TreeEntry *treeroot = nullptr;
std::shared_ptr<BlockDevice> blockDevice;
mutable u32 lastReadBlock_;
mutable u32 lastReadBlock_ = 0;
TreeEntry entireISO;
TreeEntry entireISO{};
std::string errorString_;
void ReadDirectory(TreeEntry *root) const;
const TreeEntry *GetFromPath(std::string_view path, bool catchError = true);