[+] TouchSensitivity

This commit is contained in:
Clansty 2024-09-17 06:25:52 +08:00
parent 5128db9f6c
commit 8087396188
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
5 changed files with 163 additions and 5 deletions

View File

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

View File

@ -84,3 +84,49 @@ JudgeAdjustA=0.0
JudgeAdjustB=0.0
# Touch screen delay, unit is milliseconds, one second = 1000 milliseconds. Must be an integer
TouchDelay=0
[TouchSensitivity]
# Enable custom sensitivity
# When enabled, the settings in Test mode will not take effect
# When disabled, the settings in Test mode can still be used
Enable=false
# Sensitivity adjustments in Test mode are not linear
# Default sensitivity in area A: 90, 80, 70, 60, 50, 40, 30, 26, 23, 20, 10
# Default sensitivity in other areas: 70, 60, 50, 40, 30, 20, 15, 10, 5, 1, 1
# A setting of 0 in Test mode corresponds to 40, 20 here, -5 corresponds to 90, 70, +5 corresponds to 10, 1
# The higher the number in Test mode, the lower the number here, resulting in higher sensitivity for official machines
# For ADX, the sensitivity is reversed, so the higher the number here, the higher the sensitivity
A1=40
A2=40
A3=40
A4=40
A5=40
A6=40
A7=40
A8=40
B1=20
B2=20
B3=20
B4=20
B5=20
B6=20
B7=20
B8=20
C1=20
C2=20
D1=20
D2=20
D3=20
D4=20
D5=20
D6=20
D7=20
D8=20
E1=20
E2=20
E3=20
E4=20
E5=20
E6=20
E7=20
E8=20

View File

@ -100,3 +100,49 @@ JudgeAdjustA=0.0
JudgeAdjustB=0.0
# 触摸屏延迟,单位为毫秒,一秒 = 1000 毫秒。必须是整数
TouchDelay=0
[TouchSensitivity]
# 是否启用自定义灵敏度
# 这里启用之后 Test 里的就不再起作用了
# 这里禁用之后就还是可以用 Test 里的调
Enable=false
# 在 Test 模式下调整的灵敏度不是线性的
# A 区默认灵敏度 90, 80, 70, 60, 50, 40, 30, 26, 23, 20, 10
# 其他区域默认灵敏度 70, 60, 50, 40, 30, 20, 15, 10, 5, 1, 1
# Test 里设置的 0 对应的是 40, 20 这一档,-5 是 90, 70+5 是 10, 1
# Test 里的数字越大,这里的数字越小,对于官机来说,灵敏度更大
# 而 ADX 的灵敏度是反的,所以对于 ADX这里的数字越大灵敏度越大
A1=40
A2=40
A3=40
A4=40
A5=40
A6=40
A7=40
A8=40
B1=20
B2=20
B3=20
B4=20
B5=20
B6=20
B7=20
B8=20
C1=20
C2=20
D1=20
D2=20
D3=20
D4=20
D5=20
D6=20
D7=20
D8=20
E1=20
E2=20
E3=20
E4=20
E5=20
E6=20
E7=20
E8=20

View File

@ -6,11 +6,12 @@ namespace AquaMai
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class Config
{
public UXConfig UX { get; set; }
public CheatConfig Cheat { get; set; }
public PerformanceConfig Performance { get; set; }
public FixConfig Fix { get; set; }
public UtilsConfig Utils { get; set; }
public UXConfig UX { get; set; } = new();
public CheatConfig Cheat { get; set; } = new();
public PerformanceConfig Performance { get; set; } = new();
public FixConfig Fix { get; set; } = new();
public UtilsConfig Utils { get; set; } = new();
public TouchSensitivityConfig TouchSensitivity { get; set; } = new();
public class CheatConfig
{
@ -66,5 +67,44 @@ namespace AquaMai
public float JudgeAdjustB { get; set; }
public int TouchDelay { get; set; }
}
public class TouchSensitivityConfig
{
public bool Enable { get; set; }
public byte A1 { get; set; } = 40;
public byte A2 { get; set; } = 40;
public byte A3 { get; set; } = 40;
public byte A4 { get; set; } = 40;
public byte A5 { get; set; } = 40;
public byte A6 { get; set; } = 40;
public byte A7 { get; set; } = 40;
public byte A8 { get; set; } = 40;
public byte B1 { get; set; } = 20;
public byte B2 { get; set; } = 20;
public byte B3 { get; set; } = 20;
public byte B4 { get; set; } = 20;
public byte B5 { get; set; } = 20;
public byte B6 { get; set; } = 20;
public byte B7 { get; set; } = 20;
public byte B8 { get; set; } = 20;
public byte C1 { get; set; } = 20;
public byte C2 { get; set; } = 20;
public byte D1 { get; set; } = 20;
public byte D2 { get; set; } = 20;
public byte D3 { get; set; } = 20;
public byte D4 { get; set; } = 20;
public byte D5 { get; set; } = 20;
public byte D6 { get; set; } = 20;
public byte D7 { get; set; } = 20;
public byte D8 { get; set; } = 20;
public byte E1 { get; set; } = 20;
public byte E2 { get; set; } = 20;
public byte E3 { get; set; } = 20;
public byte E4 { get; set; } = 20;
public byte E5 { get; set; } = 20;
public byte E6 { get; set; } = 20;
public byte E7 { get; set; } = 20;
public byte E8 { get; set; } = 20;
}
}
}

View File

@ -0,0 +1,25 @@
using System.Collections.Generic;
using HarmonyLib;
using IO;
using Manager;
using MelonLoader;
namespace AquaMai.TouchSensitivity;
public class Enable
{
[HarmonyPrefix]
[HarmonyPatch(typeof(NewTouchPanel), "SetTouchPanelSensitivity")]
public static void SetTouchPanelSensitivityPrefix(List<byte> sensitivity)
{
var configType = AquaMai.AppConfig.TouchSensitivity.GetType();
for (var i = 0; i < 34; i++)
{
var area = (InputManager.TouchPanelArea)i;
var field = configType.GetProperty(area.ToString());
var value = (byte)field.GetValue(AquaMai.AppConfig.TouchSensitivity);
sensitivity[i] = value;
}
MelonLogger.Msg("[TouchSensitivity] Applied");
}
}