diff --git a/UEVR/MainWindow.xaml.cs b/UEVR/MainWindow.xaml.cs index 4e78402..c1bd226 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 int m_commandLineDelayInjection = 0; private bool m_ignoreFutureVDWarnings = false; [System.Runtime.InteropServices.DllImport("user32.dll")] @@ -194,6 +195,16 @@ public MainWindow() { m_commandLineLaunchExe = arg.Substring(arg.IndexOf('=') + 1); // game exe URI may contain any characters including '=' continue; } + if (arg.StartsWith("--delay=")) { + try { + m_commandLineDelayInjection = int.Parse(arg.Split('=')[1]); + } + catch { + m_commandLineDelayInjection = 0; + } + + continue; + } } } @@ -258,6 +269,7 @@ private void RestartAsAdminButton_Click(object sender, RoutedEventArgs e) { private DateTime m_lastAutoInjectTime = DateTime.MinValue; private bool m_launchExeDone = false; + private int? m_delayInjectionTimer = null; private void Update_InjectStatus() { if (m_connected) { @@ -337,6 +349,16 @@ private void Update_InjectStatus() { return; } + if (m_commandLineDelayInjection > 0) { + if (m_delayInjectionTimer == null) { + m_delayInjectionTimer = m_commandLineDelayInjection; + } + + m_injectButton.Content = m_commandLineAttachExe.ToLower() + " found. Delaying " + m_delayInjectionTimer + "s"; + m_delayInjectionTimer--; + if (m_delayInjectionTimer > 0) return; + } + if (now - m_lastAutoInjectTime > oneSecond) { if (m_nullifyVRPluginsCheckbox.IsChecked == true) { IntPtr nullifierBase; @@ -379,6 +401,8 @@ private void Update_InjectStatus() { m_lastAutoInjectTime = now; m_commandLineAttachExe = null; // no need anymore. + m_delayInjectionTimer = null; + m_commandLineDelayInjection = 0; FillProcessList(); if (m_focusGameOnInjectionCheckbox.IsChecked == true) {