XSharp

Native sound context aliases

The extractor retains one canonical context for each exact ordered bank list. Native presets with the same uploads remain available through Aliases in the source catalog and Sfx/context-aliases.json in each generated game directory. There are 12 aliases for X1, 5 for X2 and 14 for X3 (97 canonical contexts total). The small revision-pinned map preserves them for other tools and HunterBaseStudio. No recording is copied for an alias.

For example, X2 Overlay-5A uses exactly the Song-12 bank set. The absent physical Overlay-5A directory never established silence; command 75 is audible in Song-12. The runtime can now explicitly prepare Overlay-5A and use its canonical commands:

// During level loading or an entity's [Precache] callback:
engine.PrecacheNativeSoundContext(OriginalGame.X2, "Overlay-5A");
// During simulation: command lookup and prepared PCM only.
engine.PlayNativeSound(OriginalGame.X2, 0x75, "research probe", "host", "Overlay-5A");

This example does not assign command 75 to an actor or action. Resource equality alone does not determine its semantic owner or timing.

Schema 1 alias metadata uses a flat map of names to canonical directory names. The loader rejects duplicate case-insensitive names, escaping/invalid paths, chains and cycles. It reads this file once per original game while loading, prepares the canonical command map once, and remembers declared aliases for save-state restoration. Playback and StopNativeSound perform no metadata IO. Older assets without this optional file retain their existing canonical behavior. An unavailable optional target remains a declared silent context.

Normal import/resume emits alias metadata automatically. Existing captures can refresh only their catalog/alias metadata without an emulator core or FFmpeg:

./tools/Import-NativeAudio.ps1 -X1Rom <X1-ROM> -X2Rom <X2-ROM> -X3Rom <X3-ROM> -MetadataOnly

The metadata-only mode requires an existing matching capture: ROM hash, canonical context names/banks/IDs and song presets must agree, and canonical manifests must exist. It never captures, renames, deletes or encodes media. Rebuild/copy a host’s assets afterward. --verify-assets checks aliases against the source catalog as well as the existing media/manifest checks.

Thirty extractor tests and 78 audio tests passed; one optional extracted MP3 manifest fixture remained skipped. Tests cover invalid aliases, cache sharing, playback after metadata deletion and stable stop aliases. The real DX9 mixed Sponge check restored Overlay-5A and played its Song-12/75 command alongside the existing Overlay-5B check. All 555 files /11,491 audible references were decoded and hash-verified, with unchanged encoded media size of 308,098,819 bytes. No native SPC voice, pan or complete enemy runtime parity is implied.