Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pmret/papermario/llms.txt
Use this file to discover all available pages before exploring further.
The codebase follows Nintendo/SGI IDO conventions for primitive types, defining short aliases for every built-in width in include/PR/ultratypes.h and layering game-specific typedefs on top in include/common_structs.h. You will see these names throughout all C source files and headers; understanding them is a prerequisite for reading any struct or function signature.
Primitive integer and float types
All of the types below are defined in include/PR/ultratypes.h, which is pulled in transitively through include/ultra64.h.
| Type | Underlying C type | Size | Description |
|---|
s8 | signed char | 1 byte | Signed 8-bit integer |
u8 | unsigned char | 1 byte | Unsigned 8-bit integer |
s16 | short | 2 bytes | Signed 16-bit integer |
u16 | unsigned short | 2 bytes | Unsigned 16-bit integer |
s32 | long | 4 bytes | Signed 32-bit integer |
u32 | unsigned long | 4 bytes | Unsigned 32-bit integer |
s64 | long long | 8 bytes | Signed 64-bit integer |
u64 | unsigned long long | 8 bytes | Unsigned 64-bit integer |
f32 | float | 4 bytes | Single-precision float |
f64 | double | 8 bytes | Double-precision float |
Volatile variants exist for memory-mapped hardware access: vu8, vu16, vu32, vu64, vs8, vs16, vs32, vs64. These appear in low-level OS and hardware interface code but rarely in gameplay logic.
s32 and u32 are defined as long / unsigned long, not int / unsigned int. On the SGI IDO toolchain targeting MIPS O32, long is 32 bits. Do not assume these are interchangeable with standard C int in a modern cross-compilation context.
Boolean types
| Type | Definition | Size | Description |
|---|
b8 | typedef s8 b8 | 1 byte | Boolean stored in a signed byte; 0 = false, non-zero = true |
b16 | typedef s16 b16 | 2 bytes | Boolean stored in a signed halfword |
These are declared in include/common_structs.h. The codebase uses b8 extensively in structs where a full s32 would waste space, and b16 in contexts that require halfword alignment.
ID typedefs
Several semantic ID types are defined as typedef aliases over integer types. Using distinct typedefs makes function signatures self-documenting and enables compiler warnings when IDs are mixed.
| Type | Underlying type | Description |
|---|
HitID | s32 | Identifier for a collision hit record |
AnimID | u32 | Identifier for an animation asset |
HudElemID | s32 | Identifier for a HUD element |
MsgID | s32 | Identifier for a localised message string |
All four are declared in include/common_structs.h.
Pointer typedefs
Three #define aliases provide self-documenting pointer types for asset data buffers:
#define MSG_PTR u8* // pointer to a binary message buffer
#define IMG_PTR u8* // pointer to a binary image buffer
#define PAL_PTR u16* // pointer to a binary palette buffer
The corresponding _BIN variants (MSG_BIN, IMG_BIN, PAL_BIN) name the element types of those buffers rather than pointers to them.
Function typedefs
NoArgCallback and AuCallback
typedef void NoArgCallback(void*);
typedef void (*AuCallback)(void);
NoArgCallback is a non-pointer function type used for general-purpose callbacks that accept a single opaque context pointer. AuCallback is a function pointer type used for audio-system callbacks that take no arguments. Both are defined in include/common_structs.h.
ApiFunc and ApiStatus
Script API functions — the C functions callable from EVT scripts — use a pair of types defined across include/evt.h and include/common_structs.h:
// include/evt.h
typedef s32 ApiStatus;
#define ApiStatus_BLOCK 0 /* Call again next frame */
#define ApiStatus_DONE1 1 /* Unconditional return */
#define ApiStatus_DONE2 2 /* Conditional on Evt->disableScripts */
#define ApiStatus_REPEAT 3 /* Call again immediately */
#define ApiStatus_FINISH 255 /* Corresponds to EVT_FINISH */
// include/common_structs.h
typedef ApiStatus(*ApiFunc)(struct Evt*, s32);
The macro API_CALLABLE(name) in include/macros.h expands to the correct function signature:
#define API_CALLABLE(name) ApiStatus name(Evt* script, bool isInitialCall)
Use API_CALLABLE when defining a new script API function so that the signature stays consistent with the ApiFunc typedef.
Miscellaneous types
| Type | Definition | Description |
|---|
Addr | typedef u8 Addr[] | Incomplete array type used to name linker symbol addresses from ld_addrs.h |
Bytecode | typedef s32 Bytecode | Element type of an EvtScript array; wide enough to hold a pointer on O32 |
EvtScript | typedef Bytecode EvtScript[] | Incomplete array of Bytecode values that encodes an EVT script |
PrintCallback | typedef char* (*PrintCallback)(void*, const char*, u32) | Function pointer type for print-style callbacks used in debug output |