Skip to content

C API: Asset sources

A read asks for one of two kinds (sona_read_kind):

  • SONA_READ_ASSET: name is a lowercase item id in the 36-character form above.
  • SONA_READ_DATA: name is a data file: "avatar-rig.json", "ColorSets.json", "irradiance-cube.csv", "ssao/poisson_512x32_r8g8snorm.bin" or "bin/tocassetdependencies.bin".

Container bytes are the file as stored: YTGR-wrapped, raw STRB, or an STFS package holding asset_v2.bin.

A source is described by a sona_source_desc {kind, location, custom}:

Kind location
SONA_SOURCE_CUSTOM Unused; custom points at a host-written sona_source
SONA_SOURCE_GATE The gate base; NULL for 360sona's own. Not in the WASM build
SONA_SOURCE_DIR A folder of item files the user owns, laid out as the gate serves them. The core reads it and never writes to it
SONA_SOURCE_CONSOLE A Content root, such as "uda0:/Content" on an Xbox 360, or a PC path to a copied one

A host-written sona_source holds user, read(user, kind, name, req), cancel(user, req) and destroy(user). read starts a read and returns at once; the source finishes it, now or later, from any thread, with sona_complete. cancel is optional and only asks. destroy is optional and is called by sona_close.

Sources are asked in order; the first that has an asset wins. Fetched bytes are cached in memory only, against budget.source_cache.

sona_complete

void sona_complete(sona_request *req, sona_result status, const void *bytes,
                   size_t len);
Parameter and type Meaning
req
sona_request *
The read request (required)
status
sona_result
SONA_OK, or why the read failed
bytes
const void *
The file's bytes (required)
len
size_t
How many bytes there are

Returns Nothing.

Finishes one read, exactly once, also after cancel; the request stays valid until then. status is one of:

  • SONA_OK with the bytes, which the core copies;
  • SONA_E_NOT_FOUND when the source has no such asset: the next source in the chain is asked;
  • SONA_E_IO when it failed: the read is retried later, as the web retries.

May be called from any thread.

This page as Markdown · All the docs as one file (llms-full.txt)