-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
40 lines (35 loc) · 1.61 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//Written for Requiem. https://store.steampowered.com/app/289780
using System.IO;
using System.IO.Compression;
namespace Requiem_Extractor
{
class Program
{
public static BinaryReader map;
static void Main(string[] args)
{
map = new(File.OpenRead(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + ".MAP"));
BinaryReader vdk = new(File.OpenRead(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + ".VDK"));
int fileCount = (int)(map.BaseStream.Length / 136);
System.Collections.Generic.List<Map> maps = new();
string path = Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + "//";
for (int i = 0; i < fileCount; i++)
{
Map map = Map.Read();
vdk.BaseStream.Position = map.nameStart;
vdk.ReadByte();
string name = new string(vdk.ReadChars(128)).TrimEnd('\0');
int sizeUncompressed = vdk.ReadInt32();
int sizeCompressed = vdk.ReadInt32();
int unknown = vdk.ReadInt32();
int unknown2 = vdk.ReadInt32();
Directory.CreateDirectory(path + Path.GetDirectoryName(name));
FileStream fs = File.Create(path + name);
vdk.ReadInt16();
using (var ds = new DeflateStream(new MemoryStream(vdk.ReadBytes(sizeCompressed - 2)), CompressionMode.Decompress))
ds.CopyTo(fs);
fs.Close();
}
}
}
}