Skip to content

Commit 4919d4f

Browse files
clanstykevin0216ptchen314zealain
authored
[+] ? (#103)
* more disableio4 * [+] 新增舊框燈版 837-15070-02 重低音 LED / 頂板 LED / 中央 LED 的支持 (#100) * [+] Adding support for 837-15070-02 Woofer LED, Roof LED and Center LED Co-authored-by: PT_Chen <[email protected]> * [F] Fixing not consistant module name * [F] Fixed missing command * [F] Optimized with reducing reflection fetching * refactor: Merging into SkipBoardNoCheck --------- Co-authored-by: PT_Chen <[email protected]> * [O] rename SkipBoardNoCheck to OldCabLightBoardSupport * [+] MaimollerIO 按键灯光触摸单独设置 * [O] AdxHidInput.DisableButtons * [O] Add MaiChartManager EN * Add unstable rate display (#101) * Add unstable rate display * Reuse material * Fix windows line endings * move UnstableRate * [O] UnstableRate 2P support * [O] 使用对象池优化性能 * [O] Change color * [+] build script configuration * [+] 增加同时开启的 DisplayTouchInGame * [O] 力大砖飞 -> ResourcesOverride * [O] configSort * [O] convert check to non-AI script * [O] configSort * [F] bugs * [F] minor * revert --------- Co-authored-by: Kevin S.H. Chang <[email protected]> Co-authored-by: PT_Chen <[email protected]> Co-authored-by: zealain <[email protected]>
1 parent 0c14d21 commit 4919d4f

File tree

14 files changed

+1060
-255
lines changed

14 files changed

+1060
-255
lines changed

.config/dotnet-tools.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

AquaMai.Config/ConfigSerializer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ 这是 AquaMai 的 TOML 配置文件
2626
- 该文件的格式和文字注释是固定的,配置文件将在启动时被重写,无法解析的内容将被删除
2727
2828
试试使用 MaiChartManager 图形化配置 AquaMai 吧!
29-
https://github.com/clansty/MaiChartManager
29+
https://github.com/MuNET-OSS/MaiChartManager
3030
""";
3131

3232
private const string BANNER_EN =
@@ -43,6 +43,9 @@ This is the TOML configuration file of AquaMai.
4343
- Configuration entries take effect when the corresponding section is enabled, regardless of whether they are uncommented.
4444
- Commented configuration entries retain their default values (shown in the comment), which may change with version updates.
4545
- The format and text comments of this file are fixed. The configuration file will be rewritten at startup, and unrecognizable content will be deleted.
46+
47+
Try using MaiChartManager to configure AquaMai graphically!
48+
https://github.com/MuNET-OSS/MaiChartManager
4649
""";
4750

4851
private readonly IConfigSerializer.Options Options = Options;

AquaMai.Config/Migration/ConfigMigrationManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class ConfigMigrationManager : IConfigMigrationManager
1616
new ConfigMigration_V2_0_V2_1(),
1717
new ConfigMigration_V2_1_V2_2(),
1818
new ConfigMigration_V2_2_V2_3(),
19+
new ConfigMigration_V2_3_V2_4(),
1920
}.ToDictionary(m => m.FromVersion);
2021

2122
public string LatestVersion { get; }
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using AquaMai.Config.Interfaces;
2+
using Tomlet.Models;
3+
4+
namespace AquaMai.Config.Migration;
5+
6+
public class ConfigMigration_V2_3_V2_4 : IConfigMigration
7+
{
8+
public string FromVersion => "2.3";
9+
public string ToVersion => "2.4";
10+
11+
public ConfigView Migrate(ConfigView src)
12+
{
13+
var dst = (ConfigView)src.Clone();
14+
dst.SetValue("Version", ToVersion);
15+
16+
if (src.TryGetValue<bool>("GameSystem.KeyMap.DisableIO4", out var disableIO4))
17+
{
18+
dst.SetValue("GameSystem.KeyMap.DisableIO4_1P", disableIO4);
19+
dst.SetValue("GameSystem.KeyMap.DisableIO4_2P", disableIO4);
20+
dst.SetValue("GameSystem.KeyMap.DisableIO4System", disableIO4);
21+
dst.Remove("GameSystem.KeyMap.DisableIO4");
22+
}
23+
24+
if (src.IsSectionEnabled("GameSystem.SkipBoardNoCheck"))
25+
{
26+
dst.EnsureDictionary("GameSystem.OldCabLightBoardSupport");
27+
dst.Remove("GameSystem.SkipBoardNoCheck");
28+
}
29+
30+
if (src.TryGetValue<bool>("GameSystem.MaimollerIO.P1", out var mml1p))
31+
{
32+
dst.SetValue("GameSystem.MaimollerIO.Touch1p", mml1p);
33+
dst.SetValue("GameSystem.MaimollerIO.Button1p", mml1p);
34+
dst.SetValue("GameSystem.MaimollerIO.Led1p", mml1p);
35+
dst.Remove("GameSystem.MaimollerIO.P1");
36+
}
37+
38+
if (src.TryGetValue<bool>("GameSystem.MaimollerIO.P2", out var mml2p))
39+
{
40+
dst.SetValue("GameSystem.MaimollerIO.Touch2p", mml2p);
41+
dst.SetValue("GameSystem.MaimollerIO.Button2p", mml2p);
42+
dst.SetValue("GameSystem.MaimollerIO.Led2p", mml2p);
43+
dst.Remove("GameSystem.MaimollerIO.P2");
44+
}
45+
46+
if (src.TryGetValue<bool>("GameSystem.AdxHidInput.Io4Compact", out var adxDisableButtons))
47+
{
48+
dst.SetValue("GameSystem.AdxHidInput.DisableButtons", adxDisableButtons);
49+
dst.Remove("GameSystem.AdxHidInput.Io4Compact");
50+
}
51+
52+
if (src.IsSectionEnabled("GameSystem.UnstableRate"))
53+
{
54+
dst.EnsureDictionary("Utils.UnstableRate");
55+
dst.Remove("GameSystem.UnstableRate");
56+
}
57+
58+
if (src.IsSectionEnabled("Fancy.CustomSkinsPlusStatic"))
59+
{
60+
dst.EnsureDictionary("Fancy.ResourcesOverride");
61+
dst.Remove("Fancy.CustomSkinsPlusStatic");
62+
}
63+
64+
if (src.IsSectionEnabled("Fancy.RsOverride"))
65+
{
66+
dst.EnsureDictionary("Fancy.ResourcesOverride");
67+
dst.Remove("Fancy.RsOverride");
68+
}
69+
70+
return dst;
71+
}
72+
}
73+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace AquaMai.Mods.Fancy;
1414
name: "力大砖飞",
1515
en: "[Dangerous] Full-scene texture / sprite replacement. Static injection.",
1616
zh: "【危险功能】适用于便捷魔改的自定义全场景图片。警告:可能对游戏造成未知性能影响,可能与其他模组冲突?")]
17-
public class CustomSkinsPlusStatic
17+
public class ResourcesOverride
1818
{
1919
[ConfigEntry(name: "资源目录")]
2020
private static string skinsDir = "LocalAssets/ResourcesOverride";

AquaMai.Mods/GameSystem/AdxHidInput.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static void OnBeforeEnableCheck()
117117
if (adxController[i] == null) continue;
118118
TdInit(i);
119119
if (adxController[i].Attributes.ProductId is 0x5767 or 0x5768) continue;
120-
if (io4Compact) continue;
120+
if (disableButtons) continue;
121121
keyEnabled = true;
122122
var p = i;
123123
Thread hidThread = new Thread(() => HidInputThread(p));
@@ -168,8 +168,8 @@ private static bool IsButtonPushed(int playerNo, int buttonIndex1To8)
168168
[ConfigEntry(name: "按钮 4(最下方的圆形按键)")]
169169
private static readonly IOKeyMap button4 = IOKeyMap.Test;
170170

171-
[ConfigEntry("IO4 兼容模式", zh: "如果你不知道这是什么,请勿开启", hideWhenDefault: true)]
172-
private static readonly bool io4Compact = false;
171+
[ConfigEntry("禁用外键输入")]
172+
private static readonly bool disableButtons = false;
173173

174174
private static AuxiliaryState GetAuxiliaryState()
175175
{

AquaMai.Mods/GameSystem/KeyMap.cs

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.Generic;
12
using System.Reflection;
23
using AMDaemon;
34
using AquaMai.Config.Attributes;
@@ -24,7 +25,7 @@ DebugInput 与 IO4(兼容 IO4 板 / segatools IO4 模拟)独立工作。
2425
public class KeyMap
2526
{
2627
[ConfigEntry(
27-
name: "禁用 IO4",
28+
name: "禁用 IO4(1P)",
2829
en: """
2930
Disable IO4 (IO4-compatible board / segatools IO4 emulation) input.
3031
With IO4 input disabled, your IO4-compatible board or segatools IO4 emulation is ignored.
@@ -33,7 +34,19 @@ Disable IO4 (IO4-compatible board / segatools IO4 emulation) input.
3334
禁用 IO4(兼容 IO4 板 / segatools IO4 模拟)输入。
3435
在禁用 IO4 输入后,你的兼容 IO4 板或 segatools IO4 模拟将被忽略。
3536
""")]
36-
private static readonly bool disableIO4 = false;
37+
private static readonly bool disableIO4_1P = false;
38+
[ConfigEntry("禁用 IO4(2P)")]
39+
private static readonly bool disableIO4_2P = false;
40+
41+
[ConfigEntry(
42+
name: "禁用 IO4(系统按键)",
43+
en: """
44+
System buttons (test, service) input.
45+
""",
46+
zh: """
47+
禁用系统按键的 IO4 输入,输入源同上。
48+
""")]
49+
private static readonly bool disableIO4System = false;
3750

3851
[ConfigEntry(
3952
name: "禁用 DebugInput",
@@ -59,30 +72,45 @@ 禁用 DebugFeature Polyfill 的快捷键,比如说回车暂停,左右键快
5972
""")]
6073
public static readonly bool disableDebugFeatureHotkeys = false; // Implemented in DebugFeature
6174

62-
[EnableIf(nameof(disableIO4))]
75+
private static bool DisableIO4 => disableIO4_1P || disableIO4_2P || disableIO4System;
76+
private static HashSet<SwitchInput> disabledSwitchInputs = [];
77+
78+
[EnableIf(nameof(DisableIO4))]
6379
[HarmonyPatch("IO.Jvs+JvsSwitch", ".ctor", MethodType.Constructor, [typeof(int), typeof(string), typeof(KeyCode), typeof(bool), typeof(bool)])]
64-
[HarmonyPrefix]
65-
public static void PreJvsSwitchConstructor(ref bool invert)
80+
[HarmonyPostfix]
81+
public static void PostJvsSwitchConstructor(ref bool ____invert, int playerNo, bool systemButton, SwitchInput ____switchInput)
6682
{
67-
invert = false;
83+
if ((systemButton && disableIO4System) || (playerNo == 0 && disableIO4_1P) || (playerNo == 1 && disableIO4_2P))
84+
{
85+
____invert = false;
86+
disabledSwitchInputs.Add(____switchInput);
87+
}
6888
}
6989

70-
[EnableIf(nameof(disableIO4))]
71-
[HarmonyPatch(typeof(SwitchInput), "get_IsOn")]
90+
[EnableIf(nameof(DisableIO4))]
91+
[HarmonyPatch(typeof(SwitchInput), nameof(SwitchInput.IsOn), MethodType.Getter)]
7292
[HarmonyPrefix]
73-
public static bool PreGetIsOn(ref bool __result)
93+
public static bool PreGetIsOn(ref bool __result, SwitchInput __instance)
7494
{
75-
__result = false;
76-
return false;
95+
if (disabledSwitchInputs.Contains(__instance))
96+
{
97+
__result = false;
98+
return false;
99+
}
100+
return true;
77101
}
78102

79-
[EnableIf(nameof(disableIO4))]
80-
[HarmonyPatch(typeof(SwitchInput), "get_HasOnNow")]
103+
[EnableIf(nameof(DisableIO4))]
104+
[HarmonyPatch(typeof(SwitchInput), nameof(SwitchInput.HasOnNow), MethodType.Getter)]
81105
[HarmonyPrefix]
82-
public static bool PreGetHasOnNow(ref bool __result)
106+
public static bool PreGetHasOnNow(ref bool __result, SwitchInput __instance)
83107
{
84-
__result = false;
85-
return false;
108+
if (disabledSwitchInputs.Contains(__instance))
109+
{
110+
__result = false;
111+
return false;
112+
}
113+
return true;
86114
}
87115

88116
[ConfigEntry]

0 commit comments

Comments
 (0)