Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/tosu/src/memory/stable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { calculateAccuracy } from '@/utils/calculators';
import { netDateBinaryToDate } from '@/utils/converters';
import { fromLegacyHitResults } from '@/utils/hitResult';
import { calculateMods, defaultCalculatedMods } from '@/utils/osuMods';
import { OsuMods } from '@/utils/osuMods.types';
import type {
BindingsList,
ConfigList,
Expand Down Expand Up @@ -544,18 +545,26 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
const playerName = this.process.readSharpString(
this.process.readInt(scoreBase + 0x28)
);

// [[Ruleset + 0x64] + 0x38] + 0x64
const mode = this.process.readInt(scoreBase + 0x64);

const scoreProcessor = this.process.readInt(scoreBase + 0x54);

// [[[Ruleset + 0x64] + 0x38] + 0x1C] + 0xC ^ [[[Ruleset + 0x64] + 0x38] + 0x1C] + 0x8
const modsInt =
let modsInt =
this.process.readInt(
this.process.readInt(scoreBase + 0x1c) + 0xc
) ^
this.process.readInt(
this.process.readInt(scoreBase + 0x1c) + 0x8
);
// [[Ruleset + 0x64] + 0x38] + 0x64
const mode = this.process.readInt(scoreBase + 0x64);

const scoreProcessor = this.process.readInt(scoreBase + 0x54);
// Scorev2 is not on mods if it's specified as a win condition.
if (scoreProcessor !== 0) {
modsInt |= OsuMods.ScoreV2;
}

const score =
scoreProcessor === 0
? this.process.readInt(scoreBase + 0x78) // v1
Expand Down
2 changes: 1 addition & 1 deletion packages/tosu/src/utils/osuMods.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export enum OsuMods {
Key1 = 1 << 26,
Key3 = 1 << 27,
Key2 = 1 << 28,
LastMod = 1 << 29,
ScoreV2 = 1 << 29,
keyMod = Key1 |
Key2 |
Key3 |
Expand Down