Skip to content

zokker13/cnc-replayreaders

 
 

Repository files navigation

A collection of replay file readers for Command & Conquer games
===============================================================

The programs in this package are loosely copy/pasted variantes of
replay file dissectors for Command & Conquer games of the Electronic Arts
era:

ccgzhreader.cpp: "Generals" and "Zero Hour"
cnc3reader.cpp:  "Tiberium Wars", "Kane's Wrath" and "Red Alert 3"
cnc4reader.cpp:  "Tiberian Twilight"

The replay files for all these games follow a general pattern "header, body, footer",
where the body consists of "chunks" of data which are labelled by a timecode (measured
in units of 1/15 seconds, corresponding to two visual frames at 30fps). The differences
between the games are largely in the header and footer format.

The actual specification of the file format isn't known to me, and I
am building up my knowledge of the formats as reflected by the replay
readers in the documentation file "eareplay.html".

The main program is "cnc3reader", which has proper command-line argument handling,
use '-h' to see the available options.

"cnc4reader" only supports the syntax "cnc4reader filename [r|c]", where the optional
second argument causes raw ('r') or parsed ('c') chunk output. "ccgzhreader" supports
no arguments at all, and the only permissible syntax is "ccgzhreader filename".

The haphazard state of affairs is because the programs were written on an on-demand
basis. They could certainly be unified, and a good amount of code could be reused.

cnc3reader
----------

The reader for TW/KW/RA3 is by far the most advanced of the three. It supports
repair of truncated replays, which usually occur as a result of a program crash.
As replays seem to be written out in blocks of 4kiB, such a crashed replay is
missing a proper footer. Repairing the replay consists of truncating the replay
after the last complete chunk and appending a suitable footer.

The program also supports dumping of the audio stream of a commentated replay
(although the format of the audio data is unknown), and a rudimentary action
counter.

Compilation
-----------

The following compiler invocation should work for all programs:

    g++ -o cnc3reader cnc3reader.cpp -W -Wall -Wextra -O3 -march=native -s -std=c++0x -fwhole-program

Windows users using MingW should add "-enable-auto-import -static-libgcc -static-libstdc++"
to create free-standing executables without load-time dependencies on the C and C++ libraries.

About

A loose collection of replay file dissectors for Electronic Arts Command & Conquer games, and file format documentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.8%
  • Shell 1.2%