[PSP] Heroes Phantasia help needed

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
darkprince
Posts: 5
Joined: Tue Sep 16, 2014 9:58 pm

[PSP] Heroes Phantasia help needed

Post by darkprince »

Hi everyone,

I am new here :D also new to mod/extraction.

Trying to extract images and sound files from "Heroes Phantasia" (a PSP game). Its ISO file is available here: http://www.emuparadise.me/Sony_Playstation_Portable_ISOs/Heroes_Phantasia_(Japan)/158790.

Noesis helped me to extract a file called HP.CPK (under USRDIR\). I got a bunch of folders and .bin/.dlz files, which I don't know how to open. For example, there are a bunch of .dlz files under HP_files\btl\chr\--I guess these are character image/3D model files. Then I tried to use QuickBMS. Since I don't know the compression algorithm, I used the reverse engineering method shown at http://aluigi.altervista.org/quickbms/comtype_scan.htm. However, none of the 500 files generated by comtype_scan2.bms + comtype_scan2.bat seems to make any sense like those described in the example. Now I am stuck, not sure how to proceed.

Please advise. Thanks!

P.S. a sample .dlz file is attached for you to take a look.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [PSP] Heroes Phantasia help needed

Post by aluigi »

You had to consider the first 32bit SIZE field before passing the file to the comtype2 scanner :)

The algorithm is LZSS with the dictionary initializer set to 0:

Code: Select all

comtype saint_seya  # lzss "12 4 2 2 0" or puyo_lz00 (LZSS with init 0x00)
get SIZE long
savepos OFFSET
get ZSIZE asize
math ZSIZE -= OFFSET
clog MEMORY_FILE OFFSET ZSIZE SIZE

    get OFFSET long MEMORY_FILE
for i = 0
    get NEXT_OFFSET long MEMORY_FILE
    if NEXT_OFFSET == 0
        break
    endif
    xmath SIZE "NEXT_OFFSET - OFFSET"
    log "" OFFSET SIZE MEMORY_FILE
    math OFFSET = NEXT_OFFSET
next i

*edit* script
darkprince
Posts: 5
Joined: Tue Sep 16, 2014 9:58 pm

Re: [PSP] Heroes Phantasia help needed

Post by darkprince »

Thanks! I guess now I can use LZSS to write my own bms script for extracting the files?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [PSP] Heroes Phantasia help needed

Post by aluigi »

Don't you like the one I posted?
darkprince
Posts: 5
Joined: Tue Sep 16, 2014 9:58 pm

Re: [PSP] Heroes Phantasia help needed

Post by darkprince »

You mean simply save the code you posted as a .bms file (e.g., hp.bms)?
I ran: "quickbms hp.bms c01001.dlz output" but only got the attached file.
Am I supposed to get those .tga files from the compressed file? Did I do something wrong here (maybe missing a crucial step)?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [PSP] Heroes Phantasia help needed

Post by aluigi »

ok I have updated the script to extract the files contained in it.
Just some notes, these files are not ready to use, for example the first one probably contains some tgas (don't know if the original tga or some raw format), the 00000023.dat one contains a cpk archive but you need to cut the first 0x1040 bytes before unpacking it with cpk.bms.
So it's necessary some manual editing before being able to use them.
darkprince
Posts: 5
Joined: Tue Sep 16, 2014 9:58 pm

Re: [PSP] Heroes Phantasia help needed

Post by darkprince »

As you suggested, I cut the first 0x1040 bytes from 00000023.dat and unpacked it using "quickbms cpk.bms 00000023.dat output." Script cpk.bms was found at http://aluigi.altervista.org/papers/bms/cpk.bms.

Now I have got a bunch of .vag files from 00000023.dat, and I don't know what to do with them. At the same time, I am not able to use other .dat files extracted from the original c01001.dlz although I know they may contain .tga files in some form. Am I missing some important information here? Even after I extracted those files, how could I make use of them?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [PSP] Heroes Phantasia help needed

Post by aluigi »

VAG is the audio format used on PlayStation, there are programs to read them (vgmstream for example).
For the other files, probably other users can help you.
On PSP that's quite normal to have files that cannot be used immediately (no dds, png, wav, mp3 and other known formats).
darkprince
Posts: 5
Joined: Tue Sep 16, 2014 9:58 pm

Re: [PSP] Heroes Phantasia help needed

Post by darkprince »

Thanks! I'll do some more research on the file formats.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: [PSP] Heroes Phantasia help needed

Post by AlphaTwentyThree »

Sadly, the script doesn't work on the sound archives like this one: http://6dwrlh5ukl.1fichier.com/ :\
Can you tell what the problem is?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [PSP] Heroes Phantasia help needed

Post by aluigi »

That script was for the dlz files.

The one you uploaded is a classical CPK one to open with cpk.bms.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: [PSP] Heroes Phantasia help needed

Post by AlphaTwentyThree »

My bad - had an old version of the script that didn't work with CPK files missing the file table. ;)