Difference between revisions of "GOOL Executable"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
m (Item 1: Header)
m (Type 2 - Sprite Animation)
Line 230: Line 230:
 
|}
 
|}
  
Type 3 - Font Map
+
==== Type 3 - Font Map ====
  
 
Type 3 descriptors associate with each ascii character, in lexicographic order, a separate region (location/dimensions determined by texture and color info) of a specified Texture Page. Also specified for each region are the dimensions of a textured blended quad to be rendered, with that [region of the texture page as its] texture. Type 4 descriptors, which specify a string of text, will reference a type 3 descriptor. As characters in the type 4 descriptor string are stepped through, the referenced type 3 descriptor will determine the corresponding quads to be rendered. The Type 3 descriptor may additionally specify a separate region of the texture page as [the texture for] a text backdrop [quad].
 
Type 3 descriptors associate with each ascii character, in lexicographic order, a separate region (location/dimensions determined by texture and color info) of a specified Texture Page. Also specified for each region are the dimensions of a textured blended quad to be rendered, with that [region of the texture page as its] texture. Type 4 descriptors, which specify a string of text, will reference a type 3 descriptor. As characters in the type 4 descriptor string are stepped through, the referenced type 3 descriptor will determine the corresponding quads to be rendered. The Type 3 descriptor may additionally specify a separate region of the texture page as [the texture for] a text backdrop [quad].

Revision as of 04:35, 9 December 2019

A GOOL Executable is a type of entry that describes the behavior or application of a particular type of game object. GOOL executables contain a header, executable compiled [GOOL] bytecode, a constant pool, a mapping of subtypes to [initial] states, a mapping of events to states/interrupts, state descriptors, and animation sequence, text, and sprite descriptors. They are Type 11 entries.

Format

Item 1: Header

Item 1: Header
Offset Field Size Value
0x0 Object Type 4 bytes
0x4 Object Category 4 bytes
0x8 unknown 4 bytes
0xC Initial Stack Frame Offset 4 bytes
0x10 Subtype->State Map Index
Max Interrupt Offset
4 bytes s
0x14 unknown 4 bytes

Item 2: Executable Bytecode

Item 2: Executable Bytecode
Offset Field Size Value
0x0 Code * x 4 bytes *

Item 3: Constant Data Pool

Item 3: Constant Data Pool
Offset Field Size Value
0x0 Data * x 4 bytes *

Item 4: State Map

Item 4: State Map
Offset Field Size Value
0x0 Event->State/Interrupt Map s x 2 bytes *
0x0 + (2 x s) Subtype->State Map * x 2 bytes *

*0xFF is a null state

Item 5: State Descriptors/Definitions

Item 5: State Descriptors/Definitions
Offset Field Size Value
0x0 State Descriptors * x 16 bytes *
(format of state descriptor d)
(d x 16) + 0x0 State Flags 4 bytes *
(d x 16) + 0x4 Object Status C Flags 4 bytes *
(d x 16) + 0x8 External Executable EID (*index in const pool) 2 bytes *
(d x 16) + 0xA Event Block Program Counter Offset 2 bytes *
(d x 16) + 0xC Trans Block Program Counter Offset 2 bytes *
(d x 16) + 0xE Code Block Program Counter Offset 2 bytes *

Item 6: Animation Descriptors

Item 6: Animation Descriptors
Offset Field Size Value
0x0 Animation Descriptors * x * bytes

Animation descriptors are stored contiguously, occupying the 6th item of the GOOL executable entry. Each type of animation descriptor has a different structure; the size of an animation descriptor is entirely dependent upon its type.

Type 1 - Vertex Animation

Type 1 animation descriptors simply specify an SVTX entry that contains their representative vertex animation. This is the most frequently used type.

Animation Descriptor Type 1 format
Offset Field Size Value
0x0 Type 1 byte 1
0x1 Unused 1 byte *
0x2 Frame Count 1 byte c
0x3 Unused 1 byte *
0x4 SVTX Model EID 4 bytes *

Type 2 - Sprite Animation

Type 2 descriptors specify a separate square for each frame of animation, each square to be transformed and rendered as a blended textured quad. Square dimensions are not specified in the descriptor but are calculated from the instanced object's scale vector.

