Avoid bloating patch size any more than strictly needed

This commit is contained in:
Kevin Cathcart 2018-07-14 21:11:31 -04:00
parent 3c19ea33e9
commit 1402a4bb1b
1 changed files with 6 additions and 2 deletions

View File

@ -1182,7 +1182,7 @@ class TextTable(object):
else: else:
self._text[key]=value self._text[key]=value
def getBytes(self): def getBytes(self, pad=false):
logger = logging.getLogger('') logger = logging.getLogger('')
data = b''.join(self._text.values()) data = b''.join(self._text.values())
logger.debug("translation space remaining: %i", self.SIZE - len(data)) logger.debug("translation space remaining: %i", self.SIZE - len(data))
@ -1190,7 +1190,10 @@ class TextTable(object):
if len(data) > self.SIZE: if len(data) > self.SIZE:
raise Exception("Text data is too large to fit") raise Exception("Text data is too large to fit")
return data.ljust(self.SIZE, b'\xff') if (pad):
return data.ljust(self.SIZE, b'\xff')
else:
return data
def removeUnwantedText(self): def removeUnwantedText(self):
nomessage = bytes(CompressedTextMapper.convert("{NOTEXT}", False)) nomessage = bytes(CompressedTextMapper.convert("{NOTEXT}", False))
@ -1805,3 +1808,4 @@ class TextTable(object):
text['ganon_phase_3_alt'] = CompressedTextMapper.convert("Got wax in\nyour ears?\nI cannot die!") text['ganon_phase_3_alt'] = CompressedTextMapper.convert("Got wax in\nyour ears?\nI cannot die!")
# 190 # 190
text['end_pad_data'] = bytearray([0xfb]) text['end_pad_data'] = bytearray([0xfb])
text['terminator'] = bytearray([0xFF, 0xFF])