Add 2 new cli options to allow for opening with logs and debug windows open.

This commit is contained in:
Robert Peralta 2025-02-05 07:18:53 -04:00
parent a6fb0a48eb
commit c36a82b259
3 changed files with 33 additions and 1 deletions

View file

@ -74,7 +74,10 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
po::options_description hidden{ "Hidden options" }; po::options_description hidden{ "Hidden options" };
hidden.add_options() hidden.add_options()
("nsight", po::value<bool>()->implicit_value(true), "NSight debugging options") ("nsight", po::value<bool>()->implicit_value(true), "NSight debugging options")
("legacy", po::value<bool>()->implicit_value(true), "Intel legacy graphic mode"); ("legacy", po::value<bool>()->implicit_value(true), "Intel legacy graphic mode")
("logs", po::value<bool>()->implicit_value(true), "Opens the log window on launch")
("debug", po::value<bool>()->implicit_value(true), "Opens the debugger window on launch");
po::options_description extractor{ "Extractor tool" }; po::options_description extractor{ "Extractor tool" };
extractor.add_options() extractor.add_options()
@ -177,6 +180,12 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
if (vm.count("enable-gdbstub")) if (vm.count("enable-gdbstub"))
s_enable_gdbstub = vm["enable-gdbstub"].as<bool>(); s_enable_gdbstub = vm["enable-gdbstub"].as<bool>();
if (vm.count("logs"))
s_open_log_window_on_launch = vm["logs"].as<bool>();
if (vm.count("debug"))
s_open_debug_window_on_launch = vm["debug"].as<bool>();
std::wstring extract_path, log_path; std::wstring extract_path, log_path;
std::string output_path; std::string output_path;
if (vm.count("extract")) if (vm.count("extract"))

View file

@ -27,6 +27,9 @@ public:
static bool ForceInterpreter() { return s_force_interpreter; }; static bool ForceInterpreter() { return s_force_interpreter; };
static bool OpenLogWindowOnLaunch() { return s_open_log_window_on_launch; };
static bool OpenDebugWindowOnLaunch() { return s_open_debug_window_on_launch; };
static std::optional<uint32> GetPersistentId() { return s_persistent_id; } static std::optional<uint32> GetPersistentId() { return s_persistent_id; }
private: private:
@ -41,6 +44,9 @@ private:
inline static bool s_nsight_mode = false; inline static bool s_nsight_mode = false;
inline static bool s_force_interpreter = false; inline static bool s_force_interpreter = false;
inline static bool s_open_log_window_on_launch = false;
inline static bool s_open_debug_window_on_launch = false;
inline static std::optional<uint32> s_persistent_id{}; inline static std::optional<uint32> s_persistent_id{};

View file

@ -157,6 +157,8 @@ wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent);
wxDEFINE_EVENT(wxEVT_REQUEST_GAMELIST_REFRESH, wxCommandEvent); wxDEFINE_EVENT(wxEVT_REQUEST_GAMELIST_REFRESH, wxCommandEvent);
wxDEFINE_EVENT(wxEVT_LAUNCH_GAME, wxLaunchGameEvent); wxDEFINE_EVENT(wxEVT_LAUNCH_GAME, wxLaunchGameEvent);
wxDEFINE_EVENT(wxEVT_REQUEST_RECREATE_CANVAS, wxCommandEvent); wxDEFINE_EVENT(wxEVT_REQUEST_RECREATE_CANVAS, wxCommandEvent);
wxDEFINE_EVENT(wxEVT_OPEN_LOGGING_WINDOW, wxCommandEvent);
wxDEFINE_EVENT(wxEVT_OPEN_DEBUG_WINDOWS, wxCommandEvent);
wxBEGIN_EVENT_TABLE(MainWindow, wxFrame) wxBEGIN_EVENT_TABLE(MainWindow, wxFrame)
EVT_TIMER(MAINFRAME_ID_TIMER1, MainWindow::OnTimer) EVT_TIMER(MAINFRAME_ID_TIMER1, MainWindow::OnTimer)
@ -304,6 +306,8 @@ MainWindow::MainWindow()
auto* main_sizer = new wxBoxSizer(wxVERTICAL); auto* main_sizer = new wxBoxSizer(wxVERTICAL);
auto load_file = LaunchSettings::GetLoadFile(); auto load_file = LaunchSettings::GetLoadFile();
auto load_title_id = LaunchSettings::GetLoadTitleID(); auto load_title_id = LaunchSettings::GetLoadTitleID();
auto open_log_window = LaunchSettings::OpenLogWindowOnLaunch();
auto open_debug_window = LaunchSettings::OpenDebugWindowOnLaunch();
bool quick_launch = false; bool quick_launch = false;
if (load_file) if (load_file)
@ -360,6 +364,19 @@ MainWindow::MainWindow()
{ {
g_gdbstub = std::make_unique<GDBServer>(config.gdb_port); g_gdbstub = std::make_unique<GDBServer>(config.gdb_port);
} }
if(open_log_window)
{
wxCommandEvent event(wxEVT_OPEN_LOGGING_WINDOW);
OnLoggingWindow(event);
}
if (open_debug_window)
{
wxCommandEvent event(wxEVT_OPEN_DEBUG_WINDOWS);
OnDebugViewPPCDebugger(event);
}
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()