Skip to content

Commit

Permalink
[+] TouchPanelBaudRate
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Oct 21, 2024
1 parent 3bc9f13 commit 0f1bfc5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions AquaMai/AquaMai.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ FrameRateDisplay=false
# Practice mode, activated by pressing Test in the game
# Must be used together with TestProof
PractiseMode=true
# Adjust the baud rate of the touch screen serial port, default value is 9600
# Requires hardware support. If you are unsure whether you can use it, you cannot use it
# Set to 0 to disable
TouchPanelBaudRate=0

# ===================================
# Save some potentially unnecessary time
Expand Down
4 changes: 4 additions & 0 deletions AquaMai/AquaMai.zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ FrameRateDisplay=false
# 练习模式,在游戏中按 Test 打开
# 必须和 TestProof 一起用
PractiseMode=true
# 调整触摸屏串口波特率,默认值 9600
# 需要硬件配合。如果你不清楚你是否可以使用,那你不能使用
# 改为 0 禁用
TouchPanelBaudRate=0

# ===================================
# 节省一些不知道有用没用的时间
Expand Down
1 change: 1 addition & 0 deletions AquaMai/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class UtilsConfig
public bool SelectionDetail { get; set; }
public bool ShowNetErrorDetail { get; set; }
public bool FrameRateDisplay { get; set; }
public int TouchPanelBaudRate { get; set; }
}

public class TimeSavingConfig
Expand Down
1 change: 1 addition & 0 deletions AquaMai/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public override void OnInitializeMelon()
Patch(typeof(CustomLogo));
// Utils
Patch(typeof(JudgeAdjust));
Patch(typeof(TouchPanelBaudRate));
# if DEBUG
Patch(typeof(LogNetworkErrors));
# endif
Expand Down
15 changes: 15 additions & 0 deletions AquaMai/Utils/TouchPanelBaudRate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using HarmonyLib;
using IO;

namespace AquaMai.Utils;

public class TouchPanelBaudRate
{
[HarmonyPatch(typeof(NewTouchPanel), "Open")]
[HarmonyPrefix]
private static void OpenPrefix(ref int ___BaudRate)
{
if (AquaMai.AppConfig.Utils.TouchPanelBaudRate <= 0) return;
___BaudRate = AquaMai.AppConfig.Utils.TouchPanelBaudRate;
}
}

0 comments on commit 0f1bfc5

Please sign in to comment.