From 8724e8131c2b98064dfae2648567a4dd6919a219 Mon Sep 17 00:00:00 2001
From: morkt <muvluv.ru@gmail.com>
Date: Fri, 28 Jul 2017 16:53:34 +0400
Subject: [PATCH] (INT): added scheme lookup by executable name.

---
 ArcFormats/CatSystem/ArcINT.cs         | 7 +++++--
 ArcFormats/CatSystem/WidgetINT.xaml.cs | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ArcFormats/CatSystem/ArcINT.cs b/ArcFormats/CatSystem/ArcINT.cs
index 808750a5..391646be 100644
--- a/ArcFormats/CatSystem/ArcINT.cs
+++ b/ArcFormats/CatSystem/ArcINT.cs
@@ -128,7 +128,7 @@ namespace GameRes.Formats.CatSystem
                 return null;
             if (file.View.AsciiEqual (8, "__key__.dat\x00"))
             {
-                uint? key = QueryEncryptionInfo();
+                uint? key = QueryEncryptionInfo (file.Name);
                 if (null == key)
                     throw new UnknownEncryptionScheme();
                 return OpenEncrypted (file, entry_count, key.Value);
@@ -274,8 +274,11 @@ namespace GameRes.Formats.CatSystem
             return new GUI.CreateINTWidget();
         }
 
-        uint? QueryEncryptionInfo ()
+        uint? QueryEncryptionInfo (string arc_name)
         {
+            var title = FormatCatalog.Instance.LookupGame (arc_name);
+            if (!string.IsNullOrEmpty (title) && KnownSchemes.ContainsKey (title))
+                return KnownSchemes[title].Key;
             var options = Query<IntOptions> (arcStrings.INTNotice);
             return options.EncryptionInfo.GetKey();
         }
diff --git a/ArcFormats/CatSystem/WidgetINT.xaml.cs b/ArcFormats/CatSystem/WidgetINT.xaml.cs
index d1fc17bb..6f801928 100644
--- a/ArcFormats/CatSystem/WidgetINT.xaml.cs
+++ b/ArcFormats/CatSystem/WidgetINT.xaml.cs
@@ -86,7 +86,7 @@ namespace GameRes.Formats.GUI
                 CheckPathExists = true,
                 Multiselect = false,
                 Title = arcStrings.INTChooseExe,
-                Filter = arcStrings.INTExeFiles+"|*.exe",
+                Filter = arcStrings.INTExeFiles+"|*.exe;*.bin",
                 FilterIndex = 1,
                 InitialDirectory = Directory.GetCurrentDirectory(),
             };