ResourceAnalyzer improvements

This commit is contained in:
dexy 2020-03-13 04:21:30 +11:00
parent dcfe22ade7
commit 7712807c36
4 changed files with 36 additions and 14 deletions

View File

@ -18,6 +18,10 @@ namespace CodeWalker.GameFiles
//used by the editor:
public bool HasChanged { get; set; } = false;
#if DEBUG
public ResourceAnalyzer Analyzer { get; set; }
#endif
public YbnFile() : base(null, GameFileType.Ybn)
{
@ -55,6 +59,10 @@ namespace CodeWalker.GameFiles
Bounds.OwnerYbn = this;
Bounds.OwnerName = entry.Name;
#if DEBUG
Analyzer = new ResourceAnalyzer(rd);
#endif
Loaded = true;
}

View File

@ -3654,7 +3654,7 @@ namespace CodeWalker.GameFiles
}
public void TestYbns()
{
bool xmltest = true;
bool xmltest = false;
bool savetest = false;
bool reloadtest = false;
var errorfiles = new List<RpfEntry>();
@ -3878,7 +3878,7 @@ namespace CodeWalker.GameFiles
//}
}
}
if (errorfiles.Count > 0)
if (errorfiles.Count != 13)
{ }
}
public void TestYdds()

View File

@ -2141,6 +2141,19 @@ namespace CodeWalker.GameFiles
this.BVH = reader.ReadBlockAt<BVH>(
this.BvhPointer // offset
);
//var cap = BVH.Nodes.EntriesCount;//how to calc this?
//var diff = BVH.Nodes.EntriesCapacity - cap;
//switch (diff)
//{
// case 0:
// case 1:
// case 2:
// break;
// default:
// break;//no hit
//}
}
else
{
@ -2453,23 +2466,21 @@ namespace CodeWalker.GameFiles
this.BVHPointer = reader.ReadUInt64();
// read reference data
this.Children = reader.ReadBlockAt<ResourcePointerArray64<Bounds>>(
this.ChildrenPointer, // offset
this.ChildrenCount1
);
this.Children = reader.ReadBlockAt<ResourcePointerArray64<Bounds>>(this.ChildrenPointer, this.ChildrenCount1);
this.ChildrenTransformation1 = reader.ReadStructsAt<Matrix4F_s>(this.ChildrenTransformation1Pointer, this.ChildrenCount1);
this.ChildrenTransformation2 = reader.ReadStructsAt<Matrix4F_s>(this.ChildrenTransformation2Pointer, this.ChildrenCount1);
this.ChildrenBoundingBoxes = reader.ReadStructsAt<AABB_s>(this.ChildrenBoundingBoxesPointer, this.ChildrenCount1);
this.ChildrenFlags1 = reader.ReadStructsAt<BoundCompositeChildrenFlags>(this.ChildrenFlags1Pointer, this.ChildrenCount1);
this.ChildrenFlags2 = reader.ReadStructsAt<BoundCompositeChildrenFlags>(this.ChildrenFlags2Pointer, this.ChildrenCount1);
this.BVH = reader.ReadBlockAt<BVH>(this.BVHPointer);
this.BVH = reader.ReadBlockAt<BVH>(
this.BVHPointer // offset
);
//if (BVH != null)
//{
// var cap = Math.Max(BVH.Nodes.EntriesCount + 2, ChildrenCount1 * 2 + 1);
// var diff = BVH.Nodes.EntriesCapacity - cap;
// if (diff != 0)
// { }//no hit
//}
var childTransforms = ChildrenTransformation1 ?? ChildrenTransformation2;
if ((Children != null) && (Children.data_items != null))

View File

@ -847,6 +847,9 @@ namespace CodeWalker.GameFiles
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
if (EntriesCount != EntriesCapacity)
{ }
}
/// <summary>
@ -926,7 +929,7 @@ namespace CodeWalker.GameFiles
// read reference data
//TODO: NEEDS TO BE TESTED!!!
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCapacity);
}
/// <summary>