From 069b400dd08e21ce8e52369e5708721680b2c1f4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 27 Feb 2024 19:36:03 +0900 Subject: [PATCH] Move manager to desktop game --- osu.Desktop/OsuGameDesktop.cs | 6 ++++++ .../Performance/HighPerformanceSessionManager.cs | 6 +++--- osu.Game/OsuGame.cs | 3 --- .../Performance/IHighPerformanceSessionManager.cs | 12 ++++++++++++ osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) rename {osu.Game => osu.Desktop}/Performance/HighPerformanceSessionManager.cs (90%) create mode 100644 osu.Game/Performance/IHighPerformanceSessionManager.cs diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index a0db896f46..5b5f5c2167 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Runtime.Versioning; using Microsoft.Win32; +using osu.Desktop.Performance; using osu.Desktop.Security; using osu.Framework.Platform; using osu.Game; @@ -15,9 +16,11 @@ using osu.Framework.Logging; using osu.Game.Updater; using osu.Desktop.Windows; +using osu.Framework.Allocation; using osu.Game.IO; using osu.Game.IPC; using osu.Game.Online.Multiplayer; +using osu.Game.Performance; using osu.Game.Utils; using SDL2; @@ -28,6 +31,9 @@ internal partial class OsuGameDesktop : OsuGame private OsuSchemeLinkIPCChannel? osuSchemeLinkIPCChannel; private ArchiveImportIPCChannel? archiveImportIPCChannel; + [Cached(typeof(IHighPerformanceSessionManager))] + private readonly HighPerformanceSessionManager highPerformanceSessionManager = new HighPerformanceSessionManager(); + public OsuGameDesktop(string[]? args = null) : base(args) { diff --git a/osu.Game/Performance/HighPerformanceSessionManager.cs b/osu.Desktop/Performance/HighPerformanceSessionManager.cs similarity index 90% rename from osu.Game/Performance/HighPerformanceSessionManager.cs rename to osu.Desktop/Performance/HighPerformanceSessionManager.cs index 304ab44975..eb2b3be5b9 100644 --- a/osu.Game/Performance/HighPerformanceSessionManager.cs +++ b/osu.Desktop/Performance/HighPerformanceSessionManager.cs @@ -4,12 +4,12 @@ using System; using System.Runtime; using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Framework.Logging; +using osu.Game.Performance; -namespace osu.Game.Performance +namespace osu.Desktop.Performance { - public partial class HighPerformanceSessionManager : Component + public class HighPerformanceSessionManager : IHighPerformanceSessionManager { private GCLatencyMode originalGCMode; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 13e80e0707..f65557c6bb 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -55,7 +55,6 @@ using osu.Game.Overlays.SkinEditor; using osu.Game.Overlays.Toolbar; using osu.Game.Overlays.Volume; -using osu.Game.Performance; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens; @@ -1086,8 +1085,6 @@ protected override void LoadComplete() loadComponentSingleFile(new AccountCreationOverlay(), topMostOverlayContent.Add, true); loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true); - loadComponentSingleFile(new HighPerformanceSessionManager(), Add, true); - loadComponentSingleFile(new BackgroundDataStoreProcessor(), Add); Add(difficultyRecommender); diff --git a/osu.Game/Performance/IHighPerformanceSessionManager.cs b/osu.Game/Performance/IHighPerformanceSessionManager.cs new file mode 100644 index 0000000000..826a0a04f5 --- /dev/null +++ b/osu.Game/Performance/IHighPerformanceSessionManager.cs @@ -0,0 +1,12 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace osu.Game.Performance +{ + public interface IHighPerformanceSessionManager + { + IDisposable BeginSession(); + } +} diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index fe235dd56d..00a4a86c71 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -156,7 +156,7 @@ protected bool BackgroundBrightnessReduction private BatteryInfo? batteryInfo { get; set; } [Resolved] - private HighPerformanceSessionManager? highPerformanceSessionManager { get; set; } + private IHighPerformanceSessionManager? highPerformanceSessionManager { get; set; } public PlayerLoader(Func createPlayer) {