70 lines
2.3 KiB
C#
70 lines
2.3 KiB
C#
using BepInEx;
|
|
using BepInEx.Configuration;
|
|
using BepInEx.Logging;
|
|
using BepInEx.Unity.IL2CPP;
|
|
using HarmonyLib;
|
|
using RecRoom.Systems;
|
|
using System;
|
|
|
|
namespace Radium.InputManagerPatch
|
|
{
|
|
/// <summary>
|
|
/// Patch for InputManager in Radium's 2021 build to set the input type to whatever you desire!
|
|
/// </summary>
|
|
[BepInPlugin("com.radium.inputmanager", "Radium.InputManagerPatch", "1.0.3")]
|
|
public class Plugin : BasePlugin
|
|
{
|
|
internal static new ManualLogSource Log;
|
|
|
|
internal static readonly Harmony _harmony = new(MyPluginInfo.PLUGIN_GUID);
|
|
|
|
/// <summary>
|
|
/// The input type we wish to set. If no value is provided, it defaults to SteamVR_Vive.
|
|
/// </summary>
|
|
internal static ConfigEntry<InputManager.LNEHPBFDEGG> VRInputDeviceType;
|
|
/// <summary>
|
|
/// If this plugin should be enabled or not or if we should break before anything gets patched
|
|
/// </summary>
|
|
internal static ConfigEntry<bool> Enabled;
|
|
|
|
public override void Load()
|
|
{
|
|
Log = base.Log;
|
|
|
|
Enabled = Config.Bind(
|
|
section: "General",
|
|
key: "Enabled",
|
|
defaultValue: true,
|
|
description: "Determines if the patch is enabled.");
|
|
|
|
if (!Enabled.Value)
|
|
return;
|
|
|
|
VRInputDeviceType = Config.Bind(
|
|
section: "Input",
|
|
key: "VRInputDeviceType",
|
|
defaultValue: InputManager.LNEHPBFDEGG.SteamVR_Vive,
|
|
description: "Fixed input mode. Set it to any of the acceptable values below.");
|
|
|
|
Log.LogInfo($"{MyPluginInfo.PLUGIN_GUID} loaded! (VRInputDeviceType: {VRInputDeviceType.Value})");
|
|
|
|
_harmony.PatchAll();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets GetVRInputMode (NACIMCNEHMP) of InputManager to whatever we desire!
|
|
/// </summary>
|
|
[HarmonyPatch(typeof(InputManager), "NACIMCNEHMP")]
|
|
public class InputManagerPatch()
|
|
{
|
|
private static bool Prefix(ref InputManager.LNEHPBFDEGG __result)
|
|
{
|
|
__result = Plugin.VRInputDeviceType.Value;
|
|
#if DEBUG
|
|
Log.LogInfo($"We are set! ({VRInputDeviceType.Value})");
|
|
#endif
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |