mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(StuduiJikkenshitsu): moved to ArcFormats project.
added encryption scheme query.
This commit is contained in:
parent
c18672f1d4
commit
761ec768b1
@ -306,6 +306,12 @@
|
|||||||
<Compile Include="Slg\ImageTIM.cs" />
|
<Compile Include="Slg\ImageTIM.cs" />
|
||||||
<Compile Include="Speed\ArcARC.cs" />
|
<Compile Include="Speed\ArcARC.cs" />
|
||||||
<Compile Include="Stack\ArcGPK.cs" />
|
<Compile Include="Stack\ArcGPK.cs" />
|
||||||
|
<Compile Include="StudioJikkenshitsu\ImageDAT.cs" />
|
||||||
|
<Compile Include="StudioJikkenshitsu\ImageGRD.cs" />
|
||||||
|
<Compile Include="StudioJikkenshitsu\SjTransform.cs" />
|
||||||
|
<Compile Include="StudioJikkenshitsu\WidgetSJDAT.xaml.cs">
|
||||||
|
<DependentUpon>WidgetSJDAT.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="StudioSakura\ArcDAT.cs" />
|
<Compile Include="StudioSakura\ArcDAT.cs" />
|
||||||
<Compile Include="Silky\ImageGRD.cs" />
|
<Compile Include="Silky\ImageGRD.cs" />
|
||||||
<Compile Include="Slg\ArcSPD.cs" />
|
<Compile Include="Slg\ArcSPD.cs" />
|
||||||
@ -575,6 +581,7 @@
|
|||||||
<DependentUpon>WidgetTactics.xaml</DependentUpon>
|
<DependentUpon>WidgetTactics.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Tail\ArcCAF.cs" />
|
<Compile Include="Tail\ArcCAF.cs" />
|
||||||
|
<Compile Include="Tail\ArcPKG.cs" />
|
||||||
<Compile Include="Tail\ImageCFP.cs" />
|
<Compile Include="Tail\ImageCFP.cs" />
|
||||||
<Compile Include="Tamamo\ArcPCK.cs" />
|
<Compile Include="Tamamo\ArcPCK.cs" />
|
||||||
<Compile Include="Tamamo\WidgetPCK.xaml.cs">
|
<Compile Include="Tamamo\WidgetPCK.xaml.cs">
|
||||||
@ -1094,6 +1101,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="StudioJikkenshitsu\WidgetSJDAT.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Tactics\WidgetTactics.xaml">
|
<Page Include="Tactics\WidgetTactics.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
12
ArcFormats/Properties/Settings.Designer.cs
generated
12
ArcFormats/Properties/Settings.Designer.cs
generated
@ -789,5 +789,17 @@ namespace GameRes.Formats.Properties {
|
|||||||
this["LEAFTitle"] = value;
|
this["LEAFTitle"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||||
|
public string SJDatTitle {
|
||||||
|
get {
|
||||||
|
return ((string)(this["SJDatTitle"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["SJDatTitle"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,5 +194,8 @@
|
|||||||
<Setting Name="LEAFTitle" Type="System.String" Scope="User">
|
<Setting Name="LEAFTitle" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="SJDatTitle" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -29,8 +29,10 @@ using System.ComponentModel.Composition;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using GameRes.Formats.Strings;
|
||||||
|
|
||||||
// [010719][Studio Jikkenshitsu] Shin Gekka Bijin ~Hitori Shizuka
|
// [010719][Studio Jikkenshitsu] Shin Gekka Bijin ~Hitori Shizuka
|
||||||
|
// [030606][Studio Jikkenshitsu] Bias {biAs+}
|
||||||
// [031212][Studio Jikkenshitsu] Jam n' Limit
|
// [031212][Studio Jikkenshitsu] Jam n' Limit
|
||||||
|
|
||||||
namespace GameRes.Formats.Jikkenshitsu
|
namespace GameRes.Formats.Jikkenshitsu
|
||||||
@ -50,6 +52,11 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
public IDictionary<string, byte[]> KnownSchemes;
|
public IDictionary<string, byte[]> KnownSchemes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class SjOptions : ResourceOptions
|
||||||
|
{
|
||||||
|
public byte[] Key;
|
||||||
|
}
|
||||||
|
|
||||||
[Export(typeof(ImageFormat))]
|
[Export(typeof(ImageFormat))]
|
||||||
public class SpDatFormat : ImageFormat
|
public class SpDatFormat : ImageFormat
|
||||||
{
|
{
|
||||||
@ -63,11 +70,7 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
Signatures = new uint[] { 0x010003, 0x010007, 0x01000B, 0x010046, 0 };
|
Signatures = new uint[] { 0x010003, 0x010007, 0x01000B, 0x010046, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Futanari Clinic Karte #1
|
byte[] DefaultKey = null;
|
||||||
// static readonly byte[] DefaultKey = { 10, 0, 5, 10, 11, 0, 9, 0, 1, 13, 5, 2, 3, 5, 6, 4 };
|
|
||||||
|
|
||||||
// Jam n' Limit
|
|
||||||
static readonly byte[] DefaultKey = { 12, 5, 0, 8, 5, 1, 2, 10, 4, 8, 2, 3, 9, 6, 0, 1 };
|
|
||||||
|
|
||||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||||
{
|
{
|
||||||
@ -77,14 +80,24 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
int flags = header.ToUInt16 (0);
|
int flags = header.ToUInt16 (0);
|
||||||
if ((flags & ~0xFF) != 0)
|
if ((flags & ~0xFF) != 0)
|
||||||
return null;
|
return null;
|
||||||
return new SpMetaData {
|
var info = new SpMetaData {
|
||||||
Width = header.ToUInt16 (0x16),
|
Width = header.ToUInt16 (0x16),
|
||||||
Height = header.ToUInt16 (0x18),
|
Height = header.ToUInt16 (0x18),
|
||||||
BPP = 8,
|
BPP = 8,
|
||||||
Flags = flags,
|
Flags = flags,
|
||||||
Colors = header.ToUInt16 (0x1E),
|
Colors = header.ToUInt16 (0x1E),
|
||||||
Key = DefaultKey,
|
|
||||||
};
|
};
|
||||||
|
if (info.IsEncrypted)
|
||||||
|
{
|
||||||
|
if (null == DefaultKey)
|
||||||
|
{
|
||||||
|
DefaultKey = QueryKey (file.Name);
|
||||||
|
if (null == DefaultKey)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
info.Key = DefaultKey;
|
||||||
|
}
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
public override ImageData Read (IBinaryStream file, ImageMetaData info)
|
||||||
@ -106,6 +119,30 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
get { return DefaultScheme; }
|
get { return DefaultScheme; }
|
||||||
set { DefaultScheme = (SjSchemeMap)value; }
|
set { DefaultScheme = (SjSchemeMap)value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ResourceOptions GetDefaultOptions ()
|
||||||
|
{
|
||||||
|
return new SjOptions { Key = GetKey (Properties.Settings.Default.SJDatTitle) };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object GetAccessWidget ()
|
||||||
|
{
|
||||||
|
return new GUI.WidgetSJDAT (DefaultScheme.KnownSchemes.Keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] QueryKey (string filename)
|
||||||
|
{
|
||||||
|
var options = Query<SjOptions> (arcStrings.ArcImageEncrypted);
|
||||||
|
return options.Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] GetKey (string title)
|
||||||
|
{
|
||||||
|
byte[] key = null;
|
||||||
|
if (!string.IsNullOrEmpty (title))
|
||||||
|
DefaultScheme.KnownSchemes.TryGetValue (title, out key);
|
||||||
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class SpReader
|
internal class SpReader
|
||||||
@ -124,7 +161,7 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
m_input = input;
|
m_input = input;
|
||||||
m_info = info;
|
m_info = info;
|
||||||
m_output = new byte[info.Width * info.Height];
|
m_output = new byte[info.Width * info.Height];
|
||||||
m_stride = (int)info.Width;
|
m_stride = info.iWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Unpack ()
|
public byte[] Unpack ()
|
||||||
@ -210,8 +247,8 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
|
|
||||||
byte[] ConvertToRgbA (byte[] alpha)
|
byte[] ConvertToRgbA (byte[] alpha)
|
||||||
{
|
{
|
||||||
m_stride = (int)m_info.Width * 4;
|
m_stride = m_info.iWidth * 4;
|
||||||
var pixels = new byte[m_stride * (int)m_info.Height];
|
var pixels = new byte[m_stride * m_info.iHeight];
|
||||||
var colors = Palette.Colors;
|
var colors = Palette.Colors;
|
||||||
int dst = 0;
|
int dst = 0;
|
||||||
for (int src = 0; src < m_output.Length; ++src)
|
for (int src = 0; src < m_output.Length; ++src)
|
@ -51,7 +51,7 @@ namespace GameRes.Formats.Jikkenshitsu
|
|||||||
public override uint Signature { get { return 0x20445247; } } // 'GRD '
|
public override uint Signature { get { return 0x20445247; } } // 'GRD '
|
||||||
|
|
||||||
// Giin Oyako
|
// Giin Oyako
|
||||||
static readonly byte[] DefaultKey = { 0xF, 0, 1, 2, 8, 5, 0xA, 0xB, 5, 9, 0xE, 0xD, 1, 8, 0, 6 };
|
static readonly byte[] DefaultKey = { 15, 0, 1, 2, 8, 5, 10, 11, 5, 9, 14, 13, 1, 8, 0, 6 };
|
||||||
|
|
||||||
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
public override ImageMetaData ReadMetaData (IBinaryStream file)
|
||||||
{
|
{
|
9
ArcFormats/StudioJikkenshitsu/WidgetSJDAT.xaml
Normal file
9
ArcFormats/StudioJikkenshitsu/WidgetSJDAT.xaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<StackPanel x:Class="GameRes.Formats.GUI.WidgetSJDAT"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:p="clr-namespace:GameRes.Formats.Properties"
|
||||||
|
MaxWidth="250" Orientation="Vertical">
|
||||||
|
<ComboBox Name="Title"
|
||||||
|
SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=SJDatTitle, Mode=TwoWay}"
|
||||||
|
Width="200" HorizontalAlignment="Left"/>
|
||||||
|
</StackPanel>
|
18
ArcFormats/StudioJikkenshitsu/WidgetSJDAT.xaml.cs
Normal file
18
ArcFormats/StudioJikkenshitsu/WidgetSJDAT.xaml.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace GameRes.Formats.GUI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for WidgetSJDAT.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class WidgetSJDAT : StackPanel
|
||||||
|
{
|
||||||
|
public WidgetSJDAT (IEnumerable<string> known_schemes)
|
||||||
|
{
|
||||||
|
InitializeComponent ();
|
||||||
|
this.Title.ItemsSource = known_schemes.OrderBy (x => x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -196,6 +196,9 @@
|
|||||||
<setting name="LEAFTitle" serializeAs="String">
|
<setting name="LEAFTitle" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="SJDatTitle" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
</GameRes.Formats.Properties.Settings>
|
</GameRes.Formats.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
|
||||||
|
@ -139,9 +139,6 @@
|
|||||||
<Compile Include="Rune\ArcYK.cs" />
|
<Compile Include="Rune\ArcYK.cs" />
|
||||||
<Compile Include="Sarang\ImageABC.cs" />
|
<Compile Include="Sarang\ImageABC.cs" />
|
||||||
<Compile Include="Sogna\ArcSGS.cs" />
|
<Compile Include="Sogna\ArcSGS.cs" />
|
||||||
<Compile Include="StudioJikkenshitsu\ImageDAT.cs" />
|
|
||||||
<Compile Include="StudioJikkenshitsu\ImageGRD.cs" />
|
|
||||||
<Compile Include="StudioJikkenshitsu\SjTransform.cs" />
|
|
||||||
<Compile Include="Tako\ArcMPK.cs" />
|
<Compile Include="Tako\ArcMPK.cs" />
|
||||||
<Compile Include="Tetratech\ArcBND.cs" />
|
<Compile Include="Tetratech\ArcBND.cs" />
|
||||||
<Compile Include="Tigerman\ArcCHR.cs" />
|
<Compile Include="Tigerman\ArcCHR.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user