From 077a8de3a18e051f818d04ef6621842901cd1614 Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 21 Sep 2012 23:03:56 +0200 Subject: updated kpbin header --- src/exporter.py | 8 ++++++-- src/mapdata.py | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/exporter.py b/src/exporter.py index f1afd4b..aad9559 100644 --- a/src/exporter.py +++ b/src/exporter.py @@ -192,8 +192,12 @@ 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('>IIIII', len(self.layers), 20 + len(sectorData), 0, 0, 0)) - requiredFixUps.append((16, 'UnlockBytecode')) + version = 1 + headerSize = 0x24 + data = bytearray(struct.pack('>4sIIIIII', 'KP_m', version, len(self.layers), 20 + len(sectorData), 0, 0, 0, headerSize, 0)) + requiredFixUps.append((24, 'UnlockBytecode')) + requiredFixUps.append((32, self.map.bgName)) + stringsToAdd.add(self.map.bgName) # list of layer pointers goes here.. or will, later data += sectorData diff --git a/src/mapdata.py b/src/mapdata.py index 8f3842a..bdb8e2a 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -565,8 +565,14 @@ class KPMap(object): else: self.version = 1 + if 'bgName' in source: + self.bgName = source['bgName'] + else: + self.bgName = '/Maps/Water.brres' + def _dump(self, mapObj, dest): dest['version'] = self.version + dest['bgName'] = self.bgName def save(self): path = self.filePath -- cgit v1.2.3