From 1f1b0f3f99e70747facc486e63f14b058ad5239b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lower?= Date: Mon, 15 Jan 2024 18:46:28 +0100 Subject: [PATCH] Add ability to pass arguments to game executable via `--launch_args=` Some launchers, notably GOG Galaxy don't support launching game via URI. They require command line option `Galaxy.exe /run:gameId`. This commit adds command line parameter `--launch-args=` thant can accept space separated argument list as as single string. --- UEVR/MainWindow.xaml.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UEVR/MainWindow.xaml.cs b/UEVR/MainWindow.xaml.cs index 7761084..181a008 100644 --- a/UEVR/MainWindow.xaml.cs +++ b/UEVR/MainWindow.xaml.cs @@ -173,6 +173,7 @@ public partial class MainWindow : Window { private ExecutableFilter m_executableFilter = new ExecutableFilter(); private string? m_commandLineAttachExe = null; private string? m_commandLineLaunchExe = null; + private string? m_commandLineLaunchArgs = null; private int m_commandLineDelayInjection = 0; private bool m_ignoreFutureVDWarnings = false; @@ -195,6 +196,10 @@ public MainWindow() { m_commandLineLaunchExe = arg.Substring(arg.IndexOf('=') + 1); // game exe URI may contain any characters including '=' continue; } + if (arg.StartsWith("--launch_args=")) { + m_commandLineLaunchArgs = arg.Substring(arg.IndexOf('=') + 1); // space separated list of game exe arguments + continue; + } if (arg.StartsWith("--delay=")) { try { m_commandLineDelayInjection = int.Parse(arg.Split('=')[1]); @@ -284,7 +289,8 @@ private void Update_InjectStatus() { try { Process.Start(new ProcessStartInfo { FileName = m_commandLineLaunchExe, - UseShellExecute = true // for launcher compatiblity, executable might be an URI + UseShellExecute = true, // for launcher compatiblity, executable might be an URI + Arguments = m_commandLineLaunchArgs }); m_launchExeDone = true;