diff --git a/src/config/LaunchSettings.cpp b/src/config/LaunchSettings.cpp index 82c93c18..e12fdc62 100644 --- a/src/config/LaunchSettings.cpp +++ b/src/config/LaunchSettings.cpp @@ -77,7 +77,8 @@ std::optional LaunchSettings::HandleCommandline(const std::vector()->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()->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()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger"); + ("enable-gdbstub", po::value()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger") + ("open-debugger", po::value()->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 LaunchSettings::HandleCommandline(const std::vector(); + if (vm.count("open-debugger")) + s_open_debugger = vm["open-debugger"].as(); + if (vm.count("forward-console-logging")) { requireConsole(); diff --git a/src/config/LaunchSettings.h b/src/config/LaunchSettings.h index b594e318..d23c8454 100644 --- a/src/config/LaunchSettings.h +++ b/src/config/LaunchSettings.h @@ -31,6 +31,7 @@ public: static std::unordered_map& 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 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; diff --git a/src/gui/wxgui/MainWindow.cpp b/src/gui/wxgui/MainWindow.cpp index 698bf65a..09ef727a 100644 --- a/src/gui/wxgui/MainWindow.cpp +++ b/src/gui/wxgui/MainWindow.cpp @@ -377,6 +377,9 @@ MainWindow::MainWindow() { g_gdbstub = std::make_unique(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); diff --git a/src/gui/wxgui/MainWindow.h b/src/gui/wxgui/MainWindow.h index e1cfc8b5..deb656ce 100644 --- a/src/gui/wxgui/MainWindow.h +++ b/src/gui/wxgui/MainWindow.h @@ -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;