Run 1.4.3 into its opening cutscene: CPU-visible physical pools, no add-on content list, probes on SDK 20.5

1.4.3's GPU heap allocator creates a physical pool with flags 0x18c (CPU_CACHED, GPU_NO_ACCESS, COMPRESSIBLE): it
keeps the game's storage and gets device memory like the 0x189 pools of 1.2.1, which virtual pools alias. The CPU
never writes that storage (its hash was unchanged over 3600 frames of the intro), so nothing is synced.
nn::aoc::ListAddOnContent, which 1.4.3's main calls at start, returns no add-on content instead of running the SDK
on an uninitialized aoc client.

probe-ipc runs the 1.4.3 SDK's renderer semaphore constructor (sdk+0x221fb0) instead of the 1.2.1 sf heaps, and
expects SDK 20.5 to keep its audren:u manager session open. probe-services checks ListAddOnContent.
package_build.py takes --version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-26 18:09:47 +03:00
1 parent cd60d20a7f
commit a7e362fc0a
6 files changed
+50 -18

No files matched your search

+11 -4
View File
@@ -715,13 +715,17 @@ static uint64_t stub(const char *sym) {
// mutex look owned by the caller (__cxa_guard_acquire in nn::sm::Initialize aborts);
// - sdk's full DT_INIT needs nn::os initialised (its TLS slot constructor reaches ThreadManager), which is the boot
// sequence's job (T6). The audio client only needs its two sf heap constructors: 16 KiB ExpHeaps on static buffers,
// stored at sdk+0xd37e90 and sdk+0xd3bec0 (CreateAudioRendererManagerByHipc reads the second).
// stored at sdk+0xd37e90 and sdk+0xd3bec0 (CreateAudioRendererManagerByHipc reads the second). The 1.4.3 SDK creates
// that heap lazily; its OpenAudioRenderer takes nn::audio::detail::g_RendererResourceSemaphore first, which the
// constructor at sdk+0x221fb0 initializes (two renderers).
static void sdk_prepare(Cpu *c) {
Cpu *again;
ST32(LD64(c->tpidrro + 0x1F8) + 0x1B0, kern_main_thread(&again));
const RtLoaded *sdk = ldr_module(2);
static const uint64_t heap_ctors[] = {0x1dcbd0, 0x1de8a0};
for (unsigned k = 0; !RT_V143 && k < sizeof heap_ctors / sizeof *heap_ctors; k++) {
static const uint64_t ctors_121[] = {0x1dcbd0, 0x1de8a0}, ctors_143[] = {0x221fb0};
const uint64_t *heap_ctors = RT_V143 ? ctors_143 : ctors_121;
unsigned nctors = RT_V143 ? sizeof ctors_143 / sizeof *ctors_143 : sizeof ctors_121 / sizeof *ctors_121;
for (unsigned k = 0; k < nctors; k++) {
int found = 0;
for (uint64_t e = 0; e < sdk->init_array_size; e += 8)
found |= LD64(sdk->init_array + e) == sdk->base + heap_ctors[k];
@@ -784,7 +788,10 @@ static void probe_sdk_client(Cpu *c) {
"lifted client (sm: kept open by the SDK: %ld session)\n", audren_renderers_live(),
(unsigned long long)(ipc_sessions_released() - released0), (unsigned long long)requests,
ipc_sessions_live());
CHECK(audren_renderers_live() == 0 && ipc_sessions_released() - released0 >= 3 && ipc_sessions_live() == 1,
// The 1.2.1 SDK closes the renderer, device and manager sessions and keeps sm; the 1.4.3 SDK keeps the
// audren:u manager it created lazily, beside sm.
CHECK(audren_renderers_live() == 0 && ipc_sessions_released() - released0 >= (RT_V143 ? 1u : 3u) &&
ipc_sessions_live() == (RT_V143 ? 2 : 1),
"SDK CloseAudioRenderer");
rt_trace = trace;
}
+12 -5
View File
@@ -123,8 +123,9 @@ const pool_t *nvn_pool_find(uint64_t addr, uint64_t len) {
return p;
}
// Physical and virtual pools (MacNativeGames totk_vpool.c:32-52 checks). A CPU-invisible one gets a GPU window range;
// a CPU-visible one would need aliased guest storage, which this port does not support (section 3.3).
// Physical and virtual pools (MacNativeGames totk_vpool.c:32-52 checks). A CPU-invisible one gets a GPU window range.
// A CPU-visible physical pool (1.4.3: flags 0x18c, GPU_NO_ACCESS) keeps the game's storage for the CPU; the back end
// gives it device memory as any physical pool (vk_memory.c vk_pool_init), which the GPU reaches through virtual pools.
static int pool_place(pool_t *o) {
int phys = (o->flags & NVN_MEMORY_POOL_FLAGS_PHYSICAL) != 0, virt = (o->flags & NVN_MEMORY_POOL_FLAGS_VIRTUAL) != 0;
if (!phys && !virt) return 1;
@@ -136,9 +137,15 @@ static int pool_place(pool_t *o) {
}
if (virt && o->mem) { rt_log("nvn: virtual pool given storage %p", (void *)o->mem); return 0; }
if (phys && !o->mem) { rt_log("nvn: physical pool without storage"); return 0; }
if (!(o->flags & NVN_MEMORY_POOL_FLAGS_CPU_NO_ACCESS))
rt_fatal("nvn: CPU-visible %s pool (flags %#x, size %#llx) needs aliased guest storage",
kind, o->flags, (unsigned long long)o->size);
if (!(o->flags & NVN_MEMORY_POOL_FLAGS_CPU_NO_ACCESS)) {
if (virt) {
rt_log("nvn: CPU-visible virtual pool (flags %#x, size %#llx) refused", o->flags, (unsigned long long)o->size);
return 0;
}
rt_log("nvn: CPU-visible physical pool %p (flags %#x, size %#llx) keeps the game's storage", (void *)o->mem,
o->flags, (unsigned long long)o->size);
return 1;
}
uint64_t a = gva_alloc(o->size);
if (!a) {
rt_log("nvn: GPU address window full, %s pool of %#llx bytes refused", kind, (unsigned long long)o->size);
+5 -1
View File
@@ -75,6 +75,7 @@ static Ov ovs[] = {
// SDK-internal (section 5.2)
{"nndiagStartup", "nndiagStartup"},
{"aoc.Initialize", "_ZN2nn3aoc10InitializeEv"},
{"aoc.ListAddOnContent", "_ZN2nn3aoc16ListAddOnContentEPiii"},
{"err.InitializeContextWriterApi", "_ZN2nn3err26InitializeContextWriterApiEv"},
{"pctl.Initialize", "_ZN2nn4pctl10InitializeEv"},
{"diag.InitializeApplicationAbortObserver", "_ZN2nn4diag34InitializeApplicationAbortObserverEv"},
@@ -374,6 +375,7 @@ static void probe_applet(void) {
CALL("err.ShowError", 0x2a8);
CALL("nndiagStartup", 0);
CALL("aoc.Initialize", 0);
CHECK(CALL("aoc.ListAddOnContent", U(out), 0, 8) == 0, "aoc: no add-on content");
CALL("err.InitializeContextWriterApi", 0);
CALL("pctl.Initialize", 0);
CALL("diag.InitializeApplicationAbortObserver", 0);
@@ -966,7 +968,9 @@ int probe_services(void) {
for (int k = 0; k < NOBS; k++)
if (!strcmp(observers[k], n)) obs_bound++;
}
for (int k = 0; k < NOV; k++) CHECK(ovs[k].bound, "override %s matches no relocation", ovs[k].name);
for (int k = 0; k < NOV; k++) // 1.2.1 lists no add-on content
CHECK(ovs[k].bound || (!RT_V143 && !strcmp(ovs[k].key, "aoc.ListAddOnContent")), "override %s matches no relocation",
ovs[k].name);
for (int k = 0; k < NOBS; k++) CHECK(hostfn_observer(observers[k]), "observer %s is not linked", observers[k]);
CHECK(obs_bound == NOBS, "%d of %d observers match a JUMP_SLOT", obs_bound, NOBS);
+8
View File
@@ -301,6 +301,13 @@ static void ov_show_error(Cpu *c) {
// ==== SDK-internal initialisation (services.c:208-218)
static void ov_diag_startup(Cpu *c) { (void)c; rt_log("diag: host diagnostics"); }
static void ov_aoc_initialize(Cpu *c) { (void)c; rt_log("aoc: no add-on content"); }
// 1.4.3's main lists add-on content (MNG services.c host_aoc_list): there is none.
// int ListAddOnContent(AddOnContentIndex *out, int offset, int count)
static void ov_aoc_list(Cpu *c) {
int offset = (int)arg_x(c, 1), count = (int)arg_x(c, 2);
if (offset < 0 || count < 0) rt_fatal("aoc: ListAddOnContent range %d+%d", offset, count);
ret_x(c, 0);
}
static void ov_err_context(Cpu *c) { (void)c; rt_log("err: error contexts stay local"); }
static void ov_pctl_initialize(Cpu *c) { (void)c; rt_log("pctl: no parental controls"); }
static void ov_abort_observer(Cpu *c) { (void)c; rt_log("diag: the host crash reporter observes aborts"); }
@@ -820,6 +827,7 @@ HOST_OVERRIDE("_ZN2nn3err9ShowErrorENS_6ResultE", ov_show_error);
HOST_OVERRIDE("nndiagStartup", ov_diag_startup);
HOST_OVERRIDE("_ZN2nn3aoc10InitializeEv", ov_aoc_initialize);
HOST_OVERRIDE("_ZN2nn3aoc16ListAddOnContentEPiii", ov_aoc_list);
HOST_OVERRIDE("_ZN2nn3err26InitializeContextWriterApiEv", ov_err_context);
HOST_OVERRIDE("_ZN2nn4pctl10InitializeEv", ov_pctl_initialize);
HOST_OVERRIDE("_ZN2nn4diag34InitializeApplicationAbortObserverEv", ov_abort_observer);
+3 -1
View File
@@ -242,7 +242,9 @@ static void destroy_rec(VkCtx *c, PoolRec *r) {
int vk_pool_init(pool_t *p) {
VkCtx *c = vk_ctx();
if (!c) { rt_log("vk: MemoryPoolInitialize before vk_init"); return 0; }
// The GPU never sees a GPU_NO_ACCESS pool, except a physical one (0x189) through the virtual pools that map it.
// The GPU never sees a GPU_NO_ACCESS pool, except a physical one (0x189; 1.4.3 also 0x18c, CPU-visible) through the
// virtual pools that map it. Either gets device-local memory: 1.4.3's CPU never writes its 0x18c pool's storage
// (unchanged over 3600 frames of the intro), so the guest storage and the GPU copy need no sync.
if ((p->flags & NVN_MEMORY_POOL_FLAGS_GPU_NO_ACCESS) && !(p->flags & NVN_MEMORY_POOL_FLAGS_PHYSICAL)) return 1;
PoolRec *r = calloc(1, sizeof *r);
if (!r) rt_fatal("vk: out of memory for a pool record");