Please create an account or Login! Have fun!

C2H

Jump to navigation Jump to search

A C2H file (having the extension .c2h) is the file format where Chip's Challenge 2 stores the best scores and times for each level.

The file is a binary file consisting of several sections one after the other, terminated by the END section. Each section begins with a section header, which is followed by the section's data. Each level in the set that the player has encountered has its own copy of the FILE, TYPE, NAME and SAVE sections.

All data in the file is little-endian.

Format[edit]

Section header[edit]

Bytes Content
4 Four character code identifying the section, see table below. Codes shorter than 4 characters (such as "END") are padded with spaces (making "END " in this case).
4 The length of the section's data

Section types[edit]

Section ID Content Type Content
CC2H Null-terminated string The file's version. The latest version is "7".
FILE Null-terminated string The level's file name
TYPE Null-terminated string Usually the name of the levelset. For the base game, it's "Chips Challenge 2". In some cases it contains an empty string.
NAME Null-terminated string The level's title
SAVE 100 bytes Miscellaneous data
END No content (length is 0) Signifies end of file

SAVE section[edit]

Offset Bytes Content
0x00 4 Line number into c2g file where music and level file name can be found
0x04 4 Some kind of total score, in most cases slightly lower than the actual total score
0x08 4 Highest bonus score achieved (does not include bonus from time left)
0x0C 4 Sixtieths of a second left[1] for the worst attempt recorded
0x10 4 Chips left
0x14 4 Time bonus
0x18 4 Level number
0x1C 4 Initial time, in seconds
0x20 4 Number of level attempts before completion
0x24 4 Exit gender
0x28 4 Entry point that was used (advanced scripting)
0x2C 4 Exit that was used (advanced scripting)
0x30 4 1 if level is solved, 0 if unsolved
0x34 4 Result (advanced scripting)
0x38 4 Register 1 (advanced scripting)
0x3C 4 Register 2 (advanced scripting)
0x40 4 Register 3 (advanced scripting)
0x44 4 Register 4 (advanced scripting)
0x48 4 Menu processing
0x4C 4 Internal flags
0x50 4 Tools carried on exit
0x54 4 Keys carried on exit
0x58 4 Highest level time achieved
0x5C 4 Highest level score achieved (including base level score)
0x60 4 Level checksum

Corruption[edit]

C2H files sometimes get corrupted during normal gameplay; it is unknown what causes this to happen. This usually takes the form of the same level (and its score) appearing twice in the same C2H file, or a level's score being saved for the wrong level. A program exists to automatically create backups of C2H files, allowing the player to easily revert to a prior version should corruption occur.

If the player does not have a backup, the corruption can usually be undone using a hex editor. If a level is duplicated, the duplicate's FILE, TYPE, NAME and SAVE sections will have to be removed from the file. If a level has the wrong score, its SAVE section will have to be replaced with zeroes, except the line number, level number and initial time offsets; this will reset the level back to its initial, unsolved state. In both cases, the C2S file will have to be removed, as it still contains an erroneous total score for the entire set (a new total will be automatically recalculated based on the fixed C2H0.

The player should also create a backup of the C2H before performing any hex editing, in case they accidentally create further corruption in the process.

External Links[edit]

Footnotes[edit]

  1. Conversion to decimal time is given by diving this by 60, rounding up, readding the fraction (replacing .00 with .100). For example, 3195 would become 54.25