cli: add launch setting to open debugger
Some checks failed
Build check / build (push) Has been cancelled
Generate translation template / generate-pot (push) Has been cancelled

This commit is contained in:
Crementif
2026-07-25 18:59:35 +02:00
parent 22b0b8b0f8
commit 5ead58008d
4 changed files with 19 additions and 1 deletions

View File

@@ -77,7 +77,8 @@ std::optional<int> LaunchSettings::HandleCommandline(const std::vector<std::wstr
("force-interpreter", po::value<bool>()->implicit_value(true), "Force interpreter CPU emulation, disables recompiler. Useful for debugging purposes where you want to get accurate memory accesses and stack traces.")
("force-multicore-interpreter", po::value<bool>()->implicit_value(true), "Force multi-core interpreter CPU emulation, disables recompiler. Only useful for getting stack traces, but slightly faster than the single-core interpreter mode.")
("enable-gdbstub", po::value<bool>()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger");
("enable-gdbstub", po::value<bool>()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger")
("open-debugger", po::value<bool>()->implicit_value(true), "Open the PPC debugger window on startup");
po::options_description hidden{ "Hidden options" };
hidden.add_options()
@@ -193,6 +194,9 @@ std::optional<int> LaunchSettings::HandleCommandline(const std::vector<std::wstr
if (vm.count("enable-gdbstub"))
s_enable_gdbstub = vm["enable-gdbstub"].as<bool>();
if (vm.count("open-debugger"))
s_open_debugger = vm["open-debugger"].as<bool>();
if (vm.count("forward-console-logging"))
{
requireConsole();

View File

@@ -31,6 +31,7 @@ public:
static std::unordered_map<fs::path, std::wstring>& CosMounts() { return s_cos_mounts; }
static bool GDBStubEnabled() { return s_enable_gdbstub; }
static bool OpenDebuggerEnabled() { return s_open_debugger; }
static bool NSightModeEnabled() { return s_nsight_mode; }
static bool ForceInterpreter() { return s_force_interpreter; };
@@ -56,6 +57,7 @@ private:
inline static std::unordered_map<fs::path, std::wstring> s_cos_mounts{};
inline static bool s_enable_gdbstub = false;
inline static bool s_open_debugger = false;
inline static bool s_nsight_mode = false;
inline static bool s_force_interpreter = false;

View File

@@ -377,6 +377,9 @@ MainWindow::MainWindow()
{
g_gdbstub = std::make_unique<GDBServer>(GetConfig().gdb_port);
}
if (LaunchSettings::OpenDebuggerEnabled())
OpenPPCDebugger();
}
MainWindow::~MainWindow()
@@ -1190,6 +1193,14 @@ void MainWindow::OnDebugViewPPCDebugger(wxCommandEvent& event)
return;
}
OpenPPCDebugger();
}
void MainWindow::OpenPPCDebugger()
{
if (m_debugger_window)
return;
auto rect = GetDesktopRect();
/*
sint32 new_width = max(rect.GetWidth() * 0.70, rect.GetWidth() - 850);

View File

@@ -76,6 +76,7 @@ public:
void UpdateNFCMenu();
bool IsMenuHidden() const;
void TogglePadView();
void OpenPPCDebugger();
#if BOOST_OS_WINDOWS
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;