Move manager to desktop game

This commit is contained in:
Dan Balasescu 2024-02-27 19:36:03 +09:00
parent dc3b41865c
commit 069b400dd0
No known key found for this signature in database
5 changed files with 22 additions and 7 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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<IDialogOverlay>(new DialogOverlay(), topMostOverlayContent.Add, true);
loadComponentSingleFile(new HighPerformanceSessionManager(), Add, true);
loadComponentSingleFile(new BackgroundDataStoreProcessor(), Add);
Add(difficultyRecommender);

View File

@ -0,0 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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();
}
}

View File

@ -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<Player> createPlayer)
{