Difference between revisions of "LEX (File Format)"
(Created page with "{{under-construction}} '''LEX''' (LE-CODE Extension) is a file format defined by Wiimm. A LEX file is usually stored as part of a track SZS under the name ''cours...") |
|||
Line 6: | Line 6: | ||
At least [[LE-CODE]] will support '''LEX'''. Maybe CTGP wil do it too. | At least [[LE-CODE]] will support '''LEX'''. Maybe CTGP wil do it too. | ||
+ | |||
+ | |||
+ | __TOC__ | ||
+ | |||
+ | == Degign Notes == | ||
+ | |||
+ | There were some prerequisites before the definition of the file format: | ||
+ | * The format should be open for future extensions. | ||
+ | * Extensions are menages by sections. Each section is identified by an unique ID (magic). | ||
+ | * ID should be 4 ASCII characters to make viewing by a hex-dumper easiser. | ||
+ | * Old implementation should work, event if new unknown subtypes were added. Therefore, the code needs an easy skip mechanism. | ||
+ | * The order must be stable to support sections, that depend on other prior defined sections. | ||
+ | * Fast and easy scanning support. | ||
== File Format == | == File Format == | ||
+ | |||
+ | Each file starts with a LEX header, followed by a sequence of LEX elements. The chain of elements is closed by a special termination element. | ||
+ | |||
+ | All values are stored in network byte order ([[big endian]]). Each element is aligned to 4 bytes. | ||
+ | |||
+ | {| class="textbox grid" | ||
+ | |+ File header of LEX files | ||
+ | |- | ||
+ | ! Offset !! Size || Type !! Description | ||
+ | |- | ||
+ | | 0x00 || 4 || char || File magic, always »LE-X« | ||
+ | |- | ||
+ | | 0x04 || 2 || uint16 | ||
+ | | rowspan=2 | The complete version number is devided into a major number (offset 4) and a minor number (offset 6). The major version changes, if the data structure changes in an incompatible way. On small changes like adding additional members to this file header, the minor version number is incremented. | ||
+ | |- | ||
+ | | 0x06 || 2 || uint16 | ||
+ | |- | ||
+ | | 0x08 || 4 || uint32 || Total size of file. use it for sanity cheks. | ||
+ | |- | ||
+ | | 0x0c || 4 || uint32 || Offset first element of the chain relative to the beginning of this structure. | ||
+ | |- | ||
+ | | 0x10 || colspan=3 {{unknown|end of header}} | ||
+ | |} | ||
+ | |||
??? | ??? | ||
Revision as of 21:37, 27 February 2019
LEX (LE-CODE Extension) is a file format defined by Wiimm. A LEX file is usually stored as part of a track SZS under the name course.lex. It's like KMP's course.kmp, but it provides additional settings and modifications outside of a KMP.
LEX is designed to be open for future extension by third persons. Anyway, each new section identifier (a 4 byte ASCII magic) should be requested to Wiimm. he will guarantee unique identifiers.
At least LE-CODE will support LEX. Maybe CTGP wil do it too.
Degign Notes
There were some prerequisites before the definition of the file format:
- The format should be open for future extensions.
- Extensions are menages by sections. Each section is identified by an unique ID (magic).
- ID should be 4 ASCII characters to make viewing by a hex-dumper easiser.
- Old implementation should work, event if new unknown subtypes were added. Therefore, the code needs an easy skip mechanism.
- The order must be stable to support sections, that depend on other prior defined sections.
- Fast and easy scanning support.
File Format
Each file starts with a LEX header, followed by a sequence of LEX elements. The chain of elements is closed by a special termination element.
All values are stored in network byte order (big endian). Each element is aligned to 4 bytes.
Offset | Size | Type | Description |
---|---|---|---|
0x00 | 4 | char | File magic, always »LE-X« |
0x04 | 2 | uint16 | The complete version number is devided into a major number (offset 4) and a minor number (offset 6). The major version changes, if the data structure changes in an incompatible way. On small changes like adding additional members to this file header, the minor version number is incremented. |
0x06 | 2 | uint16 | |
0x08 | 4 | uint32 | Total size of file. use it for sanity cheks. |
0x0c | 4 | uint32 | Offset first element of the chain relative to the beginning of this structure. |
0x10 | end of header |
???
Example Implementation
???
Sections
???
CANN : Cannon settings
???