Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions README.md

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions dm/games/0400E88025B1A000/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Star Fox (`0400E88025B1A000`)

A Switch 2 game: update v131072 over the base game, SDK 21.4.4 built for the Switch 2 (`Ounce`), NVN2 with DLSS. A custom engine (its own prefixes: `vfs`, `vrender`, `vjob`, `vscript`, `vspirv`, `veffects`, `vphysics`; project name `eclipse`, built on Windows), with Wwise 2024.1 for audio, Bullet physics and NPLN for online play. Modules `main`, `sdk`, `subsdk0` (the SDK's movie module), `subsdk3` (`nn::camera`); `subsdk1` (the C library) and `subsdk2` (`NintendoSDK_DLSS`) are shipped but `main` imports nothing from them. **Plays on the Mac** (M5 Max): the title (`Nintendo presents STAR FOX`, `A Start`), the prologue cinematic (the Lylat System, James McCloud's Arwing, the cockpit with General Pepper's briefing and subtitles) and the tutorial flight after it (`map_tutorial`: Peppy's lessons over the holographic city), 7 minutes with a controller at 60 fps (frame time p50 16.67 ms, p95 17.1 ms; a few dropped frames at scene changes and loads), with sound, the characters' fur, the Opus voices, the camera, GameChat and the network layers answered offline. iOS is not tested.

## What it needs

