diff --git a/ArcFormats/ArcNPA.cs b/ArcFormats/ArcNPA.cs index 9fa08644..d01c4020 100644 --- a/ArcFormats/ArcNPA.cs +++ b/ArcFormats/ArcNPA.cs @@ -273,9 +273,16 @@ namespace GameRes.Formats return table; } + public override ResourceOptions GetOptions () + { + return new ResourceOptions { + Widget = new GUI.WidgetNPA() + }; + } + NpaTitleId QueryGameEncryption () { - var widget = new GUI.WidgetNPA (KnownSchemes[(int)Settings.Default.NPAScheme]); + var widget = new GUI.WidgetNPA(); var args = new ParametersRequestEventArgs { Notice = arcStrings.ArcEncryptedNotice, diff --git a/ArcFormats/ArcYPF.cs b/ArcFormats/ArcYPF.cs index cd8c762b..46d5364e 100644 --- a/ArcFormats/ArcYPF.cs +++ b/ArcFormats/ArcYPF.cs @@ -55,14 +55,9 @@ namespace GameRes.Formats return new ZLibStream (input, CompressionMode.Decompress); } - uint m_last_key = Settings.Default.YPFKey; - uint QueryEncryptionKey () { - uint? key = m_last_key; - if (m_last_key > 0xff) - key = null; - var widget = new GUI.WidgetYPF (key); + var widget = new GUI.WidgetYPF(); var args = new ParametersRequestEventArgs { Notice = arcStrings.YPFNotice, @@ -72,10 +67,9 @@ namespace GameRes.Formats if (!args.InputResult) throw new OperationCanceledException(); - key = widget.GetKey(); - m_last_key = null != key && key.Value < 0x100 ? key.Value : DefaultKey; - Settings.Default.YPFKey = m_last_key; - return m_last_key; + uint last_key = widget.GetKey() ?? DefaultKey; + Settings.Default.YPFKey = last_key; + return last_key; } private class Parser @@ -99,9 +93,8 @@ namespace GameRes.Formats { uint dir_offset = 0x20; uint dir_remaining = m_dir_size; - uint num; var dir = new List ((int)m_count); - for (num = 0; num < m_count; ++num) + for (uint num = 0; num < m_count; ++num) { if (dir_remaining < 0x17) break; diff --git a/ArcFormats/WidgetINT.xaml b/ArcFormats/WidgetINT.xaml index a91a5eb9..a4d87351 100644 --- a/ArcFormats/WidgetINT.xaml +++ b/ArcFormats/WidgetINT.xaml @@ -2,6 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:GameRes.Formats.Strings" + xmlns:fmt="clr-namespace:GameRes.Formats" xmlns:local="clr-namespace:GameRes.Formats.GUI" MaxWidth="260"> @@ -52,6 +53,7 @@