Files
PS5_RetroArch/tests/test_input_ps5.py
T
Mihawk dae9006c37 Fix PS5 menu analog navigation and input binding capture
Register ps5_joypad with raw buttons/axes and a built-in controller profile.
Route controls through RetroArch's binding helpers and stop OR-ing hardcoded
pad state back into remapped input. Preserve held samples across the extra
binding-screen poll and keep disconnect/interception handling.

Add three upstream edits (105 -> 108): joypad declaration, registration and
built-in profile. No new dependency or toolchain flag. Host tests exercise
upstream mapping/analog helpers, native polling/lifecycle and ELF registration.

Validation: tools/verify.sh (all five gates, 37 tests, 17 evidence records).
Fresh patch replay: 107 applied + one existing marker; second pass unchanged.
Console: tools/run-title.sh --no-build --watch 120; owner confirmed flawless
stick navigation and binding capture, then confirmed manual close.
Follow-up: tools/run-title.sh --no-build --no-deploy --watch 30; full window
alive and script-closed, zero Vulkan refusals/API failures.
Evidence: evidence/native-joypad/{capture,expectation}.json.
Build: e6211dea9fd0bb512e83a9979a6a44c0c8c5fdf175564c753e3fd2a25067e0a9.
PS5_Vulkan unchanged.
2026-09-19 13:35:42 -04:00

31 lines
1.5 KiB
Python

"""Exercise PS5 callbacks and upstream input_state_wrap with native service mocks."""
from pathlib import Path
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parent.parent
class InputPs5(unittest.TestCase):
def test_joypad_bindings(self):
with tempfile.TemporaryDirectory() as td:
source = (ROOT / 'vendor/retroarch/input/input_driver.c').read_text()
start = source.index('static int32_t input_state_wrap(')
end = source.index('\nstatic int16_t input_joypad_axis(', start)
parts = [source[start:end]]
start = source.index('static int16_t input_joypad_axis(')
end = source.index('\n/**', start)
parts.append(source[start:end])
start = source.index('static int16_t input_joypad_analog_axis(')
end = source.index('\nvoid input_keyboard_line_append(', start)
parts.append(source[start:end])
Path(td, 'input_state_wrap.inc').write_text(
'static input_driver_state_t input_driver_st;\n' + '\n'.join(parts))
binary = str(Path(td) / 'input-test')
subprocess.run(['c++', '-std=c++17', '-O2', '-Wall', '-Wextra',
'-Ivendor/retroarch', '-Ivendor/retroarch/libretro-common/include',
'-I' + td, 'tests/input_ps5_test.cpp', '-o', binary],
cwd=ROOT, check=True)
subprocess.run([binary], cwd=ROOT, check=True, timeout=15)