mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 19:34:15 +08:00
(YkcOpener): decrypt YKS script files.
This commit is contained in:
parent
ce27b2a5db
commit
4e5aed23d8
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion ("1.1.9.401")]
|
||||
[assembly: AssemblyFileVersion ("1.1.9.401")]
|
||||
[assembly: AssemblyVersion ("1.1.9.406")]
|
||||
[assembly: AssemblyFileVersion ("1.1.9.406")]
|
||||
|
@ -48,6 +48,11 @@ namespace GameRes.Formats.Yuka
|
||||
public override bool IsHierarchic { get { return true; } }
|
||||
public override bool CanCreate { get { return true; } }
|
||||
|
||||
public YkcOpener ()
|
||||
{
|
||||
Extensions = new string[] { "ykc", "dat" };
|
||||
}
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (0x3130 != file.View.ReadUInt32 (4))
|
||||
@ -82,6 +87,23 @@ namespace GameRes.Formats.Yuka
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
if (entry.Size < 0x24
|
||||
|| !entry.Name.EndsWith (".yks", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| !arc.File.View.AsciiEqual (entry.Offset, "YKS001")
|
||||
|| 1 != arc.File.View.ReadUInt16 (entry.Offset+6))
|
||||
return arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
// decrypt script contents
|
||||
var data = new byte[entry.Size];
|
||||
arc.File.View.Read (entry.Offset, data, 0, entry.Size);
|
||||
uint text_offset = LittleEndian.ToUInt32 (data, 0x20);
|
||||
for (uint i = text_offset; i < data.Length; ++i)
|
||||
data[i] ^= 0xAA;
|
||||
data[6] = 0;
|
||||
return new MemoryStream (data);
|
||||
}
|
||||
|
||||
public override void Create (Stream output, IEnumerable<Entry> list, ResourceOptions options,
|
||||
EntryCallback callback)
|
||||
{
|
||||
|
@ -345,6 +345,7 @@ Kikouyoku Senki Gin no Toki no Corona<br/>
|
||||
<tr><td>*.wag<br/>*.4ag</td><td><tt>WAG@</tt><br/><tt>GAF4</tt></td><td>No</td></tr>
|
||||
<tr class="odd"><td>*.ykc</td><td><tt>YKC001</tt></td><td>Yes</td><td rowspan="2">Yuka</td><td rowspan="2">
|
||||
SuGirly Wish<br/>
|
||||
_summer<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.ykg</td><td><tt>YKG000</tt></td><td>No</td></tr>
|
||||
<tr><td>*.pak</td><td><tt>GCEX</tt></td><td>No</td><td rowspan="2">G2</td><td rowspan="2">
|
||||
|
Loading…
x
Reference in New Issue
Block a user