Filesystem: Do more validity checking in the constructor

This makes it possible to catch errors earlier so that file systems
simply fail to load instead of behaving oddly. It also makes it possible
to check for errors that weren't checkable before, like the end of a
directory being after the end of the parent directory.
This commit is contained in:
JosJuice
2015-10-20 14:32:04 +02:00
parent ee27be06d7
commit e3a2cd827a
2 changed files with 71 additions and 36 deletions

View File

@ -46,6 +46,8 @@ public:
std::string GetName() const override;
std::string GetPath() const override;
bool IsValid(u64 fst_size, const FileInfoGCWii& parent_directory) const;
protected:
uintptr_t GetAddress() const override;
FileInfo& operator++() override;
@ -71,6 +73,8 @@ private:
// Returns one of the three properties of this FST entry.
// Read the comments in EntryProperty for details.
u32 Get(EntryProperty entry_property) const;
// Returns the name offset, excluding the directory identification byte
u64 GetNameOffset() const;
const u8* m_fst;
u8 m_offset_shift;