Email or username:

Password:

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

buh
one of them IS a font
but it's not the font I was looking for
it's a different font that JUST SO HAPPENS to be the same size.

suspicious

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

okay so I figured out when and where that one is loaded
but still not where the other file of the same size is loaded, or what it is.

so I miscounted. 6 fonts. I have names for three, IDs for 5, and source files for 4.

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

I could get the final source file if I could parse the Weird Bundle, and I could get the filenames if I could parse the filename trie.

ANYWAY I think I have what I need for my current hax

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

this font file ALMOST makes sense. Like I'll look at 19 out of 20 characters and they'll match perfectly and then one will just be completely wrong.
Why does it think the number 4 is in the middle? it's not, it's on the top!

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

well I manually extracted the hidden font, good ol' GENERICFONT.FDX.PRD.

NOPE! it's similarly aligned, so it's not the right one either. the fuck?

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

okay after matching all the dumped textures with the fonts by process of elimination, this is the font I want:

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

that symbol in the top left, which appears to render as "ss", is §.

what the fuck are they doing, exactly?

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

there is a SLIGHT chance that it's actually ß and they invented a new encoding that's a hybrid of utf-8 and MacRoman.

But I really, really hope not

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

why is this function being called with this->__vt set to 5?

I'M PRETTY SURE YOUR OBJECT'S VTABLE IS NOT AT ADDRESS 5, GAME

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

especially considering that this is PowerPC and it'd presumably generate an unaligned address fault, and OH YET THE WII HAS NO MEMORY MAPPED AT 0

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

I have now learned about RGB5A3, and I hate it.

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

So it's a 16-bit RGBA color format. You might say "I can do basic math, and 5+5+5+3 isn't 16", but guess what: it's weirder and worse than you imagine!

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

it's two formats combined into one.
It's either RGB555 (no alpha) or RGB444A3. And the top bit is a marker to tell you which one that pixel is using.

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

hate hate hate hate hate this is the worst hate

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

well I tried to decode one these images and I got this.
not terribly helpful. I think some of the pixels may be in a weird order?

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

I think that's supposed to look like this, just guessing from the dumped textures.

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

oh yeah it's a blocked format, because Nintendo hates the idea of storing pixels in an order that makes sense

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

this is a 32bit console doing 3D rendering!
why not encode all the textures in 4x4 blocks like it's still 1983?

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

okay I can decode it now. I basically just took my existing parsing code and made it pretend every texture was 4x4, then ran it (width+3)//4*(height+3)//4 times for the whole image, compositing all the subimages together.

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

ugh. I'm like 99% sure the game's texture format doesn't store the size.
that's included in the metadata! in the ROM or in the archive! Great! I hate it!

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

ah-ha. look at this. both res_ids are identical, but one is only 16 bytes, uncompressed. This is a res_id for a texture.

text editor screenshot:

chunk_offset 21918772
BFLAGS 20
decompressed_size 16
CFLAGS 64
compressed_size 16
res_id 1616696397

chunk_offset 21918788
BFLAGS 20
decompressed_size 2784
CFLAGS 36
compressed_size 1710
res_id 1616696397
Foone🏳️‍⚧️ replied to Foone🏳️‍⚧️

and 16 bytes is exactly the same size as the WiiTextureHeader structure used by the engine!

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

so they have two copies of the resource in the file, but one of them has different FLAGS, which presumably indicates "hey this is the metadata", which has stuff like the texture format and image size. both of them.
it's 32x32 and 32x32. I don't know why there are two.

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

I'm gonna have to modify the extractor I'm working on to do two searches and find the CFLAGS=64 version, get the metadata, then extract the other one separately.

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

the datafile has 1938 matches for "CFLAGS 64", so... does this game have 1938 separate textures? maybe!

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

fun fact: just about every other game and file format in the world solves this complex problem by JUST PUTTING A FUCKING HEADER IN THE FILE WHAT ARE YOU DOING

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

what do you think this is, classic macos with resource forks?

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

1984 called they want their filesystem design back, Pipeworks!

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

okay having written an extractor for that format, I move onto the next format: GX_TF_RGBA8.
Hey, that seems simple! 8 bits per channel, RBGA, 32bit per pixel. Easy, right?

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

OH GOD NOPE.
So, it's encoded as 4x4 pixel chunks, right? But it's planar... interleaved planar.

So a 4x4 RGB8 chunk looks like this:

ARARARAR ARARARAR
ARARARAR ARARARAR
GBGBGBGB GBGBGBGB
GBGBGBGB GBGBGBGB

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

my favorite part is that nintendo literally calls this RGBA when it's not in RGBA order.
It's in ARGB order. Or, you know, ARARARARA... order.

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

re-parsed.
Yeah it turns out my code worked perfectly on the first try!
I just, wasn't, uh... running it.

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

well I'm not sure what that is but it didn't parse properly

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

OH GOD THEY CHANGED THE BLOCK SIZE FOR GREYSCALE IMAGES
they're 8x4, not 4x4

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

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

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