feat(runtime): add an opt-in local scene testing API #1543
Open
mikaba-eu wants to merge 17 commits from
mikaba-eu/pr/runtime-scene-api into main
pull from: mikaba-eu/pr/runtime-scene-api
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1543
Loading…
Reference in a new issue
No description provided.
Delete branch "mikaba-eu/pr/runtime-scene-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reproducing scene-transition stalls needs repeatable inputs and scene changes without touching the player's saves. This opt-in local testing API was implemented with GPT-6 Astra medium & xhigh.
The Linux API authenticates Unix-socket peers and bounds requests; the client checks server process identity. Analysis sessions copy saves and settings into private directories. Typed scene, event and scalar operations require locally supplied profiles tied to the exact game image and run on a configured guest worker. Input ownership, readiness checks, bounded wait diagnostics and sampler ownership fixes make these sessions easier to reproduce. Other platforms retain disabled API stubs.
No game-specific bindings, game data, saves, generated fixtures or build outputs are included. Renderer experiment switches and external DLSS support are optional integrations; their collectors and external layer files are not supplied by this PR. The API itself has no dependency on the renderer-performance PR. The present-CSV parser compatibility fix is identical in both PRs to keep either merge order compatible.
Refreshed against upstream
0a28ff29, retaining its present-phase timestamps, driver-cache initialization and virtual-core wait escape policy. The analyzer accepts both three-column and extended present traces; the presentation fixture checks one debug notification per completed native present.Validation: full Linux source suite on
963dbd8a: 386 passed, 0 failed, 14 skipped. After merging0a28ff29and updating fixture declarations, 26 affected checks passed, 0 failed, 0 skipped on final head134d7f78. The skips in the full run cover platform/game/GPU requirements and unavailable optional tools. Authored fixtures exercise the actual socket server, guest-call adapter, input ownership, cancellation and sampler handoff. No game or GPU was started for this refresh. Historical copied-save scene/event checks used the combined local tree, not this exact PR head. A fresh end-to-end scene transition, physical input devices and Windows runtime behavior remain unverified.Final refresh: merged upstream
ddafc1f9; 12 affected builder/update/fixture checks passed afterward.The final source includes upstream
2e62a977; its release-only changes passed both affected release/update checks.Heads-up: this conflicts with main now (a lot landed today). Could you merge main into the branch (or rebase) and resolve the conflicts? Thanks!
Merged current main (
1392ea3) and resolved the conflicts, preserving upstream replacements where they supersede our changes. Migrated local tests to the new per-test runner declarations. Independent source suites and the combined suite pass; fresh Linux gameplay results and limitations are recorded in the updated description. Hyrule Field and a warm Forest run completed the short movement tests, but camera hitches remain; earlier memory-guard stops and the incomplete Market event are not reported as passes. AI-assisted development: GPT-6-Astra (medium and xhigh).Refreshed again to main
117eae7and resolved the new Anti-Lag source-fixture conflict. Complete Linux source suite re-run: 329 passed, 0 failed, 18 skipped. Existing gameplay evidence remains explicitly tied to its tested build.There's real care in here. The socket server binds an abstract name and checks
SO_PEERCREDfor the same UID. It takes one bounded SEQPACKET command per connection, with 250 ms timeouts, a 512-byte request, and a reject for packets that are truncated or contain a NUL. Its parsers refuse overflow and trailing junk. Memory reads are capped at 256 bytes, kept inside the guest window, and go throughprocess_vm_readv, so a bad address can't fault the game. WithHOS_DEBUG_SOCKETunset, the Windows build gets inline stubs and the Linux build returns early.Given the size, I focused on the socket server (
host/hos_debug.c), the guest-call path (host/hos_debug_guest.c), and the edits to shared runtime files that every player runs (nn_hid.c,nn_os_sync.c,hos_thread.c,nn_video.c,posix/prof.c,hos_setjmp.c,display_sdl.c,rx_backend.c,mkw_glue.c). I didn't review the 14 Python scripts in depth.blocking — one topic per PR (CONTRIBUTING, "Commits and pull requests" 2): besides the scene-testing API, this PR carries:
host/posix/prof.c,sample_one/on_sample);posix/prof.c);.cfi_undefined %ripunwind fix forrecomp_sj_longjmp(host/hos_setjmp.c:128);HOS_START_MINIMIZED(hos_sdl.c,display_sdl.c);HOS_REQUIRE_WINDOW(rx_backend.c:266);hos_thread.c,HOS_VCORE_TRACE_MS);nn_os_sync.c,HOS_SYNC_WAIT_TRACE_MS);nn_video.c,HOS_VIDEO_ACQUIRE_TRACE);mkw_glue.c);Several of these are good fixes in their own right; the sampler race and the longjmp unwind especially deserve to land quickly and on their own. Bundled here, they wait on review of a 7.6k-line feature, and a regression in any one would revert all of them. Please split them out: one PR per fix, one per trace switch (or one "wait diagnostics" PR), then the API on top.
blocking — conflicts:
host/hos_main.c,host/nn_hid.candhost/nn_video.cconflict with current main. Note also that CI hasn't run on this head (title check only).should fix — a test that never runs (
tests/test_analysis_dlss.py, 328 lines): it loadstests/test_dlss5_api.pyandscripts/dlss5_api.pyandskipUnlesses on both, but neither file exists on main or in this PR. It always skips, including under CI's--strict, because aunittestskip isn't a missing declared tool. Drop it here and bring it with the DLSS adapter PR it belongs to.should fix — a cost while off on every Linux run (
host/hos_debug_guest.c:338):hos_debug_scene_pollis called fromnpad_stateson every pad poll, and starts withgetenv("HOS_DEBUG_SOCKET"), a scan of the environment several times a frame for every Linux player. CONTRIBUTING asks that switches cost nothing while off. Check the flaghos_debug_initalready sets (exposeenabled, or cache the getenv in a static) before anything else.should fix — undocumented switches:
HOS_START_MINIMIZED,HOS_REQUIRE_WINDOW,HOS_SYNC_WAIT_TRACE_MS,HOS_VIDEO_ACQUIRE_TRACEandHOS_DEBUG_CONTROLappear in no doc (HOS_START_MINIMIZEDonly in a source comment). They belong indocs/development.md's switch reference, next to theHOS_switches already there.question — scripted tests under the API: with
HOS_DEBUG_SOCKETset,hos_debug_inputreturnsHOS_DEBUG_PLAYERrather thanHOS_DEBUG_LEGACYin player mode (host/nn_hid.c:796-798), soHOS_INPUT_SCRIPT/HOS_INPUT_LIVEpresses are silently ignored. Is that intended? If so, log it once at start-up so a combined run doesn't look broken.Once it's split, I'm happy to review the API part on its own. At that size the guest-call adapter can get the close look it needs, since it writes guest memory and calls configured guest functions on a game thread.
No new commits since my review at
2ef23f2, and it still conflicts with main inhost/hos_main.c,host/nn_hid.candhost/nn_video.c. None of the bundled fixes has reached main separately: no.cfi_undefinedinhos_setjmp.c, and noHOS_START_MINIMIZED,HOS_REQUIRE_WINDOWorHOS_VCORE_TRACE_MS.The open points are unchanged:
posix/prof.cand the longjmp unwind fix first; both can land quickly on their own;hos_debug_scene_pollcallsgetenvon every pad poll for every Linux player while the API is off;tests/test_analysis_dlss.pycan only ever skip without #1542;HOS_switches are missing fromdocs/development.md;HOS_DEBUG_SOCKETset,HOS_INPUT_SCRIPTpresses are silently ignored.Once the API is on its own, I'm happy to look at the guest-call adapter closely.
This now conflicts with main in
host/hos_main.c,host/mkw_glue.c,host/nn_hid.c,host/nn_os_sync.c,host/nn_video.c,host/posix/prof.c. Could you merge main into the branch (or rebase) when you get a chance? I'll take another look once it's up to date.