Skip to content
Open
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
51 changes: 51 additions & 0 deletions dm/games/0100D1B006744000/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Crash Bandicoot N. Sane Trilogy (`0100D1B006744000`)

<!-- PEANUTS: a Peanuts Native profile and note (Banana Native has none for this title). -->

Base game 1.0.0 (`v0`). SDK 3.5.3 (`NintendoSdk_nnSdk-3_5_3-Release`, SdkAddon 3.5.2). Vicarious Visions' Alchemy engine (build codename `MACK`, `build.xml`) with NVN graphics, Havok, FMOD and Bink 2. Modules `main`, `subsdk0` (the game's own GLSLC) and `sdk`.

**Status (provisional): ready for Android bring-up.** Generated from the base NSP (`0100D1B006744000`, `v0`) following `peanuts/docs/NEW-GAME.md` and modelled on [Crash Team Racing Nitro-Fueled](../0100F9F00C696000/README.md) (`0100F9F00C696000`), which uses the same Alchemy engine. Not yet run on an Android device.

## Builds

| Module | Build ID |
|---|---|
| `main` | `29e1a37d84227147a50a18d055fbb032` |
| `subsdk0` | `a82aa14c5d5a359ad04dc4eab9f5d590` |
| `sdk` | `c871c614793a419581104bec9379efa3` |

## What it needs

| Setting | Where | Why |
|---|---|---|
| `mem_reserve 0x100000000`, `mem_alias 0x10000000`, `mem_stack 0x10000000`, `app_pool 0xCD500000`, `sys_resource 0x0` | `game.tsv` | Verified from `main.npdm` (`SystemResourceSize = 0x0`) and disassembly of `nninitStartup` (`main+0x1169b98`): calls `QueryMemoryInfo` and `SetMemoryHeapSize((total - used) & ~0x1FFFFF)` |
| `mem_used 0x6400000` | `game.tsv` | Raw modules take 85.0 MiB (`main` 61.44, `subsdk0` 13.50, `sdk` 10.07) and ~90 MiB after `patch_nso.py`, exceeding the 64 MiB default; without `mem_used >= image_bytes`, `nninitStartup` fails `SetMemoryHeapSize` and falls back to a fatal 32 MiB heap (`0x2000000`) |
| `modules main subsdk0 sdk` | `game.tsv` | `subsdk0` is GLSLC, imported and called by `main` at run time |
| `depth_mode zero` | `game.tsv` | Verified from disassembly of `Graphics::igNxGraphicsDevice::activate` (`main+0x9edd08`): calls `nvnDeviceSetDepthMode(device, 1)` (`NVN_DEPTH_MODE_NEAR_IS_ZERO`) |
| `recommend driver.id=8 driver=18` | `game.tsv` | Recommends Mesa Turnip (`VkDriverId` 18) on Qualcomm Adreno devices (including Snapdragon 8 Gen 1 / Adreno 730) |
| `capture_keys 8:A*45/3` | `game.tsv` | Presses A during on-device GLSLC capture boot to advance past Activision bumper / legal / language selection (`languagestartup.pak`) and compile the runtime shaders <!-- PEANUTS --> |
| `iga_entries` version 12 support | `dm/gfx/tools/shader_split.py` | Crash N. Sane Trilogy uses `igArchive` version 12 (`0x0c`), byte-compatible with CTR Nitro-Fueled's version 13 (`0x0d`); `shader_split.py:3511` must accept `ver in (12, 13)` |

## Files and shaders

