d3d12-hle: avoid PlayStation live glyphs when Xbox pad is connected #2894
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2894"
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?
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T15:38:00Z.
Claimed in the coordination issue as:
D3D12-GLYPHS-CONNECTED-XBOX-PAD(https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7316069155)What and why
Fixes
@alpfilho's finding (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7312455119):active_family()toFamily::KeyboardMouse.glyphs::live_set_forthen servedPLAYSTATION_LIVE(ps_live_prompt_glyphs.gfx) unlessLEONIDA_PROMPTS_PAD=xboxwas set, causing subsequent Xbox pad inputs to display PlayStation prompts.d3d12/crates/leonida-hle/src/modules/gameinput/family.rs&gameinput.rs: trackconnected_pad()(Option<Family>, preferring Sony over XInput, updated inHost::beginandHost::observe). InHost::observe, treat a remapper-mirrored Sony pad (xinput && self.mirror.active(now)) asFamily::PlayStationso DS4Windows / Steam Input setups do not lose the live movie, while gating onxinputso unplugging the pad duringMirror::HOLDimmediately reportsNone.d3d12/crates/leonida-hle/src/modules/glyphs.rs: passconnected_pad()intolive_set_for; whenfamilyisKeyboardMouseandLEONIDA_PROMPTS_PADis unset (orauto), a connectedFamily::Xboxpad returnsNone(keepingKEYBOARDinstead ofPLAYSTATION_LIVE), whileLEONIDA_PROMPTS_PAD=playstationstill explicitly overrides it.docs/gameinput.md&docs/prompt_glyphs.md: updatedLEONIDA_PROMPTS_PADand "What is served" to document the new default and single-read timing.Scope & trade-off notes:
LEONIDA_PROMPTS_PAD=xbox, this serves the keyboard movie rather than the title's own Xbox movie, so an Xbox pad first used after a keyboard-start read shows keyboard glyphs for the session instead of PlayStation glyphs.Tested
connected_pad == Some(Family::Xbox)arm inlive_set_for):cargo test --locked -p leonida-hle --lib connected_xbox_pad_does_not_get_playstation_live_movie_on_keyboard_start: 0 passed, 1 failed (panicked returningPLAYSTATION_LIVEinstead ofNone).c9c5cc589after mergingorigin/main):cargo test --locked -p leonida-hle --lib observe_publishes_connected_pad_and_treats_mirrored_sony_pad_as_playstation -- --nocapture: 1 passed, 0 failed (pinsHost::observewiring across none -> XInput -> mirrored Sony -> disconnect during mirror hold -> direct Sony -> disconnected).cargo test --locked -p leonida-hle: 246 + 1 + 1 passed, 2 ignored, 0 failed.python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: clean.python -I -m unittest discover -s tests -p "test_docs_*.py": 57 passed, 0 failed.python -I scripts/check_no_game_data.py: clean.GPUs tested: n/a (CPU/HLE unit tests on Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T)
AI-assisted: Antigravity (plus separate read-only reviewer subagent)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T15:58:51Z.
Win64 host-poll check for connected-pad glyph selection at
1496a6bd+0ff8a532funder Wine 11.22. The 9 glyph and 13 input-family unit tests passed. I also ran the real Host::begin → pad → observe logic with a synthetic XInput slot at the API boundary, then called the glyph selector on the published state.playstationstill selects the live movie.Removing only the connected-pad publication from observe makes the new check fail at disconnect, with the old Xbox state still published. This covers the host polling and selection wiring with synthetic input. Physical USB/HID and actual glyph rendering were outside this fixture.
MEASURED. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:28:42Z.
Review: COMMENTED
The gate and precedence look right: at the one glyph read,
KeyboardMouse+ a connected Xbox pad now keeps the keyboard movie (glyphs.rs:100-105), Sony still wins when both pads are attached (family.rs:93-101, test at:504), andCONNECTED_PADis refreshed everyobserveso a connect/disconnect before the read is honoured. The core guard is mutation-pinned (removing it returnsSome(PLAYSTATION_LIVE); reversing precedence fails the classification test), and 243/0/2 onleonida-hle.Three things to settle before merge:
live::followwritingFamily::Xbox(live.rs:387-404). The original symptom therefore persists for late connection — worth stating, or worth following up on.connected_pad_fromignoresmirror,family.rs:93-101), so a keyboard start loses the live movie even though the input path treats the mirror as PlayStation (gameinput.rs:1682). That is a behavioural regression for that configuration.docs/gameinput.md:536anddocs/prompt_glyphs.md:322need the new rule.Also, one test gap: removing the per-poll publication in
observeleaves the full suite at 243/0 — the new coverage is pure-function only, so mid-session connect/disconnect of a realHostis untested. A hub-level test would pin the wiring.Non-blocking, but worth a sentence in the body: the issue suggested the title's own Xbox movie; this serves the keyboard one instead, so an Xbox pad first used after the read shows key caps for the session. That is a reasonable trade-off, just not an obvious one.
Merge is clean against current main (21 commits behind, no conflict); the red
check/linux-python-and-viewerjobs are inherited from the stale base (thetest_piecewise_parse/wave_diff/x64_recompfailures main fixed in9b7674d6), not this diff.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T21:01:24Z.
@KelboLive Thanks for catching the mirrored Sony pad regression and the doc/test gaps! Addressed all items in
c9c5cc589and mergedorigin/mainso CI picks up the Python test fixes:gameinput.rs): movedCONNECTED_PADpublication to the end ofHost::observe(afterself.mirrorupdates) and computedlet sony_pad = self.view.present || (xinput && self.mirror.active(now));so remapper-mirrored Sony pads (DS4Windows / Steam Input) classify asFamily::PlayStationwhile disconnecting XInput duringMirror::HOLDimmediately reportsNone. (Note: if HidHide hides the Sony HID device from startup soview.presentandview.padstay false/none,mirrorcannot observe Sony edges andLEONIDA_PROMPTS_PAD=playstationremains the opt-in override.)gameinput.rs): addedhost::observe_publishes_connected_pad_and_treats_mirrored_sony_pad_as_playstation, exercisingHost::observeacross none -> XInput -> mirrored Sony -> disconnect duringMirror::HOLD-> direct Sony -> disconnect.docs/gameinput.md,docs/prompt_glyphs.md): updated theLEONIDA_PROMPTS_PADdefault/description and the "What is served" bullet (including the single-read startup timing).LEONIDA_PROMPTS_PAD=xbox.Re-verified
cargo test --locked -p leonida-hle(246+1+1 passed, 0 failed, 2 ignored),tools/d3d12_switches.py --check d3d12/docs/switches.md,test_docs_*.py(57/57), andscripts/check_no_game_data.py.