diff --git a/Linkrealms-Extractor.csproj b/Linkrealms-Extractor.csproj new file mode 100644 index 0000000..a091f80 --- /dev/null +++ b/Linkrealms-Extractor.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + Linkrealms_Extractor + + + diff --git a/Linkrealms-Extractor.sln b/Linkrealms-Extractor.sln new file mode 100644 index 0000000..9570b2c --- /dev/null +++ b/Linkrealms-Extractor.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.34407.143 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linkrealms-Extractor", "Linkrealms-Extractor.csproj", "{417A4153-4192-426C-8543-123A4A18D22F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {417A4153-4192-426C-8543-123A4A18D22F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {417A4153-4192-426C-8543-123A4A18D22F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {417A4153-4192-426C-8543-123A4A18D22F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {417A4153-4192-426C-8543-123A4A18D22F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C763ABE9-83D5-4CF0-9F51-30A7A2B2D99F} + EndGlobalSection +EndGlobal diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..69123c2 --- /dev/null +++ b/Program.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; + +namespace Linkrealms_Extractor +{ + class Program + { + static void Main(string[] args) + { + string path = Path.GetDirectoryName(args[0]); + path = path.Remove(path.IndexOf("\\resources")); + BinaryReader br = new(File.OpenRead(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + ".idx")); + + System.Collections.Generic.List data = new(); + + while (br.BaseStream.Position < br.BaseStream.Length) + { + string name = br.ReadString(); + br.BaseStream.Position += 0xA4 - name.Length - 1; + data.Add(new() + { + name = name, + start = br.ReadInt32(), + size = br.ReadInt32() + }); + } + + foreach (Subfile file in data) + { + br.BaseStream.Position = file.start; + try + { + Directory.CreateDirectory(path + "//" + Path.GetDirectoryName(file.name)); + using FileStream FS = File.Create(path + "//" + file.name); + BinaryWriter bw = new(FS); + bw.Write(br.ReadBytes(file.size)); + bw.Close(); + } + catch(DirectoryNotFoundException)//"particles.idx" has an empty spot where a file's data should be at 0x84FD4 + { + continue; + } + } + } + + class Subfile + { + public string name; + public int start; + public int size; + } + } +}