From 9464995557cd9efbd53ae50ac9c09ede6d080f6b Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Mon, 10 Jun 2024 00:03:41 -0500 Subject: [PATCH] [AASDefaultProfileFix] Initial release --- .../AASDefaultProfileFix.csproj | 6 ++++ AASDefaultProfileFix/Main.cs | 33 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 30 +++++++++++++++++ AASDefaultProfileFix/README.md | 14 ++++++++ AASDefaultProfileFix/format.json | 24 ++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 AASDefaultProfileFix/AASDefaultProfileFix.csproj create mode 100644 AASDefaultProfileFix/Main.cs create mode 100644 AASDefaultProfileFix/Properties/AssemblyInfo.cs create mode 100644 AASDefaultProfileFix/README.md create mode 100644 AASDefaultProfileFix/format.json diff --git a/AASDefaultProfileFix/AASDefaultProfileFix.csproj b/AASDefaultProfileFix/AASDefaultProfileFix.csproj new file mode 100644 index 0000000..bec5b03 --- /dev/null +++ b/AASDefaultProfileFix/AASDefaultProfileFix.csproj @@ -0,0 +1,6 @@ + + + + LoadedObjectHack + + diff --git a/AASDefaultProfileFix/Main.cs b/AASDefaultProfileFix/Main.cs new file mode 100644 index 0000000..b8fd563 --- /dev/null +++ b/AASDefaultProfileFix/Main.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using ABI_RC.Core.Util.AnimatorManager; +using ABI.CCK.Scripts; +using HarmonyLib; +using MelonLoader; + +namespace NAK.AASDefaultProfileFix; + +public class AASDefaultProfileFix : MelonMod +{ + public override void OnInitializeMelon() + { + HarmonyInstance.Patch( + typeof(CVRAdvancedAvatarSettings).GetMethod(nameof(CVRAdvancedAvatarSettings.LoadProfile), + BindingFlags.Public | BindingFlags.Instance), // earliest callback (why the fuck are you public) + prefix: new HarmonyMethod(typeof(AASDefaultProfileFix).GetMethod(nameof(OnAttemptLoadAASProfile), + BindingFlags.NonPublic | BindingFlags.Static)) + ); + } + + // when default profile is selected the defaultProfileName string is empty + // so it does not load/apply anything- we will fix by forcing LoadDefault when this is detected + private static bool OnAttemptLoadAASProfile(string profileName, AvatarAnimatorManager animatorManager, + ref CVRAdvancedAvatarSettings __instance) + { + if (!string.IsNullOrEmpty(profileName) // LoadDefault sets defaultProfileName as "" + && profileName != "default") // CVRAdvancedSettingsFile defines initial default as "default" + return true; + + __instance.LoadDefault(animatorManager); + return false; + } +} \ No newline at end of file diff --git a/AASDefaultProfileFix/Properties/AssemblyInfo.cs b/AASDefaultProfileFix/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d7741d8 --- /dev/null +++ b/AASDefaultProfileFix/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using MelonLoader; +using NAK.AASDefaultProfileFix.Properties; +using System.Reflection; + +[assembly: AssemblyVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyTitle(nameof(NAK.AASDefaultProfileFix))] +[assembly: AssemblyCompany(AssemblyInfoParams.Author)] +[assembly: AssemblyProduct(nameof(NAK.AASDefaultProfileFix))] + +[assembly: MelonInfo( + typeof(NAK.AASDefaultProfileFix.AASDefaultProfileFix), + nameof(NAK.AASDefaultProfileFix), + AssemblyInfoParams.Version, + AssemblyInfoParams.Author, + downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/AASDefaultProfileFix" +)] + +[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] +[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] +[assembly: HarmonyDontPatchAll] + +namespace NAK.AASDefaultProfileFix.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/AASDefaultProfileFix/README.md b/AASDefaultProfileFix/README.md new file mode 100644 index 0000000..595dd6b --- /dev/null +++ b/AASDefaultProfileFix/README.md @@ -0,0 +1,14 @@ +# AASDefaultProfileFix + +Fixes the Default AAS profile not being applied when loading into an avatar without a profile selected. + +--- + +Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI. +https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games + +> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive. + +> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use. + +> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive. diff --git a/AASDefaultProfileFix/format.json b/AASDefaultProfileFix/format.json new file mode 100644 index 0000000..6e5db70 --- /dev/null +++ b/AASDefaultProfileFix/format.json @@ -0,0 +1,24 @@ +{ + "_id": -1, + "name": "AASDefaultProfileFix", + "modversion": "1.0.0", + "gameversion": "2024r175", + "loaderversion": "0.6.1", + "modtype": "Mod", + "author": "NotAKidoS", + "description": "Fixes the Default AAS profile not being applied when loading into an avatar without a profile selected.\n\nBy default, the game will not apply anything and the avatar will default to the state found within the Controller parameters.", + "searchtags": [ + "aas", + "profile", + "default", + "fix", + "meow" + ], + "requirements": [ + "None" + ], + "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r33/AASDefaultProfileFix.dll", + "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/AASDefaultProfileFix/", + "changelog": "- Initial release", + "embedcolor": "#1c75f1" +} \ No newline at end of file