[O] TouchPanelPort

This commit is contained in:
Clansty 2025-10-07 22:49:10 +08:00
parent 5f61d63763
commit 785fb76e29
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
2 changed files with 7 additions and 6 deletions

View File

@ -16,9 +16,7 @@ namespace AquaMai.Mods.GameSystem;
""")]
public class TouchPanelBaudRate
{
[ConfigEntry(
name: "波特率",
en: "Baud rate.")]
[ConfigEntry("波特率")]
private static readonly int baudRate = 9600;
[HarmonyPatch(typeof(NewTouchPanel), "Open")]

View File

@ -18,19 +18,22 @@ public class TouchPanelPort
{
[ConfigEntry(
en: "Port for 1P.",
zh: "1P串口号")]
name: "1P串口号")]
private static readonly string portName_1P = "COM3";
[ConfigEntry(
en: "Port for 2P.",
zh: "2P串口号")]
name: "2P串口号")]
private static readonly string portName_2P = "COM4";
[HarmonyPatch(typeof(NewTouchPanel), "Open")]
[HarmonyPrefix]
private static void OpenPrefix(ref string[] ___PortName)
{
if (___PortName == null || ___PortName.Length < 2) return;
if (___PortName == null || ___PortName.Length < 2)
{
___PortName = new string[2];
}
___PortName[0] = portName_1P;
___PortName[1] = portName_2P;
}