Save Game Format (.CHR)

From WTFwiki
Revision as of 22:39, 30 November 2009 by Dossy (talk | contribs) (Update article to reflect format of other OMF2097 articles.)
Jump to navigation Jump to search

The CHR format is required for storing the user's saved game from Tournament mode. It is a XOR encoded file identified by a DWORD having the value 0xafaeadad. The format consists of a number of sections.

Encoding

The encoding is a simple XOR mask + iteration scheme. The first 448 bytes are coded with a XOR mask of 0xac. This covers the Player & Tournament sections. The Opponents section uses a XOR mask determined from the value stored at offset 246. This value contains the the number of opponents of in the Tournament.

int GetOppXOR(int no) 
{
       
   return (no - (((no / 256) * 256)));
}

The Player's photo is not XOR encoded.

Player

Starting at offset 4 for the user(with a XOR mask of 0xb0) & offset 448 for the first opponent(with a XOR mask determined with the code above):

Description Size in Bytes
Pilot name 16
Unknown 2
Wins 2
Loses 2
Rank 1
HAR 1
HAR 1
Arm|Blade|Flail Power, Leg Power, Arm|Flame|Blade|Flail Speed 2 (5 bits per attribute)
Leg|Flame Speed|Arm Power(Flail), Armour, Stun Resistance 2 (5 bits per attribute)
Power & Agility 2 (7 bits per attribute)
Endurance 1 (7 bits per attribute)
Credits 4
Ternary HAR colour 1
Secondary HAR colour 1
Primary HAR colour 1

The HAR is determined from the following table:

HAR Value
Jaguar 0x0
Shadow 0x1
Thorn 0x2
Pyros 0x3
Electra 0x4
Katana 0x5
Shredder 0x6
Flail 0x7
Gargoyle 0x8
Chronos 0x9
Nova 0xa

Tournament

This section stores a limited set of details relating to the tournament that the user is competing in. Starting at offset 47 (XOR mask will be 0xdb) and consuming 56 bytes of data:

Offset (Size in Bytes) 47–59 (12) 60-90 (30) 91-103 (12)
Description Tournament file name. MS-DOS 8+3 + '\0' Tournament Description. 29 + '\0'. Tournament image file name. MS-DOS 8+3 + '\0'

There is an entire section devoted to the Tournament. It has no been completely de-mystified as yet. Some parts of the section store data on the user's win or lose against un-ranked challengers, and if any HAR enhancement was won.

Offset Bytes Description
155 1 Difficulty Level
246 4 Number of opponents, including un-ranked challengers.
248 4 Number of opponents, excluding un-ranked challengers.

Values for the difficulty level

Mode Value
Aluminium (Easy) 0x0
Iron (Medium) 0x08
Steel (Hard) 0x10
Heavy Metal 0x18

HAR enhancements

This section occupies 11 consecutive bytes, and for the user is stored from offset 166 to 176. For the Opponents the section is stored directly following the format of the Player section.

HAR Offset
Jaguar +0
Shadow +1
Thorn +2
Pyros +3
Electra +4
Katana +5
Shredder +6
Flail +7
Gargoyle +8
Chronos +9
Nova +10

Enhancements follow a 0x0, 0x1, 0x2 for each upgrade. For example a value of 0x2 for the Jaguar would mean all upgrades enabled. This has not fully been evaluated.

Opponents

This section occupies 68 bytes and follows the format of Player + HAR enhancements. The first opponent will be stored at offset 448. Opponents are stored by Rank, highest to lowest (that is, rank 1 followed by rank 2 ...). Following is the un-ranked or hidden challengers.

Player's photo

Raw 8bit pelleted One Must Fall 2097 image format.

Contributors

  • Alastair Hogge
  • Carl Manzi
  • chaosbm (Richard ...)
  • Michael Nicolella
  • Mighty Wombat
  • Ray Kirkland
  • Todd Copeland