diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj index 23ffc7bf..fbf2fafa 100644 --- a/AquaMai/AquaMai.csproj +++ b/AquaMai/AquaMai.csproj @@ -305,6 +305,7 @@ + diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml index 57e2a228..ce63191e 100644 --- a/AquaMai/AquaMai.toml +++ b/AquaMai/AquaMai.toml @@ -78,3 +78,9 @@ ExtendNotesPool=128 [Utils] # Log user ID on login LogUserId=false +# Globally increase A judgment, unit is the same as in the game +JudgeAdjustA=0.0 +# Globally increase B judgment, unit is the same as in the game +JudgeAdjustB=0.0 +# Touch screen delay, unit is milliseconds, one second = 1000 milliseconds. Must be an integer +TouchDelay=0 diff --git a/AquaMai/AquaMai.zh.toml b/AquaMai/AquaMai.zh.toml index 42569743..bba8df4a 100644 --- a/AquaMai/AquaMai.zh.toml +++ b/AquaMai/AquaMai.zh.toml @@ -94,3 +94,9 @@ ExtendNotesPool=128 [Utils] # 登录时将 UserID 输出到日志 LogUserId=false +# 全局增加 A 判,单位和游戏里一样 +JudgeAdjustA=0.0 +# 全局增加 B 判,单位和游戏里一样 +JudgeAdjustB=0.0 +# 触摸屏延迟,单位为毫秒,一秒 = 1000 毫秒。必须是整数 +TouchDelay=0 diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs index 99e8bd52..df3d4e91 100644 --- a/AquaMai/Config.cs +++ b/AquaMai/Config.cs @@ -62,6 +62,9 @@ namespace AquaMai public class UtilsConfig { public bool LogUserId { get; set; } + public float JudgeAdjustA { get; set; } + public float JudgeAdjustB { get; set; } + public int TouchDelay { get; set; } } } } diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs index 7f21e5b6..f5f82bc6 100644 --- a/AquaMai/Main.cs +++ b/AquaMai/Main.cs @@ -3,6 +3,7 @@ using System.IO; using System.Runtime.InteropServices; using AquaMai.Fix; using AquaMai.Helpers; +using AquaMai.Utils; using AquaMai.UX; using MelonLoader; using Tomlet; @@ -132,6 +133,8 @@ namespace AquaMai Patch(typeof(CustomVersionString)); Patch(typeof(CustomPlaceName)); Patch(typeof(RunCommandOnEvents)); + // Utils + Patch(typeof(JudgeAdjust)); // Apply patches based on the settings ApplyPatches(); diff --git a/AquaMai/Utils/JudgeAdjust.cs b/AquaMai/Utils/JudgeAdjust.cs new file mode 100644 index 00000000..0fcfffab --- /dev/null +++ b/AquaMai/Utils/JudgeAdjust.cs @@ -0,0 +1,31 @@ +using System.Threading; +using HarmonyLib; +using IO; +using Manager.UserDatas; + +namespace AquaMai.Utils; + +public class JudgeAdjust +{ + [HarmonyPostfix] + [HarmonyPatch(typeof(UserOption), "GetAdjustMSec")] + public static void GetAdjustMSec(ref float __result) + { + __result += AquaMai.AppConfig.Utils.JudgeAdjustA * 16.666666f; + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(UserOption), "GetJudgeTimingFrame")] + public static void GetJudgeTimingFrame(ref float __result) + { + __result += AquaMai.AppConfig.Utils.JudgeAdjustB; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(NewTouchPanel), "Recv")] + public static void NewTouchPanelRecv() + { + if (AquaMai.AppConfig.Utils.TouchDelay <= 0) return; + Thread.Sleep(AquaMai.AppConfig.Utils.TouchDelay); + } +}