Skip to content

Commit c47575e

Browse files
BrettClearyaskatmeflavioislima
authored
[Feat] Overlay (#97)
* overlay injection working dx9-11 on windows, browser window streaming from electron app * re-enabling strictPropertyInit ts check * prettier * injecting on gog game launch * refactored for use with hyperplay overlay, can now code hp overlay in react, supports hmr for overlay, has access to preload script fxns, rm goverlay client code * working with legendary, added readme, time of day added to overlay * fix overlay rebase errors * fix app load * fix pid parsing, update to latest from hyperplay-goverlay, hyperplay-legendary, and hyperplay-gogdl * refactor to npm package for electron overlay * overlay working with webview mm popup * Update index.tsx * fixed webview tag for mm popup and notification * use private electron overlay package * test * prettier * add overlay code back, yarn lock update * [Tech] Overlay fix (#134) * fix scaling issue * send webview input * add webview input proxy, fix overlay css, rm unused code * comment out react devtools --------- Co-authored-by: askatme <qzq91@126.com> * change minimize on launch * inject sideloaded games * move and rename hp overlay react component and css * update to hp electron overlay 0.0.1 * Squashed commit of the following: commit 80e461d Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 10 13:32:49 2023 -0800 rm cloudflare text commit 1deed58 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 10 13:16:37 2023 -0800 Update games.ts commit dea0f39 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 10 12:54:37 2023 -0800 fix focus window on launch commit f8fe3cc Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 10 01:23:23 2023 -0800 fix tests commit 46f7580 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 10 01:13:44 2023 -0800 fix types commit dad5e0b Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 10 00:56:05 2023 -0800 add open external browser game links commit b1d8dba Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 23:32:50 2023 -0800 prettier nonsense commit b682eb3 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 23:29:02 2023 -0800 fix tests commit d7ace68 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 22:36:36 2023 -0800 Update online_monitor.ts commit a508e9f Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 22:36:29 2023 -0800 rm url query param for connected provider the import in src/backend/sideload/games.ts causes metamask background process to fail on app load but only after the metamask extension has been initialized commit c839c5b Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 21:27:29 2023 -0800 rm desktop overlay code, add error handling to preload commit dab3435 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 20:38:19 2023 -0800 rm desktop game overlay code commit f6eae7a Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 17:27:45 2023 -0800 add extension txn notification, add browser game overlay toggle commit db5d640 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 16:14:41 2023 -0800 fix txn toasts for browser game external wallets commit debd3f9 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 02:52:06 2023 -0800 fix types commit 812d842 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Feb 9 02:39:31 2023 -0800 add browser game view, add txn toast notifications, fix mm extension connected provider commit 12724f5 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 8 16:32:12 2023 -0800 Revert "test" This reverts commit 169592a. commit 92663e1 Merge: 87a3227 169592a Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 8 16:31:31 2023 -0800 Merge branch 'overlay' into feat/window_ethereum_all_wallets commit 87a3227 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 8 16:23:25 2023 -0800 add hyperplay ui commit 169592a Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 8 15:50:09 2023 -0800 test commit b60358a Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Feb 7 13:55:17 2023 -0800 update to hp electron overlay 0.0.1 commit 86e4fbb Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Feb 7 13:06:37 2023 -0800 move and rename hp overlay react component and css commit 4ec9aba Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Feb 7 13:05:33 2023 -0800 inject sideloaded games commit e64b75e Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Feb 7 13:04:56 2023 -0800 change minimize on launch commit cd00641 Author: Brett <27568879+BrettCleary@users.noreply.github.com> Date: Mon Feb 6 17:47:36 2023 -0800 [Tech] Overlay fix (#134) * fix scaling issue * send webview input * add webview input proxy, fix overlay css, rm unused code * comment out react devtools --------- Co-authored-by: askatme <qzq91@126.com> commit 0907953 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 19:05:57 2023 -0800 load browser games in a separate session commit ad5633c Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 13:30:15 2023 -0800 rm browser games fullscreen commit 0d1d51c Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 13:11:09 2023 -0800 react devtools not working commit 22aae7c Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 13:10:47 2023 -0800 don't minimize on launch commit 2725eb0 Merge: 8706e03 82bd915 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 13:04:35 2023 -0800 Merge branch 'other/heroic_sync_020223' into feat/window_ethereum_all_wallets commit 82bd915 Author: Flavio F Lima <flavioislima@gmail.com> Date: Fri Feb 3 10:51:20 2023 +0100 fix: platform selection on windows commit 8706e03 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 00:15:43 2023 -0800 Update games.ts commit 5a49793 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 00:10:42 2023 -0800 merge main in submodules commit 7ce9a19 Merge: 344433c 67a31e6 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Feb 3 00:04:26 2023 -0800 Merge branch 'main' into feat/window_ethereum_all_wallets commit 8482b0b Author: Flavio F Lima <flavioislima@gmail.com> Date: Thu Feb 2 18:35:12 2023 +0100 fix: path names commit e808611 Author: Flávio F Lima <flavioislima@gmail.com> Date: Thu Feb 2 18:24:42 2023 +0100 [Tech] Update GOGDL binaries (#2395) * other: update GOGDL binaries * chore: updated electron due to security fix commit b937fbc Author: Flávio F Lima <flavioislima@gmail.com> Date: Wed Feb 1 21:51:44 2023 +0100 [Tech] Update GOGDL binaries (#2395) * other: update GOGDL binaries * chore: updated electron due to security fix commit 6862d71 Author: Ariel Juodziukynas <arieljuod@gmail.com> Date: Wed Feb 1 12:19:57 2023 -0300 [Backend] Add cloudflare url to ping for connectivity check (#2394) * Add cloudflare url to ping for connectivity check * Update i18n commit 1869437 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 1 21:46:51 2023 -0800 add overlay code back, yarn lock update commit 18928cc Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 1 21:45:53 2023 -0800 prettier commit 4cbb15c Merge: b2f2504 67a31e6 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Feb 1 20:52:57 2023 -0800 Merge branch 'main' into overlay commit 344433c Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Jan 30 16:30:55 2023 -0800 expose window.ethereum for other providers on browser game launch commit b2f2504 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Jan 30 11:27:24 2023 -0800 test commit b71d6f3 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Fri Jan 27 10:25:23 2023 -0800 use private electron overlay package commit c0f0c62 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Jan 24 23:14:39 2023 -0800 fixed webview tag for mm popup and notification commit d2983c1 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Jan 23 16:07:51 2023 -0800 Update index.tsx commit 414ee40 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Jan 23 15:57:05 2023 -0800 overlay working with webview mm popup commit 5cee332 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Jan 16 21:48:53 2023 -0800 refactor to npm package for electron overlay commit 671852c Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Jan 16 20:49:38 2023 -0800 fix pid parsing, update to latest from hyperplay-goverlay, hyperplay-legendary, and hyperplay-gogdl commit f667484 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Sun Jan 15 20:14:31 2023 -0800 fix app load commit f139d4d Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Sun Jan 15 20:11:24 2023 -0800 fix overlay rebase errors commit 034e40d Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Mon Sep 26 09:32:11 2022 -0700 working with legendary, added readme, time of day added to overlay commit 303be75 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Thu Sep 22 13:56:37 2022 -0700 refactored for use with hyperplay overlay, can now code hp overlay in react, supports hmr for overlay, has access to preload script fxns, rm goverlay client code commit 4d8ae49 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Wed Sep 21 17:11:15 2022 -0700 injecting on gog game launch commit f0f74d1 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Sep 20 22:06:20 2022 -0700 prettier commit a8075a3 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Sep 20 21:55:04 2022 -0700 re-enabling strictPropertyInit ts check commit 1512706 Author: BrettCleary <27568879+BrettCleary@users.noreply.github.com> Date: Tue Sep 20 21:31:01 2022 -0700 overlay injection working dx9-11 on windows, browser window streaming from electron app * update extension helper and proxy server main branches * update ext helper, fix overlay url param * add toast overlay, upgrade electron overlay version * update txn toasts * fix hotkey conflict desktop and browser game overlays * fix scrolling in overlay * change to case sensitive headers * bump electron overlay version * change electron-overlay to optional dep * Update .prettierignore * fix tests on linux * update to latest electron overlay * rm heroic wine downloader * rm electron-rebuild * rm unused ipcBridge types * Update build.yml * Create overlay_games.md * fix: install private packages on build * fix: github token * only show mm extension in overlay if it is connected * update to main merged submodules * fix electron notarize import * fix: apple sign during build * add reset metamask extension button * add initial toast on game launch * fix reset app * refactor in BrowserExtensionManager * make prettier * fix callContract bug * [Fix] MetaMask Extension Loading Error (#154) * fix db lock bugs, refactor frontend onboarding mm ext code * rm unused code for rm extension feature this does not currently work on windows so I am removing it * add fs-extra back, rm comment * update fs-extra version range * Update hyperplay-extension-helper * update to latest electron overlay * pretty * update overlay popup logic * pretty again * change hotkey to alt+x * add en translations for overlay elements * add option+x as an overlay hotkey * prettier --------- Co-authored-by: askatme <qzq91@126.com> Co-authored-by: Flavio F Lima <flavioislima@gmail.com>
1 parent bfb6a08 commit c47575e

File tree

36 files changed

+1561
-145
lines changed

36 files changed

+1561
-145
lines changed

.github/workflows/build.yml

+17-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ name: Build
22

33
on:
44
push:
5-
branches: [main, stable]
5+
branches: [main, stable, overlay]
66
tags:
77
- '!v*'
88
workflow_dispatch:
99

10+
env:
11+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
12+
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
13+
CSC_IDENTITY_AUTO_DISCOVERY: true
14+
CSC_LINK: ${{ secrets.CSC_LINK }}
15+
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
16+
APPLE_ID: ${{ secrets.APPLEID }}
17+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
18+
TEAMID: ${{ secrets.TEAMID }}
19+
1020
jobs:
1121
build_windows:
1222
runs-on: windows-latest
@@ -24,14 +34,16 @@ jobs:
2434
run: >
2535
git config --global url."https://github.com/".insteadOf
2636
ssh://git@github.com/
37+
- name: Authenticate with private NPM package
38+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
2739
- name: Install modules.
2840
run: npm i --legacy-peer-deps
2941
- name: Build artifacts.
30-
run: npm run dist:win portable
42+
run: npm run dist:win nsis
3143
- name: Upload EXE.
3244
uses: actions/upload-artifact@v2
3345
with:
34-
name: win-portable
46+
name: win-setup
3547
path: dist/HyperPlay*.exe
3648
retention-days: 14
3749
build_linux:
@@ -78,6 +90,8 @@ jobs:
7890
run: >
7991
git config --global url."https://github.com/".insteadOf
8092
ssh://git@github.com/
93+
- name: Authenticate with private NPM package
94+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
8195
- name: Install modules.
8296
run: yarn
8397
- name: Build artifacts.

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ coverage
55
public/locales/
66
flatpak
77
extensions/
8-
sign/
8+
doc
9+
sign/

doc/osr.html

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<html>
2+
<head>
3+
<style>
4+
body {
5+
background-color: rgba(67, 138, 138, 0.25);
6+
margin: 0px;
7+
}
8+
9+
h1 {
10+
color: maroon;
11+
margin-left: 40px;
12+
}
13+
14+
.caption {
15+
height: 40px;
16+
background-color: brown;
17+
}
18+
</style>
19+
<title>OsrWindow</title>
20+
</head>
21+
22+
<body>
23+
<div>
24+
<div class="caption"></div>
25+
<button id="button">Button</button>
26+
<button id="doit">doit</button>
27+
<webview
28+
id="foo"
29+
src="https://www.google.com/"
30+
style="width: 640px; height: 480px"
31+
></webview>
32+
<br />
33+
Hello Electron!
34+
35+
<label id="label">Label</label>
36+
<input type="text" /><input />
37+
</div>
38+
<script>
39+
const label = document.getElementById("label");
40+
setInterval(() => {
41+
label.innerText = new Date().toString();
42+
// console.log(label.innerText)
43+
}, 1000);
44+
45+
const { ipcRenderer, remote } = window.require("electron");
46+
47+
const button = document.getElementById("button");
48+
button.addEventListener("click", () => {
49+
remote
50+
.getCurrentWindow()
51+
.setSize(window.innerWidth + 20, window.innerHeight + 20);
52+
console.log("button click ", new Date().toString());
53+
ipcRenderer.send("osrClick");
54+
});
55+
56+
const doit = document.getElementById("doit");
57+
doit.addEventListener("click", () => {
58+
ipcRenderer.send("doit");
59+
});
60+
61+
window.onfocus = function () {
62+
console.log("focus");
63+
};
64+
window.onblur = function () {
65+
console.log("blur");
66+
};
67+
68+
ipcRenderer.on("proxyWebViewInput", (event, input) => {
69+
let views = document.getElementsByTagName("webview");
70+
for (var i = 0; i < views.length; i++) {
71+
let view = views[i];
72+
73+
let newInput;
74+
if (
75+
input.type === "mouseMove" ||
76+
input.type === "mouseUp" ||
77+
input.type === "mouseDown"
78+
) {
79+
let bounds = view.getBoundingClientRect();
80+
let newX = input.x - bounds.x;
81+
let newY = input.y - bounds.y;
82+
// make sure this is still inside the bounding box
83+
newInput = { ...input, x: newX, y: newY };
84+
if (
85+
newX >= 0 &&
86+
newY >= 0 &&
87+
newX <= bounds.width &&
88+
newY <= bounds.height
89+
) {
90+
view.sendInputEvent(newInput);
91+
} else {
92+
// we're outside of the web view
93+
if (input.type === "mouseDown") {
94+
view.executeJavaScript("document.activeElement.blur()");
95+
} else {
96+
return;
97+
}
98+
}
99+
} else {
100+
// not the mouse, just send it over
101+
view.sendInputEvent(input);
102+
}
103+
}
104+
});
105+
</script>
106+
</body>
107+
</html>

doc/overlay_games.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Desktop Overlay Games
2+
3+
## Windows Native on Windows
4+
### Working Games
5+
#### Gog
6+
- Ori
7+
8+
#### Epic
9+
- Hundred Days Wine Simulator
10+
11+
### Injecting with Issues
12+
- Cyberpunk 2077 injects but mouse cannot move from center of screen
13+
14+
### Non Working Games
15+
- Celeste
16+
- Ark Survival Evolved
17+
-

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"@fortawesome/free-regular-svg-icons": "^6.1.1",
137137
"@fortawesome/free-solid-svg-icons": "^6.1.1",
138138
"@fortawesome/react-fontawesome": "^0.1.18",
139-
"@hyperplay/ui": "^0.0.3",
139+
"@hyperplay/ui": "^0.0.5",
140140
"@metamask/sdk": "^0.1.0",
141141
"@mui/icons-material": "^5.10.9",
142142
"@mui/material": "^5.10.12",
@@ -262,5 +262,8 @@
262262
"vite": "^3.2.2",
263263
"vite-plugin-electron": "^0.10.2",
264264
"vite-plugin-svgr": "^2.2.2"
265+
},
266+
"optionalDependencies": {
267+
"@hyperplay/electron-overlay": "^0.0.8"
265268
}
266269
}

