Summon Night 4 [PSP] .DAT .prx

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
pablo777
Posts: 5
Joined: Fri Apr 17, 2015 4:43 pm

Summon Night 4 [PSP] .DAT .prx

Post by pablo777 »

Hi there! I'm new to this forum, nice to meet ya all!

I'm helping a friend translate this game for the PSP. Problem is, we don't really have enough romhacking knowledge (I do, kinda, but it's mostly GBA stuff, not sure it applies here), so we wanted to know if someone could help us extract the script/graphics or at least tell us a bit about how to do it.

Anyway, I used UMDgen and took some pics of the filesystem. Here they are:

Image
Image

I'm not sure if I can link the project's current thread, as some people did investigate a bit of the files in the game. I'll post some of the comments:

Mind sharing your tool for decompressing the text. I have located some pointers in the file "02.DAT". From the way it looks, the .DAT file is actually setup like this. You will see the pointers. There is a table at these locations off the top of my head 0x0000 (Actually the pointer is at 0x38) (first pointer I see) and it points to the location of 0x0368. Another table starts at 0x1000 (0x1004 First pointer in this table)... Here is where it will get tricky. The pointers will be added to the location at which the table starts. Here the first pointer is 0x00B4. But the actual location in the file for this specific dialog is 0x10B4... and so on. There is another set that starts at 0x1800 (0x183C First pointer). First one here is 0x0424. This will take you to the location of 0x1C24.

You can tell so far by where the pointer tables are because there is a number located at 0x0000 (12), 0x1000 (16) and 0x1800 (20). Beyond this point it starts getting messy and I have not had time to investigate it much further and henceforth why I am curious about the decryption tool or what type of encryption it is. I hope this helps out some. AND if something doesn't make sense, I will try to help out as best as I can.


Yes, the archives are aligned to 0x800, so are some sub-files, and other sub-files are aligned to 0x10, and some not aligned at all. You can get the toc of sub-files, but not the whole DAT.

00.DAT you can get all the files for instance. First word is the file count, then some unknowns. File entries start at 0x8 as file pos, file len both as dwords. All the archives list files like that, but the align changes. 00.DAT is all 0x800. The first sub-file in 01.DAT is 0x10 aligned. The first file being listed as 0x3, so it starts at 0x30. You can see it's not the whole file as the 5th file starts at 0x14c30 and is 0x2720 long. Those first 5 files are only 100Kb in total, so that's clearly not the whole 268MB, it must just be one sub-file. The full toc for it must be somewhere else.

Here's what I had for decompressing text though: http://pastebin.com/1XXzvrCF - it's just a complete copy of the MIPS code.


Is this a port of the PS2 game? If so, then it's a game from the era when programmers knew what they were doing... So it kinda makes for a romhacking challenge: they were pretty creative back then in terms of coding.

I'm not really interested in getting too deep in the technical aspect, like with FFT0 or ToD2 (besides, this must be the first time I hear about this saga :P), but if you look closely at those "first 100 kb" you'll realize it's just file system description info, so the rest of the data can be read recursively... Well, besides that text at the beginning... In fact, the actual data starts right after those 100 kb, which in the case of 01.DAT are textures.

About compression, good job, you got it right (I haven't really tested the code but yeah, that's the routine ;)).

Then there is the text, which is simple shift-jis + pointers, like the decompressed one.



Anyhelp will be appreciated.


Cheers!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by aluigi »

Upload a couple of those small DAT files and also those PRX files.

In USRDIR do you see other small files without the DAT extension?
pablo777
Posts: 5
Joined: Fri Apr 17, 2015 4:43 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by pablo777 »

aluigi wrote:Upload a couple of those small DAT files and also those PRX files.

In USRDIR do you see other small files without the DAT extension?


Oops, sorry :shock:, forgot about that, here are some of the files, I'll upload them on MEGA as they are quite heavy (the minimum size is 50 mb), here's the link:

https://mega.co.nz/#!JMMlzITK!-p9ezjzr9 ... jVb2GEH96w


About the USRDIR, nope, there's only those .DAT files and .prx. Oh yeah, inside SYSDIR there's the update folder with the following files:

PARAM.SFO
EBOOT.BIN
DATA.BIN
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by aluigi »

It's better if you use a normal file ripper for known file formats because only 00.dat has a good file format and I wrote this script for it:

Code: Select all

get FILES short
get DUMMY short
get DUMMY long
get INFO_SIZE long
get ZERO long
math FILES - 1
for i = 0 < FILES
    get OFFSET long
    get SIZE long
    math OFFSET * 0x800
    math SIZE * 0x800
    log "" OFFSET SIZE
next i
pablo777
Posts: 5
Joined: Fri Apr 17, 2015 4:43 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by pablo777 »

aluigi wrote:It's better if you use a normal file ripper for known file formats because only 00.dat has a good file format and I wrote this script for it:

Code: Select all

get FILES short
get DUMMY short
get DUMMY long
get INFO_SIZE long
get ZERO long
math FILES - 1
for i = 0 < FILES
    get OFFSET long
    get S
    math OFFSET * 0x800
    math SIZE * 0x800
    log "" OFFSET SIZE
next i

Thanks! I really thought UMDgen could work, but it seems I was wrong, I will search for another file ripper then. Also thanks for that script, what language was it written? Or is it pseudocode?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by aluigi »

It's a script for quickbms:
http://quickbms.aluigi.org
pablo777
Posts: 5
Joined: Fri Apr 17, 2015 4:43 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by pablo777 »

Downloaded Quickbms, copied the code you sent me in a .txt and changed it to .BMS, and when I executed it I got an error in this line:

Error: invalid command "get" or arguments -1 at line 9
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by aluigi »

My code has a "get SIZE long" while your quoting in the previous post has only "get S", don't know why.
Copy&paste my code correctly and it will work.
pablo777
Posts: 5
Joined: Fri Apr 17, 2015 4:43 pm

Re: Summon Night 4 [PSP] .DAT .prx

Post by pablo777 »

aluigi wrote:My code has a "get SIZE long" while your quoting in the previous post has only "get S", don't know why.
Copy&paste my code correctly and it will work.

Now that's weird :oops: , I'll retry, thanks.