Battletoads text decompression (huffman)
Moderator: Moderators
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
By an amusing coincidence, I'd done exactly this last December. I'd never seen a Huffman tree in ASM form before, so I was quite baffled at first until I realized a table indexing into itself must be a tree, and then it all fell into place.
This repository contains the Python file I wrote to extract the script as well as batch files that supply the offsets for the US and Japanese versions of the ROM.
This repository contains the Python file I wrote to extract the script as well as batch files that supply the offsets for the US and Japanese versions of the ROM.
Japanese text has much less a need to be compressed in the first place than English text, because, assuming one byte per kana, it's much more efficient in the first place. I think maybe the uncompressed Japanese script is in the neighborhood of the size of the compressed English script. (I'm too lazy to check, though.) I also didn't notice anything particularly interesting about the compression ratio of the Japanese text compared to the English text; in fact, I'm fairly sure the compression ratio was higher for English.koitsu wrote:Here's an alternate theory, which I think is much more likely: did this game come out in Japan? If so, that would probably explain their choice of Huffman, which compresses Japanese amazingly well