mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
implemented Patisserie archives.
This commit is contained in:
parent
25423aadcf
commit
b0fcb19c08
@ -141,6 +141,8 @@
|
||||
<Compile Include="NonColor\WidgetNCARC.xaml.cs">
|
||||
<DependentUpon>WidgetNCARC.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Patisserie\ArcBIN.cs" />
|
||||
<Compile Include="Patisserie\ArcRAW.cs" />
|
||||
<Compile Include="RealLive\ArcG00.cs" />
|
||||
<Compile Include="RealLive\ArcOVK.cs" />
|
||||
<Compile Include="RealLive\AudioNWA.cs" />
|
||||
|
202
ArcFormats/Patisserie/ArcBIN.cs
Normal file
202
ArcFormats/Patisserie/ArcBIN.cs
Normal file
@ -0,0 +1,202 @@
|
||||
//! \file ArcBIN.cs
|
||||
//! \date Thu Jul 21 21:10:31 2016
|
||||
//! \brief Patisserie resource archive.
|
||||
//
|
||||
// Copyright (C) 2016 by morkt
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using GameRes.Compression;
|
||||
|
||||
namespace GameRes.Formats.Patisserie
|
||||
{
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
public class BinOpener : ArchiveFormat
|
||||
{
|
||||
public override string Tag { get { return "BIN/OZ"; } }
|
||||
public override string Description { get { return "Patisserie resource archive"; } }
|
||||
public override uint Signature { get { return 0x01005A4F; } } // 'OZ'
|
||||
public override bool IsHierarchic { get { return false; } }
|
||||
public override bool CanCreate { get { return false; } }
|
||||
|
||||
public BinOpener ()
|
||||
{
|
||||
Extensions = new string[] { "bin" };
|
||||
}
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
if (!file.View.AsciiEqual (4, "OFST"))
|
||||
return null;
|
||||
int index_size = file.View.ReadInt32 (8);
|
||||
int count = index_size / 4;
|
||||
if (!IsSaneCount (count))
|
||||
return null;
|
||||
var base_name = Path.GetFileNameWithoutExtension (file.Name);
|
||||
string content_ext = "", content_type = "";
|
||||
if (base_name.EndsWith ("flac", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
content_ext = "flac";
|
||||
content_type = "audio";
|
||||
base_name = base_name.Substring (0, base_name.Length-4);
|
||||
}
|
||||
else if (base_name.EndsWith ("ogg", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
content_ext = "ogg";
|
||||
content_type = "audio";
|
||||
base_name = base_name.Substring (0, base_name.Length-3);
|
||||
}
|
||||
|
||||
var filenames = GetFileNames (VFS.GetDirectoryName (file.Name), base_name);
|
||||
if (null == filenames)
|
||||
filenames = new List<string> (count);
|
||||
for (int i = filenames.Count; i < count; ++i)
|
||||
filenames.Add (string.Format ("{0}#{1:D5}", base_name, i));
|
||||
|
||||
uint index_offset = 0xC;
|
||||
var dir = new List<Entry> (count);
|
||||
uint next_offset = file.View.ReadUInt32 (index_offset);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
index_offset += 4;
|
||||
var entry = new PackedEntry { Name = filenames[i] };
|
||||
entry.Offset = next_offset;
|
||||
next_offset = i+1 < count ? file.View.ReadUInt32 (index_offset) : (uint)file.MaxOffset;
|
||||
entry.Size = next_offset - (uint)entry.Offset;
|
||||
if (entry.Size > 0 && !entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
if (!string.IsNullOrEmpty (content_type))
|
||||
{
|
||||
entry.Type = content_type;
|
||||
entry.Name = Path.ChangeExtension (entry.Name, content_ext);
|
||||
}
|
||||
dir.Add (entry);
|
||||
}
|
||||
foreach (PackedEntry entry in dir.Where (e => e.Size > 4))
|
||||
{
|
||||
entry.IsPacked = file.View.AsciiEqual (entry.Offset, "DFLT");
|
||||
if (entry.IsPacked)
|
||||
{
|
||||
entry.Size = file.View.ReadUInt32 (entry.Offset+4);
|
||||
entry.UnpackedSize = file.View.ReadUInt32 (entry.Offset+8);
|
||||
entry.Offset += 12;
|
||||
}
|
||||
else if (file.View.AsciiEqual (entry.Offset, "DATA"))
|
||||
{
|
||||
entry.Size = file.View.ReadUInt32 (entry.Offset+4);
|
||||
entry.UnpackedSize = entry.Size;
|
||||
entry.Offset += 8;
|
||||
if (string.IsNullOrEmpty (entry.Type))
|
||||
{
|
||||
uint signature = file.View.ReadUInt32 (entry.Offset);
|
||||
if (0x43614C66 == signature) // 'fLaC'
|
||||
{
|
||||
entry.Type = "audio";
|
||||
entry.Name = Path.ChangeExtension (entry.Name, "flac");
|
||||
}
|
||||
else
|
||||
{
|
||||
var res = AutoEntry.DetectFileType (signature);
|
||||
if (null != res)
|
||||
{
|
||||
entry.Type = res.Type;
|
||||
var ext = res.Extensions.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty (ext))
|
||||
entry.Name = Path.ChangeExtension (entry.Name, ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||
var pent = entry as PackedEntry;
|
||||
if (null == pent || !pent.IsPacked)
|
||||
return input;
|
||||
return new ZLibStream (input, CompressionMode.Decompress);
|
||||
}
|
||||
|
||||
IList<string> GetArcNames (string lst_name)
|
||||
{
|
||||
return File.ReadAllLines (lst_name, Encodings.cp932);
|
||||
}
|
||||
|
||||
IList<string> GetFileNames (string dir_name, string base_name)
|
||||
{
|
||||
var lists_lst_name = VFS.CombinePath (dir_name, "lists.lst");
|
||||
if (!VFS.FileExists (lists_lst_name))
|
||||
return null;
|
||||
var arcs = GetArcNames (lists_lst_name);
|
||||
var arc_no = arcs.IndexOf (base_name);
|
||||
if (-1 == arc_no)
|
||||
return null;
|
||||
var lists_bin_name = VFS.CombinePath (dir_name, "lists.bin");
|
||||
using (var lists_bin = VFS.OpenView (lists_bin_name))
|
||||
return ReadFileNames (lists_bin, arc_no);
|
||||
}
|
||||
|
||||
IList<string> ReadFileNames (ArcView index, int arc_no)
|
||||
{
|
||||
if (index.View.ReadUInt32 (0) != Signature)
|
||||
return null;
|
||||
if (!index.View.AsciiEqual (4, "OFST"))
|
||||
return null;
|
||||
int index_size = index.View.ReadInt32 (8);
|
||||
int arc_count = index_size / 4;
|
||||
if (arc_no >= arc_count)
|
||||
return null;
|
||||
uint index_offset = index.View.ReadUInt32 (0xC + arc_no * 4);
|
||||
if (index_offset >= index.MaxOffset)
|
||||
return null;
|
||||
Stream input;
|
||||
if (index.View.AsciiEqual (index_offset, "DFLT"))
|
||||
{
|
||||
uint packed_size = index.View.ReadUInt32 (index_offset+4);
|
||||
input = index.CreateStream (index_offset+12, packed_size);
|
||||
input = new ZLibStream (input, CompressionMode.Decompress);
|
||||
}
|
||||
else if (index.View.AsciiEqual (index_offset, "DATA"))
|
||||
{
|
||||
uint data_size = index.View.ReadUInt32 (index_offset+4);
|
||||
input = index.CreateStream (index_offset+8, data_size);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
using (input)
|
||||
using (var reader = new StreamReader (input, Encodings.cp932))
|
||||
{
|
||||
var list = new List<string>();
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
list.Add (line.Trim());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
88
ArcFormats/Patisserie/ArcRAW.cs
Normal file
88
ArcFormats/Patisserie/ArcRAW.cs
Normal file
@ -0,0 +1,88 @@
|
||||
//! \file ArcRAW.cs
|
||||
//! \date Fri Jul 22 00:56:19 2016
|
||||
//! \brief Patisserie animation resource.
|
||||
//
|
||||
// Copyright (C) 2016 by morkt
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
|
||||
namespace GameRes.Formats.Patisserie
|
||||
{
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
public class RawOpener : ArchiveFormat
|
||||
{
|
||||
public override string Tag { get { return "ABB/RAW"; } }
|
||||
public override string Description { get { return "Patisserie animation resource"; } }
|
||||
public override uint Signature { get { return 0x04574152; } } // 'RAW\x04'
|
||||
public override bool IsHierarchic { get { return false; } }
|
||||
public override bool CanCreate { get { return false; } }
|
||||
|
||||
public RawOpener ()
|
||||
{
|
||||
Extensions = new string[] { "raw" };
|
||||
}
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
uint end = file.View.ReadUInt32 (4);
|
||||
if (end > file.MaxOffset - 8)
|
||||
return null;
|
||||
end += 8;
|
||||
uint current_offset = 8;
|
||||
var dir = new List<Entry>();
|
||||
int i = 0;
|
||||
while (current_offset < end)
|
||||
{
|
||||
var entry = new Entry {
|
||||
Name = string.Format (i.ToString ("D4")),
|
||||
Type = "image",
|
||||
Offset = current_offset,
|
||||
};
|
||||
uint width = file.View.ReadUInt32 (current_offset+0xC);
|
||||
uint height = file.View.ReadUInt32 (current_offset+0x10);
|
||||
entry.Size = 0x14 + 4 * width * height;
|
||||
if (!entry.CheckPlacement (file.MaxOffset))
|
||||
return null;
|
||||
dir.Add (entry);
|
||||
current_offset += entry.Size;
|
||||
++i;
|
||||
}
|
||||
return new ArcFile (file, this, dir);
|
||||
}
|
||||
|
||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||
{
|
||||
var info = new ImageMetaData
|
||||
{
|
||||
OffsetX = arc.File.View.ReadInt32 (entry.Offset+4),
|
||||
OffsetY = arc.File.View.ReadInt32(entry.Offset+8),
|
||||
Width = arc.File.View.ReadUInt32(entry.Offset+0xC),
|
||||
Height = arc.File.View.ReadUInt32(entry.Offset+0x10),
|
||||
BPP = 32,
|
||||
};
|
||||
var pixels = arc.File.View.ReadBytes (entry.Offset+0x14, entry.Size-0x14);
|
||||
return TgaStream.Create (info, pixels);
|
||||
}
|
||||
}
|
||||
}
|
@ -169,6 +169,7 @@ Baldr Sky DiveX<br/>
|
||||
Fossette ~Cafe au Le Ciel Bleu~<br/>
|
||||
Jinki Extend Re:Vision<br/>
|
||||
Maji de Watashi ni Koishinasai!<br/>
|
||||
Xross Scramble<br/>
|
||||
</td></tr>
|
||||
<tr><td>*.grp</td><td><tt>GR3</tt></td><td>No</td></tr>
|
||||
<tr class="odd"><td>*.pac</td><td><tt>PAC1</tt></td><td>No</td><td rowspan="2">RAGE</td><td rowspan="2">
|
||||
@ -209,6 +210,7 @@ Love Negotiator<br/>
|
||||
Sekien no Inganock<br/>
|
||||
Shikkoku no Sharnoth<br/>
|
||||
Yami no Sen Ou ~Seijo Ojoku~<br/>
|
||||
Astelight series<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.lwg</td><td><tt>LG</tt></td><td>No</td></tr>
|
||||
<tr class="odd"><td>*.wcg</td><td><tt>WGq</tt></td><td>Yes</td></tr>
|
||||
@ -322,6 +324,7 @@ Genecracer Saki<br/>
|
||||
Hazama no Tsuki<br/>
|
||||
Hensai Keikaku<br/>
|
||||
Himawari Oka Sougou Byouin e Youkoso<br/>
|
||||
Futari no Erika ~Osanajimi to Ima Kanojo to~<br/>
|
||||
Inen no Yakata<br/>
|
||||
Inran OL Sawatari Tokiko<br/>
|
||||
Itsuwari no Kyoushitsu<br/>
|
||||
@ -382,6 +385,7 @@ Lovers Collection<br/>
|
||||
Nachtmusik<br/>
|
||||
Nachtmusik Another<br/>
|
||||
Oto☆Puri<br/>
|
||||
Prawf Clwyd<br/>
|
||||
Rakuen no Rukia ~Blood Moon Rising~<br/>
|
||||
Samayou Mitama ni Yasuragi no Toki wo<br/>
|
||||
Time Trouble ~Marie ni Kubikkake~<br/>
|
||||
@ -476,6 +480,7 @@ Inkou Haden Amatsu ~Hakudaku no Juin~<br/>
|
||||
Magical Witch Academy<br/>
|
||||
Medorei ~Okasareta Houkago~<br/>
|
||||
Onna Kyoushi<br/>
|
||||
Ore to Kanojo wa Shuju na Kankei<br/>
|
||||
Saishuu Chikan Densha<br/>
|
||||
Serina<br/>
|
||||
Ura Nyuugaku ~Ineki ni Nureta Kyoukasho~<br/>
|
||||
@ -588,6 +593,7 @@ Shinsetsu Ryouki no Ori<br/>
|
||||
Gokudou no Hanayome<br/>
|
||||
Inraku no Miko<br/>
|
||||
Knight Carnival!<br/>
|
||||
Nise Kyoushi ~Seikatsu Shidou ADV~<br/>
|
||||
Seal Princess<br/>
|
||||
Zettai★Maou ~Boku no Mune-kyun Gakuen Saga~<br/>
|
||||
</td></tr>
|
||||
@ -631,6 +637,7 @@ Seinarukana -The Spirit of Eternity Sword 2-<br/>
|
||||
<tr class="odd"><td>*.ykc</td><td><tt>YKC001</tt></td><td>Yes</td><td rowspan="2">Yuka</td><td rowspan="2">
|
||||
Aozora no Mieru Oka<br/>
|
||||
HoneyComing<br/>
|
||||
Hoshizora e Kakaru Hashi AA<br/>
|
||||
PriministAr<br/>
|
||||
SuGirly Wish<br/>
|
||||
_summer<br/>
|
||||
@ -666,6 +673,7 @@ Soukai no Valkyria <br/>
|
||||
Ashita wa Kitto, Haremasu you ni<br/>
|
||||
Cross Quartz<br/>
|
||||
Hyakki Yakou<br/>
|
||||
Mahou Senshi Extra Stage 2 ~Gakuen Kangoku~<br/>
|
||||
Saikyou Goshujin-sama! -Mighty My Master-<br/>
|
||||
Saiminjutsu Re<br/>
|
||||
Wizard Links<br/>
|
||||
@ -810,7 +818,8 @@ Planet Dragon<br/>
|
||||
<tr class="odd"><td>*.gd+*.dll</td><td>-</td><td>No</td><td>Xuse</td><td>
|
||||
Eien no Aselia -The Spirit of Eternity Sword-
|
||||
</td></tr>
|
||||
<tr><td>*.dat</td><td><tt>DAF2</tt></td><td>No</td><td>DenSDK</td><td>
|
||||
<tr><td>*.dat</td><td><tt>DAF1</tt><br/><tt>DAF2</tt></td><td>No</td><td>DenSDK</td><td>
|
||||
Ayakashi<br/>
|
||||
Ayakashi H<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.arc</td><td><tt>LINK3</tt></td><td>No</td><td rowspan="3">KaGuYa</td><td rowspan="3">
|
||||
@ -840,6 +849,7 @@ Unity Marriage ~Futari no Hanayome~<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.pgd</td><td><tt>GE</tt><br/><tt>PGD3</tt></td><td>No</td></tr>
|
||||
<tr><td>*.npk</td><td><tt>NPK2</tt></td><td>No</td><td>Nitro+</td><td>
|
||||
Sonicomi<br/>
|
||||
Tokyo Necro<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*</td><td><tt>arc</tt></td><td>No</td><td rowspan="2">ADVEngine</td><td rowspan="2">
|
||||
@ -863,6 +873,7 @@ Ase Nure Shoujo Misaki "Anata no Nioi de Icchau!"<br/>
|
||||
D-spray Biyaku de Motemote Kachou Dairi Hosa<br/>
|
||||
Hitomi no Rakuin ~Inbaku no Mesu Dorei~<br/>
|
||||
Jokujima<br/>
|
||||
Saiin Haramase Keyword<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.grp</td><td>-</td><td>No</td><td>Ankh</td><td>
|
||||
Mozu<br/>
|
||||
@ -939,12 +950,17 @@ Kara no Shoujo 2<br/>
|
||||
</td></td>
|
||||
<tr><td>data.NN<br/>ArcNN.dat</td><td>-</td><td>No</td><td>Cyberworks</td><td>
|
||||
Cosplay Ecchi ~Layer Kana no Yuuutsu~<br/>
|
||||
Hanamaru! 2<br/>
|
||||
Hime Kami 1/2<br/>
|
||||
In'youchuu Goku ~Ryoujoku Jigoku Taimaroku~<br/>
|
||||
In'youchuu Rei ~Ryoujoku Shiro Taima Emaki~<br/>
|
||||
Oshioki ~Gakuen Reijou Kousei Keikaku~<br/>
|
||||
Ore Maou! ~Kudake Chitta Tamashii<br/>
|
||||
Zoku Etsuraku no Tane<br/>
|
||||
</td></tr>
|
||||
<tr class="odd"><td>*.bin</td><td><tt>OZ</tt></td><td>No</td><td>Patisserie</td><td>
|
||||
Ore no Tamanokoshi ni Notte Kure<br/>
|
||||
</td></tr>
|
||||
</table>
|
||||
<p><a name="note-1" class="footnote">1</a> Non-encrypted only</p>
|
||||
</body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user