Your 360KB floppy has the following files on it:

  • dave2.exe
  • level01.dd2
  • level02.dd2
  • level03.dd2
  • level04.dd2
  • level05.dd2
  • level06.dd2
  • level07.dd2
  • level08.dd2
  • intro.dd2
  • egatiles.dd2
  • s_chunk1.dd2
  • s_chunk2.dd2
  • s_dave.dd2
  • s_frank.dd2 <—–
  • s_master.dd2
  • title1.dd2
  • title2.dd2
  • progpic.dd2

I don’t know about you, but I was immediately curious, who the hell is Frank?

The game executable is dave2.exe, game logic is not spanned over other files (neither code nor script.) Hexediting the files, I noticed that most files start with a nice HUFF signature. The level%02d, egatiles.dd2 and intro.dd2 are the only files that seem uncompressed. Furthermore, they are the smallest files on disk.

So, the first step was figuring out what is this HUFF mambo jambo. Firing up my favorite disassembler, I got down to work. Locating the code that checks for that magic signature was quite simple. I copy-pasted the assembly code onto a clean .c file, and started working out some sense in those nasty loops. Soon enough, I had this neat 90 lines Huffman decompressor and it unpacked all HUFF .dd2 files flawlessly. I was amazed to find out such a simple compression saved ~50%, which is the difference between a game on two floppies and on one. Sweet.

But let’s take this one step at a time…

Continue..


1 Response to “Part 2: Files and compression”

  1. 1 Frenkel

    Intro.dd2 is RLE compressed with 0xFE as the magic number. You should be able to figure out the rest yourself :) . I think Shadow Knights uses the same compression as intro.dd2.


Support