Script to unpack WAD archive in MKSM game (PS2)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Hi aluigi, I want to translate the Mortal Kombat Shaolin Monks game and I would like to know if you can make for me an script to unpack the below files. I've splitted the file into 2 parts using the "files_cutter.bms" script. Thanks in advance!
https://drive.google.com/file/d/1h6gt1l ... p=drivesdk

https://drive.google.com/file/d/1B9WXSW ... p=drivesdk
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by aluigi »

It's a container of archived files without header or tail for the information.
Check if you have a small file called GAMEDATA with a different extension or *index* or *idx* something.
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Hi aluigi, I think that TOC (header) is in these 2 files https://drive.google.com/file/d/17QAvgc ... -gCWwNY4-g mainly in the WADCRC.BIN
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by aluigi »

Eh no, there is no TOC in them.
I searched both the offset and aligned offset of one of the files.
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Hi aluigi, I managed to find something infos about the GAMEDATA.WAD, I did some tests to make the pointer of a file point to the other and it worked out in the game. The infos for each file into archive is an 8 bytes field, the 4 first bytes are the offset to a file into archive, the 4 first bytes *800=offset of beginning of file, the next 6 bytes it seems the filesize but I didn't understood the last 6 bytes. The TOC is in the GAMEDATA.WAD, replacing 8 bytes of a field that contains infos for the beginning of a texture in English by 8 bytes of the same texture in Spanish for example, I can make the game read the texture of Spanish instead of English.
So, with these infos do you think that is possible make an script now?
This TOC is similar to the ZDIR.BIN TOC in the Need for Speed series.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by aluigi »

What you are seeing is the PWF file itself, there are N PWF files without any reference and probably other formats (non-PWF) too.
If you are talking about another TOC tell us its offset.
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Hi, I want to say that the TOC is after the PWF string, as you said there is no PWF files inside the GAMEDATA, inside the GAMEDATA there is only many EWDF files and P2N textures.
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

The offset to the first file is in 0x20, e.g: in the 0x220 offset there is the pointer to the EWDF archive that contains the Main Menu textures. The value of this pointer is 570A, A57*800= EWDF archive with textures.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by aluigi »

Ok I have updated the script http://aluigi.org/bms/mksm_ewdf.bms

It looks like there is still some space at the end of the WAD archive that is not parse and the SIZE field is a mess, but currently it works.
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Thanks aluigi, I've tested the bms script here and some files have been extracted. However, an error message is showed after the extraction, "this message is related with the command in the 47 line "clog NAME OFFSET SIZE XSIZE". I've replaced the XZIZE with ZSIZE and now 2959 files are extracted, but all files has 0 bytes in filesize, probably because the SIZE field is really a mess in this format.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by aluigi »

Updated script, version 0.1.4.
Let me know if it works.
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Working perfectly, 2959 files extracted properly with valids filesize. Thank you very much!
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Hey aluigi, I have found a new WAD archive type into the GAMEDATA.WAD, I've tried to do an script to dump the files into it, but I have failed. This is the new WAD type https://drive.google.com/file/d/1m6FxQ9 ... p=drivesdk
it seems a simple format.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by aluigi »

If I touch the script anything else will no longer work, so:

Code: Select all

idstring "PWF \0"
get SOME_SIZE threebyte
get DUMMY long # 2
get FILES long
goto 0x20
for i = 0 < FILES
    get OFFSET long
    get SIZE long
    log "" OFFSET SIZE
next i
Alpha1001
Posts: 37
Joined: Tue Nov 06, 2018 10:11 am

Re: Script to unpack WAD archive in MKSM game (PS2)

Post by Alpha1001 »

Thanks!