diff --git a/BasLib/BasLib.csproj b/BasLib/BasLib.csproj index 820d11d..bfa0917 100644 --- a/BasLib/BasLib.csproj +++ b/BasLib/BasLib.csproj @@ -1,11 +1,5 @@  - - net9.0 - enable - enable - - diff --git a/CpDatLib/CpDatEntry.cs b/CpDatLib/CpDatEntry.cs index 6bfd255..b113444 100644 --- a/CpDatLib/CpDatEntry.cs +++ b/CpDatLib/CpDatEntry.cs @@ -4,7 +4,7 @@ public record CpDatEntry( string ArchiveFile, string ArchiveEntryName, int Magic1, - int Magic2, + int AttachIndex, string Description, DatEntryType Type, int ChildCount, // игра не хранит это число в объекте, но оно есть в файле diff --git a/CpDatLib/CpDatParser.cs b/CpDatLib/CpDatParser.cs index 27c2dba..6f98e08 100644 --- a/CpDatLib/CpDatParser.cs +++ b/CpDatLib/CpDatParser.cs @@ -51,7 +51,7 @@ public class CpDatParser fs.Seek(32 - str2.Length - 1, SeekOrigin.Current); // -1 ignore null terminator var magic1 = fs.ReadInt32LittleEndian(); - var magic2 = fs.ReadInt32LittleEndian(); + var attachIndex = fs.ReadInt32LittleEndian(); var descriptionString = fs.ReadNullTerminated1251String(); @@ -69,6 +69,6 @@ public class CpDatParser children.Add(child); } - return new CpDatEntry(str1, str2, magic1, magic2, descriptionString, type, childCount, Children: children); + return new CpDatEntry(str1, str2, magic1, attachIndex, descriptionString, type, childCount, Children: children); } } \ No newline at end of file diff --git a/FxidLib/FxidLib.csproj b/FxidLib/FxidLib.csproj index 568da04..a6c6b07 100644 --- a/FxidLib/FxidLib.csproj +++ b/FxidLib/FxidLib.csproj @@ -1,11 +1,5 @@  - - net9.0 - enable - enable - - diff --git a/MshLib/Msh0x01.cs b/MshLib/Msh0x01.cs index 955f892..4e440ba 100644 --- a/MshLib/Msh0x01.cs +++ b/MshLib/Msh0x01.cs @@ -54,8 +54,6 @@ public static class Msh0x01 var baseOffset = i * entry.ElementSize; var elementSpan = dataSpan.Slice(baseOffset, entry.ElementSize); - var rawBytes = elementSpan.ToArray(); - var slotIndices = new ushort[SlotCount]; Array.Fill(slotIndices, ushort.MaxValue); @@ -70,7 +68,6 @@ public static class Msh0x01 } nodes.Add(new Node( - RawBytes: rawBytes, Flags: (NodeFlags)BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x00, 2)), ParentIndexOrLink: BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x02, 2)), AnimMapStart0x13: BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x04, 2)), @@ -92,7 +89,6 @@ public static class Msh0x01 } /// Узел MSH 0x01. - /// Сырые байты узла. Нужны для copy-through нестандартных вариантов. /// [0x00..0x02] Флаги узла. /// [0x02..0x04] Parent node index. 0xFFFF обычно значит root/no parent. /// [0x04..0x06] Начало блока в MSH 0x13 animation map или 0xFFFF. @@ -102,7 +98,6 @@ public static class Msh0x01 /// Формула: slot = lod * 5 + group. 0xFFFF значит отсутствует. /// public sealed record Node( - byte[] RawBytes, NodeFlags Flags, ushort ParentIndexOrLink, ushort AnimMapStart0x13, diff --git a/MshLib/MshConverter.cs b/MshLib/MshConverter.cs index ec50b16..67e122a 100644 --- a/MshLib/MshConverter.cs +++ b/MshLib/MshConverter.cs @@ -1,4 +1,5 @@ using System.Text; +using System.Text.Json; using Common; using NResLib; @@ -104,6 +105,18 @@ public sealed class MshConverter var vertices = Msh0x03.ReadComponent(fs, archive); var indices = Msh0x06.ReadComponent(fs, archive); var batches = Msh0x0D.ReadComponent(fs, archive); + var names = Msh0x0A.ReadComponent(fs, archive); + + Console.WriteLine("0x01 component"); + Console.WriteLine(JsonSerializer.Serialize(nodes)); + + Console.WriteLine("0x02 component"); + Console.WriteLine(JsonSerializer.Serialize(geometry)); + + Console.WriteLine("0x0A component"); + Console.WriteLine(JsonSerializer.Serialize(names)); + + return; using var writer = CreateObjWriter(outputPath); diff --git a/MshLib/MshLib.csproj b/MshLib/MshLib.csproj index 568da04..a6c6b07 100644 --- a/MshLib/MshLib.csproj +++ b/MshLib/MshLib.csproj @@ -1,11 +1,5 @@  - - net9.0 - enable - enable - - diff --git a/NResUI/ImGuiUI/CpDatSchemeExplorer.cs b/NResUI/ImGuiUI/CpDatSchemeExplorer.cs index e56a814..8364173 100644 --- a/NResUI/ImGuiUI/CpDatSchemeExplorer.cs +++ b/NResUI/ImGuiUI/CpDatSchemeExplorer.cs @@ -41,7 +41,7 @@ public class CpDatSchemeExplorer : IImGuiPanel ImGui.TableSetupColumn("Архив"); ImGui.TableSetupColumn("Элемент"); ImGui.TableSetupColumn("Magic1"); - ImGui.TableSetupColumn("Magic2"); + ImGui.TableSetupColumn("AttachIndex"); ImGui.TableSetupColumn("Описание"); ImGui.TableSetupColumn("Тип"); @@ -70,7 +70,7 @@ public class CpDatSchemeExplorer : IImGuiPanel case 2: result = string.Compare(a.Entry.ArchiveFile, b.Entry.ArchiveFile, StringComparison.Ordinal); break; case 3: result = string.Compare(a.Entry.ArchiveEntryName, b.Entry.ArchiveEntryName, StringComparison.Ordinal); break; case 4: result = a.Entry.Magic1.CompareTo(b.Entry.Magic1); break; - case 5: result = a.Entry.Magic2.CompareTo(b.Entry.Magic2); break; + case 5: result = a.Entry.AttachIndex.CompareTo(b.Entry.AttachIndex); break; case 6: result = string.Compare(a.Entry.Description, b.Entry.Description, StringComparison.Ordinal); break; case 7: result = a.Entry.Type.CompareTo(b.Entry.Type); break; } @@ -96,7 +96,7 @@ public class CpDatSchemeExplorer : IImGuiPanel ImGui.TableNextColumn(); ImGui.Text(_viewModel.FlatList[i].Entry.Magic1.ToString()); ImGui.TableNextColumn(); - ImGui.Text(_viewModel.FlatList[i].Entry.Magic2.ToString()); + ImGui.Text(_viewModel.FlatList[i].Entry.AttachIndex.ToString()); ImGui.TableNextColumn(); ImGui.Text(_viewModel.FlatList[i].Entry.Description); ImGui.TableNextColumn(); @@ -114,9 +114,9 @@ public class CpDatSchemeExplorer : IImGuiPanel ImGui.SameLine(); ImGui.Text(entry.Magic1.ToString()); - ImGui.Text("Magic2: "); + ImGui.Text("AttachIndex: "); ImGui.SameLine(); - ImGui.Text(entry.Magic2.ToString()); + ImGui.Text(entry.AttachIndex.ToString()); ImGui.Text("Тип: "); ImGui.SameLine(); diff --git a/NResUI/ImGuiUI/MainMenuBar.cs b/NResUI/ImGuiUI/MainMenuBar.cs index cd10e73..abd1ffd 100644 --- a/NResUI/ImGuiUI/MainMenuBar.cs +++ b/NResUI/ImGuiUI/MainMenuBar.cs @@ -44,6 +44,7 @@ namespace NResUI.ImGuiUI nResExplorerViewModel.SetParseResult(parseResult, path); Console.WriteLine("Read NRES"); + Console.WriteLine(JsonSerializer.Serialize(parseResult.Archive)); } } diff --git a/ParkanPlayground/ParkanPlayground.csproj b/ParkanPlayground/ParkanPlayground.csproj index 450b9b3..a8b924d 100644 --- a/ParkanPlayground/ParkanPlayground.csproj +++ b/ParkanPlayground/ParkanPlayground.csproj @@ -5,6 +5,7 @@ + diff --git a/ResTreeLib/ResTreeLib.csproj b/ResTreeLib/ResTreeLib.csproj index 568da04..a6c6b07 100644 --- a/ResTreeLib/ResTreeLib.csproj +++ b/ResTreeLib/ResTreeLib.csproj @@ -1,11 +1,5 @@  - - net9.0 - enable - enable - -