From 56ca1fba148a5d30d19348c651e1830e4d8a2d74 Mon Sep 17 00:00:00 2001 From: Repflez <659133+Repflez@users.noreply.github.com> Date: Tue, 22 Feb 2022 04:53:43 -0700 Subject: [PATCH] feat: Allow toggling recording from XBG --- Plugin.cs | 7 +++++++ RecordingEnable.cs | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 RecordingEnable.cs diff --git a/Plugin.cs b/Plugin.cs index f203ae4..a5299ce 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -16,6 +16,8 @@ namespace TaikoModStuff public static ConfigEntry configCustomFramerate; public static ConfigEntry configToggleVSync; + public static ConfigEntry configEnableRecording; + public override void Load() { // Add configurations @@ -44,12 +46,17 @@ namespace TaikoModStuff true, "Enable VSync."); + configEnableRecording = Config.Bind("General.Toggles", + "EnableGameBarRecording", + true, + "Enables Game Recording from the Xbox Game Bar where it was previously disabled."); var instance = new Harmony(PluginInfo.PLUGIN_NAME); instance.PatchAll(typeof(FontChanger)); instance.PatchAll(typeof(CustomResolution)); instance.PatchAll(typeof(ForceFramerate)); + instance.PatchAll(typeof(RecordingEnable)); // Plugin startup logic Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!"); diff --git a/RecordingEnable.cs b/RecordingEnable.cs new file mode 100644 index 0000000..d402107 --- /dev/null +++ b/RecordingEnable.cs @@ -0,0 +1,19 @@ +using HarmonyLib; +using Il2CppMicrosoft.Xbox; + +namespace TaikoModStuff +{ + internal class RecordingEnable + { + // Skip the original method, we're doing magic here + [HarmonyPatch(typeof(GdkHelpers), "CaptureDisable")] + [HarmonyPrefix] + static bool PrefixRecording() + { + if (Plugin.configEnableRecording.Value) + return false; + + else return true; + } + } +}