diff options
Diffstat (limited to '')
-rw-r--r-- | src/tileset.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tileset.py b/src/tileset.py index 857a805..50aaf38 100644 --- a/src/tileset.py +++ b/src/tileset.py @@ -1,4 +1,5 @@ from common import * +from wii.u8archive import WiiArchiveU8 import struct import cPickle @@ -268,6 +269,25 @@ class KPGroupItem(object): class KPTileset(object): + @classmethod + def loadFromArc(cls, handleOrPath): + arc = WiiArchiveU8(handleOrPath) + + img = arc.resolvePath('/BG_tex').children[0].data + grp = arc.resolvePath('/BG_grp').children[0].data + + untDir = arc.resolvePath('/BG_unt') + obj, meta = None, None + + for child in untDir.children: + if child.name.endswith('_hd.bin'): + meta = child.data + else: + obj = child.data + + return cls(img, obj, meta, grp) + + def __init__(self, imageBuffer, objectBuffer, objectMetadata, groupBuffer): '''A Koopatlas Tileset class. To initialize, pass it image data, object data, and group data as read from a Koopatlas tileset file. |