Skip to content

Commit dcd776d

Browse files
committed
[+] 兼容性 2P 模式
1 parent bd17ac8 commit dcd776d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

AquaMai.Mods/GameSystem/MaimollerIO/Libs/MaimollerDevice.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace AquaMai.Mods.GameSystem.MaimollerIO.Libs;
88

9-
public class MaimollerDevice(int player)
9+
public class MaimollerDevice(int player, bool alt2p)
1010
{
1111
#region P/Invoke
1212
private enum Status
@@ -42,7 +42,11 @@ public void Open()
4242
// To align with the driver from manufacturer, 1P = 0 and 2P = 2.
4343
// But in IDA the devices array is {p1, p2, p1} and devices[0] == devices[2], so why?
4444
// 经过测试,2P是1
45-
_dev = adx_open(player == 0 ? 0 : 1);
45+
if (player == 0) {
46+
_dev = adx_open(0);
47+
} else {
48+
_dev = adx_open(alt2p ? 1 : 2);
49+
}
4650
}
4751

4852
public void Update()

AquaMai.Mods/GameSystem/MaimollerIO/MaimollerIO.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ public class MaimollerIO
111111
/* button4 */ MaimollerInputReport.ButtonMask.COIN,
112112
];
113113

114-
private static readonly MaimollerDevice[] _devices = [.. Enumerable.Range(0, 2).Select(i => new MaimollerDevice(i))];
114+
[ConfigEntry("兼容性 2P 模式",
115+
en: "When mixing Maimoller with other protocols and Maimoller is on 2P, and Maimoller is not working properly, enable this",
116+
zh: "当混用 Maimoller 与其他协议并且 Maimoller 在 2P 上,而且 Maimoller 无法正常使用时开启")]
117+
private static readonly bool alternative2p = false;
118+
119+
private static readonly MaimollerDevice[] _devices = [.. Enumerable.Range(0, 2).Select(i => new MaimollerDevice(i, alternative2p))];
115120
private static readonly MaimollerLedManager[] _ledManagers = [.. Enumerable.Range(0, 2).Select(i => new MaimollerLedManager(_devices[i].output))];
116121

117122
public static void OnBeforePatch()

0 commit comments

Comments
 (0)