diff options
| author | Treeki <treeki@gmail.com> | 2011-12-08 02:21:18 +0100 | 
|---|---|---|
| committer | Treeki <treeki@gmail.com> | 2011-12-08 02:21:18 +0100 | 
| commit | 6921d01422727c19c0b1bef2ff1834a73b9092d6 (patch) | |
| tree | e50f16c25e62d5f64f4fac93288f19f295913d11 /src | |
| parent | c1cd2955c3e9b1dbb7ea72c85f996a19ab37ea3b (diff) | |
| download | koopatlas-6921d01422727c19c0b1bef2ff1834a73b9092d6.tar.gz koopatlas-6921d01422727c19c0b1bef2ff1834a73b9092d6.zip  | |
changed DoodadImage struct to GXTexObj
Diffstat (limited to '')
| -rw-r--r-- | src/exporter.py | 20 | 
1 files changed, 16 insertions, 4 deletions
diff --git a/src/exporter.py b/src/exporter.py index 5233cdd..4026929 100644 --- a/src/exporter.py +++ b/src/exporter.py @@ -3,7 +3,7 @@ import array  import sys  from ctypes import create_string_buffer -def RGB4A3Encode(tex): +def RGB5A3Encode(tex):  	tex = tex.toImage()  	w, h = tex.width(), tex.height()  	padW = (w + 3) & ~3 @@ -301,7 +301,7 @@ class KPMapExporter:  		# textures  		texHeaderStartOffset = len(data) -		texHeaderEndOffset = texHeaderStartOffset + (len(textures) * 8) +		texHeaderEndOffset = texHeaderStartOffset + (len(textures) * 0x20)  		texDataStartOffset = (texHeaderEndOffset + 0x1F) & ~0x1F  		texPadding = texDataStartOffset - texHeaderEndOffset @@ -312,9 +312,9 @@ class KPMapExporter:  		for tex in textures:  			offsets[tex] = len(data) -			data += struct.pack('>hhi', tex.width(), tex.height(), currentTexOffset) +			data += self._buildGXTexObjRGB5A3(tex.width(), tex.height(), currentTexOffset) -			converted = RGB4A3Encode(tex) +			converted = RGB5A3Encode(tex)  			imageData.append(converted)  			currentTexOffset += len(converted) @@ -363,6 +363,18 @@ class KPMapExporter:  			self._findUnlocksForNode(destNode, checked, affected, False, secret) +	def _buildGXTexObjRGB5A3(self, width, height, imgOffset): +		# Format: RGB5A3 (5) +		# Wrap: CLAMP (0) +		return struct.pack('>IIIIIIIHH', +				0x10, 0, +				(0x20000 | ((height - 1) << 10) | (width - 1)), +				imgOffset, # (imgptr >> 5) +				0, 0, 0, +				(((width + 3) / 4) * ((height + 3) / 4)) & 0x1FFFF, +				0x0202 +				) +  	def _packSectorData(self, sectors):  		rowStruct = struct.Struct('>16h')  | 
