From 09e74e7fe9013efc19dc2d50845877166238a378 Mon Sep 17 00:00:00 2001 From: NintenHero <37460517+MichaelHinrichs@users.noreply.github.com> Date: Sun, 3 Mar 2024 09:32:36 -0600 Subject: [PATCH] Add files via upload --- PixelJunk-Extractor.csproj | 9 +++++++ PixelJunk-Extractor.sln | 25 +++++++++++++++++++ Program.cs | 50 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 PixelJunk-Extractor.csproj create mode 100644 PixelJunk-Extractor.sln create mode 100644 Program.cs diff --git a/PixelJunk-Extractor.csproj b/PixelJunk-Extractor.csproj new file mode 100644 index 0000000..4afa4bf --- /dev/null +++ b/PixelJunk-Extractor.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + PixelJunk_Extractor + + + diff --git a/PixelJunk-Extractor.sln b/PixelJunk-Extractor.sln new file mode 100644 index 0000000..e143850 --- /dev/null +++ b/PixelJunk-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}") = "PixelJunk-Extractor", "PixelJunk-Extractor.csproj", "{B0258C13-FA28-4FD4-BF94-A440FA18F660}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0258C13-FA28-4FD4-BF94-A440FA18F660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0258C13-FA28-4FD4-BF94-A440FA18F660}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0258C13-FA28-4FD4-BF94-A440FA18F660}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0258C13-FA28-4FD4-BF94-A440FA18F660}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DC7C07EB-5779-46C6-A4C6-C692F5933451} + EndGlobalSection +EndGlobal diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..a1c924f --- /dev/null +++ b/Program.cs @@ -0,0 +1,50 @@ +using System.IO; +using System.IO.Compression; + +namespace PixelJunk_Extractor +{ + class Program + { + static void Main(string[] args) + { + using FileStream pkiwin = File.OpenRead(args[0] + "//shooter.pkiwin"); + BinaryReader br = new(pkiwin); + Directory.CreateDirectory(args[0] + "//shooter"); + br.BaseStream.Position = 8; + SUBFILE[] subfiles = new SUBFILE[br.ReadInt32()]; + for (int i = 0; i < subfiles.Length; i++) + { + subfiles[i].sizeUncompressed = br.ReadInt32();//unknown + subfiles[i].sizeCompressed = br.ReadInt32(); + subfiles[i].offset = br.ReadInt32(); + br.ReadInt32();//unknown + } + int n = 0; + using FileStream pkdwin = File.OpenRead(args[0] + "//shooter.pkdwin"); + foreach (SUBFILE sub in subfiles) + { + br = new(pkdwin); + br.BaseStream.Position = sub.offset; + using FileStream FS = File.Create(args[0] + "//shooter//" + n); + BinaryWriter bw = new(FS); + + MemoryStream ms = new(); + br.ReadInt16(); + using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes(sub.sizeCompressed)), CompressionMode.Decompress)) + ds.CopyTo(ms); + br = new(ms); + br.BaseStream.Position = 0; + bw.Write(br.ReadBytes(sub.sizeUncompressed)); + bw.Close(); + n++; + } + br.Close(); + } + } + struct SUBFILE + { + public int sizeUncompressed; + public int sizeCompressed; + public int offset; + } +}