mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using GameRes.Formats.Properties;
|
||||||
using GameRes.Utility;
|
using GameRes.Utility;
|
||||||
|
|
||||||
namespace GameRes.Formats.FC01
|
namespace GameRes.Formats.FC01
|
||||||
@ -102,6 +102,7 @@ namespace GameRes.Formats.FC01
|
|||||||
uint m_width;
|
uint m_width;
|
||||||
uint m_height;
|
uint m_height;
|
||||||
uint m_pixels;
|
uint m_pixels;
|
||||||
|
byte m_key;
|
||||||
|
|
||||||
public byte[] Data { get { return m_output; } }
|
public byte[] Data { get { return m_output; } }
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ namespace GameRes.Formats.FC01
|
|||||||
m_height = info.Height;
|
m_height = info.Height;
|
||||||
m_pixels = m_width*m_height;
|
m_pixels = m_width*m_height;
|
||||||
m_output = new byte[m_pixels*3];
|
m_output = new byte[m_pixels*3];
|
||||||
|
m_key = Settings.Default.MCGLastKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly byte[] ChannelOrder = { 1, 0, 2 };
|
static readonly byte[] ChannelOrder = { 1, 0, 2 };
|
||||||
@ -122,9 +124,9 @@ namespace GameRes.Formats.FC01
|
|||||||
public void Unpack ()
|
public void Unpack ()
|
||||||
{
|
{
|
||||||
var reader = new MrgDecoder (m_input, 0, m_pixels);
|
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
|
try
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
@ -141,18 +143,19 @@ namespace GameRes.Formats.FC01
|
|||||||
}
|
}
|
||||||
catch (InvalidFormatException)
|
catch (InvalidFormatException)
|
||||||
{
|
{
|
||||||
|
m_key++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform();
|
Transform();
|
||||||
|
Settings.Default.MCGLastKey = m_key;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
while (m_key != Settings.Default.MCGLastKey);
|
||||||
throw new UnknownEncryptionScheme();
|
throw new UnknownEncryptionScheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transform ()
|
void Transform ()
|
||||||
{
|
{
|
||||||
// esi = m_input
|
|
||||||
// dst = m_output
|
|
||||||
uint dst = 0;
|
uint dst = 0;
|
||||||
uint stride = (m_width - 1) * 3;
|
uint stride = (m_width - 1) * 3;
|
||||||
for (uint y = m_height-1; y > 0; --y) // @@1a
|
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
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion ("1.0.7.79")]
|
[assembly: AssemblyVersion ("1.0.7.80")]
|
||||||
[assembly: AssemblyFileVersion ("1.0.7.79")]
|
[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;
|
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">
|
<Setting Name="ISFScheme" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="MCGLastKey" Type="System.Byte" Scope="User">
|
||||||
|
<Value Profile="(Default)">0</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -94,6 +94,9 @@
|
|||||||
<setting name="ISFScheme" serializeAs="String">
|
<setting name="ISFScheme" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="MCGLastKey" serializeAs="String">
|
||||||
|
<value>0</value>
|
||||||
|
</setting>
|
||||||
</GameRes.Formats.Properties.Settings>
|
</GameRes.Formats.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||||
|
Loading…
Reference in New Issue
Block a user