From 3ebc9872a593cae2deceab19d4588e5bea74a6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Jul 2026 21:02:00 +0200 Subject: [PATCH] Add --debugger command line flag to enable the WebSocket debugger Application-mode only (CmdLineMode::Application) - the headless build has its own separate --debugger=PORT mechanism in headless/Headless.cpp, which doesn't currently work reliably, so this new flag intentionally does not apply there. Sets bRemoteDebuggerOnStartup for the session without persisting it to the config file. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01XDNwPPuidmNxQGRJxBuRL6 --- Core/CmdLine.cpp | 6 ++++++ Core/CmdLine.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Core/CmdLine.cpp b/Core/CmdLine.cpp index d41635e1de..02964468b3 100644 --- a/Core/CmdLine.cpp +++ b/Core/CmdLine.cpp @@ -139,6 +139,7 @@ static const CommandLineParam g_autoParams[] = { {POFF(startScreen), CmdParamType::String, "start-screen", '\0', "Start on a specific screen (e.g. 'gamesettings', 'touchscreentest')", CmdLineMode::Application}, {POFF(escapeExit), CmdParamType::Bool, "escape-exit", '\0', "Escape key exits the application", CmdLineMode::Application}, {POFF(pauseMenuExit), CmdParamType::Bool, "pause-menu-exit", '\0', "Change \"Exit to menu\" in pause menu to \"Exit\"", CmdLineMode::Application}, + {POFF(enableDebugger), CmdParamType::Bool, "debugger", '\0', "Enable the WebSocket debugger on startup (see docs/WebSocketDebugger.md)", CmdLineMode::Application}, {POFF(appendConfig), CmdParamType::String, "appendconfig", '\0', "Merge config FILE into the current configuration"}, {POFF(root), CmdParamType::String, "root", 'r', "Mount root directory"}, {POFF(stateToLoad), CmdParamType::String, "state", '\0', "Load state from specified file"}, @@ -395,6 +396,11 @@ void CommandLineOptions::ApplyToConfig() const { g_Config.bPauseMenuExitsEmulator = pauseMenuExit.value(); } + if (enableDebugger.has_value()) { + g_Config.bRemoteDebuggerOnStartup = enableDebugger.value(); + g_Config.DoNotSaveSetting(&g_Config.bRemoteDebuggerOnStartup); + } + if (logLevel.has_value()) { g_logManager.SetAllLogLevels(logLevel.value()); } diff --git a/Core/CmdLine.h b/Core/CmdLine.h index 99f08822e5..573886a903 100644 --- a/Core/CmdLine.h +++ b/Core/CmdLine.h @@ -40,6 +40,9 @@ struct CommandLineOptions { std::optional escapeExit; std::optional pauseMenuExit; + // Enables the WebSocket debugger on startup (Application mode only - see docs/WebSocketDebugger.md). + std::optional enableDebugger; + std::optional appendConfig; std::optional root; // mount root, needs more explanation std::optional stateToLoad;