Hotel Dusk Need help to hack

Discussion in 'NDS - ROM Hacking and Translations' started by yerenkow, Feb 19, 2009.

  1. yerenkow
    OP

    yerenkow Newbie

    Newcomer
    7
    0
    Feb 2, 2009
    Well, anyone had hacked hotel?
    I've made so far:
    After unpacking ROM, I've found textdata_usa.wpf
    It has many files in there, in such structure:
    24 bytes for name of packed file;
    4 byte - file size; 4 byte - start of next file;

    After that I've mad a simple unpacker, and convert this textdata_usa.wpf to a directory with bunch of files.

    I need to translate, so I look into *.txt
    It have this structure:

    12 3D DA - header;
    01/00 - type of file;
    4 next bytes = unknown yet;
    8 bytes = size of used part of file (adding to this number 16, increasing to nearest number, which divide on 16, and this is real filesystem size)

    1byte = some flag; (in filetype 01 there are three of these flags: FF,FD,FB)
    2 bytes = count of pointers with offsets (could be 1 byte instead of two, maybe there are resemblance with previous flag)
    3 bytes = another header, common for many files;
    1 byte = unknown;
    After that, starts pointer table with such structure:
    [2 bytes offset][2 bytes pointer] FF (delimeter)
    [2 bytes offset][2 bytes pointer][2 bytes offset][2 bytes pointer] FF (delimeter)
    ....
    [2 bytes offset][2 bytes pointer][2 bytes offset][2 bytes pointer] FF (delimeter)
    [2 bytes offset][2 bytes pointer] (can be leading 00 00)

    Count of pointers and offsets can be even, so table will ends after FF.

    Text starts in point 16 + (count of pointers with offsets)*9/2


    That's all.
    After that, I see text with missing some words;


    For example, here is missing word "for".
    [​IMG]

    Someone have some ideas?

    I'll continue digging there anyway.
     
  2. DarthNemesis

    DarthNemesis GBAtemp Maniac

    Member
    1,213
    40
    Feb 19, 2008
    United States
    Looks like LZ77 compression or some variant thereof.
     
  3. yerenkow
    OP

    yerenkow Newbie

    Newcomer
    7
    0
    Feb 2, 2009
    I could be wrong, but it's almost all plain text...
    FF - I thing it's dialog sound (when text typing on screen)
    I'll try tomorrow split text by pointers, maybe there will be some system or scheme.
     
  4. Noitora

    Noitora ::

    Member
    3,768
    0
    Aug 9, 2007
    Greece
    Athens
    How did you find that out? [​IMG]
     
  5. Vampires

    Vampires Member

    Newcomer
    17
    0
    Mar 16, 2008
    Yugoslavia
    It's an LZ77 compression. Read about LZ compression and you'll understand meaning of 0xFF byte and where is your missing "for" word.
    What about Phoenix Wright, already dumped it?
     
  6. yerenkow
    OP

    yerenkow Newbie

    Newcomer
    7
    0
    Feb 2, 2009
    offtopic: yes, phoenix already dumped and translated. Meanwhile, I'm as main programmer of our team, looking into next ROM [​IMG]

    Ok, I've read "FAQ for the LZSS Compression". After that and further analysis i came to opinion:

    File consist of header (16 bytes) and compressed data.
    Delimeter = 11111111.
    Each byte in delimeter correspond to one of next 8 bytes of data;
    1 means that there are single byte, which simply copied to uncompressed data;
    0 means that there is chain.
    Chain can be 3 bytes, and sometime 2 byte (damn, why is that?... where's system? [​IMG] )

    Here a sample file,
    Small file

    Maybe someone say something about it.
     
  7. Narsu

    Narsu Newbie

    Newcomer
    1
    0
    Aug 25, 2010
    Yugoslavia
    Heya. Did you solve this packer?