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
37 changes: 37 additions & 0 deletions dm/games/0100FF500E34A000/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,43 @@ the opening battle take about 33 ms. The unsigned 1.1.2 IPA builds successfully
(13.2 GiB), with all 15,129 shader libraries and a complete CRC check. Further
story progression, saving / reloading and iPhone validation remain open.


## Android (AYN Thor, Turnip v27.0.0-R1, 2026-11-25)

New Game → Sword Valley prologue (Mechon M72, the M82 boss) → Colony 9: Shulk and Reyn's
first fights, the road into Colony 9 and the Commercial District, day to evening, save and load.

- **Resolved: the Colony 9 roads drew black, then in black and grey blocks.** Four shaders
(`48b8ea8fad25398d`, `fe993ca274dfde1c`, `5119ea2c4c0a2211`, `efa9a20a7f820920`) read the
1280x720 A2B10G10R10 targets (NVN format `0x3d`) as uint shader images: their raw 32-bit
words. The replay had no uint view of that packed format, so the images read as unbound
(`[RED] ... has no view of shape 0x81 (storage)`): black roads. `class_twin` (`vka_tex.c`) now
gives packed 4-byte formats R32_UINT / R32_SINT twins. With the view, the roads came out in
blocks: Turnip on a7xx keeps UBWC for an image whatever its view formats
(`ubwc_all_formats_compatible`), and the R32_UINT view read compressed data. An image whose
format list holds a view of another texel layout (not its sRGB / raw UNORM twin) is now made
with `VK_IMAGE_COMPRESSION_DISABLED_EXT` (`VK_EXT_image_compression_control`, `vka_dev.c`;
`DM_VK_UBWC_RAWVIEW=0` turns it off). `TU_DEBUG=noubwc` drew the roads right; `sysmem`,
`nolrz`, `DM_VK_UBWC=0` and `DM_VK_ZSHARE=0` did not.
- **Frame pacing:** the game times its own 30 fps (33.23 ms a frame) and presents at interval 1,
which beats against the Thor's 117.84 Hz panel (four refreshes are 33.94 ms): in SurfaceFlinger
about one frame in seven stayed five refreshes. `fps_limit 30` makes the host's limiter tick in
whole panel refreshes: 10,809 of 10,809 frames on screen for exactly four refreshes over six
minutes of Colony 9 (SurfaceFlinger `--latency` present times).
- **Resolved: about one boot in four crashed 1–4 s into `nnMain`** on a corrupt heap: `memset`
(`sdk+0xc9e24`) of a size read from a resource block's footer (`main+0x71e7b8` → `main+0x70a620`),
null `+0x68` at `main+0x721d88`, wild pointers at `main+0x6f248c` (the heap's free-list walk, the
same wild value `0x8082848b9197a1` in several boots) and `main+0x721728`. With or without a save
(3 of 12 with an empty save folder). Not changed by `core_preempt on`, a barrier after file reads,
`DM_SPIN=0`, `DM_AUDIO=0`, `DM_VK_WORKER=0`; one CPU (`taskset`): 6 of 12. The game takes two of
a core's threads (core 0: `main`, `resource_creater`, `WorkerThread0`) never to run at the same
moment, as on Horizon. `core_preempt lock` (`DM_CORE_LOCK`, `hle_thread.c`): a core's threads take
turns, a lock held in guest code and given up at SVCs, for the first 20 s (`DM_CORE_LOCK_SECS`).
0 of 60 boots crashed (24 with the lock for good, 36 with the boot window). Held for good it cost
2–3 hitches of 70–100 ms in 5 min of Colony 9 (`resource_creater` ran 100 ms in guest code while
the main thread waited for core 0); with the 20 s window, 9,026 of 9,026 frames at four refreshes
over the same 5 min route.
- **Open: save thumbnails are black.** `bfsgame00.tmb` (240x180 RGBA) holds 12 non-zero bytes.
## Memory

The NPDM declares no system resource. The 4 GB guest reservation,
Expand Down
4 changes: 4 additions & 0 deletions dm/games/0100FF500E34A000/game.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ name Xenoblade Chronicles: Definitive Edition
ipa XenobladeChroniclesDefinitiveEdition.ipa
app_category public.app-category.role-playing-games
pad_layout full
# Android: the game times its own 30 fps (33.23 ms) while presenting at interval 1, which beats against the panel (AYN Thor 117.84 Hz: 4 refreshes = 33.94 ms): 1 frame in ~7 stayed 5 refreshes (SurfaceFlinger, 2026-11-25). The limiter ticks in whole panel refreshes: 10,809 of 10,809 frames at 4 over six minutes (README)
fps_limit 30
# Android: about one boot in four corrupted the heap 1-4 s into nnMain (README); the game takes two threads of one core never running at the same moment: 0 of 60 boots crashed with this (the first 20 s)
core_preempt lock

