Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
e4a2c9f319 | |
|
b5f620844b | |
|
a539f9b584 | |
|
73e6964a45 | |
|
7580d96326 |
33
Program.cs
33
Program.cs
|
@ -8,9 +8,10 @@ namespace Islet_Online_Unpacker
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
using FileStream source = File.OpenRead(args[0]);
|
using FileStream input = File.OpenRead(args[0]);
|
||||||
BinaryReader br = new(source);
|
BinaryReader br = new(input);
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(source.Name) + "//" + Path.GetFileNameWithoutExtension(source.Name));
|
Directory.CreateDirectory(Path.GetDirectoryName(input.Name) + "//" + Path.GetFileNameWithoutExtension(input.Name));
|
||||||
|
|
||||||
while (br.BaseStream.Position < br.BaseStream.Length)
|
while (br.BaseStream.Position < br.BaseStream.Length)
|
||||||
{
|
{
|
||||||
int size = br.ReadInt32();
|
int size = br.ReadInt32();
|
||||||
|
@ -22,42 +23,39 @@ namespace Islet_Online_Unpacker
|
||||||
br.BaseStream.Position += size;
|
br.BaseStream.Position += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Collections.Generic.List<SUBFILE> subfiles = new();
|
System.Collections.Generic.List<Subfile> subfiles = new();
|
||||||
while (br.BaseStream.Position < br.BaseStream.Length - 0x28)
|
while (br.BaseStream.Position < br.BaseStream.Length - 0x28)
|
||||||
{
|
{
|
||||||
SUBFILE subfile = new()
|
Subfile subfile = new()
|
||||||
{
|
{
|
||||||
isCompressed = br.ReadInt32(),
|
isCompressed = br.ReadInt32(),
|
||||||
sizeUncompressed = br.ReadInt32(),
|
sizeUncompressed = br.ReadInt32(),
|
||||||
sizeCompressed = br.ReadInt32(),
|
sizeCompressed = br.ReadInt32(),
|
||||||
offset = br.ReadInt32()
|
start = br.ReadInt32()
|
||||||
};
|
};
|
||||||
br.ReadBytes(20);
|
br.ReadBytes(20);
|
||||||
subfile.name = new(br.ReadChars(br.ReadInt16()));
|
subfile.name = new(br.ReadChars(br.ReadInt16()));
|
||||||
subfiles.Add(subfile);
|
subfiles.Add(subfile);
|
||||||
}
|
}
|
||||||
foreach (SUBFILE sub in subfiles)
|
|
||||||
|
foreach (Subfile sub in subfiles)
|
||||||
{
|
{
|
||||||
br.BaseStream.Position = sub.offset;
|
br.BaseStream.Position = sub.start;
|
||||||
int size = br.ReadInt32();
|
int size = br.ReadInt32();
|
||||||
if ((sub.isCompressed == 0 && size != sub.sizeUncompressed) || (sub.isCompressed == 0x100 && size != sub.sizeCompressed))
|
if ((sub.isCompressed == 0 && size != sub.sizeUncompressed) || (sub.isCompressed == 0x100 && size != sub.sizeCompressed))
|
||||||
throw new System.Exception("Fuck.");
|
throw new System.Exception("Fuck.");
|
||||||
|
|
||||||
if (sub.name.Contains(@"\"))
|
if (sub.name.Contains(@"\"))
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(source.Name) + "//" + Path.GetDirectoryName(sub.name));
|
Directory.CreateDirectory(Path.GetDirectoryName(input.Name) + "//" + Path.GetDirectoryName(sub.name));
|
||||||
|
|
||||||
using FileStream FS = File.Create(Path.GetDirectoryName(source.Name) + "//" + sub.name);
|
using FileStream FS = File.Create(Path.GetDirectoryName(input.Name) + "//" + sub.name);
|
||||||
BinaryWriter bw = new(FS);
|
BinaryWriter bw = new(FS);
|
||||||
if (sub.isCompressed == 0x100)
|
if (sub.isCompressed == 0x100)
|
||||||
{
|
{
|
||||||
MemoryStream ms = new();
|
MemoryStream ms = new();
|
||||||
br.ReadInt16();
|
br.ReadInt16();
|
||||||
using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes(size)), CompressionMode.Decompress))
|
using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes(size)), CompressionMode.Decompress))
|
||||||
ds.CopyTo(ms);
|
ds.CopyTo(FS);
|
||||||
br = new(ms);
|
|
||||||
br.BaseStream.Position = 0;
|
|
||||||
bw.Write(br.ReadBytes(sub.sizeUncompressed));
|
|
||||||
br = new(source);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,12 +63,13 @@ namespace Islet_Online_Unpacker
|
||||||
bw.Close();
|
bw.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct SUBFILE
|
|
||||||
|
struct Subfile
|
||||||
{
|
{
|
||||||
public int isCompressed;
|
public int isCompressed;
|
||||||
public int sizeUncompressed;
|
public int sizeUncompressed;
|
||||||
public int sizeCompressed;
|
public int sizeCompressed;
|
||||||
public int offset;
|
public int start;
|
||||||
public string name;
|
public string name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
|
# Islet Online Unpacker
|
||||||
Extracts and decompresses the contents of .pack files from the game [Islet Online](https://store.steampowered.com/app/428180/Islet_Online/).
|
Extracts and decompresses the contents of .pack files from the game [Islet Online](https://store.steampowered.com/app/428180/Islet_Online/).
|
||||||
|
|
BIN
ZstdNet.dll
BIN
ZstdNet.dll
Binary file not shown.
Loading…
Reference in New Issue