From 334f882463cba4638783117df1655fba0e15036d Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 17 May 2024 16:22:59 -0500 Subject: [PATCH] adds a timeout to wait for tGameMain to exist --- flowerful.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/flowerful.ts b/flowerful.ts index 1b1b0bd..7cf1ad0 100644 --- a/flowerful.ts +++ b/flowerful.ts @@ -9,7 +9,13 @@ import { RegisterPatch, ApplyAllPatches } from "./flowerful.patches"; declare const nw: any; /* Set this to true to get ALL the spammy log messages */ -const debuglogging = false; +const debuglogging = true; + +/** + * This is how long flower waits in ms before setting up at the start + * This will need to be configurable on a per-game basis + */ +const timeout = 75; //#region flower_ctor @@ -163,7 +169,10 @@ function SetupLogger() /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ }, function (win: any) { - win.once('loaded', function () { onLoggerWindowLoaded(win) }); + win.once('loaded', function () + { + onLoggerWindowLoaded(win); + }); }); } @@ -181,5 +190,8 @@ function onLoggerWindowLoaded(win: any) window.onload = function () { - SetupLogger(); + window.setTimeout(() => + { + SetupLogger(); + }, timeout); }; \ No newline at end of file