mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
Fix bug in detecting corrupt RomFs.
This commit is contained in:
parent
41fee26d1f
commit
5670cb7e16
2
deps/libnintendo-hac
vendored
2
deps/libnintendo-hac
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a4bef5a52859625027f75b71d802b1a53af18534
|
||||
Subproject commit 02a5acb78bfa55edfeebcc42b4591b3d43424575
|
|
@ -83,10 +83,10 @@ void nstool::RomfsProcess::importHeader()
|
|||
mFile->seek(0, tc::io::SeekOrigin::Begin);
|
||||
mFile->read((byte_t*)&mRomfsHeader, sizeof(mRomfsHeader));
|
||||
if (mRomfsHeader.header_size.unwrap() != sizeof(nn::hac::sRomfsHeader) ||
|
||||
mRomfsHeader.dir_hash_bucket.offset.unwrap() != sizeof(nn::hac::sRomfsHeader) ||
|
||||
mRomfsHeader.dir_entry.offset.unwrap() != (mRomfsHeader.dir_hash_bucket.offset.unwrap() + mRomfsHeader.dir_hash_bucket.size.unwrap()) ||
|
||||
mRomfsHeader.data_offset.unwrap() != align<int64_t>(mRomfsHeader.header_size.unwrap(), nn::hac::romfs::kRomfsHeaderAlign))
|
||||
{
|
||||
throw tc::ArgumentOutOfRangeException("nn::hac::RomFsMetaGenerator", "Corrupt RomFs: RomFsHeader is corrupted.");
|
||||
throw tc::ArgumentOutOfRangeException(mModuleName, "Corrupt RomFs: RomFsHeader is corrupted.");
|
||||
}
|
||||
|
||||
// get dir entry ptr
|
||||
|
@ -105,7 +105,11 @@ void nstool::RomfsProcess::importHeader()
|
|||
{
|
||||
uint32_t total_size = sizeof(nn::hac::sRomfsDirEntry) + align<uint32_t>(((nn::hac::sRomfsDirEntry*)(dir_entry_table.data() + v_addr))->name_size.unwrap(), 4);
|
||||
|
||||
// don't count root directory
|
||||
if (v_addr != 0)
|
||||
{
|
||||
mDirNum += 1;
|
||||
}
|
||||
|
||||
v_addr += total_size;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue