Venomalia / DolphinTextureExtraction-tool

Dumps GC and Wii textures, compatible with the Dolphin texture hash.
MIT License
29 stars 5 forks source link

Pokémon XD: Initial WZX support #35

Closed Neui closed 1 year ago

Neui commented 1 year ago

Build upon PR #34, so merge that first, although if needed I can rebase without depending on that PR (since it doesn't need any of these changes). Rebased onto main.

Basically contains GSscene and GPT (GSparticle) files, with GPT support currently still missing.

See the main commit message for some info:

Mainly "traced" what the loading code in GXXP01 does. Seems kind of weird format with those 0x70 "chunks", maybe the header is also one (since the size it skips matches). Maybe look later at the actual usage if that is the case and maybe simplify, if needed.

Also needed to "patch" GSscene because in one file (wzx_carde_bg03.fsys/0CE72000_carde_bg03.wzx starting at 0xA0) the JObj offset is 0x00000000 (which is valid for some other files), but not in that file. So a "workaround" to try to detect that file has been implemented. It appears to only contain motion data, so maybe add a new file type and modify GSscene that when processing motion scenes to ignore JObj models. But now now. Later. Maybe.

Only tested for Pokémon XD Gale of Darkness PAL (GXXP01), so testing on other games is appreciated.

Venomalia commented 1 year ago

you should be able to replace AlignStream(stream, 32); with stream.Seek(32);. maybe I should call this function Align, so that it is easier to find.

in pokemon colosseum the format is unfortunately also different Exception: wzx_snatch_ball_land\0DC22000_snatch_ball_land.WZX Unknown type: 0x00000000

DolphinTextureExtraction.log

Neui commented 1 year ago

Oh I didn't know about stream.Seek(32), but I agree that the name should be changed to include like "Align".

However, I am not sure how to fix Pokémon Colosseum. It appears there isn't a magic value to go off against. PXD aborts loading on invalid types (where it currently throws an exception), maybe I could just do that instead and just produce an log message?

Venomalia commented 1 year ago

WZX fix That it should avoid the error with pokemon colosseum

Neui commented 1 year ago

I have added your changes. I looked what versions PXD uses and it appears to be 3, but I found a couple of files that have "version 1":

wzx_colo_name_ancient.fsys/10ef2000_colo_name_ancient.wzx
wzx_colo_name_bottom.fsys/10f02000_colo_name_bottom.wzx
wzx_colo_name_casino.fsys/10f12000_colo_name_casino.wzx
wzx_colo_name_crater.fsys/10f22000_colo_name_crater.wzx
wzx_colo_name_cylinder.fsys/10f32000_colo_name_cylinder.wzx
wzx_colo_name_earth.fsys/10f42000_colo_name_earth.wzx
wzx_colo_name_water.fsys/10f52000_colo_name_water.wzx

(Filename might be different on this tool, since I used a custom extraction tool) They appear to be basically empty (very short, no space to really store something). I wonder if Colosseum also has those files?

Anyway, if it stops erroring on Colosseum WZX files, and it appears to still work for PXD, so I accept it.

Venomalia commented 1 year ago

interesting, as far as I have seen all Colosseum WZX files version 2. I mean, Pokémon Battle Revolution uses the same formats, interesting how many differences there are already between Colosseum PXD