diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exporter.py | 11 | ||||
-rw-r--r-- | src/unlock.py | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/exporter.py b/src/exporter.py index 2396633..f39497f 100644 --- a/src/exporter.py +++ b/src/exporter.py @@ -191,7 +191,8 @@ class KPMapExporter: sectorData = self._packSectorData(sectors) # now that we've got that, we can pack the first part of the file - data = bytearray(struct.pack('>IIII', len(self.layers), 16 + len(sectorData), 0, 0)) + data = bytearray(struct.pack('>IIIII', len(self.layers), 20 + len(sectorData), 0, 0, 0)) + requiredFixUps.append((16, 'UnlockBytecode')) # list of layer pointers goes here.. or will, later data += sectorData @@ -420,6 +421,14 @@ class KPMapExporter: for piece in imageData: data += piece + # at the end comes the unlock bytecode + offsets['UnlockBytecode'] = len(data) + unlockBytecode = '' + # note: subtract 1 from the world and level number when saving + # note: also limit world to 1-10 in the parser + # note: enforce maximum term limit (64) + # note: block recursion too much + # to finish up, correct every offset for offset, target in requiredFixUps: u32.pack_into(data, offset, offsets[target]) diff --git a/src/unlock.py b/src/unlock.py index 16063ca..dfeaa33 100644 --- a/src/unlock.py +++ b/src/unlock.py @@ -8,7 +8,7 @@ class UnlockParseError(ValueError): pass def parseUnlockText(text): - return _parseUnlockBit(text) + return _parseUnlockBit(text.lower()) def _parseUnlockBit(text): # blank criterion |