Skip to main content

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.
TypeUnderlying C typeSizeDescription
s8signed char1 byteSigned 8-bit integer
u8unsigned char1 byteUnsigned 8-bit integer
s16short2 bytesSigned 16-bit integer
u16unsigned short2 bytesUnsigned 16-bit integer
s32long4 bytesSigned 32-bit integer
u32unsigned long4 bytesUnsigned 32-bit integer
s64long long8 bytesSigned 64-bit integer
u64unsigned long long8 bytesUnsigned 64-bit integer
f32float4 bytesSingle-precision float
f64double8 bytesDouble-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

TypeDefinitionSizeDescription
b8typedef s8 b81 byteBoolean stored in a signed byte; 0 = false, non-zero = true
b16typedef s16 b162 bytesBoolean 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.
TypeUnderlying typeDescription
HitIDs32Identifier for a collision hit record
AnimIDu32Identifier for an animation asset
HudElemIDs32Identifier for a HUD element
MsgIDs32Identifier 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

TypeDefinitionDescription
Addrtypedef u8 Addr[]Incomplete array type used to name linker symbol addresses from ld_addrs.h
Bytecodetypedef s32 BytecodeElement type of an EvtScript array; wide enough to hold a pointer on O32
EvtScripttypedef Bytecode EvtScript[]Incomplete array of Bytecode values that encodes an EVT script
PrintCallbacktypedef char* (*PrintCallback)(void*, const char*, u32)Function pointer type for print-style callbacks used in debug output

Build docs developers (and LLMs) love