From cc308d684f80c54c1b865e264f6f75270d616829 Mon Sep 17 00:00:00 2001 From: Diana Gunasena Date: Thu, 26 May 2022 16:40:05 -0400 Subject: [PATCH 1/5] Use proper naming scheme for FlattenHeirarchy (#80) --- Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs index af12050c9..3a1d3514e 100644 --- a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs +++ b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs @@ -697,7 +697,7 @@ private void FBXCreateMesh(FbxScene scene, MeshSetLod lod, List 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) @@ -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; From 8b0ac30d1bb339a8485efac11e6e37fb5ae66607 Mon Sep 17 00:00:00 2001 From: Diana Gunasena Date: Fri, 10 Jun 2022 17:03:56 -0400 Subject: [PATCH 2/5] Fix import issue with new naming system (#82) --- Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs index 3a1d3514e..ff99efa1c 100644 --- a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs +++ b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs @@ -1750,7 +1750,7 @@ private void ProcessLod(List 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); From 76331b01bf4c341aa4a3d5c3124e035a29d4d268 Mon Sep 17 00:00:00 2001 From: August <33284629+CosmicDreamsOfCode@users.noreply.github.com> Date: Sun, 10 Jul 2022 18:13:48 +0100 Subject: [PATCH 3/5] change manager mainwindow width to account for collections (#85) --- FrostyModManager/Windows/MainWindow.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrostyModManager/Windows/MainWindow.xaml b/FrostyModManager/Windows/MainWindow.xaml index 1fc06d94e..fc9e72e3d 100644 --- a/FrostyModManager/Windows/MainWindow.xaml +++ b/FrostyModManager/Windows/MainWindow.xaml @@ -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"> From 53d4f1ae67485580023985d4cf9d186154e5c5d7 Mon Sep 17 00:00:00 2001 From: August <33284629+CosmicDreamsOfCode@users.noreply.github.com> Date: Mon, 11 Jul 2022 22:57:45 +0100 Subject: [PATCH 4/5] Fix Battlefield 1 mesh imports (#89) * change manager mainwindow width to account for collections * fix bfv and bf1 mesh imports --- Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs | 2 +- Plugins/MeshSetPlugin/Resources/MeshSet.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs index ff99efa1c..39fff51fd 100644 --- a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs +++ b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs @@ -1992,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 diff --git a/Plugins/MeshSetPlugin/Resources/MeshSet.cs b/Plugins/MeshSetPlugin/Resources/MeshSet.cs index c7123ed61..9fcffeb33 100644 --- a/Plugins/MeshSetPlugin/Resources/MeshSet.cs +++ b/Plugins/MeshSetPlugin/Resources/MeshSet.cs @@ -1399,6 +1399,8 @@ public int MaxLodCount private List partBoundingBoxes = new List(); private List partTransforms = new List(); + private byte[] unknownbfv; + public MeshSet() { } @@ -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++) @@ -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 From 827ce380845490b52e9027009c00af90b2a0ccc0 Mon Sep 17 00:00:00 2001 From: Jona <93538252+wannkunstbeikor@users.noreply.github.com> Date: Tue, 19 Jul 2022 22:49:52 +0200 Subject: [PATCH 5/5] [ModSupport] Fixes RangeStart calculation for manifest chunks (#94) Fixes RangeStart calculation for manifest chunks --- FrostyModSupport/FrostyModExecutor.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FrostyModSupport/FrostyModExecutor.cs b/FrostyModSupport/FrostyModExecutor.cs index 2f213f551..f0fa026b9 100644 --- a/FrostyModSupport/FrostyModExecutor.cs +++ b/FrostyModSupport/FrostyModExecutor.cs @@ -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(); @@ -529,6 +529,8 @@ private void ProcessModResources(IResourceContainer fmod) decompressedSize &= 0x00FFFFFF; logicalOffset -= decompressedSize; + if(logicalOffset < 0) + break; compressionType = (ushort)(compressionType & 0x7F); if (compressionType == 0x00)