1
0
mirror of synced 2024-11-30 18:24:39 +01:00

Fix v10 bfres that have more than 64 boolean bits to load. Keep original bind indices on replace if possible.

This will fully fix and support v10 bfres by loading all possible boolean bits for the shader options. Previously would only load the first 64 bits using a uint64 value rather than checking for multiple when value is larger.
This commit is contained in:
KillzXGaming 2023-10-21 17:40:00 -04:00
parent 7e5b80e575
commit 6088d66e4a
3 changed files with 9 additions and 12 deletions

View File

@ -890,6 +890,7 @@ namespace Bfres.Structs
{
List<FSHP> Matches = shapes.Where(p => String.Equals(p.Text,
ImportedObjects[i].ObjectName, StringComparison.CurrentCulture)).ToList();
ImportedObjects[i].BoneIndex = 0;
if (Matches != null && Matches.Count > 0)
{
@ -902,6 +903,11 @@ namespace Bfres.Structs
if (settings.LimitSkinCount)
ImportedObjects[i].VertexSkinCount = ((FSHP)Matches[0]).VertexSkinCount;
//Keep original bone mapping by default
//Only do this for original boneset for now
if (!settings.ImportBones)
ImportedObjects[i].BoneIndex = ((FSHP)Matches[0]).BoneIndex;
if (settings.UseOriginalAttributes)
{
AttributeMatcher.Add(ImportedObjects[i].ObjectName, Matches[0].vertexAttributes);
@ -1325,23 +1331,14 @@ namespace Bfres.Structs
else
shape.VertexSkinCount = obj.GetMaxSkinInfluenceCount();
if (shape.VertexSkinCount == 0 && obj.boneList.Count > 0)
{
int boneIndex = Skeleton.bones.FindIndex(x => x.Text == obj.boneList[0]);
if (boneIndex != -1)
shape.BoneIndex = boneIndex;
}
else if (shape.VertexSkinCount == 1 && shape.BoneIndices.Count > 0)
{
int boneIndex = shape.BoneIndices[0];
shape.BoneIndex = boneIndex;
}
shape.CreateNewBoundingBoxes(this);
shape.OptmizeAttributeFormats();
shape.SaveShape(IsWiiU);
shape.SaveVertexBuffer(IsWiiU);
if (shape.Shape != null)
shape.Shape.BoneIndex = (ushort)shape.BoneIndex;
if (IsWiiU)
{
shape.ShapeU.SubMeshBoundingIndices = new List<ushort>();