# ---- Versions ----
build v196608 1.1.2 main=92c78bb3dcbbc3f7a3caf601d7b85f7a subsdk0=5a7ada8dd7447c10aa244944f64d0aff sdk=ad3fdfbd62a5f4b082d385ffe420d440
Expand Down
2 changes: 1 addition & 1 deletion dm/games/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ One row per profile; the notes are each profile's `README.md`.
| `fps_steps <main build ID> <global> <members> <mode> <count>` | One row per main build, for a game whose framework runs a whole number of fixed steps each frame and presents at that many vsyncs, picking the count from a mode field: the framework at `[main + <global>]`, then `[that + each member]` (`<members>` comma-separated, at most 3, or `-`), and the offsets of the mode and the step count in it. The frame rate cap (and the frame limit, whichever is lower) then holds 60, 30 or 20 fps with 1, 2 or 3 steps a frame, so the game keeps its speed (`hle_fpslock.c` `steps_tick`): 30 writes mode 2, 20 the count 3 and a mode that keeps it, 60 and 0 the game's own mode. No rewrite: the launcher's ordinary cap list. [A framework's fixed steps per frame hold the frame rate cap at full speed](../../docs/reference/frame-rate.md#a-frameworks-fixed-steps-per-frame-hold-the-frame-rate-cap-at-full-speed). Mario Kart World 1.8.0 |
| `ue_fps_cvar` | Unreal Engine games: the console variable the host writes `fps_target` into (`hle_fpslock.c`). `t.MaxFPS` (the default) is the engine's frame limit; a game whose settings apply a variable of its own to `t.MaxFPS` names that one, or the next settings change sets the game's 30 again (SHIN MEGAMI TENSEI V: Vengeance: `Project.FrameRateLimit`). The rewriter finds it by its registered name, so a name set here must be in `dm/tools/ue_cvar.py`'s `NAMES` (a red line otherwise): [Unreal's frame limit and present interval, found by name](../../docs/reference/frame-rate.md#unreals-frame-limit-and-present-interval-found-by-name) |
| `ue_texture_pool` | Unreal Engine games: megabytes of the texture streaming pool (`r.Streaming.PoolSize`) the host raises the game's own to, on the Mac (`hle_uecvar.c`; the rewriter finds the variable by its name, `dm/tools/ue_cvar.py`): past its pool the streamer drops the top mips of what is in view, and the Switch's pool is small (DRAGON QUEST VII Reimagined: 200 MB, 1000 on Windows). `0` (the default): the game's own pool. A larger value the game sets, or −1, stays. `DM_UE_TEXTURE_POOL` overrides it; on iOS only that switch turns it on (`Documents/env.txt`). An improvement over the Switch, not a fix: [Unreal's texture streaming pool](../../docs/reference/rendering.md#unreals-texture-streaming-pool) |
| `core_preempt` | `on` / `off` (the default): additionally check higher-priority runnable threads pinned to the caller's core after every thread SVC (`hle_thread.c`). `DM_PREEMPT=0` / `1` overrides it. Wake-triggered same-core handoffs apply to every game with either setting and wait until the threads the wake made runnable block, with no wall-clock cap. Metroid Dread no longer needs this key or its movie request-ring gates; see [Same-core wake handoffs](../../docs/reference/threads.md#same-core-wake-handoffs) |
| `core_preempt` | `on` / `off` (the default): additionally check higher-priority runnable threads pinned to the caller's core after every thread SVC (`hle_thread.c`). `DM_PREEMPT=0` / `1` overrides it. Wake-triggered same-core handoffs apply to every game with either setting and wait until the threads the wake made runnable block, with no wall-clock cap. Metroid Dread no longer needs this key or its movie request-ring gates; see [Same-core wake handoffs](../../docs/reference/threads.md#same-core-wake-handoffs). PEANUTS: `lock` instead: the guest threads of one core take turns as on Horizon (a core's lock held in guest code, given up at SVCs; `DM_CORE_LOCK=0` / `1` overrides): Xenoblade Chronicles: Definitive Edition corrupted its heap at boot one time in four without it |
| `alloc_big_align` | `on` / `off` (the default): `nn::mem::StandardAllocator::Allocate` aligns blocks of 64 KB or more to 64 KB (`hle_os.c`). Vanillaware's engine (13 Sentinels: Aegis Rim, Unicorn Overlord) takes a memory pool's storage from malloc and cuts ring heaps out of it at 64 KB alignment relative to the pool's GPU address. On the Switch that address is big-page aligned; the host's is the CPU address, only 4 KB aligned, so the last ring heap does not fit and keeps base 0, and the game writes through a null pointer (13 Sentinels entering its first battle, Unicorn Overlord past the title screen) |
| `shared_font` | Optional, decided by the game files without it (the SDK version the host reads from the `sdk` module, `loader.c` `dm_sdk_major`, and the imports of `main` and its NROs, `dm_game_imports`): what the shared-font address points at. `bfttf` (SDK 11 and later, when `main` imports `ScalableFontEngineHelper::Decode`) = the 8-byte BFTTF header (with the "already decoded" marker) followed by the TTF, which Mario passes to `Decode`; `ttf` = the TTF itself, which SDK 10 and older games hand straight to `ScalableFontEngine::LoadFont` (Super Mario 3D World + Bowser's Fury: with the header the engine fails with error 403 and the game crashes looking up a glyph; Odyssey, Link's Awakening, Age of Calamity and Three Houses alike) and Unity's player to FreeType (Patrick's Parabox: with the header its Japanese, Korean and Chinese text drew nothing). No profile sets it |
| `device_api` | Optional, decided by the SDK version without it: the NVN API version `major.minor` that `nvnDeviceGetInteger` reports, 55.15 for SDK 11 and later (what Mario requires) and 53.313 for SDK 10 and older (`hle_nvn.c` `nvn_api`). Games check it and skip creating their device on a mismatch: Super Mario 3D World + Bowser's Fury (SDK 10) requires major 53 and minor ≥ 313. No profile sets it. `DM_NVN_API` overrides. Not part of the shader chain version (only `shader_*` keys are) |
Expand Down
6 changes: 3 additions & 3 deletions dm/games/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def header(g):
sys.exit(f"{g.id}: pso_gpu takes 1-4 whitespace-separated GPU architectures such as 'g18p applegpu_g19p' (each an optional applegpu_ prefix then an alphanumeric token; there is no none: omit the key for g18p with pso_mtl4 on, or no archive with pso_mtl4 off): {pg}")
et = g.get('enc_thread', 'off') # Metal encoding on its own thread on the Mac by default (nvn_rec.h rec_on; on iOS it is on for every game; DM_NVN_ENC_THREAD overrides): on / off
if et not in ('on', 'off'): sys.exit(f'{g.id}: enc_thread must be on or off: {et}')
cp = g.get('core_preempt', 'off') # same-core preemption approximation (hle_thread.c): on / off
if cp not in ('on', 'off'): sys.exit(f'{g.id}: core_preempt must be on or off: {cp}')
cp = g.get('core_preempt', 'off') # same-core preemption approximation (hle_thread.c): on / off; PEANUTS: lock, one core's threads take turns (DM_CORE_LOCK)
if cp not in ('on', 'off', 'lock'): sys.exit(f'{g.id}: core_preempt must be on, off or lock: {cp}')
aba = g.get('alloc_big_align', 'off') # nn::mem::StandardAllocator::Allocate aligns blocks of 64 KB or more to 64 KB (hle_os.c; Vanillaware's memory pool storage): on / off
if aba not in ('on', 'off'): sys.exit(f'{g.id}: alloc_big_align must be on or off: {aba}')
sf = g.get('shared_font', 'bfttf') # what the shared-font address points at (hle_sdk16.c): bfttf = 8-byte header + TTF, ttf = the TTF alone
Expand Down Expand Up @@ -423,7 +423,7 @@ def header(g):
f'#define DM_GAME_STDALLOC_CAP {int(g.get("stdalloc_cap", "0"), 0):#x}ull', # StandardAllocator's address space with virtual address memory (hle_svc.c); 0 = what the alias region has room for
f'#define DM_GAME_DISPLAY_VERSIONS {vers}',
f'#define DM_GAME_PRESENT_DISPLAY {int(pi == "display")}',
f'#define DM_GAME_CORE_PREEMPT {int(cp == "on")}',
f'#define DM_GAME_CORE_PREEMPT {2 if cp == "lock" else int(cp == "on")}', # PEANUTS: lock = DM_CORE_LOCK (hle_thread.c)
f'#define DM_GAME_ALLOC_BIG_ALIGN {int(aba == "on")}',
f'#define DM_GAME_FPS_TARGET {int(ft)}',
f'#define DM_GAME_FPS_HOLD {int(fh == "on")}',
Expand Down
Loading