Compare commits

..

3 Commits
v1.0 ... main

Author SHA1 Message Date
Michael Hinrichs 6514cb49af Update Program.cs
Remove unnecessary using. Adjust line spacing.
2024-06-02 09:56:07 -05:00
NintenHero e692d6e386
Simplify name reading 2024-06-01 16:54:01 -05:00
NintenHero 4b36a134ea
Link to steam page in README.md 2024-05-24 13:43:39 -05:00
2 changed files with 4 additions and 23 deletions

View File

@ -1,5 +1,4 @@
//Written for The Accursed Crown of the Giant King. https://store.steampowered.com/app/1970780/ //Written for The Accursed Crown of the Giant King. https://store.steampowered.com/app/1970780
using System;
using System.IO; using System.IO;
namespace ACotGK_seng_Extractor namespace ACotGK_seng_Extractor
@ -18,17 +17,14 @@ namespace ACotGK_seng_Extractor
for (int i = 0; i < fileCount - 1; i++) for (int i = 0; i < fileCount - 1; i++)
{ {
br.ReadInt32(); br.ReadInt32();
string name = NullTerminatedString();
if (br.BaseStream.Position < (i + 1) * 0x4C + 0x48)
br.BaseStream.Position = (i + 1) * 0x4C + 0x48;
fileTable.Add(new SUBFILE fileTable.Add(new SUBFILE
{ {
name = name, name = new string(br.ReadChars(64)).TrimEnd('\0'),
offset = br.ReadInt32(), offset = br.ReadInt32(),
size = br.ReadInt32() size = br.ReadInt32()
}); });
} }
foreach (SUBFILE sub in fileTable) foreach (SUBFILE sub in fileTable)
{ {
br.BaseStream.Position = sub.offset; br.BaseStream.Position = sub.offset;
@ -46,20 +42,5 @@ namespace ACotGK_seng_Extractor
public int offset; public int offset;
public int size; 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;
}
} }
} }

View File

@ -1,2 +1,2 @@
# ACotGK-seng-Extractor # ACotGK-seng-Extractor
Written for The Accursed Crown of the Giant King. Use it to extract from "module.seng" or "uiwin32.seng". Written for [The Accursed Crown of the Giant King](https://store.steampowered.com/app/1970780). Use it to extract from "module.seng" or "uiwin32.seng".