summaryrefslogtreecommitdiff
path: root/src/tileset.py
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-11-09 05:48:51 +0100
committerTreeki <treeki@gmail.com>2011-11-09 05:48:51 +0100
commit02a1d81d760525f515337d2109feba8887aa5edb (patch)
tree8e0fbf75554e5be33438df83d926f1acb1091228 /src/tileset.py
parent8b93220d09adc6a56c9b0a7bfa3a9084e03ce25f (diff)
downloadkoopatlas-02a1d81d760525f515337d2109feba8887aa5edb.tar.gz
koopatlas-02a1d81d760525f515337d2109feba8887aa5edb.zip
a bunch of incomplete stuff
Diffstat (limited to '')
-rw-r--r--src/tileset.py20
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.