mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
aeef4b554e
Tomba 2's title menu was unresponsive and the idle attract demo never started. Root cause (proven against the Beetle oracle): the SIO pad state machine answered the DualShock config-mode commands (0x43 enter- config, 0x4D rumble-map, etc.) for EVERY pad, including a plain digital controller. Tomba 2's pad driver probes the controller with 0x43 every frame to detect a DualShock; on real hardware a digital pad (SCPH-1080, id 0x41) ignores 0x43 (hi-z, no ACK), so the driver classifies it as digital-only and just polls with 0x42. Our SM answered 0x43, so the driver went down the DualShock config path and read the 0x00 config- response data bytes as button data -> phantom "all buttons pressed" (pad word 0x0000). That made the menu's edge-detected navigation see nothing newly-pressed (unresponsive) AND reset the idle/attract timer every frame (no attract). Fix: model a plain digital controller. New per-slot pad_supports_config flag (sio_set_pad_config_capable), set from the player pad mode (PAD_MODE_DIGITAL => 0, ANALOG/HYBRID => 1, default 1). When 0, all config-command branches (0x43 / legacy / modern 0x44-0x4F) fall through to the hi-z "no response" path, so a digital pad answers ONLY the 0x42 poll -- byte-for-byte matching the oracle. Validated live: SIO now shows only 0x42 polls (id 0x41, buttons 0xFFFF), idle pad word is clean (no 0x0000 phantom), every injected button reaches the menu var, and START navigates the title menu and starts the game. Gated so only DIGITAL-mode pads change behaviour; HYBRID/ANALOG pads (MMX6, Tomba 1, Ape) are unaffected (config-capable as before) -- but a T1/MMX6/Ape regression pass is still required before any master merge. NEW failure point (next bug in the chain, now reachable): with input fixed, the idle attract demo triggers and loads a gameplay level, which FREEZES -- guest spins in compiled kernel/dispatch code, dirty-interp idle (insns_run flat), vblank stalled, level textures corrupted. This is the untested gameplay-overlay stage, a separate issue. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>