diff --git a/ArcFormats/ArcFormats.csproj b/ArcFormats/ArcFormats.csproj index 86d58d8e..6c7955ef 100644 --- a/ArcFormats/ArcFormats.csproj +++ b/ArcFormats/ArcFormats.csproj @@ -99,6 +99,9 @@ WidgetBELL.xaml + + WidgetGYU.xaml + @@ -606,6 +609,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/ArcFormats/ExHibit/ImageGYU.cs b/ArcFormats/ExHibit/ImageGYU.cs index d8844521..b96f131d 100644 --- a/ArcFormats/ExHibit/ImageGYU.cs +++ b/ArcFormats/ExHibit/ImageGYU.cs @@ -2,7 +2,7 @@ //! \date Mon Nov 02 00:38:41 2015 //! \brief ExHIBIT engine image format. // -// Copyright (C) 2015 by morkt +// Copyright (C) 2015-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 @@ -25,12 +25,16 @@ using System; using System.ComponentModel.Composition; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Windows.Media.Imaging; using System.Windows.Media; using GameRes.Utility; using GameRes.Compression; using GameRes.Cryptography; +using GameRes.Formats.Strings; +using GameRes.Formats.Properties; namespace GameRes.Formats.ExHibit { @@ -44,6 +48,12 @@ namespace GameRes.Formats.ExHibit public int PaletteSize; } + [Serializable] + public class GyuMap : ResourceScheme + { + public Dictionary> KnownKeys; + } + [Export(typeof(ImageFormat))] public class GyuFormat : ImageFormat { @@ -51,6 +61,14 @@ namespace GameRes.Formats.ExHibit public override string Description { get { return "ExHIBIT engine image format"; } } public override uint Signature { get { return 0x1A555947; } } // 'GYU' + public static Dictionary> KnownKeys = new Dictionary>(); + + public override ResourceScheme Scheme + { + get { return new GyuMap { KnownKeys = KnownKeys }; } + set { KnownKeys = ((GyuMap)value).KnownKeys; } + } + public override ImageMetaData ReadMetaData (Stream stream) { using (var reader = new ArcView.Reader (stream)) @@ -71,12 +89,28 @@ namespace GameRes.Formats.ExHibit } } + IDictionary CurrentMap = null; + public override ImageData Read (Stream stream, ImageMetaData info) { var meta = (GyuMetaData)info; if (0 == meta.Key) - throw new UnknownEncryptionScheme ("Unknown image encryption key"); - + { + bool got_key = false; + var name = Path.GetFileNameWithoutExtension (meta.FileName); + int num; + if (int.TryParse (name, out num)) + { + if (null == CurrentMap) + CurrentMap = QueryScheme(); + got_key = CurrentMap != null && CurrentMap.TryGetValue (num, out meta.Key); + } + if (!got_key) + { + CurrentMap = null; + throw new UnknownEncryptionScheme ("Unknown image encryption key"); + } + } var reader = new GyuReader (stream, meta); reader.Unpack(); return ImageData.CreateFlipped (meta, reader.Format, reader.Palette, reader.Data, reader.Stride); @@ -86,6 +120,33 @@ namespace GameRes.Formats.ExHibit { throw new System.NotImplementedException ("GyuFormat.Write not implemented"); } + + private IDictionary QueryScheme () + { + if (0 == KnownKeys.Count) + return null; + if (1 == KnownKeys.Count) + return KnownKeys.First().Value; + var options = Query (arcStrings.GYUImageEncrypted); + return options.Scheme; + } + + public override ResourceOptions GetDefaultOptions () + { + return new GyuOptions { Scheme = GetScheme (Settings.Default.GYUTitle) }; + } + + public override object GetAccessWidget () + { + return new GUI.WidgetGYU(); + } + + Dictionary GetScheme (string title) + { + Dictionary scheme = null; + KnownKeys.TryGetValue (title, out scheme); + return scheme; + } } internal sealed class GyuReader @@ -284,4 +345,9 @@ namespace GameRes.Formats.ExHibit } } } + + public class GyuOptions : ResourceOptions + { + public IDictionary Scheme; + } } diff --git a/ArcFormats/ExHibit/WidgetGYU.xaml b/ArcFormats/ExHibit/WidgetGYU.xaml new file mode 100644 index 00000000..fa4736f6 --- /dev/null +++ b/ArcFormats/ExHibit/WidgetGYU.xaml @@ -0,0 +1,10 @@ + + + diff --git a/ArcFormats/ExHibit/WidgetGYU.xaml.cs b/ArcFormats/ExHibit/WidgetGYU.xaml.cs new file mode 100644 index 00000000..bf681387 --- /dev/null +++ b/ArcFormats/ExHibit/WidgetGYU.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows.Controls; + +namespace GameRes.Formats.GUI +{ + /// + /// Interaction logic for WidgetGYU.xaml + /// + public partial class WidgetGYU : StackPanel + { + public WidgetGYU() + { + InitializeComponent(); + } + } +} diff --git a/ArcFormats/Properties/Settings.Designer.cs b/ArcFormats/Properties/Settings.Designer.cs index 9dea8703..0dd33c4d 100644 --- a/ArcFormats/Properties/Settings.Designer.cs +++ b/ArcFormats/Properties/Settings.Designer.cs @@ -621,5 +621,17 @@ namespace GameRes.Formats.Properties { this["TacticsArcTitle"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string GYUTitle { + get { + return ((string)(this["GYUTitle"])); + } + set { + this["GYUTitle"] = value; + } + } } } diff --git a/ArcFormats/Properties/Settings.settings b/ArcFormats/Properties/Settings.settings index 16349e7b..8e0c5aae 100644 --- a/ArcFormats/Properties/Settings.settings +++ b/ArcFormats/Properties/Settings.settings @@ -152,5 +152,8 @@ + + + \ No newline at end of file diff --git a/ArcFormats/Strings/arcStrings.Designer.cs b/ArcFormats/Strings/arcStrings.Designer.cs index b8f94df6..ae4e7a8c 100644 --- a/ArcFormats/Strings/arcStrings.Designer.cs +++ b/ArcFormats/Strings/arcStrings.Designer.cs @@ -215,6 +215,16 @@ namespace GameRes.Formats.Strings { } } + /// + /// Looks up a localized string similar to Image is encrypted. + ///Choose appropriate encryption scheme.. + /// + public static string GYUImageEncrypted { + get { + return ResourceManager.GetString("GYUImageEncrypted", resourceCulture); + } + } + /// /// Looks up a localized string similar to Choose game executable file. /// @@ -415,7 +425,7 @@ namespace GameRes.Formats.Strings { } /// - /// Looks up a localized string similar to Calcualting checksum.... + /// Looks up a localized string similar to Calculating checksum.... /// public static string MsgCalculatingChecksum { get { diff --git a/ArcFormats/Strings/arcStrings.ko-KR.resx b/ArcFormats/Strings/arcStrings.ko-KR.resx index 1f6efdf8..efb3b744 100644 --- a/ArcFormats/Strings/arcStrings.ko-KR.resx +++ b/ArcFormats/Strings/arcStrings.ko-KR.resx @@ -375,4 +375,8 @@ 제목을 선택하거나 암호값 입력하기 + + 이미지가 암호화됨. +적절한 암호체계를 선택하세요. + \ No newline at end of file diff --git a/ArcFormats/Strings/arcStrings.resx b/ArcFormats/Strings/arcStrings.resx index 0f6f2d0f..1d5db66b 100644 --- a/ArcFormats/Strings/arcStrings.resx +++ b/ArcFormats/Strings/arcStrings.resx @@ -179,7 +179,7 @@ Choose appropriate encryption scheme. Adding file - Calcualting checksum... + Calculating checksum... Compressing index... @@ -378,4 +378,8 @@ Choose appropriate encryption scheme. Choose title or enter a key + + Image is encrypted. +Choose appropriate encryption scheme. + \ No newline at end of file diff --git a/ArcFormats/Strings/arcStrings.ru-RU.resx b/ArcFormats/Strings/arcStrings.ru-RU.resx index f8b0ae22..0991dec0 100644 --- a/ArcFormats/Strings/arcStrings.ru-RU.resx +++ b/ArcFormats/Strings/arcStrings.ru-RU.resx @@ -161,6 +161,10 @@ Выберите наименование или введите ключ + + Изображение зашифровано. +Выберите способ шифрования. + Выберите исполняемый файл diff --git a/ArcFormats/Strings/arcStrings.zh-Hans.resx b/ArcFormats/Strings/arcStrings.zh-Hans.resx index d7e5ec1d..1697a55a 100644 --- a/ArcFormats/Strings/arcStrings.zh-Hans.resx +++ b/ArcFormats/Strings/arcStrings.zh-Hans.resx @@ -380,4 +380,8 @@ Choose appropriate encryption scheme. 请选择游戏名称或输入密钥 + + 图像已加密。 +请选择正确的加密方式。 + \ No newline at end of file diff --git a/ArcFormats/app.config b/ArcFormats/app.config index 2a03d682..6b37747a 100644 --- a/ArcFormats/app.config +++ b/ArcFormats/app.config @@ -154,6 +154,9 @@ + + + diff --git a/supported.html b/supported.html index 3fa1103a..ef6aba64 100644 --- a/supported.html +++ b/supported.html @@ -122,6 +122,7 @@ Happy Princess
Idol ☆ Revolution
Narimono
Reconquista
+Switch!! ~Boku ga Natsu ni Omou Koto~
White ~blanche comme la lune~
*.rct\x98\x5A\x92\x9ATYes @@ -295,6 +296,7 @@ Eien no Owari ni
Fuurinkanzan
Himemiko
Ikusa Otome Valkyrie
+Mahou Tenshi Misaki
Mahou Tenshi Misaki 2
Ohime-sama wa Tokkun Chuu R! ~Seinaru Mahou Shugyou~
Onsoku Hishou Sonic Mercedes
@@ -737,6 +739,7 @@ Moshimo Ashita ga Harenaraba
*.pgaPGAPGAHYes *.chrcharNo *.gyuGYU\x1aNoExHIBIT +Eve ~New Generation X~
Fuyu no Rondo
*.dat-NoACTGS @@ -775,6 +778,7 @@ Izumo 2
Izumo 2 ~Gakuen Kyousoukyoku~
Izumo 3
Oni Kagura
+Tokino Senka
Tsuki Kagura
*.pbxPandora.boxNoTerios @@ -1000,6 +1004,7 @@ Nukiani!! Sweet Home
*.arcARCXNoStudio Jaren Denpa no Dorei
Soushinjutsu Plus
+Soushinjutsu 2
*.ns2-NoNScripter Rakuin Hime Runed Princess