From 4d988340eb02121e4f4645b480d657bbafbbfe4b Mon Sep 17 00:00:00 2001
From: Opelkuh <25430283+Opelkuh@users.noreply.github.com>
Date: Sat, 30 Oct 2021 01:02:53 +0200
Subject: [PATCH 1/2] Add hardware acceleration toggle
---
.../Localisation/GraphicsSettingsStrings.cs | 10 +++++
.../Sections/Graphics/VideoSettings.cs | 43 +++++++++++++++++++
.../Settings/Sections/GraphicsSection.cs | 1 +
3 files changed, 54 insertions(+)
create mode 100644 osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs
diff --git a/osu.Game/Localisation/GraphicsSettingsStrings.cs b/osu.Game/Localisation/GraphicsSettingsStrings.cs
index f85cc0f2ae..996a1350eb 100644
--- a/osu.Game/Localisation/GraphicsSettingsStrings.cs
+++ b/osu.Game/Localisation/GraphicsSettingsStrings.cs
@@ -119,6 +119,16 @@ namespace osu.Game.Localisation
///
public static LocalisableString ShowCursorInScreenshots => new TranslatableString(getKey(@"show_cursor_in_screenshots"), @"Show menu cursor in screenshots");
+ ///
+ /// "Video"
+ ///
+ public static LocalisableString VideoHeader => new TranslatableString(getKey(@"video_header"), @"Video");
+
+ ///
+ /// "Use hardware acceleration"
+ ///
+ public static LocalisableString UseHardwareAcceleration => new TranslatableString(getKey(@"use_hardware_acceleration"), @"Use hardware acceleration");
+
private static string getKey(string key) => $"{prefix}:{key}";
}
}
diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs
new file mode 100644
index 0000000000..921eab63ed
--- /dev/null
+++ b/osu.Game/Overlays/Settings/Sections/Graphics/VideoSettings.cs
@@ -0,0 +1,43 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
+using osu.Framework.Configuration;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Video;
+using osu.Framework.Localisation;
+using osu.Game.Localisation;
+
+namespace osu.Game.Overlays.Settings.Sections.Graphics
+{
+ public class VideoSettings : SettingsSubsection
+ {
+ protected override LocalisableString Header => GraphicsSettingsStrings.VideoHeader;
+
+ private Bindable hardwareVideoDecoder;
+ private SettingsCheckbox hwAccelCheckbox;
+
+ [BackgroundDependencyLoader]
+ private void load(FrameworkConfigManager config)
+ {
+ hardwareVideoDecoder = config.GetBindable(FrameworkSetting.HardwareVideoDecoder);
+
+ Children = new Drawable[]
+ {
+ hwAccelCheckbox = new SettingsCheckbox
+ {
+ LabelText = GraphicsSettingsStrings.UseHardwareAcceleration,
+ },
+ };
+
+ hwAccelCheckbox.Current.Default = hardwareVideoDecoder.Default != HardwareVideoDecoder.None;
+ hwAccelCheckbox.Current.Value = hardwareVideoDecoder.Value != HardwareVideoDecoder.None;
+
+ hwAccelCheckbox.Current.BindValueChanged(val =>
+ {
+ hardwareVideoDecoder.Value = val.NewValue ? HardwareVideoDecoder.Any : HardwareVideoDecoder.None;
+ });
+ }
+ }
+}
diff --git a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
index 591848506a..c792098c6d 100644
--- a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
+++ b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
@@ -25,6 +25,7 @@ namespace osu.Game.Overlays.Settings.Sections
new LayoutSettings(),
new RendererSettings(),
new ScreenshotSettings(),
+ new VideoSettings(),
};
}
}
From e9473db77c61ce3e7b15f7f770634c5665b50d2d Mon Sep 17 00:00:00 2001
From: Dean Herbert
Date: Sat, 30 Oct 2021 20:37:55 +0900
Subject: [PATCH 2/2] Reorder to have video settings next to renderer
Co-authored-by: Salman Ahmed
---
osu.Game/Overlays/Settings/Sections/GraphicsSection.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
index c792098c6d..8cd3b841c2 100644
--- a/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
+++ b/osu.Game/Overlays/Settings/Sections/GraphicsSection.cs
@@ -24,8 +24,8 @@ namespace osu.Game.Overlays.Settings.Sections
{
new LayoutSettings(),
new RendererSettings(),
- new ScreenshotSettings(),
new VideoSettings(),
+ new ScreenshotSettings(),
};
}
}