Files
se-launcher/CringeLauncher/Patches/InputPatch.cs
zznty 17a8ba28b2
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 57s
Build / Build Nuget package (NuGet) (push) Successful in 55s
Build / Build Nuget package (SharedCringe) (push) Successful in 54s
Build / Build Launcher (push) Successful in 2m13s
Build / Build Nuget package (CringePlugins) (push) Successful in 3m20s
make patch target type reference explicit
2025-05-09 13:16:58 +07:00

34 lines
971 B
C#

using HarmonyLib;
using VRage;
using VRage.Input;
using VRage.Input.Keyboard;
using VRage.Platform.Windows.Input;
namespace CringeLauncher.Patches;
[HarmonyPatch]
internal static class InputPatch
{
[HarmonyPrefix, HarmonyPatch(typeof(MyDirectInput), nameof(MyDirectInput.GetMouseState))]
private static bool GetMouseStatePrefix(ref MyMouseState state)
{
if (ImGuiHandler.Instance?.BlockMouse == true && (MyVRage.Platform.Input.ShowCursor || ImGuiHandler.Instance.DrawMouse))
{
state = default;
return false;
}
return true;
}
[HarmonyPrefix, HarmonyPatch(typeof(MyGuiLocalizedKeyboardState), nameof(MyGuiLocalizedKeyboardState.GetCurrentState))]
private static bool GetKeyboardStatePrefix(ref MyKeyboardState __result)
{
if (ImGuiHandler.Instance?.BlockKeys == true)
{
__result = default;
return false;
}
return true;
}
}