- RomFS: 171 files, 5.59 GB: 166 `.pak` archives under `archives/` (`igArchive` version 12, 99,801 inner files), 2 Bink 2 movies (`bumper_atvi.bk2`, `credits.bk2`), and 3 root files (`build.xml`, `cachenonce.txt`, `memoryconfiguration.igz`).
- `shader_split.py` (with `igArchive` v12 enabled) finds **1,633 unique shaders** with zero hash collisions: **1,266 pixel, 366 vertex, 1 geometry, 0 compute**. 1,623 come from the 84 shader `.igz` files inside `archives/shaders_nx.pak` (2,249 raw GLSLC outputs), and 10 come from `main`.
- **Runtime GLSLC shaders:** `main` embeds 5 GLSL source strings (`#version 440 core` + `GL_NV_gpu_shader5`, Bink 2 video + Alchemy blit) and imports `glslcCompile` from `subsdk0`. Like Crash Team Racing Nitro-Fueled, these runtime shaders are captured on the device via `DM_GLSLC_CAPTURE` (or Peanuts' on-device Build) and belong to `/glslc_capture/=runtime`.

## Vulkan / Mesa Turnip notes (Snapdragon 8 Gen 1 / Adreno 730)

- `main` has **0** callers to `nvnCommandBufferSetRenderEnableConditional` (`render_cond off`), **0** callers to `nvnQueueWaitSync` (`event_wait on`), and uploads textures via `nvnTextureWriteTexels` (`tex_flush_upload off`, `tex_dirty_upload off`).
- `Graphics::igNxGraphicsDevice::activate` checks NVN API version `major == 53` and `minor >= 12` (`main+0x9edce8..0x9edcf8`); Peanuts Native's SDK <= 10 default (`53.313`) satisfies this automatically without setting `device_api`.
- With Mesa Turnip (`driver_id=18`), `vka_auto.h` automatically applies `DM_VK_PSO_SLOTS`, `DM_VK_PRESENT_GATE_WAIT=30`, `DM_VK_ZSHARE_MAX_MB=0`, `DM_VK_SUBGROUP_GS=0` (protects the 1 geometry shader), `DM_VK_SHUFFLE_LDS=1`, `DM_VK_QUAD_SHFL=1`, and `DM_VK_CS_WARM=1`.

## Rewrite census

- `main`: 5,576,212 instructions, 185 `svc` (all `#0x26`), 380 dynamic imports (100% resolved by `sdk` + `subsdk0`), 60.02 MiB image + 1.42 MiB bss.
- `subsdk0` (`GLSLC`): 1,900,973 instructions, 0 `svc`, 13.49 MiB image + 0.01 MiB bss.
- `sdk` (`nnSdk 3.5.3`): 1,014,398 instructions, 106 `svc`, 9.15 MiB image + 0.92 MiB bss.

## Open

- First boot on Android (Snapdragon 8 Gen 1 + Mesa Turnip), runtime GLSLC shader capture (`DM_GLSLC_CAPTURE`), and log verification.
- Exact resident memory measurement and multi-renderer audio verification (FMOD + `audren:u`).
- Frame rate unlock (60 FPS) deferred to Phase 3.2.
1 change: 1 addition & 0 deletions dm/games/0100D1B006744000/bf_want.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# generated
63 changes: 63 additions & 0 deletions dm/games/0100D1B006744000/game.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Game profile of Crash Bandicoot N. Sane Trilogy (Switch, base game 1.0.0 = v0)
# Format: see dm/games/README.md
# PEANUTS: a Peanuts Native profile (Banana Native has none for this title); whole file Peanuts' own
# Vicarious Visions' Alchemy engine (build codename MACK), SDK 3.5.3, NVN, Havok, FMOD, Bink 2; subsdk0 is the game's own GLSLC.
# The shaders are whole GLSLC outputs in the 84 shader .igz files of archives/shaders_nx.pak, an igArchive version 12 with LZMA blocks (shader_split.py iga_shaders, requires ver in (12, 13)),
# and 10 more in main. The game embeds 5 GLSL sources in main and imports glslcCompile from subsdk0 for runtime shaders (captured on device with DM_GLSLC_CAPTURE, the /glslc_capture/ group).
# Status: provisional profile ready for Android bring-up (Snapdragon 8 Gen 1 / Vulkan / Mesa Turnip); memory and NVN settings verified from binary analysis of nninitStartup and igNxGraphicsDevice::activate.

# ---- Identity ----
title_id 0100D1B006744000
program_id 0100D1B006744000

# ---- App ----
name Crash Bandicoot N. Sane Trilogy
ipa CrashBandicootNSaneTrilogy.ipa
app_category public.app-category.games

# ---- Versions ----
build v0 1.0.0 main=29e1a37d84227147a50a18d055fbb032 subsdk0=a82aa14c5d5a359ad04dc4eab9f5d590 sdk=c871c614793a419581104bec9379efa3
package v0
shader_versions v0

# ---- Files ----
# every module main imports from (subsdk0 is GLSLC, called by main at runtime)
modules main subsdk0 sdk
romfs_marker archives/shaders_nx.pak
zip_store .bk2:.pak:.metallib

# ---- Memory ----
# main (nninitStartup at +0x1169b98) queries QueryMemoryInfo and calls SetMemoryHeapSize((total - used) & ~0x1FFFFF), falling back to a fatal 32 MB heap on OOM.
# With sys_resource = 0 (IsVirtualAddressMemoryEnabled = false), keep the 4 GB guest block (256 MB alias + 256 MB stack + 3328 MB heap region) and standard 3285 MiB Switch 1 app pool.
mem_reserve 0x100000000
mem_alias 0x10000000
mem_stack 0x10000000
app_pool 0xCD500000
# the NPDM declares 0 MB of system resource (META +0x14 = 0): IsVirtualAddressMemoryEnabled is false, as on Horizon
sys_resource 0x0
# raw modules take 85.0 MiB (main 61.44, subsdk0 13.50, sdk 10.07) and ~90 MiB after patch_nso.py rewrite, well above the default 64 MB (0x4000000):
# 100 MiB (0x6400000) ensures SetMemoryHeapSize(pool - used) succeeds on first call (~3184 MiB heap) instead of hitting OOM and falling back to 32 MiB
mem_used 0x6400000

# ---- Graphics / Vulkan / Turnip ----
# igNxGraphicsDevice::activate (+0x9edd08) calls nvnDeviceSetDepthMode(device, 1) (NVN_DEPTH_MODE_NEAR_IS_ZERO); render_cond, tex_flush_upload and tex_dirty_upload stay off (0 SetRenderEnableConditional callers, textures uploaded via nvnTextureWriteTexels)
depth_mode zero
# PEANUTS: Alchemy engine is delta-time driven (verified on device at 60 FPS / 1x speed). Override game's present interval 2 so Peanuts' FPS cap slider unlocks 30/40/45/60/90/120 FPS while keeping 1x native resolution.
fps_target 60
present_interval display
fps_limit 60
fps_limit_max 120
fps_limit_min 30
# PEANUTS: prefer installed Mesa Turnip (VkDriverId 18) over Qualcomm's proprietary system driver (VkDriverId 8) on Adreno devices (including Snapdragon 8 Gen 1 / Adreno 730).
# On Turnip, vka_auto.h automatically enables DM_VK_PSO_SLOTS, DM_VK_PRESENT_GATE_WAIT=30, DM_VK_ZSHARE_MAX_MB=0, DM_VK_SUBGROUP_GS=0 (for the 1 geometry shader), DM_VK_SHUFFLE_LDS=1 and DM_VK_QUAD_SHFL=1.
recommend driver.id=8 driver=18

# ---- Controls ----
pad_layout full

# ---- Shader split ----
# PEANUTS: main embeds 5 GLSL sources (Bink 2 / Alchemy blit) and calls glslcCompile in subsdk0; on an empty save the game opens through Activision bumper / legal / language select (languagestartup.pak),
# so the capture boot presses A every 3 s from 8 s on (matching Crash Team Racing Nitro-Fueled 0100F9F00C696000) to capture runtime GLSLC outputs.
capture_keys 8:A*45/3
shader_groups /archives/=archives /glslc_capture/=runtime
shader_note Crash Bandicoot N. Sane Trilogy shaders
2 changes: 2 additions & 0 deletions dm/games/0100D1B006744000/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 device (DM_PSO_MANIFEST=off DM_PSO_RECORD).
1 change: 1 addition & 0 deletions dm/games/0100D1B006744000/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
1 change: 1 addition & 0 deletions dm/games/0100D1B006744000/shader_facts.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 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
Loading