Add files via upload

This commit is contained in:
NintenHero 2024-03-02 17:53:01 -06:00 committed by GitHub
parent e5f3594b82
commit 6b2ce4fc29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Islet_Online_Unpacker</RootNamespace>
</PropertyGroup>
</Project>

25
Islet Online Unpacker.sln Normal file
View File

@ -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}") = "Islet Online Unpacker", "Islet Online Unpacker.csproj", "{4B9BADD3-EE27-4AC6-8D4E-E5CAA2D2FAA1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B9BADD3-EE27-4AC6-8D4E-E5CAA2D2FAA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B9BADD3-EE27-4AC6-8D4E-E5CAA2D2FAA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B9BADD3-EE27-4AC6-8D4E-E5CAA2D2FAA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B9BADD3-EE27-4AC6-8D4E-E5CAA2D2FAA1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0969BADB-BDC0-4879-9427-A89BCF47474B}
EndGlobalSection
EndGlobal

76
Program.cs Normal file
View File

@ -0,0 +1,76 @@
using System.IO;
using System.IO.Compression;
namespace Islet_Online_Unpacker
{
static class Program
{
static void Main(string[] args)
{
using FileStream source = File.OpenRead(args[0]);
BinaryReader br = new(source);
Directory.CreateDirectory(Path.GetDirectoryName(source.Name) + "//" + Path.GetFileNameWithoutExtension(source.Name));
while (br.BaseStream.Position < br.BaseStream.Length)
{
int size = br.ReadInt32();
if (size == 0x100)
{
br.BaseStream.Position -= 4;
break;
};
br.BaseStream.Position += size;
}
System.Collections.Generic.List<SUBFILE> subfiles = new();
while (br.BaseStream.Position < br.BaseStream.Length - 0x28)
{
SUBFILE subfile = new()
{
isCompressed = br.ReadInt32(),
sizeUncompressed = br.ReadInt32(),
sizeCompressed = br.ReadInt32(),
offset = br.ReadInt32()
};
br.ReadBytes(20);
subfile.name = new(br.ReadChars(br.ReadInt16()));
subfiles.Add(subfile);
}
foreach (SUBFILE sub in subfiles)
{
br.BaseStream.Position = sub.offset;
int size = br.ReadInt32();
if ((sub.isCompressed == 0 && size != sub.sizeUncompressed) || (sub.isCompressed == 0x100 && size != sub.sizeCompressed))
throw new System.Exception("Fuck.");
if (sub.name.Contains(@"\"))
Directory.CreateDirectory(Path.GetDirectoryName(source.Name) + "//" + Path.GetDirectoryName(sub.name));
using FileStream FS = File.Create(Path.GetDirectoryName(source.Name) + "//" + sub.name);
BinaryWriter bw = new(FS);
if (sub.isCompressed == 0x100)
{
MemoryStream ms = new();
br.ReadInt16();
using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes(size)), CompressionMode.Decompress))
ds.CopyTo(ms);
br = new(ms);
br.BaseStream.Position = 0;
bw.Write(br.ReadBytes(sub.sizeUncompressed));
br = new(source);
continue;
}
bw.Write(br.ReadBytes(size));
bw.Close();
}
}
struct SUBFILE
{
public int isCompressed;
public int sizeUncompressed;
public int sizeCompressed;
public int offset;
public string name;
}
}
}

BIN
ZstdNet.dll Normal file

Binary file not shown.