Skip to content

Host HUD layer: psx_host_set_hud_draw_cb, drawn under the in-game menu - #710

Merged
mstan merged 4 commits into
RetroPortingToolKit:masterfrom
yacineolivier-maker:feat-host-hud-layer
Oct 23, 2026
Merged

mstan merged 4 commits into
RetroPortingToolKit:masterfrom
yacineolivier-maker:feat-host-hud-layer

Conversation

@yacineolivier-maker

@yacineolivier-maker yacineolivier-maker commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

A title can draw its own heads-up display on the host side (ImGui, like the
in-game overlay provider), once per presented frame -- real and generated
frames -- under the in-game menu and with the same thread and GL rules as
psx_host_overlay_set_draw_cb. Registered once at title activation; NULL
unregisters. No callback registered: no change in behaviour.

Used by a modern race HUD for R4 (lap, timing, tachometer, track map) drawn
at window resolution instead of the 320x240 native one.

Verification

  • Game-agnostic: no title check or game address in the framework; behaviour is unchanged unless a title registers a HUD callback.
  • Build: R4 (tetrisgm/RidgeRacerType4Recomp master 737827c, USA config, its committed generated C) built against this branch alone: cmake-clang-v1 1.0.14 (clang, Ninja, Release), Windows 11.
  • Runtime: exercised in R4's PAL build (SCES-01706) with all of our framework branches combined on current master fe8d937d: boot, menus, a full Time Attack lap. The same changes on the previous base (379565a6) went through several days of play-testing: intro movie, menus, races, VS split screen, attract demo. Windows 11, i5-12400F, RTX 3060, OpenGL renderer; Vulkan and the software renderer were not tested.
  • Pin / regen: runtime only, no regen. A game consumes it with a pin bump.

Game side: tetrisgm/RidgeRacerType4Recomp#49 (PAL / Europe support) and tetrisgm/RidgeRacerType4Recomp#50 (race HUD, car effects, lighting; overview in tetrisgm/RidgeRacerType4Recomp#51)

I cannot follow up on review comments, sorry. Maintainers are welcome to edit, split, take over or close this.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rkyma8rbyPiccs9n2bkyG6

A title can draw its own heads-up display on the host side (ImGui, like the
in-game overlay provider), once per presented frame -- real and generated
frames -- under the in-game menu and with the same thread and GL rules as
psx_host_overlay_set_draw_cb. Registered once at title activation; NULL
unregisters. No callback registered: no change in behaviour.

Used by a modern race HUD for R4 (lap, timing, tachometer, track map) drawn
at window resolution instead of the 320x240 native one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rkyma8rbyPiccs9n2bkyG6

@mstan mstan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 0127fcf.

The separate HUD layer is a useful elective presentation capability: it can draw below the menu without stealing the menu provider. This head needs a defined session/thread lifetime before merge. host_overlay.c publishes s_hud_fn and s_hud_ctx as two ordinary globals while the renderer reads them on another thread; unlike the existing overlay callback, there is no publication/drain protocol. NULL unregister explicitly does not wait, and no restart/package-deactivation path clears this new slot. A callback/context valid only for the old session can therefore survive into the next session or race teardown. Reuse the existing callback ownership/drain pattern and connect it to session cleanup; verify register -> present -> unregister/restart with a render in flight. State the OpenGL-only capability explicitly so a consuming title can refuse/fall back on other backends. The R4 combined-stack play report is relevant, but does not test that lifecycle. Tracking: beads-8zz2.

@mstan

mstan commented Oct 23, 2026

Copy link
Copy Markdown
Member

Maintainer fixes pushed in 570c4c8. The HUD function/context now publish coherently, replacement/unregister drains prior calls, and activation reset / GL shutdown clear the session slot. The header explicitly states OpenGL-only support and registrant ownership. Focused concurrent unregister, self-unregister and activation-reset checks pass. The combined native checks and real GL threaded/unthreaded fixture pass; the four-title smoke batch is underway. I will make the merge decision on the qualified head rather than ask you to redo these objective corrections. Tracking: beads-kgof.

@mstan mstan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer fixes address coherent HUD callback/context publication, unregister lifetime, session reset and GL shutdown. Concurrent unregister, self-unregister and activation-reset fixtures pass. The Windows test escape models non-unwinding guest callbacks without the CRT SEH crash. OpenGL-only scope and callback ownership are explicit.

One bounded muted OpenGL boot/progression/visual smoke passed for Tomba, Tomba 2, Ape Escape and Mega Man X6. Tomba 2 reached its title screen after the opening FMV at native aspect; its unsupported widescreen package remains disabled. Supported debug quit returned exit 0 for all four; this is not extended gameplay, normal-teardown or native-card-write qualification.

Combined integration 9ee1a8c63996cc91e4068aa27f100d407ab1ac0e includes #710/#723/#736/#737/#746; #736 remains held for residency policy. Six focused native checks and the GL fixture passed. This evidence qualifies the reviewed heads as a compatible subset, not an exact final-master-tree claim. Tracking: beads-kgof.

@mstan
mstan merged commit 53a6d7e into RetroPortingToolKit:master Oct 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants