Stats File Formats (AMX Mod X)

From AlliedModders Wiki
Revision as of 21:57, 29 June 2006 by BAILOPAN (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

AMX Mod X has statistics modules for Counter-Strike (CSX), Day of Defeat (DoDX), Team Fortress Classic (TFCX), and The Specialists (TSX).

They each have their own similar but separate binary file format. These file formats must be sequentially read and written, and are not organized into tables. This makes them a bit confusing to extract iteratively, however the format is still trivial.

Each stats file has a header, which contains the version. After the header, each stats entry is written sequentially. Each stats entry contains strings, and the strings are prefixed with the number of bytes to read. Once this number contains zero, the stats file has no more data, and thus iteration must be stopped.

The file formats in this document are displayed as lists. When the list has an indented section, it means that that section of the file is repeated until a condition. Explanations of the data types are below. Sample code is provided for CSX.

How to Interpret

  • int8/uint8 - Signed or Unsigned Byte (8 bits). C types: char, unsigned char
  • int16/uint16 - Signed or Unsigned Word (16 bits). C types: short, unsigned short
  • int32/uint16 - Signed or Unsigned Doubleword (32 bits). C types: int, unsigned int
  • sz - Zero-terminated C-style string

If a size is followed by [N], for example, int8[9], this would mean 9 blocks of int8 data must be read.

CSX (csstats.dat)

The CSSTATS format has RANK_VERSION of 11. The version numbers are considered isolated rather than backwards or forward compatible.

  • int16 - RANK_VERSION
  • uint16 - Bytes in first string (if 0, no entries)
    • sz - Name (read N bytes, where N is previous uint16)
    • uint16 - Bytes of next string
    • sz - Steam ID (read N bytes, where N is previous uint16)
    • uint32 - Team kills
    • uint32 - Damage
    • uint32 - Deaths
    • int32 - Kills
    • uint32 - Shots
    • uint32 - Hits
    • uint32 - Headshots
    • uint32 - Defusions
    • uint32 - Defusal Attempts
    • uint32 - Plants
    • uint32 - Explosions
    • uint32[9] - Body Hits (array of ints, one for each body hit area)
    • uint16 - If zero, end of file. Otherwise, loop back up and read the next name.