anno-mods / FileDBReader

A command line tool for working with a proprietary bluebyte file compression used in Anno 2205 and 1800.
15 stars 4 forks source link
compression

FileDBReader

example workflow Create Release

A simple command line unpacker, repacker and interpreter for proprietary Anno 1800 compression.

After you are done editing the decompressed and interpreted xml file, you have to reinterpret it to hex (using the same interpreter) and compress it again.

Tip: you can also create xml patches and apply changes using meow's xmltest which works like the modloader.

Credits: First version of FileDB unpacking done by @VeraAtVersus, based on reverse engineering by @lysannschlegel

TLDR Usage

decompress -f <inputfiles> -c <CompressionVersion> -i <interpreterFile>
compress -f <inputFiles> -o <outputFileExtension> -c <CompressionVersion> -i <interpreterFile>
interpret -f <inputFiles> -i <interpreterFile>
toHex -f <inputFiles> -i <interpreterFile>
check_fileversion -f <inputfiles>
fctohex -f <inputfiles> -i <interpreterFile>
hextofc -f <inputfiles> -i <interpreterFile>

Note that i is optional on decompress, compress, fctohex and hextofc verbs. If provided, the program will directly convert from compressed to interpreted / from interpreted to recompressed.

The FileFormats folder contains a few more-or-less correct interpreter documents that have been collected over time. Don't let that stop you from creating your own. For this, refer to the Wiki.

AnnoMods.BBDom

This project also includes a library for use in your own projects. Documentation

To get started, simply add the Nuget Package to your project

Supported .NET versions: .NET 6.0 and above

Compression Versions

There are three versions of this compression

The compressor autodetects versions while decompressing. You can use the check_fileversion verb to determine yourself.

Binary Data in xml-based Anno files

Some xml-based file formats, especially in Anno 1701/1404/2070, do not use BlueByte's compression, but they still have binary parts:

<binary>CDATA[<bytesize><content>]</binary>

This tool can also convert those parts into:

<binary>CDATA[<hex_representation_of_content>]</binary>

Which also can be interpreted using an interpreter file. CDATA nodes must be marked in the interpreter with

<Convert Structure = "Cdata">

Bytesizes are automatically adjusted.

The most common example of this are .fc files for visual feedback.

To use this functionality, run

fctohex -f <inputfiles> -i <interpreterFile>

Invalid XML

Anno accepts </> as an xml closing tag. While reading, any of these closing tags are autocorrected, and since Anno also understands the valid xml syntax, you can use them ingame right away.