mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-30 17:05:37 +08:00
(Malie): recognize different alignment in LIBP archives.
This commit is contained in:
parent
0c3ea083c5
commit
0b962cf8e3
@ -118,9 +118,28 @@ namespace GameRes.Formats.Malie
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class LibScheme : ResourceScheme
|
||||
public class LibScheme
|
||||
{
|
||||
public Dictionary<string, uint[]> KnownKeys;
|
||||
public uint DataAlign;
|
||||
public uint[] Key;
|
||||
|
||||
public LibScheme (uint[] key)
|
||||
{
|
||||
DataAlign = 0x1000;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
public LibScheme (uint align, uint[] key)
|
||||
{
|
||||
DataAlign = align;
|
||||
Key = key;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class MalieScheme : ResourceScheme
|
||||
{
|
||||
public Dictionary<string, LibScheme> KnownSchemes;
|
||||
}
|
||||
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
@ -142,15 +161,15 @@ namespace GameRes.Formats.Malie
|
||||
if (file.MaxOffset <= 0x10)
|
||||
return null;
|
||||
var header = new byte[0x10];
|
||||
foreach (var key in KnownKeys.Values)
|
||||
foreach (var scheme in KnownSchemes.Values)
|
||||
{
|
||||
var encryption = new Camellia (key);
|
||||
var encryption = new Camellia (scheme.Key);
|
||||
ReadEncrypted (file.View, encryption, 0, header, 0, 0x10);
|
||||
LibIndexReader reader;
|
||||
if (Binary.AsciiEqual (header, 0, "LIBP"))
|
||||
reader = new LibPReader (file, encryption, header);
|
||||
reader = new LibPReader (file, encryption, header, scheme);
|
||||
else if (Binary.AsciiEqual (header, 0, "LIBU"))
|
||||
reader = new LibUReader (file, encryption, header);
|
||||
reader = new LibUReader (file, encryption, header, scheme);
|
||||
else
|
||||
continue;
|
||||
using (reader)
|
||||
@ -209,11 +228,14 @@ namespace GameRes.Formats.Malie
|
||||
{
|
||||
byte[] m_index;
|
||||
long m_base_offset;
|
||||
uint m_data_align;
|
||||
uint[] m_offset_table;
|
||||
|
||||
public LibPReader (ArcView file, Camellia encryption, byte[] header) : base (file, encryption, header)
|
||||
public LibPReader (ArcView file, Camellia encryption, byte[] header, LibScheme scheme)
|
||||
: base (file, encryption, header)
|
||||
{
|
||||
m_base_offset = 0;
|
||||
m_data_align = scheme.DataAlign - 1;
|
||||
}
|
||||
|
||||
public override List<Entry> ReadIndex ()
|
||||
@ -236,7 +258,7 @@ namespace GameRes.Formats.Malie
|
||||
Buffer.BlockCopy (offsets, 0, m_offset_table, 0, offsets.Length);
|
||||
|
||||
m_base_offset += offsets.Length;
|
||||
m_base_offset = (m_base_offset + 0xFFF) & ~0xFFF;
|
||||
m_base_offset = (m_base_offset + m_data_align) & ~m_data_align;
|
||||
|
||||
m_dir.Capacity = offset_count;
|
||||
ReadDir ("", 0, 1);
|
||||
@ -276,7 +298,8 @@ namespace GameRes.Formats.Malie
|
||||
{
|
||||
BinaryReader m_input;
|
||||
|
||||
public LibUReader (ArcView file, Camellia encryption, byte[] header) : base (file, encryption, header)
|
||||
public LibUReader (ArcView file, Camellia encryption, byte[] header, LibScheme scheme)
|
||||
: base (file, encryption, header)
|
||||
{
|
||||
var input = new EncryptedStream (file, encryption);
|
||||
m_input = new BinaryReader (input, Encoding.Unicode);
|
||||
@ -380,12 +403,12 @@ namespace GameRes.Formats.Malie
|
||||
return Math.Min (length, read-offset_pad);
|
||||
}
|
||||
|
||||
public static Dictionary<string, uint[]> KnownKeys = new Dictionary<string, uint[]>();
|
||||
public static Dictionary<string, LibScheme> KnownSchemes = new Dictionary<string, LibScheme>();
|
||||
|
||||
public override ResourceScheme Scheme
|
||||
{
|
||||
get { return new LibScheme { KnownKeys = KnownKeys }; }
|
||||
set { KnownKeys = ((LibScheme)value).KnownKeys; }
|
||||
get { return new MalieScheme { KnownSchemes = KnownSchemes }; }
|
||||
set { KnownSchemes = ((MalieScheme)value).KnownSchemes; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,6 +616,7 @@ Hidamari Basket<br/>
|
||||
Makai Tenshi Djibril -episode 3-<br/>
|
||||
Mehime no Toriko<br/>
|
||||
Nanatsu no Fushigi no Owaru Toki<br/>
|
||||
Princess Lover!<br/>
|
||||
Shinigami no Kiss wa Wakare no Aji<br/>
|
||||
Soshite Ashita no Sekai yori<br/>
|
||||
</td></tr>
|
||||
@ -638,8 +639,9 @@ Gakuen ~Nerawareta Chitai~<br/>
|
||||
Kimon Youitan<br/>
|
||||
Unbalance<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.lib<br/>*.dat</td><td><tt>LIB</tt><br/><tt>LIBP</tt><br/><tt>LIBU</tt><span class="footnote">encrypted</span></td><td>No</td><td rowspan="2">Malie</td><td rowspan="2">
|
||||
<tr class="odd"><td>*.lib<br/>*.dat</td><td><tt>LIB</tt><br/><tt>LIBP</tt><br/><tt>LIBU</tt><span class="footnote">encrypted</span></td><td>No</td><td rowspan="3">Malie</td><td rowspan="3">
|
||||
Angel Crown<br/>
|
||||
Deep Love Diary<br/>
|
||||
Dies irae<br/>
|
||||
Dies irae ~Amantes amentes~<br/>
|
||||
Dokidoki Sister Paradise 2<br/>
|
||||
@ -647,9 +649,11 @@ Kajiri Kamui Kagura<br/>
|
||||
Paradise Lost<br/>
|
||||
Sakashiki Hito ni Miru Kokoro<br/>
|
||||
Tenmon Dokei no Aria<br/>
|
||||
Tsumi Koi x 2/3<br/>
|
||||
Zettai Meikyuu Grimm<br/>
|
||||
</td></tr>
|
||||
<tr class="odd last"><td>*.mgf</td><td><tt>MalieGF</tt></td><td>Yes</td></tr>
|
||||
<tr class="odd"><td>*.mgf</td><td><tt>MalieGF</tt></td><td>Yes</td></tr>
|
||||
<tr class="odd last"><td>*.dzi</td><td><tt>DZI</tt></td><td>No</td></tr>
|
||||
<tr><td>*.arc</td><td>-</td><td>No</td><td rowspan="2">AI5WIN</td><td rowspan="2">
|
||||
Ai no Katachi ~Ecchi na Onna no Ko wa Kirai... Desu ka?~<br/>
|
||||
Ai Shimai ~Docchi ni Suru no!!~<br/>
|
||||
@ -1126,6 +1130,7 @@ Ore Maou! ~Kudake Chitta Tamashii<br/>
|
||||
Oshioki ~Gakuen Reijou Kousei Keikaku~<br/>
|
||||
Ouma no Shoku ~Sei ni Tsukaeshi Yami no Guuzou~<br/>
|
||||
Shukubo no Uzuki ~Hitozuma Miboujin no Nareta Karada to Amai Toiki~<br/>
|
||||
Shukubo no Uzuki 2 ~Nareta Hitozuma kara Tadayou "Onna" no Iroka~<br/>
|
||||
Volley Coaching!<br/>
|
||||
Yumekoi Tensei<br/>
|
||||
Zoku Etsuraku no Tane<br/>
|
||||
@ -1207,6 +1212,7 @@ Triangle Heart 1-2-3<br/>
|
||||
<tr class ="odd"><td>*.sg</td><td><tt>fSG</tt></td><td>No</td></tr>
|
||||
<tr class ="odd last"><td>*.px</td><td><tt>fPX</tt></td><td>No</td></tr>
|
||||
<tr><td>*.fpk</td><td><tt>FPK 0100</tt></td><td>No</td><td>MoonhirGames</td><td>
|
||||
Bitchin Beach<br/>
|
||||
Pretty Devil Paradise ~Millium Makai Dakkan Shirei~<br/>
|
||||
S Sensei no Koto<br/>
|
||||
</td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user