From 3a1c6774e71a204036006ffdf6441e690e3e3b7d Mon Sep 17 00:00:00 2001 From: SDraw Date: Wed, 6 Sep 2023 20:05:23 +0000 Subject: [PATCH] New mods for small fixes --- README.md | 2 ++ ml_mods_cvr.sln | 17 +++++++++ ml_pvf/Main.cs | 31 ++++++++++++++++ ml_pvf/Properties/AssemblyInfo.cs | 4 +++ ml_pvf/README.md | 10 ++++++ ml_pvf/ml_pvf.csproj | 48 +++++++++++++++++++++++++ ml_vgm/Main.cs | 60 +++++++++++++++++++++++++++++++ ml_vgm/Properties/AssemblyInfo.cs | 4 +++ ml_vgm/README.md | 7 ++++ ml_vgm/ml_vgm.csproj | 44 +++++++++++++++++++++++ 10 files changed, 227 insertions(+) create mode 100644 ml_pvf/Main.cs create mode 100644 ml_pvf/Properties/AssemblyInfo.cs create mode 100644 ml_pvf/README.md create mode 100644 ml_pvf/ml_pvf.csproj create mode 100644 ml_vgm/Main.cs create mode 100644 ml_vgm/Properties/AssemblyInfo.cs create mode 100644 ml_vgm/README.md create mode 100644 ml_vgm/ml_vgm.csproj diff --git a/README.md b/README.md index 0f19c7e..013fe99 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Merged set of MelonLoader mods for ChilloutVR. | [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.0.6 [:arrow_down:](../../releases/latest/download/ml_pam.dll)| ✔ Yes | | [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.2 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)| ✔ Yes | | [Player Ragdoll Mod](/ml_prm/README.md)| ml_prm | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_prm.dll)| ✔ Yes
:hourglass_flowing_sand: Update review | +| [PostprocessVolumeFix](/ml_pvf/README.md) | ml_pvf | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_pvf.dll)| ❔ No | +| [ViveGesturesMovement](/ml_vgm/README.md) | ml_vgm | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_vgm.dll)| ❔ No | **Archived mods:** | Full name | Short name | Notes | diff --git a/ml_mods_cvr.sln b/ml_mods_cvr.sln index c08fb85..8acc416 100644 --- a/ml_mods_cvr.sln +++ b/ml_mods_cvr.sln @@ -26,6 +26,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_prm", "ml_prm\ml_prm.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_pmc", "ml_pmc\ml_pmc.csproj", "{118675AA-9AC7-4B0C-BFB1-FA1691619502}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_ppf", "ml_ppf\ml_ppf.csproj", "{0FA0B041-8347-4087-BCED-56A4F825F078}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_vgm", "ml_vgm\ml_vgm.csproj", "{5183529F-F7B7-439C-8908-1F288CFE6D51}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_pvf", "ml_pvf\ml_pvf.csproj", "{476B7470-60DC-41DB-8324-DEA41C80D26A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -56,6 +62,17 @@ Global {118675AA-9AC7-4B0C-BFB1-FA1691619502}.Debug|x64.ActiveCfg = Debug|x64 {118675AA-9AC7-4B0C-BFB1-FA1691619502}.Release|x64.ActiveCfg = Release|x64 {118675AA-9AC7-4B0C-BFB1-FA1691619502}.Release|x64.Build.0 = Release|x64 + {0FA0B041-8347-4087-BCED-56A4F825F078}.Debug|x64.ActiveCfg = Debug|x64 + {0FA0B041-8347-4087-BCED-56A4F825F078}.Release|x64.ActiveCfg = Release|x64 + {0FA0B041-8347-4087-BCED-56A4F825F078}.Release|x64.Build.0 = Release|x64 + {5183529F-F7B7-439C-8908-1F288CFE6D51}.Debug|x64.ActiveCfg = Debug|x64 + {5183529F-F7B7-439C-8908-1F288CFE6D51}.Debug|x64.Build.0 = Debug|x64 + {5183529F-F7B7-439C-8908-1F288CFE6D51}.Release|x64.ActiveCfg = Release|x64 + {5183529F-F7B7-439C-8908-1F288CFE6D51}.Release|x64.Build.0 = Release|x64 + {476B7470-60DC-41DB-8324-DEA41C80D26A}.Debug|x64.ActiveCfg = Debug|x64 + {476B7470-60DC-41DB-8324-DEA41C80D26A}.Debug|x64.Build.0 = Debug|x64 + {476B7470-60DC-41DB-8324-DEA41C80D26A}.Release|x64.ActiveCfg = Release|x64 + {476B7470-60DC-41DB-8324-DEA41C80D26A}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ml_pvf/Main.cs b/ml_pvf/Main.cs new file mode 100644 index 0000000..aaac182 --- /dev/null +++ b/ml_pvf/Main.cs @@ -0,0 +1,31 @@ +using System.Collections; +using ABI_RC.Core.Player; + +namespace ml_pvf +{ + public class PostprocessVolumeFix : MelonLoader.MelonMod + { + public override void OnInitializeMelon() + { + MelonLoader.MelonCoroutines.Start(FixVRCameraVolumeTarget()); + } + + IEnumerator FixVRCameraVolumeTarget() + { + while(PlayerSetup.Instance == null) + yield return null; + + while(PlayerSetup.Instance.vrCamera == null) + yield return null; + + UnityEngine.Rendering.PostProcessing.PostProcessLayer l_layer = null; + while(l_layer == null) + { + l_layer = PlayerSetup.Instance.vrCamera.GetComponent(); + yield return null; + } + + l_layer.volumeTrigger = PlayerSetup.Instance.vrCamera.transform; + } + } +} diff --git a/ml_pvf/Properties/AssemblyInfo.cs b/ml_pvf/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b137375 --- /dev/null +++ b/ml_pvf/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +[assembly: MelonLoader.MelonInfo(typeof(ml_pvf.PostprocessVolumeFix), "PostprocessVolumeFix", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] +[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_pvf/README.md b/ml_pvf/README.md new file mode 100644 index 0000000..1a0c762 --- /dev/null +++ b/ml_pvf/README.md @@ -0,0 +1,10 @@ +# Post-Process Volume Fix +Fixes reported [issue with wrong volume trigger for post-processing layer](https://feedback.abinteractive.net/p/2023r171ex1-post-process-volume-effects-are-applied-based-on-playspace-center-instead-of-camera-s-in-vr-mode). + +# Installation +* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader) +* Get [latest release DLL](../../../releases/latest): + * Put `ml_pvf.dll` in `Mods` folder of game + +# Notes +* Will be implemented natively in game after 2023r172ex3. diff --git a/ml_pvf/ml_pvf.csproj b/ml_pvf/ml_pvf.csproj new file mode 100644 index 0000000..2455c13 --- /dev/null +++ b/ml_pvf/ml_pvf.csproj @@ -0,0 +1,48 @@ + + + + netstandard2.1 + x64 + PostprocessVolumeFix + 1.0.0 + SDraw + None + PostprocessVolumeFix + + + + + + + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\0Harmony.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Unity.Postprocessing.Runtime.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + + + + + + + + diff --git a/ml_vgm/Main.cs b/ml_vgm/Main.cs new file mode 100644 index 0000000..0e1bd80 --- /dev/null +++ b/ml_vgm/Main.cs @@ -0,0 +1,60 @@ +using System; +using System.Reflection; +using ABI_RC.Systems.InputManagement; +using ABI_RC.Systems.InputManagement.XR; + +namespace ml_vgm +{ + public class ViveGesturesMovement : MelonLoader.MelonMod + { + public override void OnInitializeMelon() + { + HarmonyInstance.Patch( + typeof(CVRXRModule).GetMethod("Update_Gestures_Vive", BindingFlags.NonPublic | BindingFlags.Instance), + null, + new HarmonyLib.HarmonyMethod(typeof(ViveGesturesMovement).GetMethod(nameof(OnViveGesturesUpdate_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) + ); + HarmonyInstance.Patch( + typeof(CVRXRModule).GetMethod(nameof(CVRXRModule.Reset), BindingFlags.Public | BindingFlags.Instance), + new HarmonyLib.HarmonyMethod(typeof(ViveGesturesMovement).GetMethod(nameof(OnCVRXRModuleReset_Prefix), BindingFlags.NonPublic | BindingFlags.Static)), + new HarmonyLib.HarmonyMethod(typeof(ViveGesturesMovement).GetMethod(nameof(OnCVRXRModuleReset_Postfix), BindingFlags.NonPublic | BindingFlags.Static)) + ); + } + + static void OnViveGesturesUpdate_Postfix(ref CVRXRModule __instance) + { + try + { + float l_mag = ((!__instance.HasEmoteOverride) ? __instance.Primary2DAxis : __instance.EmoteOverride).magnitude; + if(__instance.ViveDirectionPressed && (l_mag >= CVRInputManager.VrViveGestureDeadZone)) + { + if(__instance.Grip > 0.5f) + { + __instance.GestureRaw = -1f; + __instance.Gesture = -1f; + } + else + { + __instance.GestureRaw = __instance.Trigger; + __instance.Gesture = __instance.Trigger; + } + } + } + catch(Exception e) + { + MelonLoader.MelonLogger.Error(e); + } + } + + static void OnCVRXRModuleReset_Prefix(ref CVRXRModule __instance, out bool __state) + { + __state = __instance.ViveDirectionPressed; + } + + static void OnCVRXRModuleReset_Postfix(ref CVRXRModule __instance, bool __state) + { + if((__instance.Type == EXRControllerType.Vive) && CVRInputManager._moduleXR.ViveAdvancedControls) + __instance.ViveDirectionPressed = __state; + } + } +} diff --git a/ml_vgm/Properties/AssemblyInfo.cs b/ml_vgm/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..67375c6 --- /dev/null +++ b/ml_vgm/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +[assembly: MelonLoader.MelonInfo(typeof(ml_vgm.ViveGesturesMovement), "ViveGesturesMovement", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] +[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_vgm/README.md b/ml_vgm/README.md new file mode 100644 index 0000000..eab98fe --- /dev/null +++ b/ml_vgm/README.md @@ -0,0 +1,7 @@ +# Vive Gestures Movement +Fixes broken `Vive Advanced Controls` input settings option and disables gestures when moving for Vive controllers. + +# Installation +* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader) +* Get [latest release DLL](../../../releases/latest): + * Put `ml_vgm.dll` in `Mods` folder of game diff --git a/ml_vgm/ml_vgm.csproj b/ml_vgm/ml_vgm.csproj new file mode 100644 index 0000000..83505cb --- /dev/null +++ b/ml_vgm/ml_vgm.csproj @@ -0,0 +1,44 @@ + + + + netstandard2.1 + x64 + ViveGesturesMovement + 1.0.0 + SDraw + None + ViveGesturesMovement + + + + + + + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\0Harmony.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll + false + + + D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + + + + + + + +