mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
remove unused transpiler, fix up mousemode
This commit is contained in:
parent
e0a6e910df
commit
c8ee3e1527
3 changed files with 10 additions and 50 deletions
|
@ -193,48 +193,4 @@ internal class HarmonyPatches
|
|||
MenuScalePatch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
//[HarmonyTranspiler]
|
||||
//[HarmonyPatch(typeof(ControllerRay), "LateUpdate")]
|
||||
private static IEnumerable<CodeInstruction> Transpiler_ControllerRay_UpdateInput(
|
||||
IEnumerable<CodeInstruction> instructions, ILGenerator il)
|
||||
{
|
||||
|
||||
// Stop calling move mouse events on the menus, the ones that instantiate and the send the event (easy)
|
||||
// Makes this: "component.View.MouseEvent(mouseEventData1);" go POOF
|
||||
instructions = new CodeMatcher(instructions)
|
||||
.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(i => i.opcode == OpCodes.Callvirt && i.operand is MethodInfo { Name: "get_View" }),
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(i => i.opcode == OpCodes.Callvirt && i.operand is MethodInfo { Name: "MouseEvent" }))
|
||||
.Repeat(matcher => matcher
|
||||
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop))
|
||||
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop))
|
||||
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop))
|
||||
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop))
|
||||
)
|
||||
.InstructionEnumeration();
|
||||
|
||||
// Look for the if flag2 and replace flag 2 with false, for the ones that create the event and send inline (hard ;_;)
|
||||
// Makes this: "if (flag2 && this._mouseDownOnMenu != ControllerRay.Menu.None || ..." into:
|
||||
// this: "if (false && this._mouseDownOnMenu != ControllerRay.Menu.None || ..."
|
||||
instructions = new CodeMatcher(instructions)
|
||||
.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldloc_2),
|
||||
new CodeMatch(OpCodes.Brfalse),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(i =>
|
||||
i.opcode == OpCodes.Ldfld && i.operand is FieldInfo { Name: "_mouseDownOnMenu" }),
|
||||
new CodeMatch(OpCodes.Brtrue),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(i =>
|
||||
i.opcode == OpCodes.Ldfld && i.operand is FieldInfo { Name: "_mouseDownOnMenu" }),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Bne_Un))
|
||||
.SetOpcodeAndAdvance(OpCodes.Ldc_I4_0) // replace flag2 with false
|
||||
.InstructionEnumeration();
|
||||
|
||||
return instructions;
|
||||
}
|
||||
}
|
|
@ -28,16 +28,20 @@ public class MSP_MenuInfo
|
|||
internal static bool DisableMMHelper_VR;
|
||||
|
||||
//reflection (traverse sucks ass)
|
||||
private static readonly FieldInfo _desktopMouseMode = typeof(CVR_MenuManager).GetField("_desktopMouseMode", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
private static readonly FieldInfo _desktopMouseModeQM = typeof(ViewManager).GetField("_desktopMouseMode", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
private static readonly FieldInfo _desktopMouseModeMM = typeof(CVR_MenuManager).GetField("_desktopMouseMode", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
internal static void ToggleDesktopInputMethod(bool flag)
|
||||
{
|
||||
if (MetaPort.Instance.isUsingVr) return;
|
||||
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
|
||||
CVRInputManager.Instance.inputEnabled = !flag;
|
||||
|
||||
_desktopMouseModeQM.SetValue(ViewManager.Instance, flag);
|
||||
_desktopMouseModeMM.SetValue(CVR_MenuManager.Instance, flag);
|
||||
|
||||
RootLogic.Instance.ToggleMouse(flag);
|
||||
CVRInputManager.Instance.inputEnabled = !flag;
|
||||
PlayerSetup.Instance._movementSystem.disableCameraControl = flag;
|
||||
CVR_MenuManager.Instance.desktopControllerRay.enabled = !flag;
|
||||
_desktopMouseMode.SetValue(CVR_MenuManager.Instance, flag);
|
||||
}
|
||||
|
||||
internal static readonly FieldInfo ms_followAngleY = typeof(MovementSystem).GetField("_followAngleY", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cohtml.Runtime">
|
||||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll</HintPath>
|
||||
<HintPath>C:\Program Files (x86)\\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MelonLoader">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AnimationModule">
|
||||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
<HintPath>C:\Program Files (x86)\\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue