Add files via upload
This commit is contained in:
parent
ecf089db31
commit
163b0c5407
|
@ -0,0 +1,9 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<RootNamespace>ACotGK_seng_Extractor</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -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}") = "ACotGK-seng-Extractor", "ACotGK-seng-Extractor.csproj", "{879F783D-F43F-41E2-B47F-5A7D35CFC70B}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{879F783D-F43F-41E2-B47F-5A7D35CFC70B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{879F783D-F43F-41E2-B47F-5A7D35CFC70B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{879F783D-F43F-41E2-B47F-5A7D35CFC70B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{879F783D-F43F-41E2-B47F-5A7D35CFC70B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {E148DFAD-0BFD-44C3-A171-4AC9AD3B50A5}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,65 @@
|
||||||
|
//Written for The Accursed Crown of the Giant King. https://store.steampowered.com/app/1970780/
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace ACotGK_seng_Extractor
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
public static BinaryReader br;
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
using FileStream source = File.OpenRead(args[0]);
|
||||||
|
br = new(source);
|
||||||
|
int fileCount = br.ReadInt32();
|
||||||
|
|
||||||
|
System.Collections.Generic.List<SUBFILE> fileTable = new();
|
||||||
|
for (int i = 0; i < fileCount - 1; i++)
|
||||||
|
{
|
||||||
|
br.ReadInt32();
|
||||||
|
string name = NullTerminatedString();
|
||||||
|
if (br.BaseStream.Position < (i + 1) * 0x4C + 0x48)
|
||||||
|
br.BaseStream.Position = (i + 1) * 0x4C + 0x48;
|
||||||
|
|
||||||
|
fileTable.Add(new SUBFILE
|
||||||
|
{
|
||||||
|
name = name,
|
||||||
|
offset = br.ReadInt32(),
|
||||||
|
size = br.ReadInt32()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
foreach (SUBFILE sub in fileTable)
|
||||||
|
{
|
||||||
|
br.BaseStream.Position = sub.offset;
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + "//" + Path.GetDirectoryName(sub.name));
|
||||||
|
using FileStream FS = File.Create(Path.GetDirectoryName(args[0]) + "//" + Path.GetFileNameWithoutExtension(args[0]) + "//" + sub.name);
|
||||||
|
BinaryWriter bw = new(FS);
|
||||||
|
bw.Write(br.ReadBytes(sub.size));
|
||||||
|
bw.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SUBFILE
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public int offset;
|
||||||
|
public int size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string NullTerminatedString()
|
||||||
|
{
|
||||||
|
char[] fileName = Array.Empty<char>();
|
||||||
|
char readchar = (char)1;
|
||||||
|
while (readchar > 0)
|
||||||
|
{
|
||||||
|
readchar = br.ReadChar();
|
||||||
|
Array.Resize(ref fileName, fileName.Length + 1);
|
||||||
|
fileName[^1] = readchar;
|
||||||
|
}
|
||||||
|
Array.Resize(ref fileName, fileName.Length - 1);
|
||||||
|
string name = new(fileName);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue