Compare commits

...

11 Commits

Author SHA1 Message Date
Crsky
eeceb8bf1d Add support "Hanagane Kanade Gram Chapter 2" 2022-11-26 01:25:49 +08:00
Crsky
d2ea724c07 Update HxCrypt implementation 2022-11-26 01:09:18 +08:00
Crsky
069e05bf13 Add support "Same to Ikiru Nanokakan" 2022-11-25 21:30:36 +08:00
crskycode
aa7714be18 Add support "Same to Ikiru Nanokakan [Trial]" 2022-11-05 08:42:41 +08:00
crskycode
7530e5e6a3 Update package 2022-10-30 11:23:51 +08:00
Crsky
02a12bbe48 Implement Kirikiri HxCrypt 2022-09-11 04:55:25 +08:00
Crsky
a547f0282b Guess entry type by signature. 2022-09-11 04:54:01 +08:00
Crsky
0f827a9eba Change some fields from private to protected. 2022-09-11 04:43:44 +08:00
crskycode
736fe8aeea Add support "Natsu no Owari" 2022-09-02 10:34:20 +08:00
Crsky
bce3c1ff5b Merge pull request #6 from imKota/master
Add support new minori games.
2022-06-20 18:31:07 +08:00
Kota
45013e79d3 Add support new minori games.
ef - the first tale [English]
ef - the first tale [English Steam]
ef - the latter tale [English]
ef - the latter tale [English Steam]
eden* [English Steam]
eden* PLUS+MOSAIC [English Steam]
Tsumi no Hikari Rendezvous Mikan Blossom
Trinoline [English Steam]
Trinoline: Genesis [English Steam]
2022-06-18 23:10:04 +03:00
9 changed files with 1080 additions and 8 deletions

View File

@@ -232,6 +232,7 @@
<Compile Include="Kid\ArcDAT.cs" />
<Compile Include="Kid\AudioWAF.cs" />
<Compile Include="Kid\ImagePRT.cs" />
<Compile Include="KiriKiri\HxCrypt.cs" />
<Compile Include="KiriKiri\MoreCrypt.cs" />
<Compile Include="KiriKiri\YuzCrypt.cs" />
<Compile Include="Lambda\ArcLAX.cs" />

View File

@@ -56,6 +56,7 @@ namespace GameRes.Formats.KiriKiri
public ICrypt Cipher { get; set; }
public List<Xp3Segment> Segments { get { return m_segments; } }
public uint Hash { get; set; }
public object Extra { get; set; }
}
public class Xp3Options : ResourceOptions
@@ -145,6 +146,7 @@ namespace GameRes.Formats.KiriKiri
using (var header = new BinaryReader (header_stream, Encoding.Unicode))
using (var filename_map = new FilenameMap())
{
Dictionary<string, HxEntry> hx_entry_info = null;
while (-1 != header.PeekChar())
{
uint entry_signature = header.ReadUInt32();
@@ -208,7 +210,6 @@ namespace GameRes.Formats.KiriKiri
goto NextEntry;
}
entry.Name = name;
entry.Type = FormatCatalog.Instance.GetTypeFromName (name, ContainedFormats);
entry.IsEncrypted = !(entry.Cipher is NoCrypt)
&& !(entry.Cipher.StartupTjsNotEncrypted && "startup.tjs" == name);
break;
@@ -253,6 +254,34 @@ namespace GameRes.Formats.KiriKiri
{
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);
}
}
@@ -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)
{
// 0x6E666E68 == entry_signature // "hnfn"

View File

@@ -103,6 +103,7 @@ namespace GameRes.Formats.KiriKiri
var header = new byte[5];
input.Read (header, 0, 5);
uint signature = header.ToUInt32 (0);
GuessEntryTypeBySignature (entry, signature);
if (0x184D2204 == signature) // LZ4 magic
{
// assume no scripts are compressed using LZ4, return decompressed stream right away
@@ -197,6 +198,25 @@ namespace GameRes.Formats.KiriKiri
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]

View File

File diff suppressed because it is too large Load Diff

View File

@@ -55,8 +55,8 @@ namespace GameRes.Formats.KiriKiri
[Serializable]
public class CxEncryption : ICrypt
{
private uint m_mask;
private uint m_offset;
protected uint m_mask;
protected uint m_offset;
protected byte[] PrologOrder;
protected byte[] OddBranchOrder;
@@ -207,7 +207,7 @@ namespace GameRes.Formats.KiriKiri
Decrypt (entry, offset, values, pos, count);
}
Tuple<uint, uint> ExecuteXCode (uint hash)
protected Tuple<uint, uint> ExecuteXCode (uint hash)
{
uint seed = hash & 0x7f;
if (null == m_program_list[seed])

View File

Binary file not shown.

View File

@@ -7,7 +7,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<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>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />

View File

@@ -45,8 +45,8 @@
<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>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.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>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />

View File

@@ -3,5 +3,5 @@
<package id="System.Buffers" version="4.5.1" 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.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" />
</packages>