mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-10-05 23:47:25 +08:00
ResourceAnalyzer improvements
This commit is contained in:
parent
dcfe22ade7
commit
7712807c36
@ -18,6 +18,10 @@ namespace CodeWalker.GameFiles
|
|||||||
//used by the editor:
|
//used by the editor:
|
||||||
public bool HasChanged { get; set; } = false;
|
public bool HasChanged { get; set; } = false;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
public ResourceAnalyzer Analyzer { get; set; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public YbnFile() : base(null, GameFileType.Ybn)
|
public YbnFile() : base(null, GameFileType.Ybn)
|
||||||
{
|
{
|
||||||
@ -55,6 +59,10 @@ namespace CodeWalker.GameFiles
|
|||||||
Bounds.OwnerYbn = this;
|
Bounds.OwnerYbn = this;
|
||||||
Bounds.OwnerName = entry.Name;
|
Bounds.OwnerName = entry.Name;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Analyzer = new ResourceAnalyzer(rd);
|
||||||
|
#endif
|
||||||
|
|
||||||
Loaded = true;
|
Loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3654,7 +3654,7 @@ namespace CodeWalker.GameFiles
|
|||||||
}
|
}
|
||||||
public void TestYbns()
|
public void TestYbns()
|
||||||
{
|
{
|
||||||
bool xmltest = true;
|
bool xmltest = false;
|
||||||
bool savetest = false;
|
bool savetest = false;
|
||||||
bool reloadtest = false;
|
bool reloadtest = false;
|
||||||
var errorfiles = new List<RpfEntry>();
|
var errorfiles = new List<RpfEntry>();
|
||||||
@ -3878,7 +3878,7 @@ namespace CodeWalker.GameFiles
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errorfiles.Count > 0)
|
if (errorfiles.Count != 13)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
public void TestYdds()
|
public void TestYdds()
|
||||||
|
@ -2141,6 +2141,19 @@ namespace CodeWalker.GameFiles
|
|||||||
this.BVH = reader.ReadBlockAt<BVH>(
|
this.BVH = reader.ReadBlockAt<BVH>(
|
||||||
this.BvhPointer // offset
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -2453,23 +2466,21 @@ namespace CodeWalker.GameFiles
|
|||||||
this.BVHPointer = reader.ReadUInt64();
|
this.BVHPointer = reader.ReadUInt64();
|
||||||
|
|
||||||
// read reference data
|
// read reference data
|
||||||
this.Children = reader.ReadBlockAt<ResourcePointerArray64<Bounds>>(
|
this.Children = reader.ReadBlockAt<ResourcePointerArray64<Bounds>>(this.ChildrenPointer, this.ChildrenCount1);
|
||||||
this.ChildrenPointer, // offset
|
|
||||||
this.ChildrenCount1
|
|
||||||
);
|
|
||||||
|
|
||||||
this.ChildrenTransformation1 = reader.ReadStructsAt<Matrix4F_s>(this.ChildrenTransformation1Pointer, this.ChildrenCount1);
|
this.ChildrenTransformation1 = reader.ReadStructsAt<Matrix4F_s>(this.ChildrenTransformation1Pointer, this.ChildrenCount1);
|
||||||
this.ChildrenTransformation2 = reader.ReadStructsAt<Matrix4F_s>(this.ChildrenTransformation2Pointer, this.ChildrenCount1);
|
this.ChildrenTransformation2 = reader.ReadStructsAt<Matrix4F_s>(this.ChildrenTransformation2Pointer, this.ChildrenCount1);
|
||||||
this.ChildrenBoundingBoxes = reader.ReadStructsAt<AABB_s>(this.ChildrenBoundingBoxesPointer, this.ChildrenCount1);
|
this.ChildrenBoundingBoxes = reader.ReadStructsAt<AABB_s>(this.ChildrenBoundingBoxesPointer, this.ChildrenCount1);
|
||||||
this.ChildrenFlags1 = reader.ReadStructsAt<BoundCompositeChildrenFlags>(this.ChildrenFlags1Pointer, this.ChildrenCount1);
|
this.ChildrenFlags1 = reader.ReadStructsAt<BoundCompositeChildrenFlags>(this.ChildrenFlags1Pointer, this.ChildrenCount1);
|
||||||
this.ChildrenFlags2 = reader.ReadStructsAt<BoundCompositeChildrenFlags>(this.ChildrenFlags2Pointer, this.ChildrenCount1);
|
this.ChildrenFlags2 = reader.ReadStructsAt<BoundCompositeChildrenFlags>(this.ChildrenFlags2Pointer, this.ChildrenCount1);
|
||||||
|
this.BVH = reader.ReadBlockAt<BVH>(this.BVHPointer);
|
||||||
|
|
||||||
this.BVH = reader.ReadBlockAt<BVH>(
|
//if (BVH != null)
|
||||||
this.BVHPointer // offset
|
//{
|
||||||
);
|
// 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;
|
var childTransforms = ChildrenTransformation1 ?? ChildrenTransformation2;
|
||||||
if ((Children != null) && (Children.data_items != null))
|
if ((Children != null) && (Children.data_items != null))
|
||||||
|
@ -847,6 +847,9 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
//TODO: NEEDS TO BE TESTED!!!
|
//TODO: NEEDS TO BE TESTED!!!
|
||||||
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
|
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
|
||||||
|
|
||||||
|
if (EntriesCount != EntriesCapacity)
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -926,7 +929,7 @@ namespace CodeWalker.GameFiles
|
|||||||
// read reference data
|
// read reference data
|
||||||
|
|
||||||
//TODO: NEEDS TO BE TESTED!!!
|
//TODO: NEEDS TO BE TESTED!!!
|
||||||
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCount);
|
data_items = reader.ReadStructsAt<T>(EntriesPointer, EntriesCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user