diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj index 70752762..4c891cf5 100644 --- a/AquaMai/AquaMai.csproj +++ b/AquaMai/AquaMai.csproj @@ -263,7 +263,9 @@ + + diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml index 294a9cea..8fcedd98 100644 --- a/AquaMai/AquaMai.toml +++ b/AquaMai/AquaMai.toml @@ -1,4 +1,10 @@ +# =================================== +# Cheat: You control the buttons you press +[Cheat] +# Unlock normally event-only tickets +TicketUnlock=true + # =================================== # UX: User Experience Improvements [UX] diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs index 8f20891e..0a1e0c98 100644 --- a/AquaMai/Config.cs +++ b/AquaMai/Config.cs @@ -6,6 +6,12 @@ namespace AquaMai public class Config { public UXConfig UX { get; set; } + public CheatConfig Cheat { get; set; } + + public class CheatConfig + { + public bool TicketUnlock { get; set; } + } public class UXConfig { diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs index e7e62e9a..c613eb4f 100644 --- a/AquaMai/Main.cs +++ b/AquaMai/Main.cs @@ -1,4 +1,7 @@ -using AquaMai.UX; +using System; +using AquaMai.Cheat; +using AquaMai.Fix; +using AquaMai.UX; using MelonLoader; using Tomlet; @@ -18,6 +21,12 @@ namespace AquaMai { public static Config AppConfig { get; private set; } + private void Patch(Type type) + { + MelonLogger.Msg($"> Patching {type}"); + HarmonyLib.Harmony.CreateAndPatchAll(type); + } + public override void OnInitializeMelon() { MelonLogger.Msg("Loading mod settings..."); @@ -33,16 +42,17 @@ namespace AquaMai AppConfig = TomletMain.To(System.IO.File.ReadAllText("AquaMai.toml")); if (AppConfig.UX.SkipWarningScreen) - { - MelonLogger.Msg("> Patching SkipWarningScreen"); - HarmonyLib.Harmony.CreateAndPatchAll(typeof(SkipWarningScreen)); - } + Patch(typeof(SkipWarningScreen)); if (AppConfig.UX.SinglePlayer) - { - MelonLogger.Msg("> Patching SinglePlayer"); - HarmonyLib.Harmony.CreateAndPatchAll(typeof(SinglePlayer)); - } + Patch(typeof(SinglePlayer)); + + if (AppConfig.Cheat.TicketUnlock) + Patch(typeof(TicketUnlock)); + + // Fixes that does not have side effects + // These don't need to be configurable + Patch(typeof(FixCharaCrash)); MelonLogger.Msg("Loaded!"); } diff --git a/AquaMai/UX/SinglePlayer.cs b/AquaMai/UX/SinglePlayer.cs index e62018cc..eb9c2c1e 100644 --- a/AquaMai/UX/SinglePlayer.cs +++ b/AquaMai/UX/SinglePlayer.cs @@ -2,10 +2,12 @@ using System; using HarmonyLib; using UnityEngine; -namespace AquaMai { +namespace AquaMai.UX +{ // Hides the 2p (right hand side) UI. // Note: this is not my original work. I simply interpreted the code and rewrote it as a mod. - public class SinglePlayer { + public class SinglePlayer + { [HarmonyPrefix] [HarmonyPatch(typeof(Main.GameMain), "LateInitialize", new Type[] { typeof(MonoBehaviour), typeof(Transform), typeof(Transform) })] public static bool LateInitialize(MonoBehaviour gameMainObject, ref Transform left, ref Transform right)