Add files via upload
This commit is contained in:
parent
136a925e3e
commit
c46854eaf7
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>ASURA_Dat_Extractor</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34309.116
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASURA-Dat-Extractor", "ASURA-Dat-Extractor.csproj", "{0F02F8AF-66B4-4BCD-8CE8-99EC0FA91388}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0F02F8AF-66B4-4BCD-8CE8-99EC0FA91388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F02F8AF-66B4-4BCD-8CE8-99EC0FA91388}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F02F8AF-66B4-4BCD-8CE8-99EC0FA91388}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F02F8AF-66B4-4BCD-8CE8-99EC0FA91388}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B9437036-BE0E-4F28-A7F8-4A87692DCBB9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,53 @@
|
|||
//Written for ASURA. https://store.steampowered.com/app/2293900/
|
||||
using System.IO.Compression;
|
||||
|
||||
FileStream input = File.OpenRead(args[0]);
|
||||
BinaryReader br = new(input);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(args[0]) + "\\" + Path.GetFileNameWithoutExtension(args[0]));
|
||||
if (new string(br.ReadChars(7)) != "D-PACK2")
|
||||
throw new Exception("Not a ASURA dat file.");
|
||||
|
||||
br.ReadByte();
|
||||
int fileCount = br.ReadInt32();
|
||||
int size = br.ReadInt32();
|
||||
|
||||
List<SUBFILE> subfiles = [];
|
||||
for (int i = 0; i < fileCount; i++)
|
||||
{
|
||||
subfiles.Add(new()
|
||||
{
|
||||
unknown = br.ReadSingle(),
|
||||
start = br.ReadInt32(),
|
||||
sizeUncompressed = br.ReadInt32(),
|
||||
sizeCompressed = br.ReadInt32(),
|
||||
name = i
|
||||
});
|
||||
}
|
||||
|
||||
foreach (SUBFILE subfile in subfiles)
|
||||
{
|
||||
br.BaseStream.Position = subfile.start;
|
||||
|
||||
using FileStream FS = File.Create(Path.GetDirectoryName(args[0]) + "\\" + Path.GetFileNameWithoutExtension(args[0]) + "\\" + subfile.name);
|
||||
BinaryWriter bw = new(FS);
|
||||
|
||||
MemoryStream ms = new();
|
||||
br.ReadInt16();
|
||||
using (var ds = new DeflateStream(new MemoryStream(br.ReadBytes(subfile.sizeCompressed - 2)), CompressionMode.Decompress))
|
||||
ds.CopyTo(ms);
|
||||
br = new(ms);
|
||||
br.BaseStream.Position = 0;
|
||||
|
||||
bw.Write(br.ReadBytes(subfile.sizeUncompressed));
|
||||
bw.Close();
|
||||
br = new(input);
|
||||
}
|
||||
|
||||
class SUBFILE
|
||||
{
|
||||
public float unknown;
|
||||
public int start;
|
||||
public int sizeUncompressed;
|
||||
public int sizeCompressed;
|
||||
public int name;
|
||||
}
|
Loading…
Reference in New Issue