Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of KeyboardLayoutFix v1.0.0
KeyboardLayoutFix.dll
Decompiled 4 days agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine.InputSystem; using Valheim.SettingsGui; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("KeyboardLayoutFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("KeyboardLayoutFix")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e4c1e059-c9ae-4244-ad0f-0a74b0728930")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ForceEnglishKeybinds; [BepInPlugin("com.LFB.forcelatinkeybinds", "Force Latin Keybinds", "1.0.0")] public class Plugin : BaseUnityPlugin { private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.LFB.forcelatinkeybinds"); val.PatchAll(); } } [HarmonyPatch(typeof(ZInput), "GetBoundKeyString")] public static class GetBoundKeyString_Patch { private static string MyMapKeyFromPath(string path) { string[] array = path.Split('/').Skip(1).ToArray(); string separator = "_"; string text = array[^1]; return string.Join(separator, (text == "x" || text == "y") ? array[..^1] : array); } [HarmonyPrefix] public static bool Prefix(ZInput __instance, Dictionary<string, ButtonDef> ___m_buttons, Dictionary<string, Dictionary<string, string>> ___s_gamepadSpriteMap, Dictionary<string, string> ___s_keyLocalizationMap, string name, ref string __result, bool emptyStringOnMissing = false) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected I4, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected I4, but got Unknown if (!___m_buttons.TryGetValue(name, out var value)) { if (!emptyStringOnMissing) { __result = "MISSING BUTTON DEF \"" + name + "\""; return false; } __result = ""; return false; } if (value.DisplayNameOverride != null) { __result = value.DisplayNameOverride; return false; } InputBinding val = ((IEnumerable<InputBinding>)(object)value.ButtonAction.bindings).FirstOrDefault(); if (val == default(InputBinding) || string.IsNullOrEmpty(((InputBinding)(ref val)).effectivePath)) { if (!emptyStringOnMissing) { __result = "MISSING KEY BINDING \"" + name + "\""; return false; } __result = ""; return false; } string key = MyMapKeyFromPath(((InputBinding)(ref val)).effectivePath); if ((int)value.Source == 180) { GamepadGlyphs currentGlyph = ZInput.CurrentGlyph; GamepadGlyphs val2 = currentGlyph; string text; switch ((int)val2) { case 0: { GamepadType connectedGamepadType = ZInput.ConnectedGamepadType; GamepadType val3 = connectedGamepadType; string text2; switch (val3 - 3) { case 0: text2 = "xbox"; break; case 1: case 2: text2 = "ps5"; break; case 3: text2 = "switch2"; break; case 4: text2 = "switch2"; break; case 5: text2 = "switch2"; break; default: text2 = "xbox"; break; } text = text2; break; } case 1: text = "xbox"; break; case 2: text = "ps5"; break; case 3: text = "switch2"; break; default: text = "xbox"; break; } string text3 = text; __result = "<sprite=\"" + text3 + "\" name=\"" + ___s_gamepadSpriteMap[key][text3] + "\">"; return false; } if (!___s_keyLocalizationMap.TryGetValue(key, out var value2)) { __result = ((InputBinding)(ref val)).ToDisplayString((DisplayStringOptions)4, (InputControl)null); return false; } __result = value2; return false; } }