Repository navigation
Port: make the Debug menu binding open the debug menu - #124
Merged
Merged
Conversation
carrdylan52
marked this pull request as draft
October 19, 2026 00:55
carrdylan52
force-pushed
the
pr/debug-menu-key
branch
from
October 19, 2026 02:28
0736477 to
a9ec841
Compare
carrdylan52
marked this pull request as ready for review
October 19, 2026 02:28
The Bindings page offered "Debug menu" (debug_menu), but nothing read the action, so a key bound to it did nothing. With debug mode on, the key is now a one-key shortcut to the current loop's debug menu: it turns DebugFlag on and presses Start+Select on the title, or R3 in a dungeon or town, where a second press closes the open debug menu. R3 only reaches the debug menu while the player has control. In an ordinary menu it toggles menu_debug_flag, and in a town menu it can start the edit debug menu under it and reset MenuBuffer. So the key is dropped in menus, events, Georama edit, sub-games, under a pad lock (also with a debug menu open) and in other loops, before DebugFlag or the pad changes. The control checks are the ones floor and town autosave already used, now shared as PortDungeonFieldControl and PortTownFieldControl. The dungeon adds checks for the key alone: dungeon fishing and Spheda run in field mode but read the pad after the debug R3, and the player-control pause holds the player. The host counts presses whenever it polls input, so a press made while the game waits would be delivered once it resumes. Presses count only within one ordinary tick: MainLoop drops them when a mode starts, after the frame pause and the pause overlay, and after a tick that ended more than its own frame.
carrdylan52
force-pushed
the
pr/debug-menu-key
branch
from
October 20, 2026 17:26
a9ec841 to
cd91cc1
Compare
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.
Port: make the Debug menu binding open the debug menu
Before
PC SETTINGS > Bindings offers a "Debug menu" action (
debug_menu, paddle 1 by default), but nothing reads it, so a key bound to it does nothing. You can already reach the debug menus from the keyboard: the four-shoulder/R3 chord or pad-2 Circle togglesDebugFlag, then R3 opens the dungeon or town debug menu. With debug mode on, Start+Select also goes to the developer menu (docs/DEBUG.md). Each of these takes a chord or two steps.After
With
game.debug_modeor--jump, the bound key is a one-key shortcut to the current loop's debug menu:The key turns
DebugFlagon first, so it works when the flag is off.These presses are dropped without touching
DebugFlagor the pad:Presses made during the pause overlay, the frame pause, a loading screen inside a tick or a mode change are dropped too, so they are not delivered once the game resumes.
How
DebugModeMenuButtons(loop)(port/src/debug_mode.cpp) returns the buttons for this tick, or 0 to drop the press:GamePad__2.key_lock) returns 0 in every loop, before any other check.PortDungeonFieldControl(), and also noDNG_PAUSE_PLAYER_CONTROL, no running sub-game and no Spheda being played. Fishing and Spheda run in field mode, butDngMainKeytakes the debug R3 before it dispatches to them (ps2/src/dng_main.cpp:2176, 2235, 2275). These three checks are for the key only; autosave is unchanged.dngGetDebugInfo()->activein field mode). An open menu pauses the player and field steps, so it has its own check.PortTownFieldControl()is true, or when the edit debug menu is already open (EditDebugMode()with control inEDIT_CONTROL_DEBUG).DebugModeMenuKey(loop)setsDebugFlagand injects the buttons as a new pad-1 press, but only when it delivers.menu_debug_flagthroughMenuMainKey(ps2/src/menumain.cpp:1433). In a town menu it can reachEditDebugStart, which resetsMenuBuffer__2while the open menu is using it (ps2/src/editloop.cpp:1730, ps2/src/editdebug.cpp:178).PortDungeonFieldControlandPortTownFieldControl(port/src/mainloop.cpp) are the conditions floor and town autosave already checked, moved out so both features share them. Autosave behaves as before.InputHostPressedremoves only one. The fix is port-side, with no Kazarov change:DebugModeTakeMenuKey(frame)drains every pending press each tick. It counts them, as one press, only when the previous tick ended on the currentmgPortFrameCount(), meaning nothing else ended a frame in between.DebugModeEndMenuKeyTickmarks a tick that ended more than one frame, such as a loading screen inside the tick, so the presses read at the next tick are dropped.DebugModeDiscardMenuKey()when a mode starts, after the frame pause and afterPauseLoop. The frame pause waits onsceGsSyncVand ends no frame, so it needs this explicit discard.port/include/stubs/subgame.hppexposes retailSubGame, so the tests can make a sub-game appear to run without starting one.debug_menuis removed from "PC gaps".Tests
DebugMenuKeycases in port/src/tests/debug_mode_test.cpp:DebugFlagand the pad unchanged, in:DNG_PAUSE_PLAYER_STEP,DNG_PAUSE_FIELD_STEPandDNG_PAUSE_PLAYER_CONTROLon its own,DngMainKey. The first opens the menu, and the second closes it and restores the field's pause flags.EditDebugLoopcloses on, and control stays with the menu.EditDebugLoopitself draws through the renderer and the save data, so the test stops at that press.DebugMenuKeyInputcases bind F9 and press it through the host input (InputSetScriptedDevices):cd91cc100onb949b1c0b: Windows build completed successfully. The non-GPU CTest run reported “100% tests passed out of 1665”; its 1666 selected entries comprise 1622 Passed, 43 Skipped, and one Disabled, with no failures. All 16DebugMenuKey/DebugMenuKeyInputtests passed. This adds recorded build/test evidence; the earlier headless evidence remains historical.darkchronicle_tests(Windows release) compared against origin/master: no new failures and no lost passes.EzBgmaudio,PlatformMc/PlatformCdvdfile system,MesWinFillRect,GamePadSingleDebug.DeveloperMenuChordUsesHostInputPastTheGameLockAndOnlyOnAnEdge,TownEyeCamera.FixedRoomReseatCutsButForcedFollowInTheSameRoomDoesNot.EeKernelThreads.RotateInsidePumpWithNothingReadyDoesNotSwitchaborts the test process on both, so the runner restarts past it.{"game":{"debug_mode":true},"input":{"bindings":{"debug_menu":"F9"}}}and--fast-load:--jump dungeon:1:1 --skip-events: F9 opens the dungeon DEBUG MENU, and a second F9 closes it.--jump town:10: F9 opens the town edit debug menu, and a second F9 closes it.--jump title: F9 reaches the Ver0.334 developer menu.