Skip to content

Commit

Permalink
Merge branch '1.0.6' of github.com:CadeEvs/FrostyToolsuite into 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
CadeEvs committed Jul 20, 2022
2 parents 427955d + 827ce38 commit f666331
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion FrostyModManager/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:localctrl="clr-namespace:FrostyModManager.Controls"
xmlns:conv="clr-namespace:Frosty.Core.Converters;assembly=FrostyCore"
mc:Ignorable="d"
Title="Frosty Mod Manager" Height="750" Width="1000"
Title="Frosty Mod Manager" Height="750" Width="1050"
Icon="/FrostyModManager;component/AppIcon.ico"
FrostyLoaded="FrostyWindow_FrostyLoaded" Closing="FrostyWindow_Closing" AllowDrop="True" Drop="FrostyWindow_Drop">

Expand Down
4 changes: 3 additions & 1 deletion FrostyModSupport/FrostyModExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ private void ProcessModResources(IResourceContainer fmod)
long logicalOffset = entry.LogicalOffset;
uint size = 0;

while (logicalOffset > 0)
while (true)
{
int decompressedSize = reader.ReadInt(Endian.Big);
ushort compressionType = reader.ReadUShort();
Expand All @@ -529,6 +529,8 @@ private void ProcessModResources(IResourceContainer fmod)
decompressedSize &= 0x00FFFFFF;

logicalOffset -= decompressedSize;
if(logicalOffset < 0)
break;

compressionType = (ushort)(compressionType & 0x7F);
if (compressionType == 0x00)
Expand Down
9 changes: 4 additions & 5 deletions Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ private void FBXCreateMesh(FbxScene scene, MeshSetLod lod, List<FbxNode> boneNod
{
FbxNode actor = FBXExportSubObject(scene, section, lod.VertexBufferSize, indexSize, reader);
if (flattenHierarchy)
actor.Name = lod.String03 + ":" + section.Name;
actor.Name = $"{section.Name}:{lod.String03.Insert(lod.String03.Length - 1, ".00")}";
meshNode.AddChild(actor);

if ((lod.Type == MeshType.MeshType_Skinned || lod.Type == MeshType.MeshType_Composite) && boneNodes.Count > 0)
Expand Down Expand Up @@ -1605,8 +1605,7 @@ public void ImportFBX(string filename, MeshSet inMeshSet, EbxAsset asset, EbxAss
{
if (nodeName.Contains(":"))
{
// flat hierarchy, contains lod:section names
nodeName = nodeName.Remove(nodeName.IndexOf(':'));
// flat hierarchy, contains section:lod names
nodeName = nodeName.Substring(nodeName.Length - 1);
int lodIndex = -1;

Expand Down Expand Up @@ -1751,7 +1750,7 @@ private void ProcessLod(List<FbxNode> nodes, int lodIndex)
if (sectionName.Contains(':'))
{
// remove the lod portion of the name
sectionName = sectionName.Remove(0, sectionName.IndexOf(':') + 1);
sectionName = sectionName.Remove(sectionName.IndexOf(':'));
}

int idx = meshSections.FindIndex((a) => a.Name == sectionName);
Expand Down Expand Up @@ -1993,7 +1992,7 @@ private void ProcessSection(FbxNode[] sectionNodes, MeshSetLod meshLod, int sect
}

// MEC/BF1/SWBF2/BFV/Anthem/FIFA19/FIFA20/BFN/SWS
else if (ProfilesLibrary.DataVersion == (int)ProfileVersion.MirrorsEdgeCatalyst || ProfilesLibrary.DataVersion == (int)ProfileVersion.Battlefield1 || ProfilesLibrary.DataVersion == (int)ProfileVersion.StarWarsBattlefrontII || ProfilesLibrary.DataVersion == (int)ProfileVersion.Fifa19 ||
else if (ProfilesLibrary.DataVersion == (int)ProfileVersion.MirrorsEdgeCatalyst || ProfilesLibrary.DataVersion == (int)ProfileVersion.Battlefield5 || ProfilesLibrary.DataVersion == (int)ProfileVersion.StarWarsBattlefrontII || ProfilesLibrary.DataVersion == (int)ProfileVersion.Fifa19 ||
ProfilesLibrary.DataVersion == (int)ProfileVersion.Fifa20 || ProfilesLibrary.DataVersion == (int)ProfileVersion.StarWarsSquadrons)
{
// ushort/uint, can handle long lists so just put all bones into sections
Expand Down
8 changes: 7 additions & 1 deletion Plugins/MeshSetPlugin/Resources/MeshSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,8 @@ public int MaxLodCount
private List<AxisAlignedBox> partBoundingBoxes = new List<AxisAlignedBox>();
private List<LinearTransform> partTransforms = new List<LinearTransform>();

private byte[] unknownbfv;

public MeshSet()
{
}
Expand Down Expand Up @@ -1596,7 +1598,7 @@ public override void Read(NativeReader reader, AssetManager am, ResAssetEntry en

reader.Pad(16);
if (ProfilesLibrary.DataVersion == (int)ProfileVersion.Battlefield5)
reader.ReadBytes(16);
unknownbfv = reader.ReadBytes(16);

// lods
for (int i = 0; i < lodCount; i++)
Expand Down Expand Up @@ -1856,6 +1858,10 @@ private void Process(NativeWriter writer, MeshContainer meshContainer)

writer.WritePadding(16);

if (ProfilesLibrary.DataVersion == (int)ProfileVersion.Battlefield5)
writer.Write(unknownbfv);


Debug.Assert(writer.Position == HeaderSize);

// lods
Expand Down

0 comments on commit f666331

Please sign in to comment.