mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 01:33:45 +01:00
Avoid some unnecessary error reporting while loading ISOs for the file browser
This commit is contained in:
1 parent
21e4677305
commit
e9d5e451fb
3 files changed
+22
-10
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user