From 89c544e3378240feb6db14e504084a385bbeb3ca Mon Sep 17 00:00:00 2001 From: Mikhail Babynichev Date: Tue, 19 Dec 2023 20:06:21 +0300 Subject: [PATCH] fix: more try/catches because at fast speeds, still having issues with offsets --- .../objects/instanceManager/osuInstance.ts | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/packages/tosu/src/objects/instanceManager/osuInstance.ts b/packages/tosu/src/objects/instanceManager/osuInstance.ts index 4121c266..a2a5142d 100644 --- a/packages/tosu/src/objects/instanceManager/osuInstance.ts +++ b/packages/tosu/src/objects/instanceManager/osuInstance.ts @@ -213,7 +213,11 @@ export class OsuInstance { prevTime = allTimesData.PlayTime; - if (allTimesData.PlayTime < 150) { + if ( + allTimesData.PlayTime < 150 && + !gamePlayData.isDefaultState + ) { + gamePlayData.init(); break; } @@ -238,7 +242,7 @@ export class OsuInstance { await tourneyUserProfileData.updateState(); } } catch (exc) { - wLogger.error('error happend while another loop executed`'); + wLogger.error('error happend while another loop executed'); console.error(exc); } @@ -255,20 +259,27 @@ export class OsuInstance { ]); while (!this.isDestroyed) { - switch (allTimesData.Status) { - case 2: - if (allTimesData.PlayTime < 150) { + try { + switch (allTimesData.Status) { + case 2: + if (allTimesData.PlayTime < 150) { + break; + } + + await gamePlayData.updateKeyOverlay(); + // await break; - } + default: + // no-default + } - await gamePlayData.updateKeyOverlay(); - // await - break; - default: - // no-default + await sleep(config.keyOverlayPollRate); + } catch (exc) { + wLogger.error( + 'error happend while keyboard overlay attempted to parse' + ); + console.error(exc); } - - await sleep(config.keyOverlayPollRate); } }