diff --git a/MeshUnpacker/MeshUnpacker.csproj b/MeshUnpacker/MeshUnpacker.csproj deleted file mode 100644 index 7420c8c..0000000 --- a/MeshUnpacker/MeshUnpacker.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - Exe - - - diff --git a/MeshUnpacker/Program.cs b/MeshUnpacker/Program.cs deleted file mode 100644 index 40dac44..0000000 --- a/MeshUnpacker/Program.cs +++ /dev/null @@ -1,14 +0,0 @@ -// See https://aka.ms/new-console-template for more information - -Console.WriteLine("Hello, World!"); - -using var fs = new FileStream("C:\\ParkanUnpacked\\11_fr_e_brige.msh\\0_fr_e_brige.bin", FileMode.Open); - -byte[] buffer = new byte[38]; - -for (int i = 0; i < 6; i++) -{ - fs.ReadExactly(buffer); - - Console.WriteLine(string.Join(" ", buffer.Select(x => x.ToString("X2")))); -} \ No newline at end of file diff --git a/MissionDataUnpacker/MissionDataUnpacker.csproj b/MissionDataUnpacker/MissionDataUnpacker.csproj deleted file mode 100644 index 7420c8c..0000000 --- a/MissionDataUnpacker/MissionDataUnpacker.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - Exe - - - diff --git a/MissionDataUnpacker/Program.cs b/MissionDataUnpacker/Program.cs deleted file mode 100644 index 39ea3bc..0000000 --- a/MissionDataUnpacker/Program.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Buffers.Binary; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Text; - -// var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\Autodemo.00\\data.tma"; -// var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\Tutorial.01\\data.tma"; -var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\CAMPAIGN\\CAMPAIGN.01\\Mission.02\\data.tma"; -// var missionFilePath = "C:\\Program Files (x86)\\Nikita\\Iron Strategy\\MISSIONS\\Single.01\\data.tma"; diff --git a/NLUnpacker/Program.cs b/NLUnpacker/Program.cs index 27bda12..30517f8 100644 --- a/NLUnpacker/Program.cs +++ b/NLUnpacker/Program.cs @@ -1,6 +1,8 @@ using System.Buffers.Binary; using System.Text; +// Unfinished + var fileBytes = File.ReadAllBytes("C:\\Program Files (x86)\\Nikita\\Iron Strategy\\gamefont-1.rlb"); var header = fileBytes.AsSpan().Slice(0, 32); diff --git a/ParkanPlayground.slnx b/ParkanPlayground.slnx index ac5de6f..370f813 100644 --- a/ParkanPlayground.slnx +++ b/ParkanPlayground.slnx @@ -6,8 +6,6 @@ - - @@ -16,7 +14,5 @@ - - \ No newline at end of file diff --git a/TextureDecoder/Program.cs b/TextureDecoder/Program.cs deleted file mode 100644 index 97eba84..0000000 --- a/TextureDecoder/Program.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Buffers.Binary; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.PixelFormats; -using TexmLib; - -var folder = "C:\\Projects\\CSharp\\ParkanPlayground\\ParkanPlayground\\bin\\Debug\\net8.0\\ui.lib"; - -var files = Directory.EnumerateFiles(folder); - -List textureFiles = []; - -foreach (var file in files) -{ - try - { - var fs = new FileStream(file, FileMode.Open); - - var parseResult = TexmParser.ReadFromStream(fs, file); - - textureFiles.Add(parseResult.TexmFile); - - Console.WriteLine($"Successfully read: {file}"); - } - catch - { - Console.WriteLine($"Failed read: {file}"); - } -} - -foreach (var textureFile in textureFiles) -{ - await textureFile.WriteToFolder("unpacked"); - Console.WriteLine($"Unpacked {Path.GetFileName(textureFile.FileName)} into folder"); -} \ No newline at end of file diff --git a/TextureDecoder/TextureDecoder.csproj b/TextureDecoder/TextureDecoder.csproj deleted file mode 100644 index 57fe6d0..0000000 --- a/TextureDecoder/TextureDecoder.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - - - - - - - - - - - diff --git a/Visualisator/Program.cs b/Visualisator/Program.cs deleted file mode 100644 index 7933aff..0000000 --- a/Visualisator/Program.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Configure window options - -using System.Buffers.Binary; -using System.Numerics; -using Silk.NET.OpenGL; -using Silk.NET.Windowing; - -public static class Program -{ - private static string vertexShaderSource = @" - #version 330 core - layout (location = 0) in vec3 aPos; - uniform mat4 uMVP; - - void main() - { - gl_Position = uMVP * vec4(aPos, 1.0); - gl_PointSize = 8.0; - } - "; - - private static string fragmentShaderSource = @" - #version 330 core - out vec4 FragColor; - - void main() - { - FragColor = vec4(1.0, 1.0, 1.0, 1.0); // White points - } - "; - - - private static IWindow? window; - private static GL? gl = null; - - - private static uint shaderProgram = uint.MaxValue; - private static uint vao = uint.MaxValue; - private static uint vbo = uint.MaxValue; - private static Matrix4x4 mvp = new Matrix4x4(); - private static float[] points = []; - - public static void Main(string[] args) - { - var path = "C:\\ParkanUnpacked\\Land.msh\\2_03 00 00 00_Land.bin"; - var bytes = File.ReadAllBytes(path); - - points = new float[bytes.Length / 4]; - for (int i = 0; i < bytes.Length / 4; i++) - { - points[i] = BinaryPrimitives.ReadSingleBigEndian(bytes.AsSpan()[(i * 4)..]); - } - - var options = WindowOptions.Default; - options.API = new GraphicsAPI(ContextAPI.OpenGL, new APIVersion(3, 3)); - options.Title = "3D Points with Silk.NET"; - window = Window.Create(options); - - window.Load += OnLoad; - window.Render += OnRender; - window.Run(); - } - - - unsafe static void OnLoad() - { - gl = window.CreateOpenGL(); - // Compile shaders - uint vertexShader = gl.CreateShader(ShaderType.VertexShader); - gl.ShaderSource(vertexShader, vertexShaderSource); - gl.CompileShader(vertexShader); - CheckShaderCompile(vertexShader); - - uint fragmentShader = gl.CreateShader(ShaderType.FragmentShader); - gl.ShaderSource(fragmentShader, fragmentShaderSource); - gl.CompileShader(fragmentShader); - CheckShaderCompile(fragmentShader); - - // Create shader program - shaderProgram = gl.CreateProgram(); - gl.AttachShader(shaderProgram, vertexShader); - gl.AttachShader(shaderProgram, fragmentShader); - gl.LinkProgram(shaderProgram); - CheckProgramLink(shaderProgram); - - gl.DeleteShader(vertexShader); - gl.DeleteShader(fragmentShader); - - // Create VAO and VBO - vao = gl.GenVertexArray(); - gl.BindVertexArray(vao); - - vbo = gl.GenBuffer(); - gl.BindBuffer(BufferTargetARB.ArrayBuffer, vbo); - unsafe - { - fixed (float* ptr = points) - { - gl.BufferData( - BufferTargetARB.ArrayBuffer, - (nuint) (points.Length * sizeof(float)), - ptr, - BufferUsageARB.StaticDraw - ); - } - } - - gl.VertexAttribPointer( - 0, - 3, - VertexAttribPointerType.Float, - false, - 3 * sizeof(float), - (void*) 0 - ); - gl.EnableVertexAttribArray(0); - - gl.BindVertexArray(0); // Unbind VAO - - gl.Enable(EnableCap.DepthTest); - } - - unsafe static void OnRender(double dt) - { - gl.ClearColor( - 0.1f, - 0.1f, - 0.1f, - 1.0f - ); - gl.Clear((uint) (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit)); - - // Set up MVP matrix - Matrix4x4 view = Matrix4x4.CreateLookAt( - new Vector3(100, 100, 40), // Camera position - Vector3.Zero, // Look at origin - Vector3.UnitY - ); // Up direction - Matrix4x4 projection = Matrix4x4.CreatePerspectiveFieldOfView( - (float) Math.PI / 4f, // 45 degrees - (float) window.Size.X / window.Size.Y, - 0.1f, - 100f - ); - mvp = view * projection; - - gl.UseProgram(shaderProgram); - - // Set MVP matrix (transpose=true for column-major format) - int mvpLocation = gl.GetUniformLocation(shaderProgram, "uMVP"); - - fixed (Matrix4x4* ptr = &mvp) - { - gl.UniformMatrix4( - mvpLocation, - 1, - true, - (float*) ptr - ); - } - - gl.BindVertexArray(vao); - gl.DrawArrays(PrimitiveType.Points, 0, (uint) (points.Length / 3)); - } - - // Error checking methods - static void CheckShaderCompile(uint shader) - { - gl.GetShader(shader, ShaderParameterName.CompileStatus, out int success); - if (success == 0) - Console.WriteLine(gl.GetShaderInfoLog(shader)); - } - - static void CheckProgramLink(uint program) - { - gl.GetProgram(program, ProgramPropertyARB.LinkStatus, out int success); - if (success == 0) - Console.WriteLine(gl.GetProgramInfoLog(program)); - } -} \ No newline at end of file diff --git a/Visualisator/Visualisator.csproj b/Visualisator/Visualisator.csproj deleted file mode 100644 index 17afd97..0000000 --- a/Visualisator/Visualisator.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - true - - - - - - - - - -