Repository navigation
Second pad for scripts and the debug channel (pad2, port) — #101 phase 3 - #104
Merged
Merged
Conversation
…ad "port" The last part of #101: port 1 from the tools that drive a run, not only from the window. - Script (runtime/script.c, tools/replay/run.lua: the same engine on both runners): `"pad2": true` at the top puts a pad in port 1 from the first frame, and a press step with `"port": 1` holds its buttons there; the other steps drive port 0, and a press on port 1 without pad2 is refused at load. run.lua sets PCSX-Redux's pad 2 Connected from pad2 either way (Redux's default is none, and the user's configuration never decides it) and records port 1's inputs from its first frame, as the port does. The held buttons of both ports are part of the script's save state. - Debug channel (runtime/debug.c): `pad` takes `port` (0 or 1; port 1 is connected while the channel owns it), each port owned on its own (the window keeps the other: port_debug_pad_owned is a bitmask now); `pad_free` takes an optional port (none: every port the channel owns); status adds pad2_owner, pad2 and pad2_connected. - MCP (tools/mcp): pad_press/pad_hold/pad_release/pad_free take `port`; game_status gives pad2_buttons; the fake game models both ports. - tests/hello_test.py: a script with pad2 and a press on port 1 traces port 1 in its log and record, and hello draws another picture than with the press on port 0 or none (the game sees it); the two refusals. The refused scripts' crash reports go to the build directory. Closes #101 (phase 3 of 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 of #101, the last one (phase 1 #102: the runtime; phase 2 #103: the Controls screen). Closes #101.
What
runtime/script.candtools/replay/run.lua, the same engine on both runners):"pad2": trueat the top level puts a digital pad in port 1 from the first frame.pressstep with"port": 1holds its buttons there. Other steps, and apresswithoutport, drive port 0.presson port 1 withoutpad2is refused when the script loads, as is apad2that isn't a boolean.pads[2].Connectedfrompad2. Redux's default is no pad 2 (checked in the pinned build), and this way the user's Redux configuration never decides it."port": 1entries).runtime/debug.c):padtakesport(0 or 1). Port 1 has a pad in it while the channel owns it.port_debug_pad_ownedis now a bitmask.pad_freetakes an optionalport; without one it frees every port the channel owns.statusaddspad2_owner,pad2andpad2_connected.tools/mcp):pad_press/pad_hold/pad_release/pad_freetakeport;game_statusaddspad2_buttons; the fake game models both ports.tools/mcp/README.md.Gates that ran
tests/hello_test.py(new checks):pad2and a press on port 1 traces port 1 in the log (I 1 port 1 buttons 0x0000,I 4 … 0x4000,I 8 … 0x0000) and the record (port-1 entries at frames 1, 4, 8).--exe --wine).tools/mcp/selftest.py: 77/77, with the new checks for port 1 (status, owning port 1 alone,pad_free(port=1)keeping port 0,port=2refused).--debug), same frame in three runs: holding buttons on port 1 changes the picture, holding them on port 0 changes it differently, and nothing held is the baseline. The log traces port 1 and its release onpad_free.Connectedthe game's port-1 buffer readsFF…(no pad); with it,00 41 FF FF; CROSS on pad 2 givesFF BF.pad2presses CROSS on port 1 until the game's buffer shows it (passes).pad2, a press on port 1, then START on port 0) gives identicalinputsin the emulator's and the port's records, with the checkpoint at the same frame.tests/port/run.pywith this branch and withmain(Controls: Player 2 on the Gamepad tab (input.player2) — #101 phase 2 #103 merged) both pass, and the outputs are byte-identical (only output paths insidereplay.scriptdiffer).tests/hello_test.py --menu,tasks_test.py(plain,--sanitize,--m32),shim_test.py,replay_test.py,game_gen_test.py,py_compile.Notes
00, where the shim writes00 FF FF. Only the status byte (0xFF, no pad) means anything there, and it matches. Left as it is.replay_test.pydoesn't exercise run.lua (it fakes the emulator), so the Redux checks above were run by hand.🤖 Generated with Claude Code