mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-15 18:13:40 +03:00
wait for toaster ready, hopefully fix file browser patch
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -15,6 +15,7 @@ class Toaster extends Logger {
|
||||
private instanceRetPatch?: Patch;
|
||||
private node: any;
|
||||
private settingsModule: any;
|
||||
private ready: boolean = false;
|
||||
|
||||
constructor() {
|
||||
super('Toaster');
|
||||
@@ -72,9 +73,13 @@ class Toaster extends Logger {
|
||||
};
|
||||
this.node.stateNode.forceUpdate();
|
||||
this.log('Initialized');
|
||||
this.ready = true;
|
||||
}
|
||||
|
||||
toast(toast: ToastData) {
|
||||
async toast(toast: ToastData) {
|
||||
while (!this.ready) {
|
||||
await sleep(100);
|
||||
}
|
||||
const settings = this.settingsModule.settings;
|
||||
let toastData = {
|
||||
nNotificationID: window.NotificationStore.m_nNextTestNotificationID++,
|
||||
|
||||
Reference in New Issue
Block a user