From 463258febbb67bf866b107bed2417a100f6eade3 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Fri, 16 Sep 2022 18:49:35 -0400 Subject: wait for toaster ready, hopefully fix file browser patch --- .../components/modals/filepicker/patches/library.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'frontend/src/components/modals/filepicker/patches') diff --git a/frontend/src/components/modals/filepicker/patches/library.ts b/frontend/src/components/modals/filepicker/patches/library.ts index 8792900d..7ba977a5 100644 --- a/frontend/src/components/modals/filepicker/patches/library.ts +++ b/frontend/src/components/modals/filepicker/patches/library.ts @@ -1,4 +1,4 @@ -import { replacePatch, sleep } from 'decky-frontend-lib'; +import { Patch, replacePatch, sleep } from 'decky-frontend-lib'; declare global { interface Window { @@ -7,9 +7,12 @@ declare global { } } -export default async function libraryPatch() { - await sleep(10000); // If you patch anything on SteamClient within the first few seconds of the client having loaded it will get redefined for some reason, so wait 10s - const patch = replacePatch(window.SteamClient.Apps, 'PromptToChangeShortcut', async ([appid]: number[]) => { +let patch: Patch; + +function rePatch() { + // If you patch anything on SteamClient within the first few seconds of the client having loaded it will get redefined for some reason, so repatch any of these changes that occur within the first minute of the client loading + patch?.unpatch(); + patch = replacePatch(window.SteamClient.Apps, 'PromptToChangeShortcut', async ([appid]: number[]) => { try { const details = window.appDetailsStore.GetAppDetails(appid); console.log(details); @@ -25,6 +28,13 @@ export default async function libraryPatch() { console.error(e); } }); +} + +export default async function libraryPatch() { + await sleep(10000); + rePatch(); + await sleep(10000); + rePatch(); return () => { patch.unpatch(); -- cgit v1.2.3