tests: update Hybrid integration guards

This commit is contained in:
Matthew Stanley
2026-08-09 19:17:07 -07:00
parent 89cf7c2053
commit e76c53d63a
3 changed files with 20 additions and 22 deletions
+3 -5
View File
@@ -114,10 +114,9 @@ struct WidescreenAspectConeConfig {
std::array<uint32_t, 3> queue_capacities{};
std::array<uint32_t, 3> queue_type_masks{};
};
// Parse/format a pad mode. pad_mode_from_string accepts "hybrid"/"analog"/
// "digital" (case-insensitive) and returns `fallback` for anything else.
// Strict: for game.toml. THROWS on "hybrid" — the mode is mod-only and must
// not be declared by a game.
// Parse/format a pad mode. Strict game.toml parsing accepts "analog" or
// "digital" (case-insensitive), returns `fallback` for unknown values, and
// THROWS on "hybrid" — the mode is mod-only and must not be declared by a game.
int pad_mode_from_string(const std::string& s, int fallback);
// Lenient: for a user's settings.toml, where a stale persisted "hybrid" must
// migrate to analog rather than refuse to launch.
@@ -486,7 +485,6 @@ struct RuntimeConfig {
int default_p1_mode = PAD_MODE_ANALOG;
int default_p2_mode = PAD_MODE_ANALOG;
// lock_mode: when true the launcher HIDES the whole pad-mode selector
// (Hybrid | Analog | D-Pad) and forces every port to default_p1_mode. For a
// game that supports exactly one pad type — e.g. Tomba 2, whose driver only
+7 -7
View File
@@ -14,21 +14,21 @@ assert "e && (e[0] == '0'" not in MAIN, (
"PSX_DEV_INPUT must not use the old default-on/explicit-disable predicate"
)
assert "hybrid_stick_active(const PlayerInput& p, bool dev_any)" in MAIN
assert "hybrid_dpad_active(const PlayerInput& p, int player, bool dev_any)" in MAIN
assert "hybrid_stick_active(p, dev_here)" in MAIN
assert "hybrid_dpad_active(p, player, dev_here)" in MAIN
assert "hybrid_stick_active(const PlayerInput& p, const PadSources& src)" in MAIN
assert "hybrid_dpad_active(const PlayerInput& p, int player," in MAIN
assert "hybrid_stick_active(p, src)" in MAIN
assert "hybrid_dpad_active(p, player, src)" in MAIN
stick_body = MAIN.split(
"static bool hybrid_stick_active(const PlayerInput& p, bool dev_any)", 1
"static bool hybrid_stick_active(const PlayerInput& p, const PadSources& src)", 1
)[1].split("static bool hybrid_dpad_active", 1)[0]
dpad_body = MAIN.split(
"static bool hybrid_dpad_active(const PlayerInput& p, int player, bool dev_any)",
"static bool hybrid_dpad_active(const PlayerInput& p, int player,",
1,
)[1].split("/* Sample each player's live device state", 1)[0]
for name, body, detector in (
("stick", stick_body, "controller_stick_active(handle)"),
("stick", stick_body, "controller_stick_active(handle, controller_deadzone)"),
("D-pad", dpad_body, "controller_dpad_active(handle)"),
):
assert "SDL_NumJoysticks()" in body, (
+10 -10
View File
@@ -18,16 +18,16 @@ for symbol in (
):
assert symbol in HEADER, f"missing trusted-plugin controller API: {symbol}"
reset = """g_mod_controller_mode_override[0] = -1;
g_mod_controller_mode_override[1] = -1;
mod_runtime_activate_plugins();"""
apply = """if (g_mod_controller_mode_override[0] >= 0)
p1_mode = g_mod_controller_mode_override[0];
if (g_mod_controller_mode_override[1] >= 0)
p2_mode = g_mod_controller_mode_override[1];"""
reset0 = "g_mod_controller_mode_override[0] = -1;"
reset1 = "g_mod_controller_mode_override[1] = -1;"
activate = "mod_runtime_activate_plugins();"
apply0 = "player_mode[0] = g_mod_controller_mode_override[0];"
apply1 = "player_mode[1] = g_mod_controller_mode_override[1];"
assert reset in MAIN, "controller overrides must reset before every activation pass"
assert apply in MAIN, "controller overrides must replace the resolved launch modes"
assert MAIN.index(reset) < MAIN.index(apply), "reset/activate must precede application"
for snippet in (reset0, reset1, activate, apply0, apply1):
assert snippet in MAIN, f"missing controller override lifecycle step: {snippet}"
assert MAIN.index(reset0) < MAIN.index(activate) < MAIN.index(apply0)
assert MAIN.index(reset1) < MAIN.index(activate) < MAIN.index(apply1)
print("mod controller override lifecycle guard passed")