diff --git a/AquaMai/Fix/BasicFix.cs b/AquaMai/Fix/BasicFix.cs
index 189fbbd9..0681523c 100644
--- a/AquaMai/Fix/BasicFix.cs
+++ b/AquaMai/Fix/BasicFix.cs
@@ -48,14 +48,6 @@ private static bool GetMouseButtonDown(ref bool __result, int button)
return false;
}
- [HarmonyPrefix]
- [HarmonyPatch(typeof(GameManager), "CalcSpecialNum")]
- private static bool CalcSpecialNum(ref int __result)
- {
- __result = 1024;
- return false;
- }
-
[HarmonyPostfix]
[HarmonyPatch(typeof(NetHttpClient), MethodType.Constructor)]
private static void OnNetHttpClientConstructor(NetHttpClient __instance)
@@ -75,4 +67,21 @@ private static void OnNetHttpClientCreate()
// Unset the certificate validation callback (SSL pinning) to restore the default behavior
ServicePointManager.ServerCertificateValidationCallback = null;
}
+
+ public static void DoCustomPatch(HarmonyLib.Harmony h)
+ {
+ if (typeof(GameManager).GetMethod("CalcSpecialNum") is null) return;
+ h.PatchAll(typeof(CalcSpecialNumPatch));
+ }
+
+ private class CalcSpecialNumPatch
+ {
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(GameManager), "CalcSpecialNum")]
+ private static bool CalcSpecialNum(ref int __result)
+ {
+ __result = 1024;
+ return false;
+ }
+ }
}
diff --git a/AquaMai/Helpers/GameInfo.cs b/AquaMai/Helpers/GameInfo.cs
new file mode 100644
index 00000000..b29614de
--- /dev/null
+++ b/AquaMai/Helpers/GameInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using MAI2System;
+
+namespace AquaMai.Helpers;
+
+public class GameInfo
+{
+ public static uint GameVersion { get; } = GetGameVersion();
+
+ private static uint GetGameVersion()
+ {
+ return (uint)typeof(ConstParameter).GetField("NowGameVersion", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null);
+ }
+
+ public static string GameId { get; } = GetGameId();
+
+ private static string GetGameId()
+ {
+ return typeof(ConstParameter).GetField("GameIDStr", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null) as string;
+ }
+}
diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs
index 13ee9986..d9b0f087 100644
--- a/AquaMai/Main.cs
+++ b/AquaMai/Main.cs
@@ -155,12 +155,15 @@ public override void OnInitializeMelon()
Patch(typeof(FixCharaCrash));
Patch(typeof(BasicFix));
Patch(typeof(DisableReboot));
- Patch(typeof(ExtendNotesPool));
+ if (GameInfo.GameVersion >= 23000)
+ Patch(typeof(ExtendNotesPool));
Patch(typeof(FixCheckAuth));
Patch(typeof(DebugFeature));
- Patch(typeof(FixConnSlide));
+ if (GameInfo.GameVersion >= 23000)
+ Patch(typeof(FixConnSlide));
Patch(typeof(SlideAutoPlayTweak));
- Patch(typeof(FixLevelDisplay));
+ if (GameInfo.GameVersion >= 24000)
+ Patch(typeof(FixLevelDisplay));
// UX
Patch(typeof(CustomVersionString));
Patch(typeof(CustomPlaceName));
diff --git a/AquaMai/Resources/Locale.Designer.cs b/AquaMai/Resources/Locale.Designer.cs
index 8d68ad90..17a78c21 100644
--- a/AquaMai/Resources/Locale.Designer.cs
+++ b/AquaMai/Resources/Locale.Designer.cs
@@ -70,7 +70,6 @@ internal static string Loaded {
///
/// Looks up a localized string similar to Errors detected while loading!
- ///- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA
///- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
///- Check for conflicting mods, or enabled incompatible options.
///
diff --git a/AquaMai/Resources/Locale.resx b/AquaMai/Resources/Locale.resx
index 1a3b2003..8e42de15 100644
--- a/AquaMai/Resources/Locale.resx
+++ b/AquaMai/Resources/Locale.resx
@@ -59,7 +59,6 @@
Errors detected while loading!
-- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA
- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
- Check for conflicting mods, or enabled incompatible options
diff --git a/AquaMai/Resources/Locale.zh.resx b/AquaMai/Resources/Locale.zh.resx
index 3a631cb4..1d6d4ead 100644
--- a/AquaMai/Resources/Locale.zh.resx
+++ b/AquaMai/Resources/Locale.zh.resx
@@ -52,7 +52,6 @@
加载过程中检测到错误!
-- 请检查你是否安装了错误的 AquaMai 版本,比如在 SDGA 上使用了 SDEZ 的版本
- 你是否正在使用魔改的 Assembly-CSharp.dll,这会导致函数不一致而无法找到需要修改的函数
- 请检查是否有冲突的 Mod,或者开启了不兼容的选项
diff --git a/AquaMai/UX/QuickSkip.cs b/AquaMai/UX/QuickSkip.cs
index 9a8d1454..3bc1a8ea 100644
--- a/AquaMai/UX/QuickSkip.cs
+++ b/AquaMai/UX/QuickSkip.cs
@@ -10,82 +10,90 @@
using Process;
using UnityEngine;
-namespace AquaMai.UX
+namespace AquaMai.UX;
+
+public class QuickSkip
{
- public class QuickSkip
+ private static int _keyPressFrames;
+
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(GameMainObject), "Update")]
+ public static void OnGameMainObjectUpdate()
{
- private static int _keyPressFrames;
+ // The button between [1p] and [2p] button on ADX
+ if (Input.GetKey(KeyCode.Alpha7) || InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService)) _keyPressFrames++;
- [HarmonyPrefix]
- [HarmonyPatch(typeof(GameMainObject), "Update")]
- public static void OnGameMainObjectUpdate()
+ if (_keyPressFrames > 0 && !Input.GetKey(KeyCode.Alpha7) && !InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService))
{
- // The button between [1p] and [2p] button on ADX
- if (Input.GetKey(KeyCode.Alpha7) || InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService)) _keyPressFrames++;
-
- if (_keyPressFrames > 0 && !Input.GetKey(KeyCode.Alpha7) && !InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService))
- {
- _keyPressFrames = 0;
- MelonLogger.Msg(SharedInstances.ProcessDataContainer.processManager.Dump());
- return;
- }
+ _keyPressFrames = 0;
+ MelonLogger.Msg(SharedInstances.ProcessDataContainer.processManager.Dump());
+ return;
+ }
- if (_keyPressFrames != 60) return;
- MelonLogger.Msg("[QuickSkip] Activated");
+ if (_keyPressFrames != 60) return;
+ MelonLogger.Msg("[QuickSkip] Activated");
- var traverse = Traverse.Create(SharedInstances.ProcessDataContainer.processManager);
- var processList = traverse.Field("_processList").GetValue>();
+ var traverse = Traverse.Create(SharedInstances.ProcessDataContainer.processManager);
+ var processList = traverse.Field("_processList").GetValue>();
- ProcessBase processToRelease = null;
+ ProcessBase processToRelease = null;
- foreach (ProcessManager.ProcessControle process in processList)
+ foreach (ProcessManager.ProcessControle process in processList)
+ {
+ switch (process.Process.ToString())
{
- switch (process.Process.ToString())
- {
- // After login
- case "Process.ModeSelect.ModeSelectProcess":
- case "Process.LoginBonus.LoginBonusProcess":
- case "Process.RegionalSelectProcess":
- case "Process.CharacterSelectProcess":
- case "Process.TicketSelect.TicketSelectProcess":
- processToRelease = process.Process;
- break;
+ // After login
+ case "Process.ModeSelect.ModeSelectProcess":
+ case "Process.LoginBonus.LoginBonusProcess":
+ case "Process.RegionalSelectProcess":
+ case "Process.CharacterSelectProcess":
+ case "Process.TicketSelect.TicketSelectProcess":
+ processToRelease = process.Process;
+ break;
- case "Process.MusicSelectProcess":
- // Skip to save
- SoundManager.PreviewEnd();
- SoundManager.PlayBGM(Cue.BGM_COLLECTION, 2);
- SharedInstances.ProcessDataContainer.processManager.AddProcess(new FadeProcess(SharedInstances.ProcessDataContainer, process.Process, new UnlockMusicProcess(SharedInstances.ProcessDataContainer)));
- break;
- }
+ case "Process.MusicSelectProcess":
+ // Skip to save
+ SoundManager.PreviewEnd();
+ SoundManager.PlayBGM(Cue.BGM_COLLECTION, 2);
+ SharedInstances.ProcessDataContainer.processManager.AddProcess(new FadeProcess(SharedInstances.ProcessDataContainer, process.Process, new UnlockMusicProcess(SharedInstances.ProcessDataContainer)));
+ break;
}
+ }
- if (processToRelease != null)
- {
- GameManager.SetMaxTrack();
- SharedInstances.ProcessDataContainer.processManager.AddProcess(new FadeProcess(SharedInstances.ProcessDataContainer, processToRelease, new MusicSelectProcess(SharedInstances.ProcessDataContainer)));
- }
+ if (processToRelease != null)
+ {
+ GameManager.SetMaxTrack();
+ SharedInstances.ProcessDataContainer.processManager.AddProcess(new FadeProcess(SharedInstances.ProcessDataContainer, processToRelease, new MusicSelectProcess(SharedInstances.ProcessDataContainer)));
}
+ }
- [HarmonyPostfix]
- [HarmonyPatch(typeof(GameProcess), "OnUpdate")]
- public static void PostGameProcessUpdate(GameProcess __instance, Message[] ____message, ProcessDataContainer ___container)
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(GameProcess), "OnUpdate")]
+ public static void PostGameProcessUpdate(GameProcess __instance, Message[] ____message, ProcessDataContainer ___container)
+ {
+ if (InputManager.GetButtonDown(0, InputManager.ButtonSetting.Select))
{
- if (InputManager.GetButtonDown(0, InputManager.ButtonSetting.Select))
- {
- var traverse = Traverse.Create(__instance);
- ___container.processManager.SendMessage(____message[0]);
- Singleton.Instance.SetSyncResult(0);
- traverse.Method("SetRelease").GetValue();
- }
+ var traverse = Traverse.Create(__instance);
+ ___container.processManager.SendMessage(____message[0]);
+ Singleton.Instance.SetSyncResult(0);
+ traverse.Method("SetRelease").GetValue();
+ }
- if (Input.GetKey(KeyCode.Alpha7) || InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService))
- {
- // This is original typo in Assembly-CSharp
- Singleton.Instance.SetQuickRetryFrag(flag: true);
- }
+ if (Input.GetKey(KeyCode.Alpha7) || InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService) && GameInfo.GameVersion >= 23000)
+ {
+ // This is original typo in Assembly-CSharp
+ Singleton.Instance.SetQuickRetryFrag(flag: true);
}
+ }
+ public static void DoCustomPatch(HarmonyLib.Harmony h)
+ {
+ if (GameInfo.GameVersion < 23000) return;
+ h.PatchAll(typeof(FestivalAndLaterQuickRetryPatch));
+ }
+
+ private class FestivalAndLaterQuickRetryPatch
+ {
[HarmonyPrefix]
[HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")]
public static bool OnQuickRetryIsQuickRetryEnable(ref bool __result)
diff --git a/AquaMai/Utils/GameInfo.cs b/AquaMai/Utils/GameInfo.cs
deleted file mode 100644
index 05301b28..00000000
--- a/AquaMai/Utils/GameInfo.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using MAI2System;
-
-namespace AquaMai.Utils;
-
-public class GameInfo
-{
- public static uint GetGameVersion()
- {
- return (uint) typeof(ConstParameter).GetField("NowGameVersion", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null);
- }
-
- public static string GetGameId()
- {
- return typeof(ConstParameter).GetField("GameIDStr", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null) as string;
- }
-}
\ No newline at end of file