From 97c4722d8610e1ce2e4f9e9acf0a2306637f99a9 Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 30 May 2016 15:48:02 +0400 Subject: [PATCH] implemented DxLib MED archives. --- ArcFormats/ArcFormats.csproj | 3 ++ ArcFormats/DxLib/ArcDX.cs | 2 +- ArcFormats/DxLib/ArcMED.cs | 78 ++++++++++++++++++++++++++++++++++++ supported.html | 8 +++- 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 ArcFormats/DxLib/ArcMED.cs diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj index 2d5c99e8..ffa7c6dd 100644 --- a/ArcFormats/ArcFormats.csproj +++ b/ArcFormats/ArcFormats.csproj @@ -73,6 +73,7 @@ + WidgetAZ.xaml @@ -85,6 +86,8 @@ + + diff --git a/ArcFormats/DxLib/ArcDX.cs b/ArcFormats/DxLib/ArcDX.cs index 9e8c1067..b16a8feb 100644 --- a/ArcFormats/DxLib/ArcDX.cs +++ b/ArcFormats/DxLib/ArcDX.cs @@ -61,7 +61,7 @@ namespace GameRes.Formats.DxLib public DxOpener () { Extensions = new string[] { "dxa", "hud", "usi", "med", "dat" }; - Signatures = new uint[] { 0x19EF8ED4, 0xA9FCCEDD, 0x0AEE0FD3, 0x5523F211, 0 }; + Signatures = new uint[] { 0x19EF8ED4, 0xA9FCCEDD, 0x0AEE0FD3, 0x5523F211, 0x5524F211, 0 }; } public static IList KnownKeys = new List(); diff --git a/ArcFormats/DxLib/ArcMED.cs b/ArcFormats/DxLib/ArcMED.cs new file mode 100644 index 00000000..94812997 --- /dev/null +++ b/ArcFormats/DxLib/ArcMED.cs @@ -0,0 +1,78 @@ +//! \file ArcMED.cs +//! \date Mon May 30 12:35:24 2016 +//! \brief DxLib 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; + +namespace GameRes.Formats.DxLib +{ + [Export(typeof(ArchiveFormat))] + public class MedOpener : ArchiveFormat + { + public override string Tag { get { return "MED"; } } + public override string Description { get { return "DxLib engine resource archive"; } } + public override uint Signature { get { return 0; } } + public override bool IsHierarchic { get { return false; } } + public override bool CanCreate { get { return false; } } + + static readonly Lazy PrsFormat = new Lazy (() => ImageFormat.FindByTag ("PRS")); + + public override ArcFile TryOpen (ArcView file) + { + if (!file.View.AsciiEqual (0, "MD")) + return null; + uint entry_length = file.View.ReadUInt16 (4); + int count = file.View.ReadUInt16 (6); + if (entry_length <= 8 || !IsSaneCount (count)) + return null; + + uint name_length = entry_length - 8; + uint index_offset = 0x10; + var dir = new List (count); + for (int i = 0; i < count; ++i) + { + var name = file.View.ReadString (index_offset, name_length); + index_offset += name_length; + uint offset = file.View.ReadUInt32 (index_offset+4); + + var entry = new AutoEntry (name, () => { + uint signature = file.View.ReadUInt32 (offset); + if (0x4259 == (signature & 0xFFFF)) // 'YB' + return PrsFormat.Value; + return AutoEntry.DetectFileType (signature); + }); + entry.Size = file.View.ReadUInt32 (index_offset); + entry.Offset = offset; + if (!entry.CheckPlacement (file.MaxOffset)) + return null; + dir.Add (entry); + index_offset += 8; + } + return new ArcFile (file, this, dir); + } + } +} diff --git a/supported.html b/supported.html index a2e8166c..130ebbf9 100644 --- a/supported.html +++ b/supported.html @@ -77,6 +77,7 @@ Grisaia no Kajitsu
Happiness! Re:Lucks
Kamikaze ☆ Explorer!
Makai Tenshi Djibril -Episode 4-
+Sakigake ⇒ Generation!
Sengoku Tenshi Djibril
Shukufuku no Campanella
TsunaBan ♥ Love Mix
@@ -424,6 +425,8 @@ Senpai - Oppai - Kako ni Modori Pai
*.gr-No *.datSPackNoGoku-FeroInchuu Reiki Elenova *.fpk-NoCandy Soft
Interheart +Chijoku no Kankei ~Inkou Kyoushi~
+Chijoku no Kankei 2
Jii -Nozoki no Houshuu-
Itazura ZERO
@@ -506,6 +509,7 @@ Unbalance
Angel Crown
Dies irae
Dies irae ~Amantes amentes~
+Dokidoki Sister Paradise 2
Kajiri Kamui Kagura
Paradise Lost
Sakashiki Hito ni Miru Kokoro
@@ -628,12 +632,14 @@ Soukai no Oujo-tachi
Soukai no Valkyria
*.agfACGFNo -*.dxa
*.usi
*.hud
*.med
*.datDXencryptedNoDxLib +*.dxa
*.usi
*.hud
*.datDXencryptedNoDxLib Ashita wa Kitto, Haremasu you ni
Cross Quartz
Hyakki Yakou
Saikyou Goshujin-sama! -Mighty My Master-
+Saiminjutsu Re
+*.medMDNo *.tcdTCD3NoTopCat Atori no Sora to Shinchuu no Tsuki
Favorite Sweet!