Skip to content

Commit

Permalink
[+] Custom Keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Oct 2, 2024
1 parent c15dcf6 commit 1bcb721
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
24 changes: 22 additions & 2 deletions AquaMai/Config.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using Tomlet.Attributes;
using AquaMai.CustomKeyMap;

namespace AquaMai
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
}
}
}
15 changes: 12 additions & 3 deletions AquaMai/CustomKeyMap/Enable.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
namespace AquaMai.CustomKeyMap;
using DB;
using HarmonyLib;

namespace AquaMai.CustomKeyMap;

public class Enable
{

}
[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;
}
}

0 comments on commit 1bcb721

Please sign in to comment.