This commit is contained in:
bird_egop
2026-06-03 16:48:13 +03:00
parent 2bb61c41ea
commit 4163e9aecb
11 changed files with 23 additions and 37 deletions
-6
View File
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" /> <ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup> </ItemGroup>
+1 -1
View File
@@ -4,7 +4,7 @@ public record CpDatEntry(
string ArchiveFile, string ArchiveFile,
string ArchiveEntryName, string ArchiveEntryName,
int Magic1, int Magic1,
int Magic2, int AttachIndex,
string Description, string Description,
DatEntryType Type, DatEntryType Type,
int ChildCount, // игра не хранит это число в объекте, но оно есть в файле int ChildCount, // игра не хранит это число в объекте, но оно есть в файле
+2 -2
View File
@@ -51,7 +51,7 @@ public class CpDatParser
fs.Seek(32 - str2.Length - 1, SeekOrigin.Current); // -1 ignore null terminator fs.Seek(32 - str2.Length - 1, SeekOrigin.Current); // -1 ignore null terminator
var magic1 = fs.ReadInt32LittleEndian(); var magic1 = fs.ReadInt32LittleEndian();
var magic2 = fs.ReadInt32LittleEndian(); var attachIndex = fs.ReadInt32LittleEndian();
var descriptionString = fs.ReadNullTerminated1251String(); var descriptionString = fs.ReadNullTerminated1251String();
@@ -69,6 +69,6 @@ public class CpDatParser
children.Add(child); 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);
} }
} }
-6
View File
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" /> <ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\NResLib\NResLib.csproj" /> <ProjectReference Include="..\NResLib\NResLib.csproj" />
-5
View File
@@ -54,8 +54,6 @@ public static class Msh0x01
var baseOffset = i * entry.ElementSize; var baseOffset = i * entry.ElementSize;
var elementSpan = dataSpan.Slice(baseOffset, entry.ElementSize); var elementSpan = dataSpan.Slice(baseOffset, entry.ElementSize);
var rawBytes = elementSpan.ToArray();
var slotIndices = new ushort[SlotCount]; var slotIndices = new ushort[SlotCount];
Array.Fill(slotIndices, ushort.MaxValue); Array.Fill(slotIndices, ushort.MaxValue);
@@ -70,7 +68,6 @@ public static class Msh0x01
} }
nodes.Add(new Node( nodes.Add(new Node(
RawBytes: rawBytes,
Flags: (NodeFlags)BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x00, 2)), Flags: (NodeFlags)BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x00, 2)),
ParentIndexOrLink: BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x02, 2)), ParentIndexOrLink: BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x02, 2)),
AnimMapStart0x13: BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x04, 2)), AnimMapStart0x13: BinaryPrimitives.ReadUInt16LittleEndian(elementSpan.Slice(0x04, 2)),
@@ -92,7 +89,6 @@ public static class Msh0x01
} }
/// <summary>Узел MSH 0x01.</summary> /// <summary>Узел MSH 0x01.</summary>
/// <param name="RawBytes">Сырые байты узла. Нужны для copy-through нестандартных вариантов.</param>
/// <param name="Flags">[0x00..0x02] Флаги узла.</param> /// <param name="Flags">[0x00..0x02] Флаги узла.</param>
/// <param name="ParentIndexOrLink">[0x02..0x04] Parent node index. 0xFFFF обычно значит root/no parent.</param> /// <param name="ParentIndexOrLink">[0x02..0x04] Parent node index. 0xFFFF обычно значит root/no parent.</param>
/// <param name="AnimMapStart0x13">[0x04..0x06] Начало блока в MSH 0x13 animation map или 0xFFFF.</param> /// <param name="AnimMapStart0x13">[0x04..0x06] Начало блока в MSH 0x13 animation map или 0xFFFF.</param>
@@ -102,7 +98,6 @@ public static class Msh0x01
/// Формула: slot = lod * 5 + group. 0xFFFF значит отсутствует. /// Формула: slot = lod * 5 + group. 0xFFFF значит отсутствует.
/// </param> /// </param>
public sealed record Node( public sealed record Node(
byte[] RawBytes,
NodeFlags Flags, NodeFlags Flags,
ushort ParentIndexOrLink, ushort ParentIndexOrLink,
ushort AnimMapStart0x13, ushort AnimMapStart0x13,
+13
View File
@@ -1,4 +1,5 @@
using System.Text; using System.Text;
using System.Text.Json;
using Common; using Common;
using NResLib; using NResLib;
@@ -104,6 +105,18 @@ public sealed class MshConverter
var vertices = Msh0x03.ReadComponent(fs, archive); var vertices = Msh0x03.ReadComponent(fs, archive);
var indices = Msh0x06.ReadComponent(fs, archive); var indices = Msh0x06.ReadComponent(fs, archive);
var batches = Msh0x0D.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); using var writer = CreateObjWriter(outputPath);
-6
View File
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" /> <ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\NResLib\NResLib.csproj" /> <ProjectReference Include="..\NResLib\NResLib.csproj" />
+5 -5
View File
@@ -41,7 +41,7 @@ public class CpDatSchemeExplorer : IImGuiPanel
ImGui.TableSetupColumn("Архив"); ImGui.TableSetupColumn("Архив");
ImGui.TableSetupColumn("Элемент"); ImGui.TableSetupColumn("Элемент");
ImGui.TableSetupColumn("Magic1"); ImGui.TableSetupColumn("Magic1");
ImGui.TableSetupColumn("Magic2"); ImGui.TableSetupColumn("AttachIndex");
ImGui.TableSetupColumn("Описание"); ImGui.TableSetupColumn("Описание");
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 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 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 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 6: result = string.Compare(a.Entry.Description, b.Entry.Description, StringComparison.Ordinal); break;
case 7: result = a.Entry.Type.CompareTo(b.Entry.Type); break; case 7: result = a.Entry.Type.CompareTo(b.Entry.Type); break;
} }
@@ -96,7 +96,7 @@ public class CpDatSchemeExplorer : IImGuiPanel
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text(_viewModel.FlatList[i].Entry.Magic1.ToString()); ImGui.Text(_viewModel.FlatList[i].Entry.Magic1.ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text(_viewModel.FlatList[i].Entry.Magic2.ToString()); ImGui.Text(_viewModel.FlatList[i].Entry.AttachIndex.ToString());
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.Text(_viewModel.FlatList[i].Entry.Description); ImGui.Text(_viewModel.FlatList[i].Entry.Description);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@@ -114,9 +114,9 @@ public class CpDatSchemeExplorer : IImGuiPanel
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text(entry.Magic1.ToString()); ImGui.Text(entry.Magic1.ToString());
ImGui.Text("Magic2: "); ImGui.Text("AttachIndex: ");
ImGui.SameLine(); ImGui.SameLine();
ImGui.Text(entry.Magic2.ToString()); ImGui.Text(entry.AttachIndex.ToString());
ImGui.Text("Тип: "); ImGui.Text("Тип: ");
ImGui.SameLine(); ImGui.SameLine();
+1
View File
@@ -44,6 +44,7 @@ namespace NResUI.ImGuiUI
nResExplorerViewModel.SetParseResult(parseResult, path); nResExplorerViewModel.SetParseResult(parseResult, path);
Console.WriteLine("Read NRES"); Console.WriteLine("Read NRES");
Console.WriteLine(JsonSerializer.Serialize(parseResult.Archive));
} }
} }
+1
View File
@@ -5,6 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ControlLib\ControlLib.csproj" />
<ProjectReference Include="..\MissionTmaLib\MissionTmaLib.csproj" /> <ProjectReference Include="..\MissionTmaLib\MissionTmaLib.csproj" />
<ProjectReference Include="..\MshLib\MshLib.csproj" /> <ProjectReference Include="..\MshLib\MshLib.csproj" />
<ProjectReference Include="..\NResLib\NResLib.csproj" /> <ProjectReference Include="..\NResLib\NResLib.csproj" />
-6
View File
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" /> <ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\NResLib\NResLib.csproj" /> <ProjectReference Include="..\NResLib\NResLib.csproj" />