mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
remember last used MCG image key.
This commit is contained in:
parent
c4acb0c44b
commit
5907b0ad5c
@ -26,9 +26,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using GameRes.Formats.Properties;
|
||||
using GameRes.Utility;
|
||||
|
||||
namespace GameRes.Formats.FC01
|
||||
@ -102,6 +102,7 @@ namespace GameRes.Formats.FC01
|
||||
uint m_width;
|
||||
uint m_height;
|
||||
uint m_pixels;
|
||||
byte m_key;
|
||||
|
||||
public byte[] Data { get { return m_output; } }
|
||||
|
||||
@ -115,6 +116,7 @@ namespace GameRes.Formats.FC01
|
||||
m_height = info.Height;
|
||||
m_pixels = m_width*m_height;
|
||||
m_output = new byte[m_pixels*3];
|
||||
m_key = Settings.Default.MCGLastKey;
|
||||
}
|
||||
|
||||
static readonly byte[] ChannelOrder = { 1, 0, 2 };
|
||||
@ -122,9 +124,9 @@ namespace GameRes.Formats.FC01
|
||||
public void Unpack ()
|
||||
{
|
||||
var reader = new MrgDecoder (m_input, 0, m_pixels);
|
||||
for (int key = 0; key < 0x100; ++key)
|
||||
do
|
||||
{
|
||||
reader.ResetKey ((byte)key);
|
||||
reader.ResetKey (m_key);
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
@ -141,18 +143,19 @@ namespace GameRes.Formats.FC01
|
||||
}
|
||||
catch (InvalidFormatException)
|
||||
{
|
||||
m_key++;
|
||||
continue;
|
||||
}
|
||||
Transform();
|
||||
Settings.Default.MCGLastKey = m_key;
|
||||
return;
|
||||
}
|
||||
while (m_key != Settings.Default.MCGLastKey);
|
||||
throw new UnknownEncryptionScheme();
|
||||
}
|
||||
|
||||
void Transform ()
|
||||
{
|
||||
// esi = m_input
|
||||
// dst = m_output
|
||||
uint dst = 0;
|
||||
uint stride = (m_width - 1) * 3;
|
||||
for (uint y = m_height-1; y > 0; --y) // @@1a
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion ("1.0.7.79")]
|
||||
[assembly: AssemblyFileVersion ("1.0.7.79")]
|
||||
[assembly: AssemblyVersion ("1.0.7.80")]
|
||||
[assembly: AssemblyFileVersion ("1.0.7.80")]
|
||||
|
12
ArcFormats/Properties/Settings.Designer.cs
generated
12
ArcFormats/Properties/Settings.Designer.cs
generated
@ -381,5 +381,17 @@ namespace GameRes.Formats.Properties {
|
||||
this["ISFScheme"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public byte MCGLastKey {
|
||||
get {
|
||||
return ((byte)(this["MCGLastKey"]));
|
||||
}
|
||||
set {
|
||||
this["MCGLastKey"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,5 +92,8 @@
|
||||
<Setting Name="ISFScheme" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="MCGLastKey" Type="System.Byte" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -94,6 +94,9 @@
|
||||
<setting name="ISFScheme" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="MCGLastKey" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
</GameRes.Formats.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||
|
Loading…
x
Reference in New Issue
Block a user