Compare commits

..

23 Commits

Author SHA1 Message Date
Crsky
848a3a7b17 Add support "Ore no Hitomi de Maruhadaka! Fukachi na Mirai to Misukasu Vision" 2023-08-06 06:14:09 +08:00
Crsky
fb543fd3bc Added support "11eyes -Resona Forma-" 2023-08-06 06:07:39 +08:00
Crsky
1b30bb8249 Add support "Rui wa Tomo o Yobu -Full Voice Edition-" 2023-06-30 19:33:43 +08:00
Crsky
1aa985dffd Add support "Mashiro-iro Symphony -Love is pure white- Remake for FHD" 2023-06-27 20:52:34 +08:00
Crsky
ba1f807157 Add support "Mashiro-iro Symphony: Sana Edition" 2023-06-27 20:45:13 +08:00
Crsky
c8a20e0d3d Add support "AMBITIOUS MISSION After Episode 1" 2023-05-30 21:28:33 +08:00
Crsky
c6c46ce30e Add support "Criminal Border: 2nd offence" 2023-05-30 21:03:25 +08:00
Crsky
dd3d706919 Add support "Koi de wa Naku - It's not love, but so where near." 2023-03-04 12:11:08 +08:00
Crsky
00490899e3 (Kirikiri): Add Syangrila Smart encryption 2023-03-04 12:08:47 +08:00
Crsky
845e99f433 Add support "Café Stella to Shinigami no Chou [Steam]" 2023-01-29 18:18:22 +08:00
Crsky
c6d8e7c423 Add support "D.C.5 ~Da Capo 5~" 2023-01-29 16:53:27 +08:00
Crsky
1648a7a4f4 Changed package version 2023-01-29 15:53:51 +08:00
crskycode
c278e48615 Add support "9-nine- Deluxe Edition" 2023-01-23 19:48:51 +08:00
Crsky
1ab7087fe7 (SakanaGL): support new version 2023-01-09 16:31:09 +08:00
Crsky
99778823f1 Add support "Futamata Ren'ai - Yua & Kirame Mini After Story" 2023-01-08 19:43:12 +08:00
Crsky
ea84d6cc19 Add support "Futamata Ren'ai - Rui & Miyako Mini After Story" 2023-01-08 19:42:08 +08:00
Crsky
da25246c69 Add support "Futamata Ren'ai" 2023-01-08 19:40:46 +08:00
Crsky
9f5f96dd64 Fix assembly redirect problem 2023-01-08 18:47:45 +08:00
Crsky
c40996a775 Merge branch 'master' of https://github.com/crskycode/GARbro 2023-01-08 18:32:04 +08:00
Crsky
7e4f35163d Merge pull request #7 from h1531095/master
Bug: path not resolved before file check
2023-01-08 18:28:39 +08:00
Crsky
26129650fb Add support "Motto! Haramase! Honoo no Oppai Isekai Oppai Maid Gakuen!" 2023-01-08 18:22:30 +08:00
h1531095
7d0cc66090 Bug: path not resolved before file check 2023-01-05 15:19:52 +08:00
Crsky
9e0909ff0c Add support "Manakashi no Yuri wa Akaku Somaru [DL]" 2022-12-20 21:58:52 +08:00
8 changed files with 88 additions and 16 deletions

View File

@@ -73,10 +73,9 @@ namespace GameRes.Formats.Emote
var match = PathRe.Match (line);
if (!match.Success)
return null;
var pak_name = match.Groups[1].Value;
var pak_name = VFS.CombinePath (dir, match.Groups[1].Value);
if (!VFS.FileExists (pak_name))
return null;
pak_name = VFS.CombinePath (dir, pak_name);
layers.Add (Tuple.Create (pak_name, match.Groups[2].Value));
}
if (0 == layers.Count)

View File

@@ -1513,4 +1513,46 @@ namespace GameRes.Formats.KiriKiri
}
}
}
[Serializable]
public class SyangrilaSmartCrypt : ICrypt
{
byte[] GetKey (uint hash)
{
return new byte[5]
{
(byte)(hash >> 5),
(byte)(hash >> 5),
(byte)(hash >> 7),
(byte)(hash >> 1),
(byte)(hash >> 4),
};
}
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
var key = GetKey (entry.Hash);
if (offset <= 0x64)
return (byte)(value ^ key[4]);
else
return (byte)(value ^ key[offset & 3]);
}
public override void Decrypt (Xp3Entry entry, long offset, byte[] buffer, int pos, int count)
{
var key = GetKey (entry.Hash);
for (var i = 0; i < count; i++)
{
if (offset+i <= 0x64)
buffer[pos+i] ^= key[4];
else
buffer[pos+i] ^= key[(offset+i) & 3];
}
}
public override void Encrypt (Xp3Entry entry, long offset, byte[] buffer, int pos, int count)
{
Decrypt (entry, offset, buffer, pos, count);
}
}
}

