Super Smash Bros. Crusade (.BIN)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Mario123311
Posts: 50
Joined: Fri Jan 22, 2016 4:37 am

Super Smash Bros. Crusade (.BIN)

Post by Mario123311 »

The fangame Super Smash Bros. crusade has since put this weird format on the games resources as ".BIN". I haven't really found a good way to crack it though but if it's safe to ask, is it possible to do so by any chance? If this shouldn't be asked about though feel free to lock I guess.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

Do you mean that this format is different than http://aluigi.org/bms/super_smash_bros.bms ?
If yes, please provide a sample archive.
Mario123311
Posts: 50
Joined: Fri Jan 22, 2016 4:37 am

Re: Super Smash Bros. Crusade (.BIN)

Post by Mario123311 »

Sorry for the silence, But here's a sample.
https://www.mediafire.com/?6r860q34ivk9onz
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

No idea about that file. The nintendo decompression doesn't work on it.
Mario123311
Posts: 50
Joined: Fri Jan 22, 2016 4:37 am

Re: Super Smash Bros. Crusade (.BIN)

Post by Mario123311 »

It's not exactly an offical Nintendo game though. Basically a fangame. I dunno what compression they used.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

Ah ok.
Well, basically these bin archives are xored with the key "runaway_horses_take_us_through_the_night" and then decompressed by the HuffDecompress(input_file_path, output_file_path) function of PAK_File.dll

I don't have that algorithm in quickbms so I guess the only option is writing a script that calls the function of the dll.
I will keep you update.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

Mario123311
Posts: 50
Joined: Fri Jan 22, 2016 4:37 am

Re: Super Smash Bros. Crusade (.BIN)

Post by Mario123311 »

Really nice. Thanks. :3 I'll probably ask how to repack them some other time. But for now I think things are settled. Much obliged.



Just tell me whenever how I recompile this back to a .BIN I guess so I can test my changes ingame.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

PAK_File.dll contains all the functions to do everything you desire with the bin archives.
You need to know a bit of programming and reverse engineering (to find the arguments of the exported functions) to use it:

Code: Select all

Name            Address  Ordinal     
----            -------  -------     
SaveToFile      00413EB4 1           
AddFromFile     00413E1C 2           
GetFileSize     00413DB8 3           
SetFileContents 00413D5C 4           
GetFileContents 00413CAC 5           
GetFileIndex    00413BE8 6           
GetFileCount    00413BB8 7           
DeleteFile      00413B4C 8           
RenameFile      00413AC8 9           
AddFile         00413A44 10         
SavePAK         004139D8 11         
LoadPAK         0041396C 12         
Reset           00413930 13         
_Free           00413914 14         
_Init           004138E4 15         
HuffDecompress  0041385C 16         
HuffCompress    004137CC 17         
XORCrypt        0041370C 18         
DllEntryPoint   00413FF8 [main entry]

Personally I'm not interested, but it should be an easy job if someone is interested.

The alternative is using the reimport feature of quickbms in 3 steps:
  • reimport
  • HuffCompress
  • xor

If you want to try it do the following:
  • use the original script to extract the files of one bin archive (for example pacman.bin)
  • do NOT delete temp.bin
  • use reimport.bat selecting the script 1 you see below and selecting temp.bin and the sub-folder where have been extracted the files (for example inside the \pacman\ folder)
  • use script 2 on temp.bin
  • it will generate a new file called output.bin
I have tested it here and it works.

SCRIPT 1 to use in REIMPORT mode on temp.bin and the extraction sub-folder

Code: Select all

# USE reimport.bat!
idstring "PACK"
get OFFSET long
get FILES long
math FILES / 0x40
goto OFFSET
for i = 0 < FILES
    getdstring NAME 0x38
    get OFFSET long
    get SIZE long
    log NAME OFFSET SIZE
next i


SCRIPT 2 to use on temp.bin, you muse have PAK_File.dll in the same folder of quickbms:

Code: Select all

# do NOT use reimport.bat!
get NAME filename
CallDLL "PAK_File.dll" "HuffCompress" __stdcall RET NAME TEMPORARY_FILE

open "." TEMPORARY_FILE
get SIZE asize
log TEMPORARY_FILE 0 SIZE
encryption xor "runaway_horses_take_us_through_the_night"
log "output.bin" 0 SIZE
encryption "" ""


Usage example from command-line covering extraction and the 2 steps explained now:

Code: Select all

quickbms super_smash_bros_crusade.bms z:\pacman.bin z:\folder
quickbms -w -r 1.bms Z:\folder\temp.bin Z:\folder\pacman
quickbms 2.bms Z:\folder\temp.bin Z:\folder
Mario123311
Posts: 50
Joined: Fri Jan 22, 2016 4:37 am

Re: Super Smash Bros. Crusade (.BIN)

Post by Mario123311 »

Thanks, Just wondering though: Where can I get those 3 scripts compiled though? Sorry if I'm asking a lot, if you want I can just do it myself somehow I guess.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

What you mean?
They are quickbms scripts...
Mario123311
Posts: 50
Joined: Fri Jan 22, 2016 4:37 am

Re: Super Smash Bros. Crusade (.BIN)

Post by Mario123311 »

Having a bit of trouble. I'm not getting an "output.bin"

Edit: Never mind, Figured out.
bigfatidiot
Posts: 6
Joined: Sun May 26, 2019 1:03 am

Re: Super Smash Bros. Crusade (.BIN)

Post by bigfatidiot »

When I use the BMS script posted by Aluigi. I don't get an output file, I get a "temporary file". what do I do with that?
bigfatidiot
Posts: 6
Joined: Sun May 26, 2019 1:03 am

Re: Super Smash Bros. Crusade (.BIN)

Post by bigfatidiot »

Thank you
SUP3RBOB
Posts: 1
Joined: Sun May 26, 2019 2:59 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by SUP3RBOB »

I can't seem to extract the bin files from the newer version of this game.
When I use the script that was posted, QuickBMS crashes

https://i.imgur.com/wP5IjAp.png

Here's a sample:
https://www.mediafire.com/file/k9zd1b0o ... c.bin/file
bigfatidiot
Posts: 6
Joined: Sun May 26, 2019 1:03 am

Re: Super Smash Bros. Crusade (.BIN)

Post by bigfatidiot »

i'm having the same issue. Should I make a new thread about it or should I post here, Aluigi
bigfatidiot
Posts: 6
Joined: Sun May 26, 2019 1:03 am

Super Smash Bros Crusade bms not working correctly

Post by bigfatidiot »

Now I didn't make this, A luigi did. EVery time I use it the cmd closes and it gives me a temporary file and some kind of .bin file but it does not extract them, rather it just crashes. Can Aluigi fix this?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros Crusade bms not working correctly

Post by aluigi »

Maybe the encryption key is changed, don't know just guessing.
bigfatidiot
Posts: 6
Joined: Sun May 26, 2019 1:03 am

Re: Super Smash Bros. Crusade (.BIN)

Post by bigfatidiot »

Is there a possible way to fix this?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Super Smash Bros. Crusade (.BIN)

Post by aluigi »

Not without the required information (keys, formats, whatever)