From 02a1d81d760525f515337d2109feba8887aa5edb Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 9 Nov 2011 05:48:51 +0100 Subject: a bunch of incomplete stuff --- src/tileset.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/tileset.py') 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. -- cgit v1.2.3