Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/HarbourMasters/Starship/llms.txt

Use this file to discover all available pages before exploring further.

All Starship assets — models, animations, audio, scripts, and more — are stored in .o2r or .otr archive files (sf64.o2r for base game data, starship.o2r for port enhancements). Every archived asset carries a 4-character type tag encoded as a 32-bit big-endian integer. The engine reads this tag during deserialization to select the correct resource factory and produce a typed in-memory object. Resource types are defined as a C++ enum class in src/port/resource/type/ResourceType.h inside the SF64 namespace. You will encounter them whenever you implement a custom resource importer, query asset metadata, or call ResourceGetDataByName() and need to verify the result type.

Accessing Assets

ResourceGetDataByName()

void* ResourceGetDataByName(const char* path);
Looks up path in the loaded archives and returns a pointer to the deserialized resource data. The pointer type depends on the resource’s type tag — you must cast it to the appropriate struct. Returns NULL if the asset is not found.
// Load a skeleton
SkeletonHeader* skel = (SkeletonHeader*) ResourceGetDataByName("objects/arwing/skeleton");

GameEngine_OTRSigCheck()

uint8_t GameEngine_OTRSigCheck(const char* imgData);
Returns non-zero when imgData is an archive path that exists in the loaded .o2r files. Use this to test whether a pointer is an archiveable path before calling ResourceGetDataByName(), which is exactly what LOAD_ASSET does internally.

GameEngine_GetTextureInfo()

void GameEngine_GetTextureInfo(const char* path,
    int32_t* width, int32_t* height,
    float*   scale,
    bool*    custom);
Fills metadata for a texture asset without loading its pixel data. custom is true when the texture was loaded from a player mod rather than the base archive — useful for conditional HUD overlays or debugging tools.
path
const char*
required
Archive-relative asset path.
width
int32_t*
required
Receives the texture width in pixels.
height
int32_t*
required
Receives the texture height in pixels.
scale
float*
required
Receives the stored scale factor (1.0 for unscaled assets).
custom
bool*
required
Receives true if the texture originates from a mod pack.

Asset Loading Macros

// Safe load: returns archive data if path exists in archive, else returns path as-is
#define LOAD_ASSET(path) \
    (path == NULL ? NULL \
     : (GameEngine_OTRSigCheck((const char*) path) \
        ? ResourceGetDataByName((const char*) path) \
        : path))

// Always load from archive (no fallback)
#define LOAD_ASSET_RAW(path) ResourceGetDataByName((const char*) path)
Use LOAD_ASSET in code that may receive either an archived path string or a legacy ROM data pointer. Use LOAD_ASSET_RAW when the asset is guaranteed to exist in the archive, such as new mod-exclusive content.
// Works whether or not the asset is archived
void* texData = LOAD_ASSET("gfx/textures/star.rgba16");

Resource Type Reference

SF64 Game Resources

These types cover all gameplay assets: character skeletons, collision geometry, level settings, text, and scripting.
TypeHex Value4-char CodeDescription
AnimData0x414E494DANIMSkeletal animation keyframe data
ColPoly0x43504C59CPLYCollision polygon mesh
Environment0x454E5653ENVSLevel environment settings (fog, lighting)
Limb0x4C494D42LIMBIndividual skeleton limb / bone
Message0x4D534720MSG In-game dialog / text message
MessageTable0x4D534754MSGTMessage lookup table
Skeleton0x534B454CSKELFull character skeleton
Script0x53435250SCRPGame behavior script
ScriptCmd0x53434D44SCMDIndividual script command
Hitbox0x48544258HTBXObject hitbox definition
ObjectInit0x4F42494EOBINObject initialization parameters
Vec3f0x56433346VC3FArray of 32-bit float vectors
Vec3s0x56433353VC3SArray of 16-bit integer vectors
GenericArray0x47415252GARRGeneric byte array

Type Descriptions

AnimDataANIM Keyframe data for skeletal animations. Consumed by the animation system to drive limb transforms each tick. Pair with a Skeleton asset. ColPolyCPLY A mesh of collision triangles used for ground, wall, and ceiling detection. Loaded per-level and queried by the physics system during actor movement. EnvironmentENVS Level-wide rendering parameters: fog color, fog near/far distances, ambient light, and directional light settings. One environment block per scene zone. LimbLIMB A single bone in a character hierarchy. Contains a display list pointer, pivot position, and child/sibling indices. Limbs are assembled into a Skeleton. MessageMSG (note the trailing space in the 4-char code) A single localized dialog string, including control codes for pausing, changing font, or triggering sounds. Looked up by index via a MessageTable. MessageTableMSGT An indexed table mapping message IDs to Message asset paths. The dialog system resolves text by querying this table first. SkeletonSKEL A complete character skeleton: root limb count, limb array, and dex count for flex limbs. Must be paired with matching AnimData and Limb assets. ScriptSCRP A compiled sequence of ScriptCmd entries that drives AI, cutscenes, and level events. The script interpreter steps through commands each tick. ScriptCmdSCMD A single decoded script command (opcode + arguments). Normally accessed through a parent Script rather than directly. HitboxHTBX A set of oriented bounding shapes defining the collision volume for an actor or projectile. The engine tests hitboxes during damage and pickup checks. ObjectInitOBIN Per-object spawn parameters packed into a struct: initial position, rotation, scale, flags, and type ID. The level loader reads these to place actors in the scene. Vec3fVC3F A raw array of Vec3f (3 × f32) structs. Used for path waypoints, effect emitter positions, and any other bulk float-vector data. Vec3sVC3S A raw array of Vec3s (3 × s16) structs. Used for compact rotation tables and quantized position offsets. GenericArrayGARR An untyped byte buffer. Use when the data does not fit any structured type — for example, custom mod payloads or raw lookup tables.