public/locales/en/translation.json

+36
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,42 @@
269269
"part2": "For other places, use a symbolic link to one of these folders"
270270
}
271271
},
272+
"hyperplayOverlay": {
273+
"greeting": "HyperPlay Overlay is ready! Press Alt or Option + X to show or hide it.",
274+
"signatureRequest": {
275+
"INITIATED": "Signature request pending",
276+
"FAILED": "Signature interrupted",
277+
"CONFIRMED": "Signature submitted"
278+
},
279+
"chainRequest": {
280+
"INITIATED": "Custom network request",
281+
"FAILED": "Custom network canceled",
282+
"CONFIRMED": "Custom network added"
283+
},
284+
"description": {
285+
"INITIATED": "A wallet confirmation is pending in your mobile wallet",
286+
"PENDING": "Waiting for blockchain confirmation. We'll let you know when it's confirmed",
287+
"FAILED": "The transaction was canceled or not submitted, please try again",
288+
"CONFIRMED": "The transaction was successfully confirmed!"
289+
},
290+
"txnRequest": {
291+
"INITIATED": "Transaction request pending",
292+
"PENDING": "Transaction submitted",
293+
"FAILED": "Transaction interrupted",
294+
"CONFIRMED": "Transaction confirmed"
295+
},
296+
"walletWatch": {
297+
"INITIATED": "Add custom token request pending",
298+
"FAILED": "Custom token request canceled",
299+
"CONFIRMED": "Custom token added"
300+
},
301+
"extensionNotification": {
302+
"TITLE": "Transaction requested",
303+
"DESCRIPTION": "Press Alt or Option + X to see this transaction",
304+
"STATUS": "pending"
305+
},
306+
"desktopHotkeyHint": "Press Alt or Option + X to return to the game"
307+
},
272308
"info": {
273309
"hyperplay": {
274310
"beta": "Beta",

sign/notarize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('dotenv').config()
2-
const { notarize } = require('electron-notarize')
2+
const { notarize } = require('@electron/notarize')
33

44
exports.default = async function notarizing(context) {
55
const { electronPlatformName, appOutDir } = context

src/backend/api/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Wine from './wine'
77
import * as Proxy from '../hyperplay-proxy-server/api/proxy'
88
import * as DownloadManager from './downloadmanager'
99
import * as Extensions from '../hyperplay-extension-helper/api/extensions'
10+
import * as Overlay from '../overlay/api'
1011
import * as Metrics from './metrics'
1112

1213
export default {
@@ -19,5 +20,6 @@ export default {
1920
...Proxy,
2021
...DownloadManager,
2122
...Extensions,
23+
...Overlay,
2224
...Metrics
2325
}

src/backend/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const legendaryConfigPath = isLinux
4545
const appConfigFolder = join(configFolder, 'hyperplay')
4646
const configPath = join(appConfigFolder, 'config.json')
4747
const gamesConfigPath = join(appConfigFolder, 'GamesConfig')
48+
4849
const toolsPath = join(appConfigFolder, 'tools')
4950
const iconsFolder = join(appConfigFolder, 'icons')
5051
const installPath = join(homedir(), 'Games', 'HyperPlay')

src/backend/launcher.ts

+27-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { spawn } from 'child_process'
5050
import shlex from 'shlex'
5151
import { isOnline } from './online_monitor'
5252
import { showDialogBoxModalAuto } from './dialog/dialog'
53+
import { OverlayApp } from './overlay/overlay'
5354

5455
async function prepareLaunch(
5556
gameSettings: GameSettings,
@@ -710,23 +711,46 @@ async function callRunner(
710711
signal: abortController.signal
711712
})
712713

714+
if (runner.name === 'sideload') {
715+
logInfo(
716+
`Process PID for sideloaded game injected: ${child.pid}`,
717+
runner.logPrefix
718+
)
719+
if (child.pid !== undefined)
720+
OverlayApp.inject({ pid: child.pid.toString() })
721+
}
722+
713723
const stdout: string[] = []
714724
const stderr: string[] = []
715725

716726
child.stdout.setEncoding('utf-8')
717727
child.stdout.on('data', (data: string) => {
728+
const dataStr = data.toString()
729+
const pidPrefix = 'pid for popen process:'
730+
const pidPrefixStartIndex = dataStr.search(pidPrefix)
731+
if (pidPrefixStartIndex >= 0) {
732+
const PID = dataStr
733+
.substring(pidPrefixStartIndex + pidPrefix.length)
734+
.trim()
735+
logInfo(
736+
`Process PID for Gogdl or Epic game injected: ${child.pid}`,
737+
runner.logPrefix
738+
)
739+
//inject here
740+
OverlayApp.inject({ pid: PID.trim() })
741+
}
718742
if (options?.logFile) {
719-
appendFileSync(options.logFile, data)
743+
appendFileSync(options.logFile, dataStr)
720744
}
721745
if (options?.verboseLogFile) {
722746
appendFileSync(options.verboseLogFile, data)
723747
}
724748

725749
if (options?.onOutput) {
726-
options.onOutput(data, child)
750+
options.onOutput(dataStr, child)
727751
}
728752

729-
stdout.push(data.trim())
753+
stdout.push(dataStr.trim())
730754
})
731755

732756
child.stderr.setEncoding('utf-8')

0 commit comments

Comments
 (0)