View File

Binary file not shown.

View File

@@ -28,17 +28,25 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text;
namespace GameRes.Formats.Sakana
{
internal class SxEntry : PackedEntry
{
public int Storage;
public ushort Flags;
public bool IsEncrypted { get { return 0 == (Flags & 0x10); } }
}
internal class SxStorage
{
public uint Size;
public ulong Timestamp;
}
[Export(typeof(ArchiveFormat))]
public class SxOpener : ArchiveFormat
{
@@ -52,9 +60,7 @@ namespace GameRes.Formats.Sakana
public override ArcFile TryOpen (ArcView file)
{
var base_name = Path.GetFileName (file.Name);
var sx_name = base_name.Substring (0, 4) + "(00).sx";
sx_name = VFS.ChangeFileName (file.Name, sx_name);
var sx_name = FindSxName (file.Name);
if (!VFS.FileExists (sx_name) || file.Name.Equals (sx_name, StringComparison.InvariantCultureIgnoreCase))
return null;
byte[] index_data;
@@ -140,6 +146,20 @@ namespace GameRes.Formats.Sakana
}
}
}
internal static string FindSxName(string name)
{
var base_name = Path.GetFileName (name);
var file_name = Path.GetFileNameWithoutExtension (base_name);
for (var i = 1; i <= file_name.Length; i++)
{
var sx_name = file_name.Substring (0, i) + "(00).sx";
sx_name = VFS.ChangeFileName (name, sx_name);
if (VFS.FileExists (sx_name))
return sx_name;
}
return name;
}
}
internal class SxIndexDeserializer
@@ -170,36 +190,47 @@ namespace GameRes.Formats.Sakana
m_dir = new List<Entry> (count);
for (int i = 0; i < count; ++i)
{
m_index.ReadUInt16();
m_index.ReadByte();
int storage = m_index.ReadByte();
ushort flags = Binary.BigEndian (m_index.ReadUInt16());
uint offset = Binary.BigEndian (m_index.ReadUInt32());
uint size = Binary.BigEndian (m_index.ReadUInt32());
var entry = new SxEntry {
Storage = storage,
Flags = flags,
Offset = (long)offset << 4,
Size = size,
IsPacked = 0 != (flags & 0x03),
};
if (!entry.CheckPlacement (m_max_offset))
return null;
m_dir.Add (entry);
}
count = Binary.BigEndian (m_index.ReadUInt16());
var storages = new List<SxStorage>(count);
for (int i = 0; i < count; ++i)
{
m_index.ReadUInt32();
m_index.ReadUInt32();
m_index.ReadUInt32();
Binary.BigEndian (m_index.ReadUInt32()); // archive body length
m_index.ReadUInt64();
m_index.Seek (16, SeekOrigin.Current); // MD5 sum
var storage = new SxStorage {
Size = Binary.BigEndian (m_index.ReadUInt32()) << 4,
Timestamp = Binary.BigEndian (m_index.ReadUInt64()),
};
storages.Add (storage);
m_index.Seek (16, SeekOrigin.Current); // MD5
}
count = Binary.BigEndian (m_index.ReadUInt16());
if (count > 0)
m_index.Seek (count * 24, SeekOrigin.Current);
DeserializeTree();
// Remove entries in other archives
// Note using file size as archive identification can be problematic, but faster than MD5
var current_storage = storages.FindIndex (s => m_max_offset == s.Size);
if (-1 != current_storage)
{
m_dir = m_dir.Where (e => e.CheckPlacement (m_max_offset) && (e as SxEntry).Storage == current_storage).ToList();
}
return m_dir;
}

View File

@@ -100,7 +100,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="4.0.4.1" newVersion="6.0.0.0"/>
<bindingRedirect oldVersion="4.0.4.1" newVersion="4.0.5.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

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-6.0.0.0" newVersion="6.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.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=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 Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\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="6.0.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
</packages>