From 3f1c754b7d79fa7e678894710337294779e4659f Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 11 Apr 2023 22:28:43 +1000 Subject: [PATCH] Crappy CLI option to automate things --- src/duckstation-qt/qthost.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index 52175cce0..e9e906b28 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -17,6 +17,7 @@ #include "core/host.h" #include "core/host_settings.h" #include "core/memory_card.h" +#include "core/netplay.h" #include "core/spu.h" #include "core/system.h" #include "displaywidget.h" @@ -97,6 +98,9 @@ static bool s_nogui_mode = false; static bool s_start_fullscreen_ui = false; static bool s_start_fullscreen_ui_fullscreen = false; +// TODO: REMOVE ME +static int s_netplay_test = -1; + EmuThread* g_emu_thread; GDBServer* g_gdb_server; @@ -2091,6 +2095,11 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, InitializeEarlyConsole(); continue; } + else if (CHECK_ARG_PARAM("-netplay")) + { + s_netplay_test = StringUtil::FromChars(args[++i].toStdString()).value_or(0); + continue; + } #ifdef WITH_RAINTEGRATION else if (CHECK_ARG("-raintegration")) { @@ -2228,6 +2237,19 @@ int main(int argc, char* argv[]) else if (!s_nogui_mode) main_window->startupUpdateCheck(); + if (s_netplay_test >= 0) + { + Host::RunOnCPUThread([]() { + const bool first = (s_netplay_test == 0); + const int h = first ? 1 : 2; + const int nh = first ? 2 : 1; + const int port_base = 31200; + std::string remote = "127.0.0.1"; + std::string game = "D:\\PSX\\chd\\padtest.chd"; + Netplay::StartNetplaySession(h, port_base + h, remote, port_base + nh, 1, game); + }); + } + // This doesn't return until we exit. const int result = app.exec();