Results 1 to 4 of 4

Thread: Finding custom lzss on arcade game .dat file

  1. #1
    Member
    Join Date
    Jun 2017
    Location
    Somewhere
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding custom lzss on arcade game .dat file

    Aluigi from zenhax told me to post here, so apologizes if this is in the wrong section. I have a .dat file from an arcade game that has some form of custom lzss compression on it, and I'm not sure what it is. Trying anything standard results in a semi correct file. The thread below at zenhax has a bit more info, and I attached 2 compressed & 2 uncompressed files. I'm kinda desperate here, so any help would be greatly appreciated. I also have a .dll that I believe handles decompression, but it also handles a bunch of other game logic (and I'd rather refrain from posting it publicly heh)

    https://zenhax.com/viewtopic.php?f=9&p=23990#p23990
    Last edited by finalscream; 11th June 2017 at 02:31.

  2. #2
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    4,007
    Thanks
    301
    Thanked 1,322 Times in 755 Posts

    #include <stdio.h>
    #include <stdlib.h>

    typedef unsigned char byte;
    typedef unsigned int uint;

    uint get2( FILE* f ) {
    uint c1 = getc(f);
    uint c2 = getc(f);
    return (c1<<8)|(c2);
    }

    enum{ winsize=1<<12 };
    byte window[winsize];

    int main( void ) {

    uint c,d,i,l;

    FILE* f = fopen( "File1Compressed.dat", "rb" ); if( f==0 ) return 1;
    FILE* g = fopen( "File1Compressed.unp", "wb" ); if( g==0 ) return 1;

    for( i=0; i<winsize; i++ ) window[i]=0;

    getc(f); // skip first byte

    for(i=0;;) {

    c = getc(f); if( c==-1 ) break;

    printf( "%02X ; mask\n", c );

    for( c+=0x100; c!=1; c>>=1 ) {
    if( c&1 ) {
    d = getc(f); if( d==-1 ) break;
    printf( " %02X ; literal\n", d );
    window[(i++)%winsize] = d;
    putc( d, g );
    } else {
    d = get2(f); if( int(d)<0 ) break;
    if( d==0 ) break; // real EOF
    printf( " %04X ; match: dist=%i len=%i\n", d, d/16, d%16+3 );

    l = d%16+3; d=d/16+0;
    for(; l--; i++ ) {
    putc( window[i%winsize] = window[(i+winsize-d)%winsize], g );
    }
    }
    }

    }

    }
    Attached Files Attached Files
    • File Type: exe 1.exe (3.5 KB, 71 views)

  3. Thanks:

    snowcat (11th June 2017)

  4. #3
    Member
    Join Date
    Jun 2017
    Location
    Somewhere
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just tested it and it works, you are amazing. Do you have a BTC address I could throw a few bucks at? I've been trying at this for weeks and got absolutely nowhere.

  5. #4
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    4,007
    Thanks
    301
    Thanked 1,322 Times in 755 Posts
    As a bonus, this is how I parsed it (click to zoom). Unfortunately that dll didn't help - there is some lz77 inside, but I didn't find this.
    However, ida won't work with structuring of more complicated formats (bitcode etc) :(

    Click image for larger version. 

Name:	konami1.png 
Views:	166 
Size:	114.6 KB 
ID:	4944

  6. Thanks:

    xinix (11th June 2017)

Similar Threads

  1. Help on compressed file from OLD DOS game
    By theruler in forum Data Compression
    Replies: 3
    Last Post: 16th August 2015, 13:18
  2. Need help finding info on QLFC
    By Lucas in forum Data Compression
    Replies: 3
    Last Post: 1st April 2015, 04:29
  3. Finding most frequency sequences in data?
    By RichSelian in forum Data Compression
    Replies: 5
    Last Post: 21st September 2012, 04:29
  4. Replies: 6
    Last Post: 24th April 2012, 14:50
  5. found 6 bits redundancy in sharnd_challenge.dat
    By ddfox in forum The Off-Topic Lounge
    Replies: 1
    Last Post: 4th June 2010, 23:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •