PaRappa the Rapper 2 *.INT

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Miles2345
Posts: 76
Joined: Thu Oct 16, 2014 3:05 am

PaRappa the Rapper 2 *.INT

Post by Miles2345 »

I've been confused on how this game stores its data for a few years. I figured it's in these INT files, but I'm not sure.
A couple samples: http://puu.sh/cnRBS.7z
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

Miles2345
Posts: 76
Joined: Thu Oct 16, 2014 3:05 am

Re: PaRappa the Rapper 2 *.INT

Post by Miles2345 »

Thanks!
I noticed some of the files it extracts are in .tm0 format, as well as tm1 and tm2, which all seem to be TIM2 textures. The tm1 and tm2 files can convert fine, but are the tm0's compressed or something? None of them seem to look okay and the files themselves look odd in a hex editor.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

tm0 are not compressed, probably they just use a slightly different format.
Miles2345
Posts: 76
Joined: Thu Oct 16, 2014 3:05 am

Re: PaRappa the Rapper 2 *.INT

Post by Miles2345 »

I'm trying to figure out where the archives for the cutscenes are and I THINK they're in this .XTR format which seems to be stored a different way from the INT files. It may just be audio data, but could you check it?
https://drive.google.com/file/d/0B_8j1D ... sp=sharing
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

The format is very similar to INT but there is something I don't understand.
Miles2345
Posts: 76
Joined: Thu Oct 16, 2014 3:05 am

Re: PaRappa the Rapper 2 *.INT

Post by Miles2345 »

What would that be?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

There are refrerences only for the first 3 compressed embedded archives that can be extracted but from offset 0x1f0000 I see only raw data without information.

The following is the script to extract the files with information in the first part of the archive:

Code: Select all

comtype lzss "12 4 2 2 0"
get ALIGN long
get DUMMY long
get DUMMY long
get DUMMY short
get DUMMY short
for
    get DUMMY long
    if DUMMY == 0
        break
    endif
    get OFFSET long
    get SIZE long
    get ZERO long

    savepos TMP
    goto OFFSET
    get SIZE long
    get ZSIZE long
    savepos OFFSET
    goto TMP

    clog MEMORY_FILE OFFSET ZSIZE SIZE
    get DUMMY long MEMORY_FILE
    get DUMMY long MEMORY_FILE
    get DUMMY long MEMORY_FILE
    get INFO_OFF long MEMORY_FILE
    get INFO_SIZE long MEMORY_FILE
    get DATA_OFF long MEMORY_FILE
    get DATA_SIZE long MEMORY_FILE
    get FILES long MEMORY_FILE
    goto INFO_OFF MEMORY_FILE

    do
            get OFFSET long MEMORY_FILE
            get ZERO long MEMORY_FILE
            get DUMMY long MEMORY_FILE
            get DUMMY long MEMORY_FILE
    while OFFSET == 0
    for i = 1 <= FILES
        if i == FILES
            get NEXT_OFFSET asize MEMORY_FILE
        else
            get NEXT_OFFSET long MEMORY_FILE
            get NEXT_ZERO long MEMORY_FILE
            get NEXT_DUMMY long MEMORY_FILE
            get NEXT_DUMMY long MEMORY_FILE
        endif
        xmath SIZE "NEXT_OFFSET - OFFSET"
        log "" OFFSET SIZE MEMORY_FILE
        math OFFSET = NEXT_OFFSET
    next i
next
oddMLan
Posts: 13
Joined: Mon Jan 19, 2015 12:29 am

Re: PaRappa the Rapper 2 *.INT

Post by oddMLan »

The RAW data in the XTR archives is uncompressed, interleaved (at 0x200) stereo audio. I used AlphaTwentyThree's file deinterleaver quickbms script with these settings:

Code: Select all

set HEADER 0x0
set PRESERVE 0
set ADJUST 0
set BLOCKSIZE 0x800
set INTSIZE 0x200
set LAYERS 4
set SKIP 0


I get 4 files.
1st file: some non-audio data + left audio channel
2nd file: some non-audio data + right audio channel
3rd file: some non-audio data + other non-audio data that was previously interleaved with the audio (?!)
4th file: some non-audio data + other non-audio data that was previously interleaved with the audio (?!)

The first and second file can be played with Audacity where the audio starts, and you get perfect audio. In the non-audio data sections you can hear gibberish.

You can also set LAYERS 2 instead, and you'll get 2 files, one with data + interleaved stereo audio (which can be played with an audio player that lets you set the interleave, like MFAudio); and the other file is just data without audio.

EDIT: I tried to use your above script with the deinterleaved files, but the extraction always fails trying to read beyond a certain offset. Figured. But maybe that's because the data files aren't interleaved by themselves, is just the audio that is interleaved with the colliding data files? Is there a way to "substract" the interleaved audio leaving just the untouched, non-interleaved data? This seems to be a though one to extract :S
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

You can also open a thread with the same content of your post in the Audio section, just in case AlphaTwentyThree doesn't look at this section.
oddMLan
Posts: 13
Joined: Mon Jan 19, 2015 12:29 am

Re: PaRappa the Rapper 2 *.INT

Post by oddMLan »

aluigi wrote:http://aluigi.org/papers/bms/others/parappa_rapper.bms

Interesting file format.


Is it possible to modify the script to be able to reimport the files? I tried to reimport some modified files via the -r flag in QuickBMS but it says the script is invalid for reimporting because it uses MEMORY_FILEs
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

Unfortunately not.
oddMLan
Posts: 13
Joined: Mon Jan 19, 2015 12:29 am

Re: PaRappa the Rapper 2 *.INT

Post by oddMLan »

aluigi wrote:http://aluigi.org/papers/bms/others/parappa_rapper.bms

Interesting file format.


I would like a modification of this script so it dumps the files as they are arranged/ordered/sorted in the INT archive.
In other words, essentially the same but without the renaming part.

I've been able to succesfully repack parts of the INT file thru executing this in the Command Prompt

Code: Select all

copy /b *.* combined.bin
in a subfolder (0,1,2... n) of the INT file and then compressed by using

Code: Select all

comtype lzss_compress "12 4 2 2 0"
in QuickBMS, but only works if the order of the files in compressed subfolder matches with the order of the filenames in the INT file. Since Windows has its own way to sort the files by their filename, this only works when repacking the imgXXXXX.tm0 files (in subfolder 0 of most INT files), but not when repacking other subfolders.


EDIT: Appending the number of the file before the filename would work too. Ex. 000000_st01gm0.cod, 000001_noodle_pattern01.tm2, 000002.Nmb_Nm_SPXt.spm, etc.
Preserving the original file sorting is very important here.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: PaRappa the Rapper 2 *.INT

Post by aluigi »

string FNAME p= "%d/%d_%s" FOLDER i NAME

while if you want the full work made by the script, replace the "for" cycle with this one:

Code: Select all

log MEMORY_FILE2 0 0
append
        for i = 0 < FILES
            getarray OFFSET 0 i
            getarray SIZE 2 i
            getarray NAME 3 i
            log MEMORY_FILE2 OFFSET SIZE MEMORY_FILE
        next i
append
string FNAME p= "%d." FOLDER
get SIZE asize MEMORY_FILE2
log FNAME 0 SIZE MEMORY_FILE2