diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs index f8f9445f..e51e7bca 100644 --- a/AquaMai/Config.cs +++ b/AquaMai/Config.cs @@ -1,5 +1,5 @@ using System.Diagnostics.CodeAnalysis; -using Tomlet.Attributes; +using AquaMai.CustomKeyMap; namespace AquaMai { @@ -13,6 +13,7 @@ public class Config public TimeSavingConfig TimeSaving { get; set; } = new(); public WindowStateConfig WindowState { get; set; } = new(); public TouchSensitivityConfig TouchSensitivity { get; set; } = new(); + public CustomKeyMapConfig CustomKeyMap { get; set; } = new(); public class CheatConfig { @@ -126,7 +127,26 @@ public class TouchSensitivityConfig public class CustomKeyMapConfig { public bool Enable { get; set; } - public string[] KeyMap { get; set; } = new string[0]; + public KeyCodeID Test { get; set; } = (KeyCodeID)115; + public KeyCodeID Service { get; set; } = (KeyCodeID)5; + public KeyCodeID Button1_1P { get; set; } = (KeyCodeID)67; + public KeyCodeID Button2_1P { get; set; } = (KeyCodeID)49; + public KeyCodeID Button3_1P { get; set; } = (KeyCodeID)48; + public KeyCodeID Button4_1P { get; set; } = (KeyCodeID)47; + public KeyCodeID Button5_1P { get; set; } = (KeyCodeID)68; + public KeyCodeID Button6_1P { get; set; } = (KeyCodeID)70; + public KeyCodeID Button7_1P { get; set; } = (KeyCodeID)45; + public KeyCodeID Button8_1P { get; set; } = (KeyCodeID)61; + public KeyCodeID Select_1P { get; set; } = (KeyCodeID)25; + public KeyCodeID Button1_2P { get; set; } = (KeyCodeID)80; + public KeyCodeID Button2_2P { get; set; } = (KeyCodeID)81; + public KeyCodeID Button3_2P { get; set; } = (KeyCodeID)78; + public KeyCodeID Button4_2P { get; set; } = (KeyCodeID)75; + public KeyCodeID Button5_2P { get; set; } = (KeyCodeID)74; + public KeyCodeID Button6_2P { get; set; } = (KeyCodeID)73; + public KeyCodeID Button7_2P { get; set; } = (KeyCodeID)76; + public KeyCodeID Button8_2P { get; set; } = (KeyCodeID)79; + public KeyCodeID Select_2P { get; set; } = (KeyCodeID)84; } } } diff --git a/AquaMai/CustomKeyMap/Enable.cs b/AquaMai/CustomKeyMap/Enable.cs index f9d6cc6e..93458208 100644 --- a/AquaMai/CustomKeyMap/Enable.cs +++ b/AquaMai/CustomKeyMap/Enable.cs @@ -1,6 +1,15 @@ -namespace AquaMai.CustomKeyMap; +using DB; +using HarmonyLib; + +namespace AquaMai.CustomKeyMap; public class Enable { - -} \ No newline at end of file + [HarmonyPatch(typeof(JvsButtonTableRecord), MethodType.Constructor, typeof(int), typeof(string), typeof(string), typeof(int), typeof(string), typeof(int), typeof(int), typeof(int))] + [HarmonyPostfix] + public static void JvsButtonTableRecordConstructor(JvsButtonTableRecord __instance, string Name) + { + var prop = (DB.KeyCodeID)typeof(Config.CustomKeyMapConfig).GetProperty(Name).GetValue(AquaMai.AppConfig.CustomKeyMap); + __instance.SubstituteKey = prop; + } +}