Please create an account or Login! Have fun!

C2H: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
(→‎SAVE section: Added the nonsense conversion from time left to decimal and noted its somehow the WORST attempt)
Line 70: Line 70:
|0x0C
|0x0C
|4
|4
|Sixtieths of a second left
|Sixtieths of a second left<ref>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</ref> for the <em>worst</em> attempt recorded
|-
|-
|0x10
|0x10

Revision as of 18:32, 28 January 2024

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

Section header

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

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

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

External Links

  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