From 5daea91e06abbc87935bfbe58b73948d12ed3e4a Mon Sep 17 00:00:00 2001 From: Fluto Date: Sat, 20 Aug 2022 13:10:57 +1000 Subject: [PATCH] Moved patches to a patches folder --- TakoTako/IL2CPPHelper.cs | 20 ------------------- .../CustomMusicLoaderPatch.cs} | 4 ++-- .../DisableScreenChangeOnFocusPatch.cs} | 6 +++--- TakoTako/{ => Patches}/SignInPatch.cs | 3 ++- .../SkipDLCCheckPatch.cs} | 4 ++-- .../SkipSplashScreenPatch.cs} | 6 +++--- .../TaikoDrumSupportPatch.cs} | 4 ++-- TakoTako/Plugin.cs | 13 ++++++------ 8 files changed, 21 insertions(+), 39 deletions(-) delete mode 100644 TakoTako/IL2CPPHelper.cs rename TakoTako/{MusicPatch.cs => Patches/CustomMusicLoaderPatch.cs} (99%) rename TakoTako/{DisableScreenChangeOnFocus.cs => Patches/DisableScreenChangeOnFocusPatch.cs} (84%) rename TakoTako/{ => Patches}/SignInPatch.cs (95%) rename TakoTako/{SkipDLCCheck.cs => Patches/SkipDLCCheckPatch.cs} (92%) rename TakoTako/{SkipSplashScreen.cs => Patches/SkipSplashScreenPatch.cs} (89%) rename TakoTako/{TaikoDrumSupport.cs => Patches/TaikoDrumSupportPatch.cs} (99%) diff --git a/TakoTako/IL2CPPHelper.cs b/TakoTako/IL2CPPHelper.cs deleted file mode 100644 index e79766b..0000000 --- a/TakoTako/IL2CPPHelper.cs +++ /dev/null @@ -1,20 +0,0 @@ - -#if TAIKO_IL2CPP -using System; -using System.Runtime.InteropServices; -// using Il2CppSystem.Runtime.InteropServices; -using UnhollowerBaseLib; - -namespace TakoTako; - -public class ReferenceObject : Il2CppObjectBase -{ - public T Value { get; private set; } - public ReferenceObject(IntPtr pointer) : base(pointer) - { - Value = Marshal.PtrToStructure(pointer); - } - - public static implicit operator T (ReferenceObject value) => value.Value; -} -#endif diff --git a/TakoTako/MusicPatch.cs b/TakoTako/Patches/CustomMusicLoaderPatch.cs similarity index 99% rename from TakoTako/MusicPatch.cs rename to TakoTako/Patches/CustomMusicLoaderPatch.cs index dcc3518..2ce4d30 100644 --- a/TakoTako/MusicPatch.cs +++ b/TakoTako/Patches/CustomMusicLoaderPatch.cs @@ -23,14 +23,14 @@ using SongSelectRanking; using TakoTako.Common; using UnityEngine; -namespace TakoTako; +namespace TakoTako.Patches; /// /// This will allow custom songs to be read in /// [HarmonyPatch] [SuppressMessage("ReSharper", "InconsistentNaming")] -public class MusicPatch +public class CustomMusicLoaderPatch { public static int SaveDataMax => DataConst.MusicMax; diff --git a/TakoTako/DisableScreenChangeOnFocus.cs b/TakoTako/Patches/DisableScreenChangeOnFocusPatch.cs similarity index 84% rename from TakoTako/DisableScreenChangeOnFocus.cs rename to TakoTako/Patches/DisableScreenChangeOnFocusPatch.cs index 84cd4c4..7633e55 100644 --- a/TakoTako/DisableScreenChangeOnFocus.cs +++ b/TakoTako/Patches/DisableScreenChangeOnFocusPatch.cs @@ -1,9 +1,9 @@ using HarmonyLib; -namespace TakoTako; +namespace TakoTako.Patches; [HarmonyPatch] -public class DisableScreenChangeOnFocus +public class DisableScreenChangeOnFocusPatch { [HarmonyPatch(typeof(FocusManager), "OnApplicationFocus")] [HarmonyPrefix] @@ -18,4 +18,4 @@ public class DisableScreenChangeOnFocus { return false; } -} \ No newline at end of file +} diff --git a/TakoTako/SignInPatch.cs b/TakoTako/Patches/SignInPatch.cs similarity index 95% rename from TakoTako/SignInPatch.cs rename to TakoTako/Patches/SignInPatch.cs index 69e9176..8a195e3 100644 --- a/TakoTako/SignInPatch.cs +++ b/TakoTako/Patches/SignInPatch.cs @@ -5,7 +5,8 @@ using Microsoft.Xbox; #if TAIKO_IL2CPP using Il2CppMicrosoft.Xbox; #endif -namespace TakoTako; + +namespace TakoTako.Patches; /// /// This patch will address the issue where signing with GDK is done correctly diff --git a/TakoTako/SkipDLCCheck.cs b/TakoTako/Patches/SkipDLCCheckPatch.cs similarity index 92% rename from TakoTako/SkipDLCCheck.cs rename to TakoTako/Patches/SkipDLCCheckPatch.cs index f332379..f1961f5 100644 --- a/TakoTako/SkipDLCCheck.cs +++ b/TakoTako/Patches/SkipDLCCheckPatch.cs @@ -1,11 +1,11 @@ using System.Diagnostics.CodeAnalysis; using HarmonyLib; -namespace TakoTako; +namespace TakoTako.Patches; #if TAIKO_IL2CPP [SuppressMessage("ReSharper", "InconsistentNaming")] -public class SkipDLCCheck +public class SkipDLCCheckPatch { private static SongSelectManager songSelectManager; diff --git a/TakoTako/SkipSplashScreen.cs b/TakoTako/Patches/SkipSplashScreenPatch.cs similarity index 89% rename from TakoTako/SkipSplashScreen.cs rename to TakoTako/Patches/SkipSplashScreenPatch.cs index d8d93f4..4bd36e7 100644 --- a/TakoTako/SkipSplashScreen.cs +++ b/TakoTako/Patches/SkipSplashScreenPatch.cs @@ -1,11 +1,11 @@ using System.Diagnostics.CodeAnalysis; using HarmonyLib; -namespace TakoTako; +namespace TakoTako.Patches; [HarmonyPatch] [SuppressMessage("ReSharper", "InconsistentNaming")] -public class SkipSplashScreen +public class SkipSplashScreenPatch { /// /// Simply load the next scene, I don't think this scene does anything specific? @@ -17,4 +17,4 @@ public class SkipSplashScreen TaikoSingletonMonoBehaviour.Instance.MySceneManager.ChangeScene("Title", false); __instance.gameObject.SetActive(false); } -} \ No newline at end of file +} diff --git a/TakoTako/TaikoDrumSupport.cs b/TakoTako/Patches/TaikoDrumSupportPatch.cs similarity index 99% rename from TakoTako/TaikoDrumSupport.cs rename to TakoTako/Patches/TaikoDrumSupportPatch.cs index c93be16..a429421 100644 --- a/TakoTako/TaikoDrumSupport.cs +++ b/TakoTako/Patches/TaikoDrumSupportPatch.cs @@ -8,12 +8,12 @@ using Array = Il2CppSystem.Array; using UnhollowerBaseLib; #endif -namespace TakoTako; +namespace TakoTako.Patches; [HarmonyPatch] [SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("Member Access", "Publicizer001:Accessing a member that was not originally public")] -public class TaikoDrumSupport +public class TaikoDrumSupportPatch { private const float analogThreshold = 0.333f; diff --git a/TakoTako/Plugin.cs b/TakoTako/Plugin.cs index 2e3386f..35740af 100644 --- a/TakoTako/Plugin.cs +++ b/TakoTako/Plugin.cs @@ -4,6 +4,7 @@ using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; +using TakoTako.Patches; using UnityEngine; #if TAIKO_IL2CPP using BepInEx.IL2CPP.Utils; @@ -132,26 +133,26 @@ namespace TakoTako _harmony = new Harmony(PluginInfo.PLUGIN_GUID); if (ConfigSkipSplashScreen.Value) - _harmony.PatchAll(typeof(SkipSplashScreen)); + _harmony.PatchAll(typeof(SkipSplashScreenPatch)); if (ConfigFixSignInScreen.Value) _harmony.PatchAll(typeof(SignInPatch)); if (ConfigDisableScreenChangeOnFocus.Value) - _harmony.PatchAll(typeof(DisableScreenChangeOnFocus)); + _harmony.PatchAll(typeof(DisableScreenChangeOnFocusPatch)); if (ConfigEnableTaikoDrumSupport.Value) - _harmony.PatchAll(typeof(TaikoDrumSupport)); + _harmony.PatchAll(typeof(TaikoDrumSupportPatch)); #if TAIKO_IL2CPP if (ConfigSkipDLCCheck.Value) - _harmony.PatchAll(typeof(SkipDLCCheck)); + _harmony.PatchAll(typeof(SkipDLCCheckPatch)); #endif if (ConfigEnableCustomSongs.Value) { - _harmony.PatchAll(typeof(MusicPatch)); - MusicPatch.Setup(_harmony); + _harmony.PatchAll(typeof(CustomMusicLoaderPatch)); + CustomMusicLoaderPatch.Setup(_harmony); } }