[+] Global judge adjust

pull/55/head
Clansty 2024-09-17 04:13:51 +08:00
parent ef832461c0
commit 5128db9f6c
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
6 changed files with 50 additions and 0 deletions

View File

@ -305,6 +305,7 @@
<Compile Include="Performance\ImproveLoadSpeed.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="Utils\JudgeAdjust.cs" />
<Compile Include="Utils\LogUserId.cs" />
<Compile Include="UX\CustomPlaceName.cs" />
<Compile Include="UX\CustomVersionString.cs" />

View File

@ -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

View File

@ -94,3 +94,9 @@ ExtendNotesPool=128
[Utils]
# 登录时将 UserID 输出到日志
LogUserId=false
# 全局增加 A 判,单位和游戏里一样
JudgeAdjustA=0.0
# 全局增加 B 判,单位和游戏里一样
JudgeAdjustB=0.0
# 触摸屏延迟,单位为毫秒,一秒 = 1000 毫秒。必须是整数
TouchDelay=0

View File

@ -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; }
}
}
}

View File

@ -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();

View File

@ -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);
}
}