mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
implemented decryption for PACKDAT archives.
This commit is contained in:
@@ -28,13 +28,18 @@ using System.IO;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
|
|
||||||
namespace GameRes.Formats.InnocentGrey
|
namespace GameRes.Formats.SystemEpsylon
|
||||||
{
|
{
|
||||||
|
internal class PackDatEntry : PackedEntry
|
||||||
|
{
|
||||||
|
public uint Flags;
|
||||||
|
}
|
||||||
|
|
||||||
[Export(typeof(ArchiveFormat))]
|
[Export(typeof(ArchiveFormat))]
|
||||||
public class PakOpener : ArchiveFormat
|
public class PakOpener : ArchiveFormat
|
||||||
{
|
{
|
||||||
public override string Tag { get { return "PACKDAT"; } }
|
public override string Tag { get { return "PACKDAT"; } }
|
||||||
public override string Description { get { return "Innocent Grey resource archive"; } }
|
public override string Description { get { return "SYSTEM-ε resource archive"; } }
|
||||||
public override uint Signature { get { return 0x4B434150; } } // "PACK"
|
public override uint Signature { get { return 0x4B434150; } } // "PACK"
|
||||||
public override bool IsHierarchic { get { return false; } }
|
public override bool IsHierarchic { get { return false; } }
|
||||||
public override bool CanCreate { get { return false; } }
|
public override bool CanCreate { get { return false; } }
|
||||||
@@ -59,9 +64,12 @@ namespace GameRes.Formats.InnocentGrey
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
string name = file.View.ReadString (index_offset, 0x20);
|
string name = file.View.ReadString (index_offset, 0x20);
|
||||||
var entry = FormatCatalog.Instance.CreateEntry (name);
|
var entry = new PackDatEntry { Name = name };
|
||||||
|
entry.Type = FormatCatalog.Instance.GetTypeFromName (name);
|
||||||
entry.Offset = file.View.ReadUInt32 (index_offset+0x20);
|
entry.Offset = file.View.ReadUInt32 (index_offset+0x20);
|
||||||
|
entry.Flags = file.View.ReadUInt32 (index_offset+0x24);
|
||||||
entry.Size = file.View.ReadUInt32 (index_offset+0x28);
|
entry.Size = file.View.ReadUInt32 (index_offset+0x28);
|
||||||
|
entry.UnpackedSize = file.View.ReadUInt32 (index_offset+0x2c);
|
||||||
if (!entry.CheckPlacement (file.MaxOffset))
|
if (!entry.CheckPlacement (file.MaxOffset))
|
||||||
return null;
|
return null;
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
@@ -69,5 +77,33 @@ namespace GameRes.Formats.InnocentGrey
|
|||||||
}
|
}
|
||||||
return new ArcFile (file, this, dir);
|
return new ArcFile (file, this, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||||
|
{
|
||||||
|
var pentry = entry as PackDatEntry;
|
||||||
|
if (null == pentry || 0 == (pentry.Flags & 0x10000))
|
||||||
|
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
|
|
||||||
|
byte[] input = new byte[pentry.Size];
|
||||||
|
if (pentry.Size != arc.File.View.Read (entry.Offset, input, 0, pentry.Size))
|
||||||
|
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
|
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
fixed (byte* buf_raw = input)
|
||||||
|
{
|
||||||
|
uint* encoded = (uint*)buf_raw;
|
||||||
|
uint key = pentry.Size >> 2;
|
||||||
|
key = (key << (((int)key & 7) + 8)) ^ key;
|
||||||
|
for (uint i = entry.Size / 4; i != 0; --i )
|
||||||
|
{
|
||||||
|
*encoded ^= key;
|
||||||
|
int cl = (int)(*encoded++ % 24);
|
||||||
|
key = (key << cl) | (key >> (32 - cl));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new MemoryStream (input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion ("1.0.8.82")]
|
[assembly: AssemblyVersion ("1.0.8.83")]
|
||||||
[assembly: AssemblyFileVersion ("1.0.8.82")]
|
[assembly: AssemblyFileVersion ("1.0.8.83")]
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ Makai Tenshi Djibril -Episode 4-<br/>
|
|||||||
Shukufuku no Campanella<br/>
|
Shukufuku no Campanella<br/>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>*.hg3</td><td><tt>HG-3</tt></td><td>No</td></tr>
|
<tr><td>*.hg3</td><td><tt>HG-3</tt></td><td>No</td></tr>
|
||||||
<tr class="odd"><td>*.pak<br/>*.dat</td><td><tt>PACKDAT.</tt></td><td>No</td><td>Innocent Grey</td><td>
|
<tr class="odd"><td>*.pak<br/>*.dat</td><td><tt>PACKDAT.</tt></td><td>No</td><td>SYSTEM-ε</td><td>
|
||||||
|
Aoiro Rinne<br/>
|
||||||
Cartagra<br/>
|
Cartagra<br/>
|
||||||
PP -Pianissimo-<br/>
|
PP -Pianissimo-<br/>
|
||||||
Nagomibako<br/>
|
Nagomibako<br/>
|
||||||
@@ -94,6 +95,7 @@ Umineko<br/>
|
|||||||
<tr><td>*.pd</td><td><tt>PackOnly</tt><br/><tt>PackPlus</tt><br/><tt>FlyingShinePDFile</tt></td><td>Yes</td><td>Flying Shine</td><td>Cross†Channel</td></tr>
|
<tr><td>*.pd</td><td><tt>PackOnly</tt><br/><tt>PackPlus</tt><br/><tt>FlyingShinePDFile</tt></td><td>Yes</td><td>Flying Shine</td><td>Cross†Channel</td></tr>
|
||||||
<tr class="odd"><td>*.rpa</td><td><tt>RPA-3.0</tt></td><td>Yes</td><td>Ren'Py</td><td>Katawa Shoujo</td></tr>
|
<tr class="odd"><td>*.rpa</td><td><tt>RPA-3.0</tt></td><td>Yes</td><td>Ren'Py</td><td>Katawa Shoujo</td></tr>
|
||||||
<tr><td>*.arc</td><td>-</td><td>Yes</td><td rowspan="2">Will</td><td rowspan="2">
|
<tr><td>*.arc</td><td>-</td><td>Yes</td><td rowspan="2">Will</td><td rowspan="2">
|
||||||
|
Cynthia ~Sincerely to You~<br/>
|
||||||
Folklore Jam<br/>
|
Folklore Jam<br/>
|
||||||
Yume Miru Kusuri<br/>
|
Yume Miru Kusuri<br/>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user