Skip to content

Commit

Permalink
fix: Move isReplayUiHidden toi AllTimesData
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Jul 28, 2024
1 parent e056d7f commit 3043837
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/tosu/src/api/utils/buildResultV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] || ''
Expand Down
24 changes: 22 additions & 2 deletions packages/tosu/src/entities/AllTimesData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class AllTimesData extends AbstractEntity {
gameTimePtr: number = 0;

IsWatchingReplay: number = 0;
isReplayUiHidden: boolean = false;
ShowInterface: boolean = false;

ChatStatus: number = 0;
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 1 addition & 11 deletions packages/tosu/src/entities/GamePlayData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3043837

Please sign in to comment.