NAudio v0 Resources

The original N64 audio format used by the base game ROM. These types are imported by the legacy audio pipeline.
TypeHex Value4-char CodeDescription
Bank0x42414E4BBANKAudio bank (collection of samples and envelopes)
Sample0x41554643AIFCADPCM-compressed audio sample (AIFC container)
Sequence0x53455143SEQCMusic or SFX sequence

Type Descriptions

BankBANK Groups a set of instruments, drums, and envelopes into a single loadable unit. The audio engine loads banks on level entry and unloads them on exit. SampleAIFC A single ADPCM-encoded waveform stored in an AIFC-like container. Shared across instruments and drums within a bank. SequenceSEQC A MIDI-like event stream that drives the N64 music and sound-effect sequencer. Played back by the audio thread.

NAudio v1 Resources

The expanded audio format introduced by the port for higher-quality sound and more flexible instrument programming.
TypeHex Value4-char CodeDescription
SoundFont0x53464E54SFNTSound font (instruments, drums, envelopes)
Drum0x4452554DDRUMDrum instrument definition
Instrument0x494E5354INSTMelodic instrument definition
AdpcmLoop0x4150434CAPCLADPCM loop point data
AdpcmBook0x41504342APCBADPCM codebook (predictor tables)
Envelope0x45564C50EVLPAudio amplitude envelope (ADSR)
AudioTable0x4154424CATBLAudio asset lookup table

Type Descriptions

SoundFontSFNT A self-contained collection of Instrument, Drum, Envelope, AdpcmBook, and AdpcmLoop entries. Replaces the v0 Bank type in the NAudio v1 pipeline. DrumDRUM Maps a MIDI note number to a sample with its own tuning, pan, envelope, and loop settings. Used for percussion tracks. InstrumentINST A melodic instrument with a sample for each of up to three pitch ranges, plus associated envelope and tuning data. AdpcmLoopAPCL Loop start/end sample indices and the ADPCM predictor state at the loop point. Required for seamlessly looping samples. AdpcmBookAPCB A set of ADPCM predictor coefficient vectors (the “codebook”) used by the ADPCM decoder to reconstruct the waveform. One book per sample. EnvelopeEVLP An ADSR amplitude envelope expressed as a list of (rate, level) pairs. Applied to instrument and drum voices. AudioTableATBL An indexed lookup table mapping sequence IDs or sample IDs to archive paths. The audio system resolves assets through this table at runtime.

Enum Definition

For reference, the full C++ definition from src/port/resource/type/ResourceType.h:
namespace SF64 {
enum class ResourceType {
    // SF64
    AnimData     = 0x414E494D,  // ANIM
    ColPoly      = 0x43504C59,  // CPLY
    Environment  = 0x454E5653,  // ENVS
    Limb         = 0x4C494D42,  // LIMB
    Message      = 0x4D534720,  // MSG
    MessageTable = 0x4D534754,  // MSGT
    Skeleton     = 0x534B454C,  // SKEL
    Script       = 0x53435250,  // SCRP
    ScriptCmd    = 0x53434D44,  // SCMD
    Hitbox       = 0x48544258,  // HTBX
    ObjectInit   = 0x4F42494E,  // OBIN
    Vec3f        = 0x56433346,  // VC3F
    Vec3s        = 0x56433353,  // VC3S
    GenericArray = 0x47415252,  // GARR

    // NAudio v0
    Bank         = 0x42414E4B,  // BANK
    Sample       = 0x41554643,  // AIFC
    Sequence     = 0x53455143,  // SEQC

    // NAudio v1
    SoundFont    = 0x53464E54,  // SFNT
    Drum         = 0x4452554D,  // DRUM
    Instrument   = 0x494E5354,  // INST
    AdpcmLoop    = 0x4150434C,  // APCL
    AdpcmBook    = 0x41504342,  // APCB
    Envelope     = 0x45564C50,  // EVLP
    AudioTable   = 0x4154424C   // ATBL
};
} // namespace SF64
The 4-char codes are the ASCII string formed by the hex value’s four bytes in big-endian order. For example 0x414E494DA N I MANIM. This makes it easy to identify asset type from a hex dump of the archive.

Build docs developers (and LLMs) love