From 1de704fab5af5463e9d1b94f0b88363663dfda52 Mon Sep 17 00:00:00 2001 From: Tellow Krinkle Date: Fri, 14 Sep 2018 23:25:27 -0500 Subject: [PATCH] TMPAssetConverter now adds 0x0A --- scripts/TMPAssetConverter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/TMPAssetConverter.py b/scripts/TMPAssetConverter.py index f20efd7..080e24a 100644 --- a/scripts/TMPAssetConverter.py +++ b/scripts/TMPAssetConverter.py @@ -53,8 +53,15 @@ class FontFile: length = int.from_bytes(self.Array, byteorder="little") atlasWidth = struct.unpack(" 8: data.advance((itemLength - 8) * 4) x, y, width, height = struct.unpack(" atlasHeight: info[8:12] = self.AtlasHeight self.Array += info + if not lf and cr is not None: + print(f"No 0x0A LF character found, copying one from 0x0D CR") + arrayLength = int.from_bytes(self.Array[0:4], byteorder="little") + arrayLength += 1 + arrayLengthBytes = arrayLength.to_bytes(4, byteorder="little") + cr[0:4] = (0x0A).to_bytes(4, byteorder="little") + self.Array = arrayLengthBytes + cr + self.Array[4:] + self.CharacterCount = arrayLengthBytes + def _fromGame(self, data, filename, emptyAtlasPoint): data = DataScanner(data)