From 37875a2c7c0c14e9d2485faf8f5ac6e206cbe134 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 30 Jun 2023 19:31:20 -0500 Subject: [PATCH] [AASBufferFix] Fix issue allowing AASBufferFix to count past AAS bit limit. I have never seen an avatar over this limit until today... --- AASBufferFix/Utils.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/AASBufferFix/Utils.cs b/AASBufferFix/Utils.cs index fe2bf81..bde06f5 100644 --- a/AASBufferFix/Utils.cs +++ b/AASBufferFix/Utils.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using MelonLoader; +using UnityEngine; namespace NAK.AASBufferFix; @@ -9,22 +10,26 @@ public class Utils int avatarFloatCount = 0; int avatarIntCount = 0; int avatarBoolCount = 0; + int bitCount = 0; foreach (AnimatorControllerParameter animatorControllerParameter in animator.parameters) { - if (animatorControllerParameter.name.Length > 0 && animatorControllerParameter.name[0] != '#' && !coreParameters.Contains(animatorControllerParameter.name)) + if (animatorControllerParameter.name.Length > 0 && animatorControllerParameter.name[0] != '#' && !coreParameters.Contains(animatorControllerParameter.name) && bitCount <= 3200) { AnimatorControllerParameterType type = animatorControllerParameter.type; switch (type) { case AnimatorControllerParameterType.Float: avatarFloatCount++; + bitCount += 32; break; case AnimatorControllerParameterType.Int: avatarIntCount++; + bitCount += 32; break; case AnimatorControllerParameterType.Bool: avatarBoolCount++; + bitCount++; break; default: //we dont count triggers @@ -37,10 +42,11 @@ public class Utils avatarBoolCount = ((int)Math.Ceiling((double)avatarBoolCount / 8)); //create the footprint + return (avatarFloatCount + 1) * (avatarIntCount + 1) * (avatarBoolCount + 1); } - private static HashSet coreParameters = new HashSet + private static readonly HashSet coreParameters = new HashSet { "MovementX", "MovementY",