From 95a45c04662fc979ad8b4e5fa4dab6fdf6dd08b9 Mon Sep 17 00:00:00 2001 From: seiya-git Date: Fri, 10 Nov 2023 11:26:14 +0300 Subject: [PATCH] Added missing null terminator at the end of the string table --- py/nstools/Fs/Hfs0.py | 4 ++-- py/nstools/Fs/Pfs0.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/py/nstools/Fs/Hfs0.py b/py/nstools/Fs/Hfs0.py index cd050af..6eb5130 100644 --- a/py/nstools/Fs/Hfs0.py +++ b/py/nstools/Fs/Hfs0.py @@ -69,10 +69,10 @@ def close(self): super(Hfs0Stream, self).close() def getHeader(self): - stringTable = '\x00'.join(file['name'] for file in self.files) + stringTable = '\x00'.join(file['name'] for file in self.files)+'\x00' headerSize = 0x10 + len(self.files) * 0x40 + len(stringTable) - + h = b'' h += b'HFS0' h += len(self.files).to_bytes(4, byteorder='little') diff --git a/py/nstools/Fs/Pfs0.py b/py/nstools/Fs/Pfs0.py index c33afb2..7ebd318 100644 --- a/py/nstools/Fs/Pfs0.py +++ b/py/nstools/Fs/Pfs0.py @@ -68,12 +68,12 @@ def close(self): super(Pfs0Stream, self).close() def getHeaderSize(self): - stringTable = '\x00'.join(file['name'] for file in self.files) + stringTable = '\x00'.join(file['name'] for file in self.files)+'\x00' headerSize = 0x10 + len(self.files) * 0x18 + self.stringTableSize return headerSize def getStringTableSize(self): - stringTable = '\x00'.join(file['name'] for file in self.files) + stringTable = '\x00'.join(file['name'] for file in self.files)+'\x00' stringTableLen = len(stringTable) if self._stringTableSize == None: self._stringTableSize = stringTableLen