fix(plugin): revert to RegisterForGameStarted/Stopped for runtime compat

This commit is contained in:
2026-06-28 18:54:46 +08:00
parent a49aca93c7
commit 677adc5ad0
2 changed files with 12 additions and 7 deletions
+6 -7
View File
@@ -42,15 +42,14 @@ function Content() {
// ── Register SteamClient game events ──────────────────────────
useEffect(() => {
try {
const startedReg = SteamClient.Apps.RegisterForGameActionStart(
(_gameActionId: number, appId: string, _action: string, _source: number) => {
const appIdNum = parseInt(appId, 10)
onGameStart(appIdNum, `App ${appId}`)
},
)
// Use RegisterForGameStarted/Stopped — these are the most widely used
// APIs in Decky plugins despite TypeScript type warnings.
const startedReg = SteamClient.Apps.RegisterForGameStarted((appId: number) => {
onGameStart(appId, `App ${appId}`)
})
gameStartedUnregRef.current = startedReg
const stoppedReg = SteamClient.Apps.RegisterForGameActionEnd((_gameActionId: number) => {
const stoppedReg = SteamClient.Apps.RegisterForGameStopped((_appId: number) => {
onGameStop()
})
gameStoppedUnregRef.current = stoppedReg
+6
View File
@@ -5,6 +5,12 @@
declare global {
const SteamClient: {
Apps: {
RegisterForGameStarted: (
callback: (appId: number) => void,
) => { unregister: () => void }
RegisterForGameStopped: (
callback: (appId: number) => void,
) => { unregister: () => void }
RegisterForGameActionStart: (
callback: (gameActionId: number, appId: string, action: string, source: number) => void,
) => { unregister: () => void }