dat unpacker [Ys: Memories of Celceta]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Rainx
Posts: 21
Joined: Sat Feb 24, 2018 7:24 am

dat unpacker [Ys: Memories of Celceta]

Post by Rainx »

Hello there.
Can anyone make a script for attached file?

Header:
10 08 13 50 magic
0x0C - compressed data size
0x18 - first compressed block
0x02F975 - next compressed data size
0x02F981 - second compressed block
etc

comtype falcom


It's difficult to convert this file manually and then combine all the parts.
Game: Ys Celceta

Thanks.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: dat unpacker

Post by aluigi »

There is something missing in the information you provided since falcom can't work from that offset 0x18.

I tried something and one chunk worked during my tests, anyway feel free to do your tests and let me know when you have the correct offset, compressed and uncompressed size of each chunk so I can fix it:

Code: Select all

# Ys: Memories of Celceta

comtype falcom
idstring "\x10\x08\x13\x50"
get DUMMY long  # 0x200
get DUMMY long  # 0x200

get DAT_SIZE asize
for i = 0
    savepos TMP
    if TMP == DAT_SIZE
        break
    endif

    get TMP basename
    string NAME p "%s_%d." TMP i
    log NAME 0 0

    append
    get ZSIZE long
    get CHUNK_SIZE long # 0x40000
    get CHUNKS long
    for x = 0 < CHUNKS
        get CHUNK_ZSIZE long
        math CHUNK_ZSIZE & 0xffffff
        math CHUNK_ZSIZE - 3

        savepos CHUNK_OFF
        clog NAME CHUNK_OFF CHUNK_ZSIZE CHUNK_SIZE

        math CHUNK_OFF + CHUNK_ZSIZE
        goto CHUNK_OFF

        #get DUMMY byte  # ever 1 except for the last chunk
    next x
    append
next i
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: dat unpacker [Ys: Memories of Celceta]

Post by aluigi »

This one works but I have some doubts:

Code: Select all

# Ys: Memories of Celceta

comtype falcom
idstring "\x10\x08\x13\x50"
get DUMMY long  # 0x200
get DUMMY long  # 0x200

get DAT_SIZE asize
for i = 0
    savepos TMP
    if TMP == DAT_SIZE
        break
    endif

    get TMP basename
    string NAME p "%s_%d." TMP i

    get ZSIZE long
    get SIZE long
    get CHUNKS long

    math SIZE + 1   # bug in the decompression code?

    math ZSIZE - 8

    savepos OFFSET
    clog NAME OFFSET ZSIZE SIZE
    goto ZSIZE 0 SEEK_CUR
next i