public virtual void RunningUpdate() { if (_waitingForMainGameWindow) { if (ExternalWindowTracker.WindowIsPresent(_srcGame.windowTitle)) { Debug.Log("Main Game Window Appeared"); _waitingForMainGameWindow = false; _srcGame.launchSettings.mouseStartupOptions?.Perform(); } } if (!_waitingForMainGameWindow) { float prevTime = _timeSinceWindowAppeared; _timeSinceWindowAppeared += Time.deltaTime; if (_srcGame.launchSettings.joyToKeyDelayed) { bool joyToKeyDelayReached = prevTime < _srcGame.launchSettings.joyToKeyConfigDelay && _timeSinceWindowAppeared >= _srcGame.launchSettings.joyToKeyConfigDelay; if (joyToKeyDelayReached) { Debug.Log("Joy to key delay reached!"); ProcessRunner.instance.setJoyToKeyConfig(_srcGame.joyToKeyConfig); } } } }
public void BringThisToForeground() { #if !UNITY_EDITOR if (ExternalWindowTracker.EditorFocusStealing) { ExternalWindowTracker.ForceBringToForeground(ExternalWindowTracker.GetWindowByTitle(ExternalWindowTracker.editorWindowTitle)); } #else string switcherWindowName = Application.productName; ExternalWindowTracker.ForceBringToForeground(ExternalWindowTracker.GetWindowByTitle(switcherWindowName)); #endif setJoyToKeyConfigIfNotAlreadySet(SWITCHER_JOYTOKEY_CONFIG); }
public virtual void FocusWindow() { GameData currentlySelectedGame = this._srcGame; string windowTitle = currentlySelectedGame.windowTitle; if (string.IsNullOrEmpty(windowTitle)) { ExternalWindowTracker.ForceBringToForeground(ExternalWindowTracker.runningPrimaryWindowGuess(process.Id));//currentGameRunner.process.Id)); } else { ExternalWindowTracker.ForceBringToForeground(ExternalWindowTracker.GetWindowByTitle(windowTitle)); } // /// Alt way <<<<<<<<<<<<<<<< // SendKeyStrokesToWindow(windowTitle); // //>>>>>>>>>>>>>>>> }
public override void RunningUpdate() { base.RunningUpdate(); if (hasResolutionSetupScreen) { if (_resDiaSkipState == DialogSkipState.WaitingForDialogToAppear) { if (ExternalWindowTracker.WindowIsPresent(this.ResulotionDialogWindowTitle)) { _resDiaSkipState = DialogSkipState.DialogHasAppeared; } } else if (_resDiaSkipState == DialogSkipState.DialogHasAppeared) { _lastResDialogKeySendTimer += Time.deltaTime; if (!ExternalWindowTracker.WindowIsPresent(this.ResulotionDialogWindowTitle)) { _resDiaSkipState = DialogSkipState.DialogHasClosed; } else if (_lastResDialogKeySendTimer > .5f) { Debug.Log("Sending"); SendKeyToResDialog(); } } //else //{ // if (ProcessRunner.WindowIsPresent(this.ResulotionDialogWindowTitle) && _dialogWaitTimer.expired) // { // _dialogWaitTimer.Restart(); // needToSendKeys = true; // } //} } }
public bool IsGameRunning() { bool processJustStarted = _runningGame != null && currentProcessStartTimer < 5; bool windowBasedGameIsRunning = _runningGame != null && !string.IsNullOrEmpty(_runningGame.windowTitle) && ExternalWindowTracker.WindowIsPresent(_runningGame.windowTitle); bool processBasedGameIsRunning = _runningGame != null && (currentGameRunner.process != null && !currentGameRunner.process.HasExited); return(processJustStarted || windowBasedGameIsRunning || processBasedGameIsRunning); }