[AASBufferFix] Fix issue allowing AASBufferFix to count past AAS bit limit.

I have never seen an avatar over this limit until today...
This commit is contained in:
NotAKidoS 2023-06-30 19:31:20 -05:00
parent 8d4f17b8d1
commit 37875a2c7c

View file

@ -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<string> coreParameters = new HashSet<string>
private static readonly HashSet<string> coreParameters = new HashSet<string>
{
"MovementX",
"MovementY",