diff --git a/packages/tosu/src/api/utils/buildResultV2.ts b/packages/tosu/src/api/utils/buildResultV2.ts index 623ad6f4..7bacb8a9 100644 --- a/packages/tosu/src/api/utils/buildResultV2.ts +++ b/packages/tosu/src/api/utils/buildResultV2.ts @@ -121,7 +121,7 @@ export const buildResult = (instanceManager: InstanceManager): ApiAnswer => { }, settings: { interfaceVisible: allTimesData.ShowInterface, - replayUIVisible: gamePlayData.isReplayUiHidden === false, + replayUIVisible: allTimesData.isReplayUiHidden === false, chatVisibilityStatus: { number: allTimesData.ChatStatus, name: ChatStatus[allTimesData.ChatStatus] || '' diff --git a/packages/tosu/src/entities/AllTimesData/index.ts b/packages/tosu/src/entities/AllTimesData/index.ts index 06b0189e..3810852e 100644 --- a/packages/tosu/src/entities/AllTimesData/index.ts +++ b/packages/tosu/src/entities/AllTimesData/index.ts @@ -12,6 +12,7 @@ export class AllTimesData extends AbstractEntity { gameTimePtr: number = 0; IsWatchingReplay: number = 0; + isReplayUiHidden: boolean = false; ShowInterface: boolean = false; ChatStatus: number = 0; @@ -51,14 +52,16 @@ export class AllTimesData extends AbstractEntity { chatCheckerAddr, skinDataAddr, settingsClassAddr, - canRunSlowlyAddr + canRunSlowlyAddr, + rulesetsAddr } = patterns.getPatterns([ 'statusPtr', 'menuModsPtr', 'chatCheckerAddr', 'skinDataAddr', 'settingsClassAddr', - 'canRunSlowlyAddr' + 'canRunSlowlyAddr', + 'rulesetsAddr' ]); // [Status - 0x4] @@ -87,6 +90,23 @@ export class AllTimesData extends AbstractEntity { ) ); + if (this.IsWatchingReplay) { + const rulesetAddr = process.readInt( + process.readInt(rulesetsAddr - 0xb) + 0x4 + ); + if (rulesetAddr !== 0) { + // rulesetAddr mean ReplayWatcher... Sooo.... + // Ruleset + 0x1d8 + this.isReplayUiHidden = Boolean( + process.readByte(rulesetAddr + 0x1d8) + ); + } else { + this.isReplayUiHidden = false; + } + } else { + this.isReplayUiHidden = false; + } + const skinOsuAddr = process.readInt(skinDataAddr + 0x7); if (skinOsuAddr !== 0) { const skinOsuBase = process.readInt(skinOsuAddr); diff --git a/packages/tosu/src/entities/GamePlayData/index.ts b/packages/tosu/src/entities/GamePlayData/index.ts index 0551bf1d..317e1bc4 100644 --- a/packages/tosu/src/entities/GamePlayData/index.ts +++ b/packages/tosu/src/entities/GamePlayData/index.ts @@ -154,7 +154,7 @@ export class GamePlayData extends AbstractEntity { updateState() { try { - const { process, patterns, allTimesData, menuData } = + const { process, patterns, menuData } = this.osuInstance.getServices([ 'process', 'patterns', @@ -199,16 +199,6 @@ export class GamePlayData extends AbstractEntity { // needed for ex like you done with replay watching/gameplay and return to mainMenu, you need alteast one reset to gamePlayData/resultsScreenData this.isDefaultState = false; - if (allTimesData.IsWatchingReplay) { - // rulesetAddr mean ReplayWatcher... Sooo.... - // Ruleset + 0x1d8 - this.isReplayUiHidden = Boolean( - process.readByte(rulesetAddr + 0x1d8) - ); - } else { - this.isReplayUiHidden = false; - } - // [Base - 0x33] + 0x8 this.Retries = process.readInt( process.readInt(baseAddr - 0x33) + 0x8