Animation Descriptor Type 2 format
Offset Field Size Value
0x0 Type 1 byte 2
0x1 Unused 1 byte *
0x2 Frame Count 1 byte c
0x3 Unused 1 byte *
0x4 Texture Page EID 4 bytes *
0x8 CLUT/Texture info c x 2 x 4 bytes

Type 3 - Font Map

Type 3 descriptors associate with each ascii character, in lexicographic order, a separate region (location/dimensions determined by texture and color info) of a specified Texture Page. Also specified for each region are the dimensions of a textured blended quad to be rendered, with that [region of the texture page as its] texture. Type 4 descriptors, which specify a string of text, will reference a type 3 descriptor. As characters in the type 4 descriptor string are stepped through, the referenced type 3 descriptor will determine the corresponding quads to be rendered. The Type 3 descriptor may additionally specify a separate region of the texture page as [the texture for] a text backdrop [quad].

Animation Descriptor Type 3 format
Offset Field Size Value
0x0 Type 1 byte 2
0x1 Unused 1 byte *
0x2 Font Map Length 1 byte c
0x3 Unused 1 byte *
0x4 Texture Page EID 4 bytes *
0x8 Font Map c x 12 bytes *
(font mapping structure d)
0x8 + (d x 12) + 0x0 CLUT info 4 bytes *
0x8 + (d x 12) + 0x4 Texture info 4 bytes *
0x8 + (d x 12) + 0x8 Character Width 2 bytes *
0x8 + (d x 12) + 0xA Character Height 2 bytes *
(end)
0x8 + (c x 12) + 0x0 Backdrop CLUT info 4 bytes *
0x8 + (c x 12) + 0x4 Backdrop Texture info 4 bytes *

Type 4 - Text Animation

Type 4 descriptors specify a separate string of text for each frame of animation. They also specify the offset of a source font map (Type 3 descriptor) to use to render that text.

Animation Descriptor Type 4 format
Offset Field Size Value
0x0 Type 1 byte 4
0x1 Unused 1 byte *
0x2 String/Frame Count 1 byte c
0x3 Unused 1 byte *
0x4 Unknown 4 bytes *
0x8 Font Map Offset 4 bytes *
0xC Strings c x * bytes *

Each string ends with a null terminator character (\0) and can have up to 4 individual format specifiers (beginning with %); they are processed with a call to printf, with 4 corresponding arguments the 2nd, 3rd, 4th, and 5th words, respectively, before (or below) the top of the instanced object's stack.

These strings can also contain several types of extended format specifiers. These begin with a tilde '~' and can be specified as one of the following:

Specifier Output/Function
~n Newline
~% Newline
~c0 Disable shading (inst. obj's. color matrices will not affect proceeding chars)
~c1 Enable shading (inst. obj's. color matrices will affect proceeding chars)
~p# Skips the following character if the value at (2 + #) count words before/below

the top of the instanced objects stack is 1. Used to auto change from singular

to plural forms of the noun(s) introduced by the corresponding cardinal

determiner (i.e. 1 'box' to n 'boxes' for n != 1)

~sx#### Set width of following character to # (min 1, max 4 digits)
~sy#### Set height of following character to # (min 1, max 4 digits)

* if the instanced object has bit 11 of its statusb flags set, rendering of the text will include a backdrop that spans the area occupied by the text.

Type 5 - Fragment Animation

Type 5 descriptors specify a number of rectangles that compose a miniature model for each frame of animation. These are to be transformed and rendered as multiple blended textured quads.

This type is typically used for smaller objects such as fragments of exploding TNT and sparkling specks spawned by Aku Aku and by Warp Panels.

Animation Descriptor Type 5 format
Offset Field Size Value
0x0 Type 1 byte 5
0x1 Unused 1 byte *
0x2 Frame Count 1 byte c
0x3 Unused 1 byte *
0x4 Texture Page EID 4 bytes *
0x8 Rectangle Count 4 bytes r
0xC Rectangles c x r x 16 bytes *
(Rectangle structure d, frame f)
0xC + (d x f x 16) + 0x0 CLUT info 4 bytes *
0xC + (d x f x 16) + 0x4 Texture info 4 bytes *
0xC + (d x f x 16) + 0x8 X1 2 bytes *
0xC + (d x f x 16) + 0xA Y1 2 bytes *
0xC + (d x f x 16) + 0xC X2 2 bytes *
0xC + (d x f x 16) + 0xE Y2 2 bytes *