Hook graphic system #9

Manually merged
doughston merged 0 commits from doloro/Inkypaint:gpu-decode-init into main 2026-11-12 10:49:14 +00:00
Collaborator

this fixes graphic system not existing when the game requests frames to display

What was wrong or missing, and what this changes, in a few lines. Name the game or the system when there is one.

  • [area] commit subject: why, one bullet for each commit. A pull request of one commit can skip this list.

Testing: what you ran and what it showed. A test that fails without the change is the best proof. For a runtime change, the game, the scene and how many runs.
Not tested: what you did not check. Leave the line out if there is nothing.

Fixes #

  • No keys, dumps, game files or saves in the commits or the description.
  • A new file starts with SPDX-License-Identifier: GPL-3.0-or-later and the project's copyright line.
  • Code ported from another project keeps its copyright lines, names where it came from and is listed in docs/CREDITS.md.
this fixes graphic system not existing when the game requests frames to display <!-- SPDX-License-Identifier: GPL-3.0-or-later Copyright 2026 the ScarletNX contributors The title is `[area] an imperative sentence`, like the commits' (`[gpu] Set the threads making new pipelines`). Delete these comments before you open the pull request. --> What was wrong or missing, and what this changes, in a few lines. Name the game or the system when there is one. - `[area] commit subject`: why, one bullet for each commit. A pull request of one commit can skip this list. Testing: what you ran and what it showed. A test that fails without the change is the best proof. For a runtime change, the game, the scene and how many runs. Not tested: what you did not check. Leave the line out if there is nothing. Fixes # <!-- `Part of #n` when this is one step of several. --> - [x] No keys, dumps, game files or saves in the commits or the description. - [x] A new file starts with `SPDX-License-Identifier: GPL-3.0-or-later` and the project's copyright line. - [x] Code ported from another project keeps its copyright lines, names where it came from and is listed in `docs/CREDITS.md`.
nv_initialize_graphics replaces nn::gs::sdk::BootGraphicsSystem. That
boot also starts the gsv user session and initializes the SDK's
syncpoint library. A game's codec video locks the gsv session, so
without the boot nn::gsv::GetUserSession() answers 0 and
nn::codec::video::Initialize faults at the first movie. The
nn::syncpt::sdk::CreateSyncPointEvent of a movie reads the interface
table that nn::syncpt::sdk::Initialize fills, so with no library the
event registration jumps through 0.

The native NVN backend needs no gs backend, so the handler now boots
only these two pieces, through their own exports of the game, with the
memory region that the game passes. A missing export logs a warning
instead of failing the boot.

Not built or run in this session: the tree was carried over from
earlier work on another branch.
nv_initialize_graphics replaces nv::InitializeGraphics. With SDK 21
that function checks the remote memory and tail-calls
nn::gs::sdk::BootGraphicsSystem with the same arguments, because
nn::gs::sdk::CanBootWithRemoteMemory answers 1. The hook ran the gsv
boot only, and nn::syncpt::sdk::Initialize().

That shortcut leaves the SDK's syncpoint library without a cache.
BootGraphicsSystem calls nn::syncpt::sdk::InitializeEx on a
0x3000-byte region in the SDK's memory with options 1. The options
bit turns the region into transfer memories and binds them to gsv
with command 204 (BindSyncpointMemory).
nn::syncpt::sdk::TryWaitSyncPoint then reads the counters from that
page. Without the page the library has nowhere to read. The first
fence check of a movie frame answered "not reached", and the movie's
event callback called nn::diag::detail::AbortImpl() with no message.

The hook now calls the game's nn::gs::sdk::BootGraphicsSystem, as the
console does, and the gsv boot commands it sends are the ones this
runtime implements. The native NVN backend still owns the game's NNVN
resources.

Verified with the movie route. Before, 2 of 2 runs stopped with
svcBreak (reason 0) at the first movie frame. After, 2 of 2 runs
played 121 and 218 frames of two movies and reached the tank
selection screen (2666 frames in 55 s, 2364 in 50 s, exit 0). The
verbose log shows gsv: BindSyncpointMemory(rw 0xdd7e000, ro 0xdd7f000)
at boot, and each movie frame's fence reaching its armed wait.
doughston manually merged commit 53958863c5 into main 2026-11-12 10:49:14 +00:00
Sign in to join this conversation.
No description provided.