mirror of
https://github.com/xprism1/ntool.git
synced 2025-06-19 11:05:41 -04:00
ctr_romfs: add support for reading L3 only
This commit is contained in:
parent
2417b6831d
commit
1865b2831c
@ -118,9 +118,11 @@ def calc_path_hash(name, parent_off):
|
|||||||
return h
|
return h
|
||||||
|
|
||||||
class RomFSReader:
|
class RomFSReader:
|
||||||
def __init__(self, file):
|
def __init__(self, file, lvl3only=False):
|
||||||
self.file = file
|
self.file = file
|
||||||
|
self.lvl3only = lvl3only
|
||||||
|
|
||||||
|
if not lvl3only:
|
||||||
with open(file, 'rb') as f:
|
with open(file, 'rb') as f:
|
||||||
self.hdr = RomFSHdr(f.read(0x5C))
|
self.hdr = RomFSHdr(f.read(0x5C))
|
||||||
|
|
||||||
@ -157,6 +159,8 @@ class RomFSReader:
|
|||||||
curr += hashes['Level 2']['size']
|
curr += hashes['Level 2']['size']
|
||||||
|
|
||||||
self.hashes = hashes
|
self.hashes = hashes
|
||||||
|
else:
|
||||||
|
self.lvl3_offset = 0
|
||||||
|
|
||||||
# Parse level 3 (actual data)
|
# Parse level 3 (actual data)
|
||||||
self.files = {}
|
self.files = {}
|
||||||
@ -216,6 +220,7 @@ class RomFSReader:
|
|||||||
print(f'Extracted to {output_dir}')
|
print(f'Extracted to {output_dir}')
|
||||||
|
|
||||||
def verify(self):
|
def verify(self):
|
||||||
|
if not self.lvl3only:
|
||||||
f = open(self.file, 'rb')
|
f = open(self.file, 'rb')
|
||||||
|
|
||||||
hash_check = []
|
hash_check = []
|
||||||
|
Loading…
Reference in New Issue
Block a user