From 1e9c51ef1593ed31d7788b56ae62a91511d7d415 Mon Sep 17 00:00:00 2001 From: Wurielle Date: Tue, 14 Jan 2025 22:44:55 +0000 Subject: [PATCH] style: prettier formatting --- apps/app/src/electron/game-overlay.ts | 60 +++++++++++++-------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/apps/app/src/electron/game-overlay.ts b/apps/app/src/electron/game-overlay.ts index d674ecca..e8bd20a1 100644 --- a/apps/app/src/electron/game-overlay.ts +++ b/apps/app/src/electron/game-overlay.ts @@ -12,9 +12,9 @@ import { Window } from 'win-control' import { Deferred } from '@packages/toolbox' type ProcessInfo = { - process: string, - pid: number, - filepath: string, + process: string + pid: number + filepath: string user: string } @@ -32,8 +32,7 @@ class GameOverlay { private markQuit = false private scaleFactor = 1.0 - constructor() { - } + constructor() {} public isReady = () => ready.promise @@ -81,12 +80,12 @@ class GameOverlay { const { top, left, right, bottom } = Window.getByPid( payload.pid, ).getDimensions() - const width = right-left - const height = bottom-top + const width = right - left + const height = bottom - top mouse.getPosition().then(async (initialPosition) => { await mouse.setPosition( - new Point(left+width / 2, top+height / 2), + new Point(left + width / 2, top + height / 2), ) await mouse.leftClick() await mouse.setPosition(initialPosition) @@ -247,7 +246,7 @@ class GameOverlay { for (const window of this.Overlay.getTopWindows()) { if (window.processId === processInfo.pid) { console.log( - `--------------------\n injecting ${ JSON.stringify(window) }`, + `--------------------\n injecting ${JSON.stringify(window)}`, ) this.Overlay.injectProcess(window) this.hookedProcesses.push(processInfo) @@ -256,34 +255,33 @@ class GameOverlay { } public start() { - return import('@packages/electron-game-overlay') - .then((Overlay) => { - this.Overlay = Overlay.default - this.scaleFactor = screen.getDisplayNearestPoint({ - x: 0, - y: 0, - }).scaleFactor - - this.startOverlay() + return import('@packages/electron-game-overlay').then((Overlay) => { + this.Overlay = Overlay.default + this.scaleFactor = screen.getDisplayNearestPoint({ + x: 0, + y: 0, + }).scaleFactor - const child = fork(path.join(EXTERNALS_DIR, 'detect-game.js')) + this.startOverlay() - child.on('message', (processInfo: ProcessEvent) => { - if (processInfo.type === 'game-detection') { - this.injectByProcessOnceFocused(processInfo.payload) - } - }) + const child = fork(path.join(EXTERNALS_DIR, 'detect-game.js')) - onIPCGameOverlayStartIntercept(() => { - this.startIntercept() - }) + child.on('message', (processInfo: ProcessEvent) => { + if (processInfo.type === 'game-detection') { + this.injectByProcessOnceFocused(processInfo.payload) + } + }) - onIPCGameOverlayStopIntercept(() => { - this.stopIntercept() - }) + onIPCGameOverlayStartIntercept(() => { + this.startIntercept() + }) - return ready.resolve(true) + onIPCGameOverlayStopIntercept(() => { + this.stopIntercept() }) + + return ready.resolve(true) + }) } public quit() {