Skip to content

Commit

Permalink
fix(common): add extra delay after game is activated for nircmd
Browse files Browse the repository at this point in the history
  • Loading branch information
marcincichocki committed Oct 15, 2022
1 parent 1ab78a3 commit 721bf12
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/common/node/robot/nircmd.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sleep } from '@/common/util';
import { BreachProtocolRobotKeys } from './robot';
import { WindowsRobot } from './win32';

Expand All @@ -7,8 +8,12 @@ export class NirCmdRobot extends WindowsRobot {

protected readonly binPath = './resources/win32/nircmd/nircmd.exe';

activateGameWindow() {
return this.bin(`win activate stitle ${this.gameWindowTitle}`);
async activateGameWindow() {
await this.bin(`win activate stitle ${this.gameWindowTitle}`);
// Wait extra time as nircmd will not wait for window to be actually
// actived. This could cause errors when entering sequence, as keystrokes
// could be sent before game can receive them
await sleep(500);
}

click() {
Expand Down

0 comments on commit 721bf12

Please sign in to comment.