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
29 changes: 26 additions & 3 deletions packages/common/enums/osu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export enum LazerSettings {
MenuParallax,
Prefer24HourTime,
BeatmapDetailTab,
BeatmapLeaderboardSortMode,
BeatmapDetailModsFilter,
Username,
ReleaseStream,
Expand Down Expand Up @@ -296,13 +297,16 @@ export enum LazerSettings {
EditorShowStoryboard,
EditorSubmissionNotifyOnDiscussionReplies,
EditorSubmissionLoadInBrowserAfterSubmission,
WasSupporter
WasSupporter,
LastOnlineTagsPopulation,
AutomaticallyAdjustBeatmapOffset
}

export enum FrameworkSetting {
ShowLogOverlay,

AudioDevice,
AudioUseExperimentalWasapi,
VolumeUniversal,
VolumeEffect,
VolumeMusic,
Expand Down Expand Up @@ -343,15 +347,34 @@ export enum LazerBeatmapTabType {
team
}

export enum LazerGroupMode {
none,
artist,
author,
bpm,
collections,
dateAdded,
dateRanked,
difficulty,
favourites,
lastPlayed,
length,
myMaps,
rankAchieved,
rankedStatus,
source,
title
}

export enum LazerSortMode {
artist,
author,
bpm,
datesubmitted,
dateadded,
dateranked,
lastplayed,
datesubmitted,
difficulty,
lastplayed,
length,
source,
title
Expand Down
1 change: 0 additions & 1 deletion packages/tosu/src/api/types/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export interface Mouse {
disableButtons: boolean;
disableWheel: boolean;
rawInput: boolean;
highPrecision: boolean;
sensitivity: number;
}

Expand Down
7 changes: 5 additions & 2 deletions packages/tosu/src/api/utils/buildResultV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
GameState,
GroupType,
LazerBeatmapTabType,
LazerGroupMode,
LazerSortMode,
LeaderboardType,
ManiaScrollingDirection,
Expand Down Expand Up @@ -194,7 +195,6 @@ export const buildResult = (instanceManager: InstanceManager): ApiAnswer => {
},
mouse: {
rawInput: settings.mouse.rawInput,
highPrecision: settings.mouse.highPrecision,
disableButtons: settings.mouse.disableButtons,
disableWheel: settings.mouse.disableWheel,
sensitivity: settings.mouse.sensitivity
Expand Down Expand Up @@ -229,7 +229,10 @@ export const buildResult = (instanceManager: InstanceManager): ApiAnswer => {
},
group: {
number: settings.groupType,
name: GroupType[settings.groupType] || ''
name:
osuInstance.client === ClientType.lazer
? LazerGroupMode[settings.groupType] || ''
: GroupType[settings.groupType] || ''
},

skin: {
Expand Down
4 changes: 2 additions & 2 deletions packages/tosu/src/instances/lazerInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export class LazerInstance extends AbstractInstance {
const {
global,
menu,
bassDensity,
beatmapPP,
gameplay,
resultScreen,
Expand Down Expand Up @@ -288,8 +289,7 @@ export class LazerInstance extends AbstractInstance {

switch (global.status) {
case GameState.menu:
// FIXME: TODO
// bassDensity.updateState();
bassDensity.updateState();
break;

case GameState.edit:
Expand Down
101 changes: 91 additions & 10 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export interface Offsets {
SentryLogger: number;
channelManager: number;
'<frameworkConfig>k__BackingField': number;
chatOverlay: number;
};
'osu.Framework.Game': {
'<Host>k__BackingField': number;
Expand Down Expand Up @@ -161,6 +162,15 @@ export interface Offsets {
'osu.Game.Online.Multiplayer.MultiplayerClient': {
room: number;
};
'osu.Game.Overlays.ChatOverlay': {
State: number;
};
'osu.Game.Screens.Menu.OsuLogo': {
visualizer: number;
};
'osu.Game.Screens.Menu.LogoVisualisation': {
frequencyAmplitudes: number;
};
'osu.Game.Screens.Play.Player': {
'<api>k__BackingField': number;
'<scoreManager>k__BackingField': number;
Expand Down Expand Up @@ -269,6 +279,7 @@ export interface Offsets {
};
'osu.Game.Screens.Play.HUDOverlay': {
InputCountController: number;
'<ShowHud>k__BackingField': number;
};
'osu.Game.Screens.Play.HUD.InputCountController': {
triggers: number;
Expand Down Expand Up @@ -356,10 +367,12 @@ export interface Offsets {
}

const localConfigList = [
LazerSettings.ReleaseStream,
LazerSettings.ScoreDisplayMode,
LazerSettings.BeatmapDetailTab,
LazerSettings.SongSelectSortingMode,
LazerSettings.HUDVisibilityMode,
LazerSettings.SongSelectGroupMode,
LazerSettings.GameplayLeaderboard,
LazerSettings.ReplaySettingsOverlay,
LazerSettings.DimLevel,
LazerSettings.BlurLevel,
Expand All @@ -376,6 +389,7 @@ const localConfigList = [
];

const frameworkConfigList = [
FrameworkSetting.WindowMode,
FrameworkSetting.WindowedSize,
FrameworkSetting.VolumeUniversal,
FrameworkSetting.VolumeMusic,
Expand Down Expand Up @@ -404,7 +418,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {

private currentScreen: number = 0;
private scoringDisplayMode: ScoringMode = ScoringMode.standardised;
private HUDVisibilityMode: number = 0;
private showInterface: boolean = true;
private ReplaySettingsOverlay: boolean = true;

private modMappings: Map<string, string> = new Map();
Expand All @@ -413,6 +427,8 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {

private gameBaseAddress: number;

private isLeaderboardVisible: boolean = false;

patterns: LazerPatternData = {
scalingContainerTargetDrawSize: 0
};
Expand Down Expand Up @@ -932,6 +948,10 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
const address = localValues[key];

switch (key) {
case LazerSettings.ReleaseStream:
config['client.branch'] = this.process.readInt(address);
break;

case LazerSettings.ScoreDisplayMode:
this.scoringDisplayMode = this.process.readInt(address);
break;
Expand All @@ -944,8 +964,13 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
config.sortType = this.process.readInt(address);
break;

case LazerSettings.HUDVisibilityMode:
this.HUDVisibilityMode = this.process.readInt(address);
case LazerSettings.SongSelectGroupMode:
config.groupType = this.process.readInt(address);
break;

case LazerSettings.GameplayLeaderboard:
this.isLeaderboardVisible =
this.process.readByte(address) === 1;
break;

case LazerSettings.ReplaySettingsOverlay:
Expand All @@ -972,7 +997,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
break;

case LazerSettings.VolumeInactive:
config['audio.volume.musicInactive'] = fixDecimals(
config['audio.volume.masterInactive'] = fixDecimals(
this.process.readDouble(address) * 100
);
break;
Expand All @@ -997,6 +1022,8 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
case LazerSettings.ShowStoryboard:
config['background.storyboard'] =
this.process.readByte(address) === 1;
config['background.video'] =
this.process.readByte(address) === 1;
break;

case LazerSettings.MouseDisableButtons:
Expand Down Expand Up @@ -1039,6 +1066,11 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
const address = frameworkValues[key];

switch (key) {
case FrameworkSetting.WindowMode:
config['resolution.fullscreen'] =
this.process.readInt(address) === 2;
break;

case FrameworkSetting.WindowedSize:
config['resolution.width'] = this.process.readInt(
address + 0x4
Expand Down Expand Up @@ -1778,7 +1810,27 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
}

audioVelocityBase(): IAudioVelocityBase {
return [];
const osuLogo = this.process.readIntPtr(
this.gameBase() + this.offsets['osu.Game.OsuGame'].osuLogo
);

const visualizer = this.process.readIntPtr(
osuLogo + this.offsets['osu.Game.Screens.Menu.OsuLogo'].visualizer
);

const frequencyAmplitudes = this.process.readIntPtr(
visualizer +
this.offsets['osu.Game.Screens.Menu.LogoVisualisation']
.frequencyAmplitudes
);

const result: number[] = [];
for (let i = 0; i < 40; i++) {
result.push(
this.process.readFloat(frequencyAmplitudes + 0x10 + 0x4 * i)
);
}
return result;
}

readUser(user: number) {
Expand Down Expand Up @@ -3006,11 +3058,40 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {

this.isPlayerLoading = isPlayerLoader;

if (isPlaying) {
const hudOverlay = this.process.readIntPtr(
this.player() +
this.offsets['osu.Game.Screens.Play.Player'][
'<HUDOverlay>k__BackingField'
]
);

const showHudBindable = this.process.readIntPtr(
hudOverlay +
this.offsets['osu.Game.Screens.Play.HUDOverlay'][
'<ShowHud>k__BackingField'
]
);

this.showInterface =
this.process.readByte(showHudBindable + 0x40) === 1;
}

const chatOverlay = this.process.readIntPtr(
this.gameBase() + this.offsets['osu.Game.OsuGame'].chatOverlay
);

const stateBindable = this.process.readIntPtr(
chatOverlay + this.offsets['osu.Game.Overlays.ChatOverlay'].State
);

const chatStatus = this.process.readInt(stateBindable + 0x40);

return {
isWatchingReplay: watchingReplay,
isReplayUiHidden: !this.ReplaySettingsOverlay,
showInterface: this.HUDVisibilityMode > 0,
chatStatus: 0,
showInterface: this.showInterface,
chatStatus,
isMultiSpectating,
status,
gameTime: 0,
Expand Down Expand Up @@ -3261,7 +3342,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
// scores.push(this.readLeaderboardScore(items[i], i));
// }

return [true, personalScore, []];
return [this.isLeaderboardVisible, personalScore, []];
}

readSpectatingData(): ILazerSpectator {
Expand Down Expand Up @@ -3593,7 +3674,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
]['<UseRelativeMode>k__BackingField']
) + 0x40
) === 1;
values['mouse.highPrecision'] = userRelativeMode;
values['mouse.rawInput'] = userRelativeMode;
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/tosu/src/states/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class Settings extends AbstractState {
};

mouse: Mouse = {
highPrecision: false,
rawInput: false,
disableButtons: false,
disableWheel: false,
Expand Down