The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by Ekey »

Code: Select all

# The Legend of Heroes: Trails in the Sky (DAT/DIR format)
#
# Written by Ekey (h4x0r)
#
# open DIR file for unpack
# script for QuickBMS http://quickbms.aluigi.org

open FDDE DAT 0
open FDDE DIR 1

idstring "LB DIR" 1
goto 0x10 1

for
    getdstring NAME 16 1
    get ZSIZE long 1
    get SIZE long 1
    get SIZE2 long 1
    get CRC32 long 1
    get OFFSET long 1
   
   if NAME == "/_______.___"
      cleanexit
   endif
   
    if ZSIZE == 0
        log NAME OFFSET SIZE 0
    else if ZSIZE == SIZE
        log NAME OFFSET SIZE 0
    else
        #unknown compression :/
        log NAME OFFSET ZSIZE 0
    endif
next
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by aluigi »

No luck with the compression scanner?

Do you have a website or repository where you collect all your scripts?
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by Ekey »

aluigi wrote:No luck with the compression scanner?

Here samples

aluigi wrote:Do you have a website or repository where you collect all your scripts?

http://forum.xentax.com here :mrgreen:
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by aluigi »

What should be the format or structure of these SYS files when uncompressed?
I mean, how they should look? :)

It's very difficult to understand what results may be correct because there are no text strings or known formats to recognize.

I tried both the original file and by removing the 24bit compresssed size but there no result had an interesting format.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by Ekey »

aluigi wrote:What should be the format or structure of these SYS files when uncompressed?
I mean, how they should look? :)

Good question! I dont know :)
cgaion
Posts: 1
Joined: Tue Aug 19, 2014 10:39 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by cgaion »

good job!
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

There are script files in DT01.dat Would it be possible to edit script file..? Is there are some script tools?
chrrox
Posts: 388
Joined: Thu Aug 07, 2014 10:28 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by chrrox »

I am not sure if its the same format as the japanese version but you can try rpg viewer
http://pigspy.ys168.com/
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

chrrox wrote:I am not sure if its the same format as the japanese version but you can try rpg viewer
http://pigspy.ys168.com/


Hi, I bought steam version of L.o.h. But RPG viewer doesn't work.
K-65.jpg

PC version of L.o.h 4 and L.o.h6 has the same script structure.
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

Here is all of the script files. https://www.sendspace.com/file/ih179h
It seems that there some decompilers, but it can not extract and insertion text.
https://github.com/Ouroboros/Arianrhod/tree/master/Source/Hooks/Falcom/ed63cn/ScriptDecompiler
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

Loh4 has the same structure, however, there are no *.dir files for Loh4. How to adjust your script to Loh4?
Here is sample file.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by aluigi »

You can try something like the following:

Code: Select all

idstring "LB DAT"
goto 0x10
    get OFFSET long
for
    get NEXT_OFFSET long
    if NEXT_OFFSET == 0
        break
    endif
    xmath SIZE "NEXT_OFFSET - OFFSET"
    log "" OFFSET SIZE
    math OFFSET = NEXT_OFFSET
next
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

aluigi wrote:You can try something like the following:

Code: Select all

idstring "LB DAT"
goto 0x10
    get OFFSET long
for
    get NEXT_OFFSET long
    if NEXT_OFFSET == 0
        break
    endif
    xmath SIZE "NEXT_OFFSET - OFFSET"
    log "" OFFSET SIZE
    math OFFSET = NEXT_OFFSET
next


Thanks a lot :) , however, bms script can't get unzip the data because there are no SIZE values. https://www.sendspace.com/file/6wtuwb
Although there are no SIZE valuse in dat files, is it possible to get SIZE values and unpack it by bms script?
Last edited by sigroon365 on Tue Nov 25, 2014 5:34 am, edited 4 times in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by aluigi »

I have the compression algorithm :D
It will be available in quickbms 0.7.7 together with the script for the format
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

aluigi wrote:I have the compression algorithm :D
It will be available in quickbms 0.7.7 together with the script for the format


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

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by aluigi »

The script works with any game of Nihon Falcom that uses the same "LB DIR/DAT" format, so Dinosaur Resurrection too :)
The TODO list of the next quickbms is quite big now so it's probably the right moment to start to implement everything and pushing the new version in the next weeks.
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

aluigi wrote:so it's probably the right moment to start to implement everything and pushing the new version in the next weeks.


Could you also consider compress_zlib? :) Recompressing file with copress_zlib is smaller than the original ZSIZE of the file.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by aluigi »

About what are you referring?
There is no zlib used in this format.
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: The Legend of Heroes: Trails in the Sky (*.DAT/DIR)

Post by sigroon365 »

What I said is get off this subject. You're going to update quickbms, right?
I just hope you consider update the compress_zlib.