Common file format types: Difference between revisions

From Arx Libertatis Wiki
Jump to navigation Jump to search
(Created page with "This page describes types common to various Arx Fatalis file formats. == Numbers == All integers are encoded in little-endian byte order. Types are the same as in <code>platfor...")
 
No edit summary
Line 12: Line 12:


Example: <b>u32[64]</b> is an array of 64 unsigned 32-bit integers.
Example: <b>u32[64]</b> is an array of 64 unsigned 32-bit integers.
Example: <b>u8[128]</b> is a fixed length string of (max) 128 bytes.


== C Strings ==
== C Strings ==


Types described as <b>c string</b> are variably sized strings that are terminated with a null-byte.
Types described as <b>c string</b> are variably sized strings that are terminated with a null-byte.
The original Arx Fatalis code did not define an encoding for this name and presumably only allowed ASCII characters. Unless noted otherwise, Arx Libertatis interprets c strings as UTF-8.
== Fixed-length strings ==
Fixed length strings used the array syntax with the component type <b>char</b>. All unused bytes of fixed length strings are set to zero.
Unless noted otherwise, Arx Libertatis interprets fixed length strings as UTF-8.
Example: <b>char[128]</b> is a fixed length string of (max) 128 bytes.

Revision as of 06:18, 11 February 2012

This page describes types common to various Arx Fatalis file formats.

Numbers

All integers are encoded in little-endian byte order. Types are the same as in platform/Platform.h - s (signed integer) / u (unsigned integer) / f (float), followed by the number of bits.

Example: u32 is an unsigned 32-bit integer.

Arrays

Arrays are denoted by brackets like in c++.

Example: u32[64] is an array of 64 unsigned 32-bit integers.

C Strings

Types described as c string are variably sized strings that are terminated with a null-byte.

The original Arx Fatalis code did not define an encoding for this name and presumably only allowed ASCII characters. Unless noted otherwise, Arx Libertatis interprets c strings as UTF-8.

Fixed-length strings

Fixed length strings used the array syntax with the component type char. All unused bytes of fixed length strings are set to zero.

Unless noted otherwise, Arx Libertatis interprets fixed length strings as UTF-8.

Example: char[128] is a fixed length string of (max) 128 bytes.