CNUnity update, bug fixes.
This commit is contained in:
@@ -5,10 +5,11 @@ namespace AssetStudio
|
||||
{
|
||||
public static class BlkUtils
|
||||
{
|
||||
private const int DataPos = 0x2A;
|
||||
private const int KeySize = 0x1000;
|
||||
private const int SeedBlockSize = 0x800;
|
||||
|
||||
public static CryptoStream Decrypt(FileReader reader, Blk blk)
|
||||
public static XORStream Decrypt(FileReader reader, Blk blk)
|
||||
{
|
||||
reader.Endian = EndianType.LittleEndian;
|
||||
|
||||
@@ -53,7 +54,7 @@ namespace AssetStudio
|
||||
BinaryPrimitives.WriteUInt64LittleEndian(xorpad.AsSpan(i, 8), mt64.Int64());
|
||||
}
|
||||
|
||||
return new CryptoStream(reader.BaseStream, xorpad);
|
||||
return new XORStream(reader.BaseStream, DataPos, xorpad);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace AssetStudio
|
||||
{
|
||||
using var aes = Aes.Create();
|
||||
aes.Mode = CipherMode.ECB;
|
||||
aes.Key = Encoding.UTF8.GetBytes(entry.Key);
|
||||
aes.Key = entry.GenerateKey();
|
||||
|
||||
Encryptor = aes.CreateEncryptor();
|
||||
}
|
||||
@@ -140,24 +140,18 @@ namespace AssetStudio
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
try
|
||||
var bytes = GenerateKey();
|
||||
if (bytes.Length != 0x10)
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(Key);
|
||||
if (bytes.Length != 0x10)
|
||||
{
|
||||
Logger.Warning($"[CNUnity] {this} has invalid key, size should be 16 bytes, skipping...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.Error($"[CNUnity] Error while adding {this}: {e.Message}");
|
||||
Logger.Warning($"[CNUnity] {this} has invalid key, size should be 16 bytes, skipping...");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] GenerateKey() => Convert.FromHexString(Key);
|
||||
|
||||
public override string ToString() => $"{Name} ({Key})";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,70 @@
|
||||
[
|
||||
{
|
||||
"Name": "PGR GLB/KR",
|
||||
"Key": "kurokurokurokuro"
|
||||
"Key": "6B75726F6B75726F6B75726F6B75726F"
|
||||
},
|
||||
{
|
||||
"Name": "PGR CN/JP/TW",
|
||||
"Key": "y5XPvqLOrCokWRIa"
|
||||
"Key": "7935585076714C4F72436F6B57524961"
|
||||
},
|
||||
{
|
||||
"Name": "Archeland/Kalpa of Universe",
|
||||
"Key": "BlackJackProject"
|
||||
"Key": "426C61636B4A61636B50726F6A656374"
|
||||
},
|
||||
{
|
||||
"Name": "Archeland 1.1.14",
|
||||
"Key": "ProjectArcheLand"
|
||||
"Key": "50726F6A65637441726368654C616E64"
|
||||
},
|
||||
{
|
||||
"Name": "Neural Cloud",
|
||||
"Key": "1cab846f52901c9e"
|
||||
"Key": "31636162383436663532393031633965"
|
||||
},
|
||||
{
|
||||
"Name": "Higan: Eruthyll",
|
||||
"Key": "E1x2c3a4l5i6b7ur"
|
||||
"Key": "45317832633361346C35693662377572"
|
||||
},
|
||||
{
|
||||
"Name": "White Chord",
|
||||
"Key": "yulong1868gnoluy"
|
||||
"Key": "79756C6F6E6731383638676E6F6C7579"
|
||||
},
|
||||
{
|
||||
"Name": "Mecharashi",
|
||||
"Key": "38C83F132E7F7A0A"
|
||||
"Key": "33384338334631333245374637413041"
|
||||
},
|
||||
{
|
||||
"Name": "Castlevania: Moon Night Fantasy",
|
||||
"Key": "1234567812345678"
|
||||
"Key": "31323334353637383132333435363738"
|
||||
},
|
||||
{
|
||||
"Name": "Huā Yì Shān Xīn Zhī Yuè",
|
||||
"Key": "INHJnhdypqk547xd"
|
||||
"Key": "494E484A6E68647970716B3534377864"
|
||||
},
|
||||
{
|
||||
"Name": "Doula Continent",
|
||||
"Key": "52346366773339474644326661785756"
|
||||
},
|
||||
{
|
||||
"Name": "Bless Global",
|
||||
"Key": "6C6F6E67747567616D652E796A66623F"
|
||||
},
|
||||
{
|
||||
"Name": "Starside",
|
||||
"Key": "41394A3542384D4A50554D3539464B57"
|
||||
},
|
||||
{
|
||||
"Name": "Resonance Soltice",
|
||||
"Key": "5265736F6E616E63655265626F726E52"
|
||||
},
|
||||
{
|
||||
"Name": "Oblivion Override",
|
||||
"Key": "7179666D6F6F6E323331323433343532"
|
||||
},
|
||||
{
|
||||
"Name": "Dawnlands",
|
||||
"Key": "636F6465737339353237636F64657373"
|
||||
},
|
||||
{
|
||||
"Name": "BB",
|
||||
"Key": "5F6C4E3F3A3F233F3F3F3F663F1A3F3F"
|
||||
}
|
||||
]
|
||||
@@ -2,13 +2,11 @@
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class CryptoStream : BlockStream
|
||||
public class XORStream : BlockStream
|
||||
{
|
||||
private const long _dataPosition = 0x2A;
|
||||
|
||||
private readonly byte[] _xorpad;
|
||||
|
||||
public CryptoStream(Stream stream, byte[] xorpad) : base(stream, _dataPosition)
|
||||
public XORStream(Stream stream, long pos, byte[] xorpad) : base(stream, pos)
|
||||
{
|
||||
_xorpad = xorpad;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ namespace AssetStudioGUI
|
||||
Properties.Settings.Default.skipContainer = skipContainer.Checked;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
SkipContainer = enableResolveDependencies.Checked;
|
||||
SkipContainer = skipContainer.Checked;
|
||||
}
|
||||
private void displayAssetInfo_Check(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
39
AssetStudioGUI/CNUnityForm.Designer.cs
generated
39
AssetStudioGUI/CNUnityForm.Designer.cs
generated
@@ -31,8 +31,6 @@
|
||||
this.specifyCNUnityList = new System.Windows.Forms.DataGridView();
|
||||
this.NameField = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.KeyField = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Cancel = new System.Windows.Forms.Button();
|
||||
this.OKbutton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.specifyCNUnityList)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -45,13 +43,15 @@
|
||||
this.specifyCNUnityList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.NameField,
|
||||
this.KeyField});
|
||||
this.specifyCNUnityList.Location = new System.Drawing.Point(12, 12);
|
||||
this.specifyCNUnityList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.specifyCNUnityList.Location = new System.Drawing.Point(0, 0);
|
||||
this.specifyCNUnityList.MultiSelect = false;
|
||||
this.specifyCNUnityList.Name = "specifyCNUnityList";
|
||||
this.specifyCNUnityList.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||
this.specifyCNUnityList.RowTemplate.Height = 25;
|
||||
this.specifyCNUnityList.Size = new System.Drawing.Size(332, 171);
|
||||
this.specifyCNUnityList.Size = new System.Drawing.Size(432, 229);
|
||||
this.specifyCNUnityList.TabIndex = 0;
|
||||
this.specifyCNUnityList.RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.specifyCNUnityList_RowHeaderMouseDoubleClick);
|
||||
//
|
||||
// NameField
|
||||
//
|
||||
@@ -65,38 +65,11 @@
|
||||
this.KeyField.HeaderText = "Key";
|
||||
this.KeyField.Name = "KeyField";
|
||||
//
|
||||
// Cancel
|
||||
//
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(255, 190);
|
||||
this.Cancel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(88, 26);
|
||||
this.Cancel.TabIndex = 9;
|
||||
this.Cancel.Text = "Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
|
||||
//
|
||||
// OKbutton
|
||||
//
|
||||
this.OKbutton.Location = new System.Drawing.Point(159, 190);
|
||||
this.OKbutton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.OKbutton.Name = "OKbutton";
|
||||
this.OKbutton.Size = new System.Drawing.Size(88, 26);
|
||||
this.OKbutton.TabIndex = 8;
|
||||
this.OKbutton.Text = "OK";
|
||||
this.OKbutton.UseVisualStyleBackColor = true;
|
||||
this.OKbutton.Click += new System.EventHandler(this.OKbutton_Click);
|
||||
//
|
||||
// CNUnityForm
|
||||
//
|
||||
this.AcceptButton = this.OKbutton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(356, 229);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OKbutton);
|
||||
this.ClientSize = new System.Drawing.Size(432, 229);
|
||||
this.Controls.Add(this.specifyCNUnityList);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||
this.MaximizeBox = false;
|
||||
@@ -115,8 +88,6 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView specifyCNUnityList;
|
||||
private System.Windows.Forms.Button Cancel;
|
||||
private System.Windows.Forms.Button OKbutton;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn NameField;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn KeyField;
|
||||
}
|
||||
|
||||
@@ -79,5 +79,48 @@ namespace AssetStudioGUI
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void specifyCNUnityList_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||
{
|
||||
var keys = new List<CNUnity.Entry>();
|
||||
for (int i = specifyCNUnityList.Rows.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var row = specifyCNUnityList.Rows[i];
|
||||
var name = row.Cells["NameField"].Value as string;
|
||||
var key = row.Cells["KeyField"].Value as string;
|
||||
|
||||
if (!(string.IsNullOrEmpty(name) || string.IsNullOrEmpty(key)))
|
||||
{
|
||||
var cnunity = new CNUnity.Entry(name, key);
|
||||
|
||||
if (cnunity.Validate())
|
||||
{
|
||||
keys.Add(cnunity);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (specifyCNUnityList.CurrentCell.RowIndex == row.Index)
|
||||
{
|
||||
var previousRow = specifyCNUnityList.Rows.Cast<DataGridViewRow>().ElementAtOrDefault(i - 1);
|
||||
if (previousRow != null)
|
||||
{
|
||||
specifyCNUnityList.CurrentCell = previousRow.Cells[0];
|
||||
}
|
||||
}
|
||||
if (i != specifyCNUnityList.RowCount - 1)
|
||||
{
|
||||
specifyCNUnityList.Rows.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
CNUnityKeyManager.SaveEntries(keys.Reverse<CNUnity.Entry>().ToList());
|
||||
CNUnityKeyManager.SetKey(specifyCNUnityList.CurrentRow.Index);
|
||||
|
||||
Properties.Settings.Default.selectedCNUnityKey = specifyCNUnityList.CurrentRow.Index;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user