Skip to content

Commit

Permalink
Update 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aboood40091 committed Sep 29, 2016
1 parent 821f028 commit f88dd2a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Wii U GTX Extractor v3.0
Extracts textures from the GFD ('Gfx2' / .gtx file extension) format used in Wii U games, and save them as DDS.
# Wii U GTX Extractor v3.2
Extracts textures from the GFD ('Gfx2' / .gtx file extension) format used in Wii U games, and saves them as DDS.

Can Also convert DDS files into .gtx files!

A bit of work could get it to extract .bflim files, too.

# Requirements:
Python 3.4 or higher.

Expand Down
4 changes: 2 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# GTX Extractor
# Version v3.1
# Version v3.2
# Copyright © 2014 Treeki, 2015-2016 AboodXD

# This file is part of GTX Extractor.
Expand All @@ -25,7 +25,7 @@
import os, shutil, sys
from cx_Freeze import setup, Executable

version = 'v3.1'
version = 'v3.2'

# Pick a build directory
dir_ = 'gtx_extract ' + version
Expand Down
30 changes: 20 additions & 10 deletions gtx_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# GTX Extractor
# Version v3.1
# Version v3.2
# Copyright © 2014 Treeki, 2015-2016 AboodXD

# This file is part of GTX Extractor.
Expand Down Expand Up @@ -48,7 +48,9 @@
0x00000033: 'GX2_SURFACE_FORMAT_T_BC3_UNORM',
0x00000433: 'GX2_SURFACE_FORMAT_T_BC3_SRGB',
0x00000034: 'GX2_SURFACE_FORMAT_T_BC4_UNORM',
0x00000035: 'GX2_SURFACE_FORMAT_T_BC5_UNORM'
0x00000234: 'GX2_SURFACE_FORMAT_T_BC4_SNORM',
0x00000035: 'GX2_SURFACE_FORMAT_T_BC5_UNORM',
0x00000235: 'GX2_SURFACE_FORMAT_T_BC5_SNORM'
}

# ----------\/-Start of GFD Extracting section-\/------------- #
Expand Down Expand Up @@ -233,11 +235,15 @@ def get_deswizzled_data(gfd):
elif (gfd.format == 0x33 or gfd.format == 0x433):
format_ = "BC3"
elif gfd.format == 0x34:
format_ = "BC4"
format_ = "BC4U"
elif gfd.format == 0x234:
format_ = "BC4S"
elif gfd.format == 0x35:
format_ = "BC5"
format_ = "BC5U"
elif gfd.format == 0x235:
format_ = "BC5S"

if (gfd.format != 0x31 and gfd.format != 0x431 and gfd.format != 0x32 and gfd.format != 0x432 and gfd.format != 0x33 and gfd.format != 0x433 and gfd.format != 0x34 and gfd.format != 0x35):
if (gfd.format != 0x31 and gfd.format != 0x431 and gfd.format != 0x32 and gfd.format != 0x432 and gfd.format != 0x33 and gfd.format != 0x433 and gfd.format != 0x34 and gfd.format != 0x234 and gfd.format != 0x35 and gfd.format != 0x235):
result = swizzle(gfd.width, gfd.height, gfd.depth, gfd.format, gfd.tileMode, gfd.swizzle, gfd.pitch, gfd.data, gfd.dataSize)

hdr = writeHeader(1, gfd.width, gfd.height, format_, compressed=False)
Expand Down Expand Up @@ -269,7 +275,7 @@ def writeGFD(gfd, f, f1):
sys.exit(1)

swizzled_data = []
if (gfd.format != 0x31 and gfd.format != 0x431 and gfd.format != 0x32 and gfd.format != 0x432 and gfd.format != 0x33 and gfd.format != 0x433 and gfd.format != 0x34 and gfd.format != 0x35):
if (gfd.format != 0x31 and gfd.format != 0x431 and gfd.format != 0x32 and gfd.format != 0x432 and gfd.format != 0x33 and gfd.format != 0x433 and gfd.format != 0x34 and gfd.format != 0x234 and gfd.format != 0x35 and gfd.format != 0x235):
result = swizzle(gfd.width, gfd.height, gfd.depth, gfd.format, gfd.tileMode, gfd.swizzle, gfd.pitch, data, gfd.dataSize, True)
else:
result = swizzle_BC(gfd.width, gfd.height, gfd.depth, gfd.format, gfd.tileMode, gfd.swizzle, gfd.pitch, data, gfd.dataSize, True)
Expand Down Expand Up @@ -964,10 +970,14 @@ def writeHeader(num_mipmaps, w, h, format_, compressed=False):
fourcc = b'DXT3'
elif format_ == "BC3":
fourcc = b'DXT5'
elif format_ == "BC4":
fourcc = b'ATI1'
elif format_ == "BC5":
elif format_ == "BC4U":
fourcc = b'BC4U'
elif format_ == "BC4S":
fourcc = b'BC4S'
elif format_ == "BC5U":
fourcc = b'ATI2'
elif format_ == "BC5S":
fourcc = b'BC5S'

hdr[8:8+4] = flags.to_bytes(4, 'little')
hdr[80:80+4] = pflags.to_bytes(4, 'little')
Expand All @@ -987,7 +997,7 @@ def main():
"""
This place is a mess...
"""
print("GTX Extractor v3.1")
print("GTX Extractor v3.2")
print("(C) 2014 Treeki, 2015-2016 AboodXD")

if len(sys.argv) != 2:
Expand Down

0 comments on commit f88dd2a

Please sign in to comment.