For the complete documentation index, see llms.txt. This page is also available as Markdown.

Immutable const data

Numeric arrays

Choose the smallest type that holds every value:

Type
Bytes/value
Range

int8

1

-128..127

uint8

1

0..255

int16

2

-32,768..32,767

uint16

2

0..65,535

int32

4

-2,147,483,648..2,147,483,647

const int8 CURVE[] = { 0, 5, 12, 22, 35, 51, 72, 100 };

const int16 POINTS[][] = {
    { -100, -50, 0, 50, 100 },
    { -100, -25, 0, 25, 100 }
};

Every row of a two-dimensional const array must have the same number of columns. Const data is immutable and consumes compiled data/bytecode space even when never used.

Access:

const-data-access.gpc
int a, b;

main {
    a = CURVE[3];
    b = POINTS[1][4];
}

Strings

Strings live in the const/data area, not runtime variables:

When an API expects an address, pass a const item or addr(...) as required by its signature. Bare string literals are not general runtime expression values.


Images

An image begins with width and height, followed by exactly ceil(width * height / 8) packed pixel bytes:

Pixels are packed left-to-right, top-to-bottom. Validate the byte count; invalid image data is a compiler error.

An array of image records needs a nested record for each image:


PS5 adaptive-trigger data

ps5adt records contain exactly 11 byte values in this order:

Index
Field selector
Meaning

0

PS5_ADT_MODE

Effect mode

1

PS5_ADT_START

Start position

2

PS5_ADT_FORCE1

First force parameter

3

PS5_ADT_FORCE2

Second force parameter

4

PS5_ADT_STRENGTH_LOW

Low-zone strength

5

PS5_ADT_STRENGTH_MID

Mid-zone strength

6

PS5_ADT_STRENGTH_HIGH

High-zone strength

7

PS5_ADT_UNK1

Unknown/reserved byte 1

8

PS5_ADT_UNK2

Unknown/reserved byte 2

9

PS5_ADT_FREQ

Effect frequency

10

PS5_ADT_UNK3

Unknown/reserved byte 3

Use a named mode and comment every positional field. Do not invent meanings for the three unknown/reserved bytes; preserve them from a known-good profile.

Last updated