diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..262b1ec --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 NotAKidoS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MenuScalePatch/Main.cs b/MenuScalePatch/Main.cs new file mode 100644 index 0000000..2a50bfe --- /dev/null +++ b/MenuScalePatch/Main.cs @@ -0,0 +1,48 @@ +using ABI_RC.Core.InteractionSystem; +using ABI_RC.Core.Player; +using ABI_RC.Core.Savior; +using cohtml; +using HarmonyLib; +using MelonLoader; +using UnityEngine; + + +namespace MenuScalePatch; + +public class MenuScalePatch : MelonMod +{ + [HarmonyPatch] + private class HarmonyPatches + { + [HarmonyPostfix] + [HarmonyPatch(typeof(CVR_MenuManager), "SetScale")] + private static void SetQMScale(ref CohtmlView ___quickMenu, ref float ____scaleFactor) + { + //correct quickmenu - pretty much needsQuickmenuPositionUpdate() + Transform rotationPivot = PlayerSetup.Instance._movementSystem.rotationPivot; + ___quickMenu.transform.eulerAngles = new Vector3(rotationPivot.eulerAngles.x, rotationPivot.eulerAngles.y, rotationPivot.eulerAngles.z); + ___quickMenu.transform.position = rotationPivot.position + rotationPivot.forward * 1f * ____scaleFactor; + } + + //ViewManager.SetScale runs once a second when it should only run when aspect ratio changes...? bug + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "SetScale")] + private static void SetMMScale(ref ViewManager __instance, ref bool ___needsMenuPositionUpdate, ref float ___scaleFactor, ref float ___cachedScreenAspectRatio, ref float ___cachedAvatarHeight) + { + //correct main menu - pretty much UpdateMenuPosition() + Transform rotationPivot = PlayerSetup.Instance._movementSystem.rotationPivot; + float num = Mathf.Abs(rotationPivot.localRotation.eulerAngles.z); + float settingsFloat = MetaPort.Instance.settings.GetSettingsFloat("GeneralMinimumMenuTilt"); + if (MetaPort.Instance.isUsingVr && (num <= settingsFloat || num >= 360f - settingsFloat)) + { + __instance.gameObject.transform.rotation = Quaternion.LookRotation(rotationPivot.forward, Vector3.up); + } + else + { + __instance.gameObject.transform.eulerAngles = new Vector3(rotationPivot.eulerAngles.x, rotationPivot.eulerAngles.y, rotationPivot.eulerAngles.z); + } + __instance.gameObject.transform.position = rotationPivot.position + rotationPivot.forward * 1f * ___scaleFactor; + ___needsMenuPositionUpdate = false; + } + } +} diff --git a/MenuScalePatch/MenuScalePatch.csproj b/MenuScalePatch/MenuScalePatch.csproj new file mode 100644 index 0000000..7c80c7d --- /dev/null +++ b/MenuScalePatch/MenuScalePatch.csproj @@ -0,0 +1,43 @@ + + + + + net472 + enable + latest + false + + + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + + + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\SteamVR.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll + + + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll + + + + + + + + + diff --git a/MenuScalePatch/MenuScalePatch.sln b/MenuScalePatch/MenuScalePatch.sln new file mode 100644 index 0000000..fe3a351 --- /dev/null +++ b/MenuScalePatch/MenuScalePatch.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32630.192 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvatarScaleUpdater", "AvatarScaleUpdater.csproj", "{1B069D34-0AD6-43A4-A116-C325F37D33A6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1B069D34-0AD6-43A4-A116-C325F37D33A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B069D34-0AD6-43A4-A116-C325F37D33A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B069D34-0AD6-43A4-A116-C325F37D33A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B069D34-0AD6-43A4-A116-C325F37D33A6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {67335521-EBA9-453E-A0E2-3DE0E3A86EBF} + EndGlobalSection +EndGlobal diff --git a/MenuScalePatch/Properties/AssemblyInfo.cs b/MenuScalePatch/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2150156 --- /dev/null +++ b/MenuScalePatch/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using MelonLoader; +using MenuScalePatch.Properties; +using System.Reflection; + + +[assembly: AssemblyVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyTitle(nameof(MenuScalePatch))] +[assembly: AssemblyCompany(AssemblyInfoParams.Author)] +[assembly: AssemblyProduct(nameof(MenuScalePatch))] + +[assembly: MelonInfo( + typeof(MenuScalePatch.MenuScalePatch), + nameof(MenuScalePatch), + AssemblyInfoParams.Version, + AssemblyInfoParams.Author, + downloadLink: "https://github.com/NotAKidOnSteam/MenuScalePatch" +)] + +[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] +[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] + +namespace MenuScalePatch.Properties; +internal static class AssemblyInfoParams +{ + public const string Version = "1.0.0"; + public const string Author = "NotAKidoS"; +} \ No newline at end of file diff --git a/MenuScalePatch/format.json b/MenuScalePatch/format.json new file mode 100644 index 0000000..cca9289 --- /dev/null +++ b/MenuScalePatch/format.json @@ -0,0 +1,23 @@ +{ + "_id": -1, + "name": "MenuScalePatch", + "modversion": "1.0.0", + "gameversion": "2022r168", + "loaderversion": "0.5.4", + "modtype": "Mod", + "author": "NotAKidoS", + "description": "Corrects MM and QM position when avatar is scaled.", + "searchtags": [ + "menu", + "scale", + "avatarscale", + "slider" + ], + "requirements": [ + "None" + ], + "downloadlink": "https://github.com/NotAKidOnSteam/MenuScalePatch/releases/download/r1/MenuScalePatch.dll", + "sourcelink": "https://github.com/NotAKidOnSteam/MenuScalePatch/", + "changelog": "Initial Release.", + "embedcolor": "804221" +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d86a35 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# MenuScalePatch + +just updates the menu position when the game detects a change in avatar scale + +im sure itll be patched officially before cvrmg verifies it lol + +--- + +Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI. +https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games + +> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny. + +> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk. + +> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be. +> They reserve the right to punish users using my mod. +> If you are scared of using modifications in your game do not install mods. + +> I do not affiliate ABI and the mod is not supported by ABI. + +> Me and this modification are in no affiliation with ABI and not supported by ABI. + +> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse. + +> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game. + +> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface: + +> i ran out of places to steal disclaimers from