Files
psxrecomp/runtime/tests/test_mod_local_input_scope.c
Shokunin f3801ba10b mods: read local host sticks for presentation-only plugins
psx_mod_read_local_pad_sticks(player, out[4]) returns the mapped local
stick axes (lx, ly, rx, ry; 0..255, centre 128) without touching the
SIO sample, so a presentation plugin (a look-around camera) can read the
right stick even when the game selected a digital pad. It returns 0 and
centred axes for an invalid or disconnected player, in netplay, and
during rollback resimulation; peer input is never presentation input.
The debug-server axis override feeds it for deterministic tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:11:51 -07:00

17 lines
578 B
C

#include "mod_local_input_policy.h"
#include <stdio.h>
static int failures;
#define CHECK(cond) do { if (!(cond)) { fprintf(stderr, "FAIL: %s\n", #cond); failures++; } } while (0)
int main(void) {
/* Digital guest pad mode does not gate local presentation input. */
CHECK(psx_mod_local_input_available(1, 1, 0, 0));
CHECK(!psx_mod_local_input_available(0, 1, 0, 0));
CHECK(!psx_mod_local_input_available(1, 0, 0, 0));
CHECK(!psx_mod_local_input_available(1, 1, 1, 0));
CHECK(!psx_mod_local_input_available(1, 1, 0, 1));
return failures ? 1 : 0;
}