Email or username:

Password:

Forgot your password?
Top-level
Foone🏳️‍⚧️

NINTENDO IS JAPANESE FOR "I HATE THE VERY IDEA FOR MAKING ANY FUCKING SENSE"

14 comments
Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

it's only slightly better when properly parsed, to be honest

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

oh wow. I parsed IA8 correctly on the first try!

(it is, of course, in AI byte-order)

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

the final format I need to implement is GX_TF_CMPR, which is a variant of DXT1 texture compression, in 8x8 blocks.

JUST KIDDING! it's implemented as four 4x4 sub-blocks.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

so for each subblock, there's 64 bits.
The first half is two 16-bit values, c0 and c1. Their numeric value is important, as they're compared, and mean different things which one is bigger.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

so the two numbers are compared, and either way, c0 and c1 are RGB 5:6:5 colors.
Then, depending on which is bigger, c2 and c3 get calculated.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

if c0 is bigger than c1, then:
c2 is set to 2/3rds of c0 + 1/3rd of c1
and
c3 is set to 1/3rd of c0 and 2/3rds of c1.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

but if c1 is bigger than c0, then:
c2 is set to 1/2 c0 and 1/2 c1, and c3 is set to transparent black.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

so now you have 4 colors, c0 through c3.

The final 32 bits of the subblock is an index into this palette, with two bits per pixel.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

so yeah. dxt1 works by having you define two colors, they get an extra bit of metadata by making the order of the colors important, then generate 2 more colors based on those colors + metadata.
Then it's a simple 4-bit paletted image, like we're running a CGA 3D Renderer over here.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

ugh it turns out it's hard to decode 0-width fonts, thanks to divisions.

Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

I'm now mass-converting all the textures.
I don't think this one is working right. Just a guess.

Go Up