| Setting | Where | Why |
|---|---|---|
| `mem_alias 0x400000000`, `mem_reserve 0x550000000`, `mem_stack 0x10000000`, `app_pool 0x240000000` | [`game.tsv`](game.tsv) | Fire Emblem Fortune's Weave's split as a starting point (the Switch 2's 9 GB, a DLSS game); not measured yet |
| `sys_resource 0x1000000` | `game.tsv` | the NPDM declares 16 MB, so virtual address memory is on; `main` never sets a heap (`profile_guess.py`) |
| `modules main subsdk0 subsdk3 sdk` | `game.tsv` | `main` imports 17 movie functions from `subsdk0` and 19 `nn::camera` functions from `subsdk3`, nothing from `subsdk1` or `subsdk2` |
| `romfs_marker data.zip` | `game.tsv` | the RomFS has two files, and this is the game |
| `zip_store .zip:.metallib` | `game.tsv` | the archive's members are LZ4-compressed already |
| `shader_groups /data.zip=shader` | `game.tsv` | every shader is a member of the archive |

No `render_cond`: not tried.

What the host needed for it, all general (the reference entries are linked under *Found on this game*): SDK 21's socket initialization against host bsd sessions and the C library's `poll` routed to the host; SDK 21's hardware Opus decoder manager on the SDK's software decoder; SDK 21's output streams on the host's AudioOut; 33 GameChat calls answered as "no chat"; the camera module's commands answered as a console with no camera plugged in; `nvnDlssNetworkResize`; the translator's TXD through a uniform-register handle (0xf6c, also fixed on main meanwhile).

## Files

- Packed from a NUP (`scripts/pack_nup.py`): a base package (v0, 13.4 GB) and an update package (v131072, 14.5 GB), each with its own ExeFS and RomFS. The NUP carries the base game's icon but no NACP, so the name comes from the profile and the display version is the placeholder `v131072`.
- The RomFS is two files: `data.zip` (14.5 GB) and `veclipse_build.cvar` (a JSON line: `system.is_shipping_build: true`). `main` opens `rom:/data.zip` (and `rom:/headless.zip`, which is not there) through its own virtual file system (`vfs.zip.c`). The archive is a zip behind an 18 MB `VZIP` preamble (the engine's own index); zipfile reads it through the central directory. Its 114,154 members are named by a 16-digit hash with no folders or extensions, and every one is listed as stored (method 0), but a member whose size on disk differs from its file size is a chain of 64 KB chunks, each a u32 length and an LZ4 block of that length compressed against the previous chunk as its dictionary (a chunk that would not shrink is stored raw); the directory's CRC is the decoded data's. 92,069 members are chained, 22,085 (the Wwise `RIFF` sound files and `BKHD` banks) stored plain; all 33.4 GB decode and check ([`viper_zip_member`](../../gfx/tools/shader_split.py)). What is inside: 24,802 JSON documents (the engine's assets), 24,650 `VIPR` containers, 23,590 index or mesh buffers, 21,918 Wwise sounds, 163 Wwise banks, 2,828 shader binaries, and a few thousand raw texture mips.
- `main` is 192 MB of code with 1,036 imports, of which the host and the other modules supply all but two (gRPC thread-local initialisers, `_ZTH…`). No shader is in any code module.

## Shaders

2,856 in [`shader_map.tsv`](shader_map.tsv): 1,483 vertex, 1,305 pixel, 68 compute; 2,828 one per archive member, no task or mesh shaders, and the rest from the two NDSR upscaler networks (`ounce-nvn2-upper_left_ndsr.bin`, 40 shaders each, 28 of them new) embedded in two `VIPR` resource containers. Each member is the engine's shader binary (`_vrender_shader_binary_t`): the GLSLC output magic `0x19866891`, the code length, the control length, a zero and a 64-bit hash (0x18 bytes), then the Ampere code area (its 0x80-byte SPH first) and the NVN2 control section (version 0xc9; 0xe0 or 0xf8 bytes, up to 0x9f68 for 172 compute and vertex shaders that carry more). `shader_split.py` reads them as single-stage programs (`viper_shader`, `#VIPER`), paired at draw time as GLSLC outputs are (`separable_pairs`: 1,480 cover pairs). The engine also carries a SPIR-V interpreter (`vspirv`, ISPC) for its scripts; those SPIR-V modules (11 in the archive) are not GPU shaders. The DLSS and NDSR networks are the SDK's (`subsdk2`, `SMAA_For_NDSR`), which the host answers on MetalFX ([NVN2's DLSS on MetalFX](../../../docs/reference/rendering.md#nvn2s-dlss-on-metalfx)).

## Driving it on the Mac

`python3 scripts/build_ipa_from_nsp.py <folder>/StarFox\ [0400E88025B1A000].nup --platform mac` builds the Mac shaders and the host and prints the run command; `--platform mac-app` packs the Mac app. `DM_KEYS=12:A` starts the game from the title; the prologue cinematic follows. `DM_NVN_SHOT=600,1500:<dir>/f_%d.png` saves frames (the picture is the top-left 1920x1080 of the 4K swapchain).

## Found on this game

- [SDK 21 socket initialization and overloads](../../../docs/reference/services.md#sdk-21-socket-initialization-and-overloads) and [Socket `Poll` and `Select` with nothing to wait on](../../../docs/reference/services.md#socket-poll-and-select-with-nothing-to-wait-on): the game's HTTP thread aborted on a failed `poll`.
- [SDK 21's hardware Opus decoder manager](../../../docs/reference/audio.md#sdk-21s-hardware-opus-decoder-manager) and [SDK 21 output streams on the host's AudioOut](../../../docs/reference/audio.md#sdk-21-output-streams-on-the-hosts-audioout): its voice and music.
- [GameChat queries from the title screen (SDK 21)](../../../docs/reference/services.md#gamechat-queries-from-the-title-screen-sdk-21): a null read in `nn::chat::GetChattingUid`.
- [The camera commands of SDK 21's own camera module](../../../docs/reference/services.md#the-camera-commands-of-sdk-21s-own-camera-module): the game's own camera module, a console with no camera plugged in.
- [The DLSS network resized](../../../docs/reference/rendering.md#the-dlss-network-resized): `nvnDlssNetworkResize`.
- [TXD through a uniform register kept no handle](../../../docs/reference/shaders.md#txd-through-a-uniform-register-kept-no-handle): 281 pixel shaders (the fur shells) read 0, the same fix taken in from PR 1261 meanwhile.
- [A handle pair ORed sampler word first](../../../docs/reference/shaders.md#a-handle-pair-ored-sampler-word-first): 62 pixel shaders.

## Open

- Once in a 7-minute gameplay session, a GPU hang in one submission (`segment command buffer execution error … kIOGPUCommandBufferCallbackErrorHang`, at 178 s, in the prologue); the game went on. Not reproduced.
- The game opens a new output stream each time the window regains focus and never closes the old one (the console would keep them too): each orphaned output plays on empty. Harmless so far.
- One compute shader (`1002069a331ceded`) fails at load (`reflection conversion failed: B binding cp_t_cb196610_10280074Smplr has no resolved slot number`): its sampler words lie at c[2] 0x1028 and 0x1e0, past the separate sampler table the host decodes (NVN2 compute's own handle layout, mapped from c[0]). What it computes has not been seen missing.
- 3 shaders do not translate: Ampere opcodes 0x925 (2 compute shaders) and 0x21b (1). (On the chain before main's surface-atomic and TLD4 changes of 2026-11-04 it was 13: SURED form 0310e000 and 0xf63 too.)
- The memory split is Fortune's Weave's, not measured (the address region check runs only for a provisional profile; the game mapped up to alias +7.0 GB of 16 at the title).
- `render_cond` not tried. Mario Kart World 1.8.0 is not re-tested with the camera answers changed for this game.
- The game's wake-up eventfd fails (the host refuses `nn::socket::EventFd`), so its HTTP thread polls without a wake-up; harmless offline.
1 change: 1 addition & 0 deletions dm/games/0400E88025B1A000/bf_want.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# generated
40 changes: 40 additions & 0 deletions dm/games/0400E88025B1A000/game.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Star Fox (Switch 2, update v131072 over the base game). Bring-up in progress: see README.md
# A custom engine ("Viper": vfs, vrender, vjob, vscript, vspirv prefixes; Windows-built, project "eclipse"), SDK 21.4.4 built for the Switch 2 (Ounce), NVN2 with DLSS. Wwise 2024.1 audio, Bullet physics.
# Modules main, sdk, subsdk0 (movie), subsdk3 (nn::camera); subsdk1 (libc) and subsdk2 (NintendoSDK_DLSS) are not imported by main.
# The RomFS is one archive, data.zip: a zip with a VZIP preamble whose members are stored as 64 KB LZ4 chunks, each chained to the previous one (shader_split.py viper_zip_member).
# Packed from a NUP with scripts/pack_nup.py. Shaders: 2,828 NVN2 program binaries, one per member, in the engine's wrapper (shader_split.py viper_shader).

# ---- Identity ----
title_id 0400E88025B1A000
program_id 0400E88025B1A000

# ---- App ----
name Star Fox
ipa StarFox.ipa
app_category public.app-category.action-games
pad_layout full

# ---- Versions ----
build v131072 v131072 main=a7730d0f74d168d90422354c8317f76f subsdk0=593524e167fecd3c7a42a184c9da3963 subsdk3=973102ab6bb2be3dc4f0c3a4c9e7e1c4 sdk=41d4de4a3b78214ad20c896960df0e5e
build v0 v0 main=898024ffa42c059518eb38196f1ee0f6 subsdk0=593524e167fecd3c7a42a184c9da3963 subsdk3=973102ab6bb2be3dc4f0c3a4c9e7e1c4 sdk=41d4de4a3b78214ad20c896960df0e5e
package v131072
shader_versions v131072

# ---- Files ----
# main imports nothing from subsdk1 (C / libc) or subsdk2 (NintendoSDK_DLSS) that the host does not supply (dm/games/profile_guess.py modules)
modules main subsdk0 subsdk3 sdk
romfs_marker data.zip
zip_store .zip:.metallib

# ---- Memory ----
# Fire Emblem Fortune's Weave's split as a starting point (the Switch 2's 9 GB; a DLSS game): the NPDM declares 16 MB of system resource, so virtual address memory is on, and main never sets a heap
mem_reserve 0x550000000
mem_alias 0x400000000
mem_stack 0x10000000
app_pool 0x240000000
sys_resource 0x1000000

# ---- Shader split ----
# every shader is a member of /data.zip
shader_groups /data.zip=shader
shader_note Star Fox shaders
2 changes: 2 additions & 0 deletions dm/games/0400E88025B1A000/pso_manifest.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prewarm seed list (shipped in the app, next to shader_map.tsv). Rows: S<TAB>shader key<TAB>stage / R<TAB>render pipeline key (pso_skey hex) / C<TAB>compute shader key.
# Provisional profile: empty until recorded on the Mac (DM_PSO_MANIFEST=off DM_PSO_RECORD).
1 change: 1 addition & 0 deletions dm/games/0400E88025B1A000/pso_pairs.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# kind: evidence supplemental vertex / pixel shader pairs (BAHS program variations and legacy Unity pass-input covers) for vertex output padding and the pipeline prebuild (generated by dm/gfx/tools/shader_split.py, do not edit): vertex key <TAB> pixel key
69 changes: 69 additions & 0 deletions dm/games/0400E88025B1A000/shader_facts.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Answer table for translation queries (generated by dm/gfx/tools/shader_split.py, do not edit): key <TAB> fact JSON. No PC shader pairing supplied: only the thread group / shared memory of compute shaders (taken from the control section); other queries get the translator defaults
0253bd17deceee79 {"local":[128,1,1],"shared":5584}
085c6fddc9443e70 {"local":[128,1,1],"shared":8704}
0f8b241fa4de4a87 {"local":[32,32,1],"shared":80}
1002069a331ceded {"local":[4,4,4],"shared":0}
10e27c45f0670ac5 {"local":[8,8,1],"shared":3072}
146dd61797af358c {"local":[32,1,1],"shared":48}
194c7b2c00e198ce {"local":[64,1,1],"shared":0}
196dfe02185a7518 {"local":[128,1,1],"shared":4608}
1adedd63c356b5b0 {"local":[8,8,1],"shared":0}
272b4465a1e36d03 {"local":[32,32,1],"shared":16384}
2b5f964223e70873 {"local":[4,4,4],"shared":0}
30d8ee33de9dee85 {"local":[128,1,1],"shared":8064}
33cc90c9d4be52c1 {"local":[128,1,1],"shared":10496}
36a764abe55baff2 {"local":[8,8,8],"shared":0}
3a91e23633e25ad4 {"local":[4,4,4],"shared":0}
3fe6b091bb8c40ce {"local":[128,1,1],"shared":8064}
4acef5afefba098b {"local":[128,1,1],"shared":5504}
4ef187a92d0f337b {"local":[32,32,1],"shared":0}
546f2576bcc31ca8 {"local":[128,1,1],"shared":11008}
58046f286de779e1 {"local":[8,8,1],"shared":0}
589170d45ba32c2b {"local":[8,8,8],"shared":0}
5e1eefff46e00a62 {"local":[8,8,1],"shared":1200}
60f3f31a0e0132e1 {"local":[128,1,1],"shared":8064}
68c00aaafc80765a {"local":[32,1,1],"shared":0}
6b91d94e8f3f9e23 {"local":[8,8,1],"shared":0}
70f06e7d81f85563 {"local":[4,4,4],"shared":0}
725bcf5c3f4bb3f3 {"local":[128,1,1],"shared":11232}
73dec8e0f4095331 {"local":[128,1,1],"shared":10496}
773105d50ff9c1c7 {"local":[4,4,4],"shared":0}
7d733496906d56bc {"local":[8,8,1],"shared":0}
7efeafcb27c39a49 {"local":[4,4,4],"shared":0}
7f15edb944751969 {"local":[16,1,1],"shared":128}
7fe1717b163564d7 {"local":[8,8,1],"shared":0}
85889d37a8aae69c {"local":[4,4,4],"shared":0}
8e747cc7689d1519 {"local":[8,8,1],"shared":0}
9341db76d9154cdb {"local":[8,8,1],"shared":0}
96d0599558bcf9a1 {"local":[64,1,1],"shared":0}
9cf7c6a5b13c4f4c {"local":[128,1,1],"shared":5440}
a38caaa0bb3544ea {"local":[8,8,1],"shared":400}
abef20ad0d9a9b12 {"local":[128,1,1],"shared":10016}
b5db079b7a2f6987 {"local":[256,1,1],"shared":2048}
b6b7070116bd27cc {"local":[8,8,1],"shared":0}
ba99d74683580b97 {"local":[8,8,1],"shared":0}
bcfb3add633291d4 {"local":[4,4,4],"shared":0}
be9c92e971553082 {"local":[4,4,4],"shared":0}
c1b8edc09e3313b1 {"local":[128,1,1],"shared":8064}
c30ffb207563b483 {"local":[8,8,1],"shared":400}
c722857cfbeca8e1 {"local":[1,1,1],"shared":0}
c78798281d3519c1 {"local":[128,1,1],"shared":7040}
c7986cba253bc053 {"local":[8,8,1],"shared":0}
cc5f1d7b2c3b95fa {"local":[8,8,1],"shared":6144}
ce924739bfff4106 {"local":[1,256,1],"shared":2048}
cf6916cdb4b3b038 {"local":[1,512,1],"shared":12288}
d8004f4f16e15719 {"local":[8,8,1],"shared":0}
da3b5dda39a9f8b3 {"local":[8,8,1],"shared":0}
dbbd1a9592e0e9ca {"local":[8,8,1],"shared":0}
ddc729bcdb4c8df9 {"local":[128,1,1],"shared":12672}
e00483a4b5a488fe {"local":[8,8,1],"shared":0}
e2a63ab95b10951f {"local":[128,1,1],"shared":8064}
e4e61047509eb389 {"local":[8,8,1],"shared":0}
e97e43383ed843b6 {"local":[128,1,1],"shared":11008}
ed14e3f40334f815 {"local":[256,1,1],"shared":13312}
ed99cd6205a8b002 {"local":[4,4,4],"shared":0}
f2d6c5cfbdcf3f71 {"local":[128,1,1],"shared":9024}
f622daf33b9988ea {"local":[8,8,1],"shared":0}
f87592cca6a9dd17 {"local":[128,1,1],"shared":8064}
fc5fe7adc8c58250 {"local":[8,8,1],"shared":0}
ff37d53160adc73f {"local":[512,1,1],"shared":12288}
Loading
Loading