TheDocumentation 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.
.o2r format is Starship’s native asset archive container. It uses a standard ZIP file as its outer envelope, with individual entries storing serialized game resources. This design is fully compatible with .otr archives from Ship of Harkinian—the two formats share the same container layout and differ only in the file extension and the toolchain that produces them.
Container structure
An.o2r file is a ZIP archive. Each ZIP entry corresponds to one game resource and is addressed by its archive path—a forward-slash-separated string that mirrors the original ROM’s segment hierarchy (e.g. sf64/assets/ast_corneria/texture_wall).
The resource manager in libultraship indexes all entries from all loaded archives at startup, building an in-memory map from archive path → binary payload. When game code calls ResourceGetDataByName("sf64/assets/..."), the manager looks up that path across every loaded archive, with later archives (including those in mods/) taking precedence over earlier ones.
Because
.o2r and .otr share the same container format, any tool that reads one can also read the other. Starship accepts both extensions in the mods/ folder.Archive path sentinel
Archive-resident paths are distinguished from raw file-system paths at runtime by a seven-byte sentinel prefix.GameEngine_OTRSigCheck checks for this marker:
__OTR__ to the path string. The LOAD_ASSET macro uses this check to decide whether to call ResourceGetDataByName or pass the pointer through unchanged.
Resource types
Every entry in an.o2r archive is tagged with a four-character type code stored as a 32-bit big-endian integer in the serialized header. Starship’s ResourceType.h defines all recognized codes in the SF64::ResourceType enum.
Game asset types
| Type name | 4-char code | Hex value | Description |
|---|---|---|---|
AnimData | ANIM | 0x414E494D | Character and object animation data |
ColPoly | CPLY | 0x43504C59 | Collision polygon geometry |
Environment | ENVS | 0x454E5653 | Per-stage environment settings (fog, lighting, sky) |
Limb | LIMB | 0x4C494D42 | Individual skeleton limb node |
Message | MSG | 0x4D534720 | In-game message text (note the trailing space) |
MessageTable | MSGT | 0x4D534754 | Message index lookup table |
Skeleton | SKEL | 0x534B454C | Full character skeleton hierarchy |
Script | SCRP | 0x53435250 | Gameplay event script |
ScriptCmd | SCMD | 0x53434D44 | Individual script command entry |
Hitbox | HTBX | 0x48544258 | Object hitbox definition |
ObjectInit | OBIN | 0x4F42494E | Object initialization parameters |
Vec3f | VC3F | 0x56433346 | Array of 32-bit floating-point 3D vectors |
Vec3s | VC3S | 0x56433353 | Array of 16-bit integer 3D vectors |
GenericArray | GARR | 0x47415252 | Raw byte array for miscellaneous binary data |
NAudio v0 types (legacy audio)
| Type name | 4-char code | Hex value | Description |
|---|---|---|---|
Bank | BANK | 0x42414E4B | Audio bank (instrument collection) |
Sample | AIFC | 0x41554643 | Compressed audio sample (AIFC/ADPCM) |
Sequence | SEQC | 0x53455143 | MIDI-like music sequence |
NAudio v1 types (current audio)
| Type name | 4-char code | Hex value | Description |
|---|---|---|---|
SoundFont | SFNT | 0x53464E54 | Sound font (maps notes to samples) |
Drum | DRUM | 0x4452554D | Percussion drum instrument definition |
Instrument | INST | 0x494E5354 | Melodic instrument definition |
AdpcmLoop | APCL | 0x4150434C | ADPCM loop point data |
AdpcmBook | APCB | 0x41504342 | ADPCM predictor coefficient book |
Envelope | EVLP | 0x45564C50 | Audio amplitude envelope (ADSR) |
AudioTable | ATBL | 0x4154424C | Audio asset lookup table |
How the engine loads resources
At startupGameEngine builds an ordered list of archive files and passes it to libultraship’s resource manager:
mods/ the highest precedence.
Game code retrieves a resource’s raw binary payload by name:
LOAD_ASSET macro wraps this call with the __OTR__ sentinel check so it degrades gracefully when passed a plain (non-archived) pointer:
Creating .o2r files
The retro tool is the recommended way to produce.o2r archives for mods.
retro — OTR & O2R Generator
Command-line tool that reads asset definition files and packs them into a standards-compliant
.o2r (or .otr) archive. Point it at a directory of exported assets, specify the output format as o2r, and drop the result into the mods/ folder.