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",