diff --git a/packages/tosu/src/entities/BeatmapPpData/index.ts b/packages/tosu/src/entities/BeatmapPpData/index.ts index 758c4ea5..24e5bbe1 100644 --- a/packages/tosu/src/entities/BeatmapPpData/index.ts +++ b/packages/tosu/src/entities/BeatmapPpData/index.ts @@ -238,7 +238,7 @@ export class BeatmapPPData extends AbstractEntity { return this.beatmap; } - updateMapMetadata(currentMods: number) { + updateMapMetadata(currentMods: number, currentMode: number) { try { const startTime = performance.now(); @@ -279,6 +279,8 @@ export class BeatmapPPData extends AbstractEntity { } this.beatmap = new rosu.Beatmap(this.beatmapContent); + if (this.beatmap.mode !== currentMode) + this.beatmap.convert(currentMode); const beatmapCheckTime = performance.now(); const totalTime = (beatmapCheckTime - startTime).toFixed(2); diff --git a/packages/tosu/src/entities/MenuData/index.ts b/packages/tosu/src/entities/MenuData/index.ts index 2eb00ed0..2b47965d 100644 --- a/packages/tosu/src/entities/MenuData/index.ts +++ b/packages/tosu/src/entities/MenuData/index.ts @@ -51,6 +51,9 @@ export class MenuData extends AbstractEntity { return 'not-ready'; } + // [Base - 0x33] + this.MenuGameMode = process.readPointer(baseAddr - 0x33); + // [[Beatmap] + 0x6C] const newMD5 = process.readSharpString( process.readInt(beatmapAddr + 0x6c) @@ -88,9 +91,6 @@ export class MenuData extends AbstractEntity { this.MD5 = newMD5; this.Path = newPath; - // [Base - 0x33] - this.MenuGameMode = process.readPointer(baseAddr - 0x33); - // [Base - 0x33] + 0xC this.Plays = process.readInt( process.readInt(baseAddr - 0x33) + 0xc diff --git a/packages/tosu/src/objects/instanceManager/osuInstance.ts b/packages/tosu/src/objects/instanceManager/osuInstance.ts index 7638959f..bc74c751 100644 --- a/packages/tosu/src/objects/instanceManager/osuInstance.ts +++ b/packages/tosu/src/objects/instanceManager/osuInstance.ts @@ -290,7 +290,14 @@ export class OsuInstance { ? resultsScreenData.Mods : allTimesData.MenuMods; - const currentState = `${menuData.MD5}:${menuData.MenuGameMode}:${currentMods}`; + const currentMode = + allTimesData.Status === 2 + ? gamePlayData.Mode + : allTimesData.Status === 7 + ? resultsScreenData.Mode + : menuData.MenuGameMode; + + const currentState = `${menuData.MD5}:${currentMode}:${currentMods}`; const updateGraph = this.previousState !== currentState || this.previousMP3Length !== menuData.MP3Length; @@ -299,8 +306,10 @@ export class OsuInstance { allTimesData.GameFolder && this.previousState !== currentState ) { - const metadataUpdate = - beatmapPpData.updateMapMetadata(currentMods); + const metadataUpdate = beatmapPpData.updateMapMetadata( + currentMods, + currentMode + ); if (metadataUpdate === 'not-ready') { await sleep(config.pollRate); continue;