mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
Compare commits
11 Commits
GARbro-Mod
...
GARbro-Mod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeceb8bf1d | ||
|
|
d2ea724c07 | ||
|
|
069e05bf13 | ||
|
|
aa7714be18 | ||
|
|
7530e5e6a3 | ||
|
|
02a12bbe48 | ||
|
|
a547f0282b | ||
|
|
0f827a9eba | ||
|
|
736fe8aeea | ||
|
|
bce3c1ff5b | ||
|
|
45013e79d3 |
@@ -232,6 +232,7 @@
|
|||||||
<Compile Include="Kid\ArcDAT.cs" />
|
<Compile Include="Kid\ArcDAT.cs" />
|
||||||
<Compile Include="Kid\AudioWAF.cs" />
|
<Compile Include="Kid\AudioWAF.cs" />
|
||||||
<Compile Include="Kid\ImagePRT.cs" />
|
<Compile Include="Kid\ImagePRT.cs" />
|
||||||
|
<Compile Include="KiriKiri\HxCrypt.cs" />
|
||||||
<Compile Include="KiriKiri\MoreCrypt.cs" />
|
<Compile Include="KiriKiri\MoreCrypt.cs" />
|
||||||
<Compile Include="KiriKiri\YuzCrypt.cs" />
|
<Compile Include="KiriKiri\YuzCrypt.cs" />
|
||||||
<Compile Include="Lambda\ArcLAX.cs" />
|
<Compile Include="Lambda\ArcLAX.cs" />
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
public ICrypt Cipher { get; set; }
|
public ICrypt Cipher { get; set; }
|
||||||
public List<Xp3Segment> Segments { get { return m_segments; } }
|
public List<Xp3Segment> Segments { get { return m_segments; } }
|
||||||
public uint Hash { get; set; }
|
public uint Hash { get; set; }
|
||||||
|
public object Extra { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Xp3Options : ResourceOptions
|
public class Xp3Options : ResourceOptions
|
||||||
@@ -145,6 +146,7 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
using (var header = new BinaryReader (header_stream, Encoding.Unicode))
|
using (var header = new BinaryReader (header_stream, Encoding.Unicode))
|
||||||
using (var filename_map = new FilenameMap())
|
using (var filename_map = new FilenameMap())
|
||||||
{
|
{
|
||||||
|
Dictionary<string, HxEntry> hx_entry_info = null;
|
||||||
while (-1 != header.PeekChar())
|
while (-1 != header.PeekChar())
|
||||||
{
|
{
|
||||||
uint entry_signature = header.ReadUInt32();
|
uint entry_signature = header.ReadUInt32();
|
||||||
@@ -208,7 +210,6 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
goto NextEntry;
|
goto NextEntry;
|
||||||
}
|
}
|
||||||
entry.Name = name;
|
entry.Name = name;
|
||||||
entry.Type = FormatCatalog.Instance.GetTypeFromName (name, ContainedFormats);
|
|
||||||
entry.IsEncrypted = !(entry.Cipher is NoCrypt)
|
entry.IsEncrypted = !(entry.Cipher is NoCrypt)
|
||||||
&& !(entry.Cipher.StartupTjsNotEncrypted && "startup.tjs" == name);
|
&& !(entry.Cipher.StartupTjsNotEncrypted && "startup.tjs" == name);
|
||||||
break;
|
break;
|
||||||
@@ -253,6 +254,34 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
{
|
{
|
||||||
DeobfuscateEntry (entry);
|
DeobfuscateEntry (entry);
|
||||||
}
|
}
|
||||||
|
if (null != hx_entry_info)
|
||||||
|
{
|
||||||
|
if (hx_entry_info.TryGetValue (entry.Name, out HxEntry info))
|
||||||
|
{
|
||||||
|
entry.Extra = info;
|
||||||
|
|
||||||
|
var sb = new StringBuilder ();
|
||||||
|
if (!string.IsNullOrEmpty (info.Path))
|
||||||
|
{
|
||||||
|
sb.Append (info.Path);
|
||||||
|
if (!info.Path.EndsWith ("/") && !info.Path.EndsWith ("\\"))
|
||||||
|
sb.Append ('/');
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty (info.Name))
|
||||||
|
{
|
||||||
|
sb.Append (info.Name);
|
||||||
|
if (sb.Length > 0)
|
||||||
|
entry.Name = sb.ToString ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append (entry.Name);
|
||||||
|
if (sb.Length > 0)
|
||||||
|
entry.Name = sb.ToString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entry.Type = FormatCatalog.Instance.GetTypeFromName(entry.Name, ContainedFormats);
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,6 +300,22 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (0x34767848 == entry_signature) // "Hxv4"
|
||||||
|
{
|
||||||
|
if (crypt_algorithm.Value is HxCrypt)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var offset = header.ReadInt64 () + base_offset;
|
||||||
|
var size = header.ReadUInt32 ();
|
||||||
|
var flags = header.ReadUInt16 ();
|
||||||
|
var hx = file.View.ReadBytes (offset, size);
|
||||||
|
var crypt = crypt_algorithm.Value as HxCrypt;
|
||||||
|
hx_entry_info = crypt.ReadIndex (Path.GetFileName (file.Name), hx);
|
||||||
|
}
|
||||||
|
catch (Exception) { /* ignore parse error */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (entry_size > 7)
|
else if (entry_size > 7)
|
||||||
{
|
{
|
||||||
// 0x6E666E68 == entry_signature // "hnfn"
|
// 0x6E666E68 == entry_signature // "hnfn"
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
var header = new byte[5];
|
var header = new byte[5];
|
||||||
input.Read (header, 0, 5);
|
input.Read (header, 0, 5);
|
||||||
uint signature = header.ToUInt32 (0);
|
uint signature = header.ToUInt32 (0);
|
||||||
|
GuessEntryTypeBySignature (entry, signature);
|
||||||
if (0x184D2204 == signature) // LZ4 magic
|
if (0x184D2204 == signature) // LZ4 magic
|
||||||
{
|
{
|
||||||
// assume no scripts are compressed using LZ4, return decompressed stream right away
|
// assume no scripts are compressed using LZ4, return decompressed stream right away
|
||||||
@@ -197,6 +198,25 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static readonly Dictionary<uint, string> FileTypesMap = new Dictionary<uint, string>
|
||||||
|
{
|
||||||
|
{ 0x5367674f, "audio" }, // OGG
|
||||||
|
{ 0x46464952, "audio" }, // WAV
|
||||||
|
{ 0x474e5089, "image" }, // PNG
|
||||||
|
{ 0xe0ffd8ff, "image" }, // JPG
|
||||||
|
{ 0x30474c54, "image" }, // TLG
|
||||||
|
{ 0x35474c54, "image" }, // TLG
|
||||||
|
{ 0x36474c54, "image" }, // TLG
|
||||||
|
{ 0x35474cab, "image" }, // TLG
|
||||||
|
{ 0x584d4b4a, "image" }, // TLG
|
||||||
|
};
|
||||||
|
|
||||||
|
internal void GuessEntryTypeBySignature(Entry entry, uint signature)
|
||||||
|
{
|
||||||
|
if (FileTypesMap.TryGetValue (signature, out var type))
|
||||||
|
entry.Type = type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|||||||
1006
ArcFormats/KiriKiri/HxCrypt.cs
Normal file
1006
ArcFormats/KiriKiri/HxCrypt.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -55,8 +55,8 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class CxEncryption : ICrypt
|
public class CxEncryption : ICrypt
|
||||||
{
|
{
|
||||||
private uint m_mask;
|
protected uint m_mask;
|
||||||
private uint m_offset;
|
protected uint m_offset;
|
||||||
|
|
||||||
protected byte[] PrologOrder;
|
protected byte[] PrologOrder;
|
||||||
protected byte[] OddBranchOrder;
|
protected byte[] OddBranchOrder;
|
||||||
@@ -207,7 +207,7 @@ namespace GameRes.Formats.KiriKiri
|
|||||||
Decrypt (entry, offset, values, pos, count);
|
Decrypt (entry, offset, values, pos, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tuple<uint, uint> ExecuteXCode (uint hash)
|
protected Tuple<uint, uint> ExecuteXCode (uint hash)
|
||||||
{
|
{
|
||||||
uint seed = hash & 0x7f;
|
uint seed = hash & 0x7f;
|
||||||
if (null == m_program_list[seed])
|
if (null == m_program_list[seed])
|
||||||
|
|||||||
Binary file not shown.
@@ -7,7 +7,7 @@
|
|||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
|||||||
@@ -45,8 +45,8 @@
|
|||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
|
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
|
||||||
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
|
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" />
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user