Skip to content

Commit

Permalink
Add ability to pass arguments to game executable via --launch_args=
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
keton committed Jan 15, 2024
1 parent 4f32ad6 commit 1f1b0f3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion UEVR/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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]);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1f1b0f3

Please sign in to comment.