From 7af8ef80806a74ab711f178fcf8402609d0b0624 Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Thu, 23 Jun 2016 13:24:50 +1000 Subject: [PATCH] Updated SB3U library --- AA2Data/LST.cs | 2 +- AA2Snowflake/AA2Snowflake.csproj | 2 +- AA2Snowflake/Changelog.txt | 1 + AA2Snowflake/LST.cs | 2 +- AA2Snowflake/Personality.cs | 6 +- AA2Snowflake/Tools.cs | 23 +- AA2Snowflake/formCrash.resx | 2 +- AA2Snowflake/formMain.Designer.cs | 244 ++++++++-------- AA2Snowflake/formMain.cs | 46 +-- AA2Snowflake/formMain.resx | 25 +- AA2Snowflake/packages.config | 2 +- SB3UtilityPP/JchStream.cs | 418 --------------------------- SB3UtilityPP/MemSubfile.cs | 33 ++- SB3UtilityPP/Report.cs | 26 -- SB3UtilityPP/SB3UtilityPP.csproj | 33 ++- SB3UtilityPP/SeekableCryptoStream.cs | 35 +++ SB3UtilityPP/Structures.cs | 11 - SB3UtilityPP/Subfile.cs | 5 +- SB3UtilityPP/Utility.cs | 135 +-------- SB3UtilityPP/lstParser.cs | 38 --- SB3UtilityPP/ppFormat.cs | 232 ++------------- SB3UtilityPP/ppHeader.cs | 226 ++++++++++----- SB3UtilityPP/ppParser.cs | 253 +++++++++------- SB3UtilityPP/ppSubfile.cs | 21 +- SB3UtilityPP/ppSwapfile.cs | 87 ------ SB3UtilityPP/xxFormatDiff.txt | 38 --- 26 files changed, 612 insertions(+), 1334 deletions(-) delete mode 100644 SB3UtilityPP/JchStream.cs delete mode 100644 SB3UtilityPP/Report.cs create mode 100644 SB3UtilityPP/SeekableCryptoStream.cs delete mode 100644 SB3UtilityPP/Structures.cs delete mode 100644 SB3UtilityPP/lstParser.cs delete mode 100644 SB3UtilityPP/ppSwapfile.cs delete mode 100644 SB3UtilityPP/xxFormatDiff.txt diff --git a/AA2Data/LST.cs b/AA2Data/LST.cs index 4482f52..665708c 100644 --- a/AA2Data/LST.cs +++ b/AA2Data/LST.cs @@ -6,7 +6,7 @@ namespace AA2Data { - public abstract partial class BaseLST + public class BaseLST { public byte[] raw { get; set; } diff --git a/AA2Snowflake/AA2Snowflake.csproj b/AA2Snowflake/AA2Snowflake.csproj index a3fcb28..dbd29b1 100644 --- a/AA2Snowflake/AA2Snowflake.csproj +++ b/AA2Snowflake/AA2Snowflake.csproj @@ -78,7 +78,7 @@ - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True diff --git a/AA2Snowflake/Changelog.txt b/AA2Snowflake/Changelog.txt index 4b2431f..1bbdbbc 100644 --- a/AA2Snowflake/Changelog.txt +++ b/AA2Snowflake/Changelog.txt @@ -1,6 +1,7 @@ v2.2 + Changed TGA handler to something more stable + Increased the limits of pose numbers again ++ Updated SB3U libary v2.1 + Fixed setting pose for male personalities diff --git a/AA2Snowflake/LST.cs b/AA2Snowflake/LST.cs index 0886194..89b08b2 100644 --- a/AA2Snowflake/LST.cs +++ b/AA2Snowflake/LST.cs @@ -45,7 +45,7 @@ public static PersonalityLST LoadLST(this IWriteFile iw, LSTMode mode) public static IWriteFile ToSubfile(this BaseLST lst, string name) { - return new MemSubfile(new MemoryStream(lst.raw), name); + return new MemSubfile(lst.raw, name); } } } diff --git a/AA2Snowflake/Personality.cs b/AA2Snowflake/Personality.cs index 9d381e2..3076628 100644 --- a/AA2Snowflake/Personality.cs +++ b/AA2Snowflake/Personality.cs @@ -145,7 +145,7 @@ public static Dictionary GetAllPersonalities() foreach (string path in Directory.EnumerateFiles(Paths.AA2Play)) if (regex.IsMatch(path)) { - CustomPersonality cp = LoadPersonality(new ppParser(path, new ppFormat_AA2())); + CustomPersonality cp = LoadPersonality(new ppParser(path)); if (!ReferenceEquals(cp, null)) //is there a better way to check null? pers[cp.Slot] = cp; } @@ -158,7 +158,7 @@ public static ppParser GetLstPP(this IPersonality personality) string path = Paths.AA2Play + "\\" + personality.LSTLocation.RemoveFilename('/'); if (!File.Exists(path)) path = Paths.AA2Edit + "\\" + personality.LSTLocation.RemoveFilename('/'); - return new ppParser(path, new ppFormat_AA2()); + return new ppParser(path); } public static IWriteFile GetLst(this IPersonality personality) @@ -172,7 +172,7 @@ public static ppParser GetIcfPP(this IPersonality personality) string path = Paths.AA2Play + "\\" + personality.ICFLocation; if (!File.Exists(path)) path = Paths.AA2Edit + "\\" + personality.ICFLocation; - return new ppParser(path, new ppFormat_AA2()); + return new ppParser(path); } } diff --git a/AA2Snowflake/Tools.cs b/AA2Snowflake/Tools.cs index db4bc9a..9c0387d 100644 --- a/AA2Snowflake/Tools.cs +++ b/AA2Snowflake/Tools.cs @@ -27,10 +27,10 @@ public static MemoryStream GetStreamFromFile(string file) public static void RefreshPPs() { - PP.jg2e00_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e00_00_00.pp", new ppFormat_AA2()); - PP.jg2e01_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e01_00_00.pp", new ppFormat_AA2()); - PP.jg2e06_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e06_00_00.pp", new ppFormat_AA2()); - PP.jg2p01_00_00 = new ppParser(Paths.AA2Play + @"\jg2p01_00_00.pp", new ppFormat_AA2()); + PP.jg2e00_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e00_00_00.pp"); + PP.jg2e01_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e01_00_00.pp"); + PP.jg2e06_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e06_00_00.pp"); + PP.jg2p01_00_00 = new ppParser(Paths.AA2Play + @"\jg2p01_00_00.pp"); } public static void BackupFile(string file) @@ -55,7 +55,12 @@ public static void DeleteBackup(string file) public static Bitmap LoadTGA(Stream stream) { Bitmap bit; - using (var image = new ImageMagick.MagickImage(stream.ToByteArray())) + var sett = new ImageMagick.MagickReadSettings() + { + Format = ImageMagick.MagickFormat.Tga + }; + + using (var image = new ImageMagick.MagickImage(stream.ToByteArray(), sett)) bit = image.ToBitmap(); return bit; @@ -95,9 +100,9 @@ public static IEnumerable PatternAt(byte[] source, byte[] pattern) public static class PP { - public static ppParser jg2e00_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e00_00_00.pp", new ppFormat_AA2()); - public static ppParser jg2e01_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e01_00_00.pp", new ppFormat_AA2()); - public static ppParser jg2e06_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e06_00_00.pp", new ppFormat_AA2()); - public static ppParser jg2p01_00_00 = new ppParser(Paths.AA2Play + @"\jg2p01_00_00.pp", new ppFormat_AA2()); + public static ppParser jg2e00_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e00_00_00.pp"); + public static ppParser jg2e01_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e01_00_00.pp"); + public static ppParser jg2e06_00_00 = new ppParser(Paths.AA2Edit + @"\jg2e06_00_00.pp"); + public static ppParser jg2p01_00_00 = new ppParser(Paths.AA2Play + @"\jg2p01_00_00.pp"); } } diff --git a/AA2Snowflake/formCrash.resx b/AA2Snowflake/formCrash.resx index d268ad3..e86ece7 100644 --- a/AA2Snowflake/formCrash.resx +++ b/AA2Snowflake/formCrash.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - AA2Install has crashed. If you were in the middle of an operation, your game may have become corrupt. + AA2Snowflake has crashed. If you were in the middle of an operation, your game may have become corrupt. Please notify the dev (via a github issue or directly on /aa2g/ or hongfire ) of this, what you were doing and attach the following files: diff --git a/AA2Snowflake/formMain.Designer.cs b/AA2Snowflake/formMain.Designer.cs index 7591d7c..bdf1e64 100644 --- a/AA2Snowflake/formMain.Designer.cs +++ b/AA2Snowflake/formMain.Designer.cs @@ -83,6 +83,11 @@ private void InitializeComponent() this.cmbCharacter = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); this.tabPage3 = new System.Windows.Forms.TabPage(); + this.groupBox12 = new System.Windows.Forms.GroupBox(); + this.cmbPersonality34 = new System.Windows.Forms.ComboBox(); + this.btnBackupAll34 = new System.Windows.Forms.Button(); + this.btnSetBlank34 = new System.Windows.Forms.Button(); + this.btnRestore34 = new System.Windows.Forms.Button(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.txtFOV = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); @@ -156,11 +161,6 @@ private void InitializeComponent() this.radio2x = new System.Windows.Forms.RadioButton(); this.lblPatcherOutputSize = new System.Windows.Forms.Label(); this.trkCardSize = new System.Windows.Forms.TrackBar(); - this.groupBox12 = new System.Windows.Forms.GroupBox(); - this.cmbPersonality34 = new System.Windows.Forms.ComboBox(); - this.btnSetBlank34 = new System.Windows.Forms.Button(); - this.btnRestore34 = new System.Windows.Forms.Button(); - this.btnBackupAll34 = new System.Windows.Forms.Button(); this.menuStrip1.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); @@ -192,6 +192,7 @@ private void InitializeComponent() this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.imgCharacter)).BeginInit(); this.tabPage3.SuspendLayout(); + this.groupBox12.SuspendLayout(); this.groupBox5.SuspendLayout(); this.groupBox11.SuspendLayout(); this.groupBox10.SuspendLayout(); @@ -214,7 +215,6 @@ private void InitializeComponent() this.groupBox6.SuspendLayout(); this.groupBox8.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trkCardSize)).BeginInit(); - this.groupBox12.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -316,7 +316,7 @@ private void InitializeComponent() this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(744, 459); + this.tabPage1.Size = new System.Drawing.Size(405, 451); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Background"; this.tabPage1.UseVisualStyleBackColor = true; @@ -327,7 +327,7 @@ private void InitializeComponent() this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(738, 453); + this.groupBox1.Size = new System.Drawing.Size(399, 445); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Part 1: Custom background"; @@ -350,8 +350,8 @@ private void InitializeComponent() this.splitContainer1.Panel2.Controls.Add(this.btnLoadBG); this.splitContainer1.Panel2.Controls.Add(this.cmbBackground); this.splitContainer1.Panel2.Controls.Add(this.label1); - this.splitContainer1.Size = new System.Drawing.Size(732, 434); - this.splitContainer1.SplitterDistance = 350; + this.splitContainer1.Size = new System.Drawing.Size(393, 426); + this.splitContainer1.SplitterDistance = 187; this.splitContainer1.TabIndex = 0; // // imgBackground @@ -360,7 +360,7 @@ private void InitializeComponent() this.imgBackground.Dock = System.Windows.Forms.DockStyle.Fill; this.imgBackground.Location = new System.Drawing.Point(0, 0); this.imgBackground.Name = "imgBackground"; - this.imgBackground.Size = new System.Drawing.Size(350, 434); + this.imgBackground.Size = new System.Drawing.Size(187, 426); this.imgBackground.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.imgBackground.TabIndex = 0; this.imgBackground.TabStop = false; @@ -437,7 +437,7 @@ private void InitializeComponent() this.tabPage7.Location = new System.Drawing.Point(4, 22); this.tabPage7.Name = "tabPage7"; this.tabPage7.Padding = new System.Windows.Forms.Padding(3); - this.tabPage7.Size = new System.Drawing.Size(744, 459); + this.tabPage7.Size = new System.Drawing.Size(405, 451); this.tabPage7.TabIndex = 7; this.tabPage7.Text = "Roster"; this.tabPage7.UseVisualStyleBackColor = true; @@ -448,7 +448,7 @@ private void InitializeComponent() this.groupBox9.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox9.Location = new System.Drawing.Point(3, 3); this.groupBox9.Name = "groupBox9"; - this.groupBox9.Size = new System.Drawing.Size(738, 453); + this.groupBox9.Size = new System.Drawing.Size(399, 445); this.groupBox9.TabIndex = 2; this.groupBox9.TabStop = false; this.groupBox9.Text = "Part 1: Custom roster background"; @@ -471,8 +471,8 @@ private void InitializeComponent() this.splitContainer5.Panel2.Controls.Add(this.btnRosterLoad); this.splitContainer5.Panel2.Controls.Add(this.cmbRoster); this.splitContainer5.Panel2.Controls.Add(this.label6); - this.splitContainer5.Size = new System.Drawing.Size(732, 434); - this.splitContainer5.SplitterDistance = 350; + this.splitContainer5.Size = new System.Drawing.Size(393, 426); + this.splitContainer5.SplitterDistance = 187; this.splitContainer5.TabIndex = 0; // // imgRosterBackground @@ -481,7 +481,7 @@ private void InitializeComponent() this.imgRosterBackground.Dock = System.Windows.Forms.DockStyle.Fill; this.imgRosterBackground.Location = new System.Drawing.Point(0, 0); this.imgRosterBackground.Name = "imgRosterBackground"; - this.imgRosterBackground.Size = new System.Drawing.Size(350, 434); + this.imgRosterBackground.Size = new System.Drawing.Size(187, 426); this.imgRosterBackground.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.imgRosterBackground.TabIndex = 0; this.imgRosterBackground.TabStop = false; @@ -557,7 +557,7 @@ private void InitializeComponent() this.tabPage5.Location = new System.Drawing.Point(4, 22); this.tabPage5.Name = "tabPage5"; this.tabPage5.Padding = new System.Windows.Forms.Padding(3); - this.tabPage5.Size = new System.Drawing.Size(744, 459); + this.tabPage5.Size = new System.Drawing.Size(405, 451); this.tabPage5.TabIndex = 5; this.tabPage5.Text = "Border"; this.tabPage5.UseVisualStyleBackColor = true; @@ -568,7 +568,7 @@ private void InitializeComponent() this.groupBox7.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox7.Location = new System.Drawing.Point(3, 3); this.groupBox7.Name = "groupBox7"; - this.groupBox7.Size = new System.Drawing.Size(738, 453); + this.groupBox7.Size = new System.Drawing.Size(399, 445); this.groupBox7.TabIndex = 0; this.groupBox7.TabStop = false; this.groupBox7.Text = "Part 1: Custom border"; @@ -593,8 +593,8 @@ private void InitializeComponent() this.splitContainer4.Panel2.Controls.Add(this.btnLoadBorder); this.splitContainer4.Panel2.Controls.Add(this.cmbBorder); this.splitContainer4.Panel2.Controls.Add(this.label5); - this.splitContainer4.Size = new System.Drawing.Size(732, 434); - this.splitContainer4.SplitterDistance = 350; + this.splitContainer4.Size = new System.Drawing.Size(393, 426); + this.splitContainer4.SplitterDistance = 187; this.splitContainer4.TabIndex = 1; // // imgBorder @@ -603,7 +603,7 @@ private void InitializeComponent() this.imgBorder.Dock = System.Windows.Forms.DockStyle.Fill; this.imgBorder.Location = new System.Drawing.Point(0, 0); this.imgBorder.Name = "imgBorder"; - this.imgBorder.Size = new System.Drawing.Size(350, 434); + this.imgBorder.Size = new System.Drawing.Size(187, 426); this.imgBorder.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.imgBorder.TabIndex = 0; this.imgBorder.TabStop = false; @@ -701,7 +701,7 @@ private void InitializeComponent() this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(744, 459); + this.tabPage2.Size = new System.Drawing.Size(405, 451); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Clothes"; this.tabPage2.UseVisualStyleBackColor = true; @@ -712,7 +712,7 @@ private void InitializeComponent() this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Location = new System.Drawing.Point(3, 3); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(738, 453); + this.groupBox2.Size = new System.Drawing.Size(399, 445); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "Part 2: Assigning clothes"; @@ -735,8 +735,8 @@ private void InitializeComponent() this.splitContainer2.Panel2.Controls.Add(this.btnLoadCHR); this.splitContainer2.Panel2.Controls.Add(this.cmbCharacter); this.splitContainer2.Panel2.Controls.Add(this.label2); - this.splitContainer2.Size = new System.Drawing.Size(732, 434); - this.splitContainer2.SplitterDistance = 350; + this.splitContainer2.Size = new System.Drawing.Size(393, 426); + this.splitContainer2.SplitterDistance = 187; this.splitContainer2.TabIndex = 0; // // imgCharacter @@ -745,7 +745,7 @@ private void InitializeComponent() this.imgCharacter.Dock = System.Windows.Forms.DockStyle.Fill; this.imgCharacter.Location = new System.Drawing.Point(0, 0); this.imgCharacter.Name = "imgCharacter"; - this.imgCharacter.Size = new System.Drawing.Size(350, 434); + this.imgCharacter.Size = new System.Drawing.Size(187, 426); this.imgCharacter.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.imgCharacter.TabIndex = 0; this.imgCharacter.TabStop = false; @@ -826,6 +826,91 @@ private void InitializeComponent() this.tabPage3.Text = "Poses"; this.tabPage3.UseVisualStyleBackColor = true; // + // groupBox12 + // + this.groupBox12.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox12.Controls.Add(this.cmbPersonality34); + this.groupBox12.Controls.Add(this.btnBackupAll34); + this.groupBox12.Controls.Add(this.btnSetBlank34); + this.groupBox12.Controls.Add(this.btnRestore34); + this.groupBox12.Location = new System.Drawing.Point(3, 374); + this.groupBox12.Name = "groupBox12"; + this.groupBox12.Size = new System.Drawing.Size(399, 77); + this.groupBox12.TabIndex = 3; + this.groupBox12.TabStop = false; + this.groupBox12.Text = "Part 3.4 Clearing personality labels"; + // + // cmbPersonality34 + // + this.cmbPersonality34.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbPersonality34.FormattingEnabled = true; + this.cmbPersonality34.Items.AddRange(new object[] { + "(00) Lively", + "(01) Delicate", + "(02) Cheerful", + "(03) Quiet", + "(04) Playful", + "(05) Frisky", + "(06) Kind", + "(07) Joyful", + "(08) Ordinary", + "(09) Irritated", + "(10) Harsh", + "(11) Sweet", + "(12) Creepy", + "(13) Reserved", + "(14) Dignified", + "(15) Aloof", + "(16) Smart", + "(17) Genuine", + "(18) Mature", + "(19) Lazy", + "(20) Manly", + "(21) Gentle", + "(22) Positive", + "(23) Otaku", + "(24) Savage", + "(25) Cadet", + "(26) Caring", + "(27) Schemer", + "(28) Carefree", + "(29) Warm"}); + this.cmbPersonality34.Location = new System.Drawing.Point(137, 19); + this.cmbPersonality34.Name = "cmbPersonality34"; + this.cmbPersonality34.Size = new System.Drawing.Size(125, 21); + this.cmbPersonality34.TabIndex = 18; + // + // btnBackupAll34 + // + this.btnBackupAll34.Location = new System.Drawing.Point(175, 46); + this.btnBackupAll34.Name = "btnBackupAll34"; + this.btnBackupAll34.Size = new System.Drawing.Size(75, 23); + this.btnBackupAll34.TabIndex = 15; + this.btnBackupAll34.Text = "Backup All"; + this.btnBackupAll34.UseVisualStyleBackColor = true; + this.btnBackupAll34.Click += new System.EventHandler(this.btnBackupAll34_Click); + // + // btnSetBlank34 + // + this.btnSetBlank34.Location = new System.Drawing.Point(94, 46); + this.btnSetBlank34.Name = "btnSetBlank34"; + this.btnSetBlank34.Size = new System.Drawing.Size(75, 23); + this.btnSetBlank34.TabIndex = 12; + this.btnSetBlank34.Text = "Set Blank"; + this.btnSetBlank34.UseVisualStyleBackColor = true; + this.btnSetBlank34.Click += new System.EventHandler(this.btnSetBlank34_Click); + // + // btnRestore34 + // + this.btnRestore34.Location = new System.Drawing.Point(256, 46); + this.btnRestore34.Name = "btnRestore34"; + this.btnRestore34.Size = new System.Drawing.Size(75, 23); + this.btnRestore34.TabIndex = 13; + this.btnRestore34.Text = "Restore"; + this.btnRestore34.UseVisualStyleBackColor = true; + this.btnRestore34.Click += new System.EventHandler(this.btnRestore34_Click); + // // groupBox5 // this.groupBox5.Controls.Add(this.txtFOV); @@ -1183,7 +1268,7 @@ private void InitializeComponent() this.numMouth32.Enabled = false; this.numMouth32.Location = new System.Drawing.Point(316, 69); this.numMouth32.Maximum = new decimal(new int[] { - 9, + 19, 0, 0, 0}); @@ -1207,7 +1292,7 @@ private void InitializeComponent() this.numEye32.Enabled = false; this.numEye32.Location = new System.Drawing.Point(316, 46); this.numEye32.Maximum = new decimal(new int[] { - 9, + 16, 0, 0, 0}); @@ -1378,7 +1463,7 @@ private void InitializeComponent() this.tabPage4.Controls.Add(this.toolStrip1); this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Name = "tabPage4"; - this.tabPage4.Size = new System.Drawing.Size(744, 459); + this.tabPage4.Size = new System.Drawing.Size(405, 451); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "Card Replacer"; this.tabPage4.UseVisualStyleBackColor = true; @@ -1396,8 +1481,8 @@ private void InitializeComponent() // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.imgCard); - this.splitContainer3.Size = new System.Drawing.Size(744, 434); - this.splitContainer3.SplitterDistance = 246; + this.splitContainer3.Size = new System.Drawing.Size(405, 426); + this.splitContainer3.SplitterDistance = 133; this.splitContainer3.TabIndex = 1; // // imgRoster @@ -1406,7 +1491,7 @@ private void InitializeComponent() this.imgRoster.Dock = System.Windows.Forms.DockStyle.Fill; this.imgRoster.Location = new System.Drawing.Point(0, 0); this.imgRoster.Name = "imgRoster"; - this.imgRoster.Size = new System.Drawing.Size(246, 434); + this.imgRoster.Size = new System.Drawing.Size(133, 426); this.imgRoster.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this.imgRoster.TabIndex = 3; this.imgRoster.TabStop = false; @@ -1417,7 +1502,7 @@ private void InitializeComponent() this.imgCard.Dock = System.Windows.Forms.DockStyle.Fill; this.imgCard.Location = new System.Drawing.Point(0, 0); this.imgCard.Name = "imgCard"; - this.imgCard.Size = new System.Drawing.Size(494, 434); + this.imgCard.Size = new System.Drawing.Size(268, 426); this.imgCard.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.imgCard.TabIndex = 2; this.imgCard.TabStop = false; @@ -1436,7 +1521,7 @@ private void InitializeComponent() this.replaceCardRosterFromCardToolStripButton}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(744, 25); + this.toolStrip1.Size = new System.Drawing.Size(405, 25); this.toolStrip1.TabIndex = 0; this.toolStrip1.Text = "toolStrip1"; // @@ -1518,7 +1603,7 @@ private void InitializeComponent() this.tabPage6.Location = new System.Drawing.Point(4, 22); this.tabPage6.Name = "tabPage6"; this.tabPage6.Padding = new System.Windows.Forms.Padding(3); - this.tabPage6.Size = new System.Drawing.Size(744, 459); + this.tabPage6.Size = new System.Drawing.Size(405, 451); this.tabPage6.TabIndex = 6; this.tabPage6.Text = "Patcher"; this.tabPage6.UseVisualStyleBackColor = true; @@ -1538,7 +1623,7 @@ private void InitializeComponent() this.groupBox6.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox6.Location = new System.Drawing.Point(3, 3); this.groupBox6.Name = "groupBox6"; - this.groupBox6.Size = new System.Drawing.Size(738, 453); + this.groupBox6.Size = new System.Drawing.Size(399, 445); this.groupBox6.TabIndex = 0; this.groupBox6.TabStop = false; this.groupBox6.Text = "AA2Edit"; @@ -1672,91 +1757,6 @@ private void InitializeComponent() this.trkCardSize.TabIndex = 0; this.trkCardSize.Scroll += new System.EventHandler(this.trkCardSize_Scroll); // - // groupBox12 - // - this.groupBox12.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox12.Controls.Add(this.cmbPersonality34); - this.groupBox12.Controls.Add(this.btnBackupAll34); - this.groupBox12.Controls.Add(this.btnSetBlank34); - this.groupBox12.Controls.Add(this.btnRestore34); - this.groupBox12.Location = new System.Drawing.Point(3, 374); - this.groupBox12.Name = "groupBox12"; - this.groupBox12.Size = new System.Drawing.Size(399, 77); - this.groupBox12.TabIndex = 3; - this.groupBox12.TabStop = false; - this.groupBox12.Text = "Part 3.4 Clearing personality labels"; - // - // cmbPersonality34 - // - this.cmbPersonality34.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbPersonality34.FormattingEnabled = true; - this.cmbPersonality34.Items.AddRange(new object[] { - "(00) Lively", - "(01) Delicate", - "(02) Cheerful", - "(03) Quiet", - "(04) Playful", - "(05) Frisky", - "(06) Kind", - "(07) Joyful", - "(08) Ordinary", - "(09) Irritated", - "(10) Harsh", - "(11) Sweet", - "(12) Creepy", - "(13) Reserved", - "(14) Dignified", - "(15) Aloof", - "(16) Smart", - "(17) Genuine", - "(18) Mature", - "(19) Lazy", - "(20) Manly", - "(21) Gentle", - "(22) Positive", - "(23) Otaku", - "(24) Savage", - "(25) Cadet", - "(26) Caring", - "(27) Schemer", - "(28) Carefree", - "(29) Warm"}); - this.cmbPersonality34.Location = new System.Drawing.Point(137, 19); - this.cmbPersonality34.Name = "cmbPersonality34"; - this.cmbPersonality34.Size = new System.Drawing.Size(125, 21); - this.cmbPersonality34.TabIndex = 18; - // - // btnSetBlank34 - // - this.btnSetBlank34.Location = new System.Drawing.Point(94, 46); - this.btnSetBlank34.Name = "btnSetBlank34"; - this.btnSetBlank34.Size = new System.Drawing.Size(75, 23); - this.btnSetBlank34.TabIndex = 12; - this.btnSetBlank34.Text = "Set Blank"; - this.btnSetBlank34.UseVisualStyleBackColor = true; - this.btnSetBlank34.Click += new System.EventHandler(this.btnSetBlank34_Click); - // - // btnRestore34 - // - this.btnRestore34.Location = new System.Drawing.Point(256, 46); - this.btnRestore34.Name = "btnRestore34"; - this.btnRestore34.Size = new System.Drawing.Size(75, 23); - this.btnRestore34.TabIndex = 13; - this.btnRestore34.Text = "Restore"; - this.btnRestore34.UseVisualStyleBackColor = true; - this.btnRestore34.Click += new System.EventHandler(this.btnRestore34_Click); - // - // btnBackupAll34 - // - this.btnBackupAll34.Location = new System.Drawing.Point(175, 46); - this.btnBackupAll34.Name = "btnBackupAll34"; - this.btnBackupAll34.Size = new System.Drawing.Size(75, 23); - this.btnBackupAll34.TabIndex = 15; - this.btnBackupAll34.Text = "Backup All"; - this.btnBackupAll34.UseVisualStyleBackColor = true; - this.btnBackupAll34.Click += new System.EventHandler(this.btnBackupAll34_Click); - // // formMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1806,6 +1806,7 @@ private void InitializeComponent() this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.imgCharacter)).EndInit(); this.tabPage3.ResumeLayout(false); + this.groupBox12.ResumeLayout(false); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); this.groupBox11.ResumeLayout(false); @@ -1836,7 +1837,6 @@ private void InitializeComponent() this.groupBox8.ResumeLayout(false); this.groupBox8.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.trkCardSize)).EndInit(); - this.groupBox12.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); diff --git a/AA2Snowflake/formMain.cs b/AA2Snowflake/formMain.cs index 3c3cd10..b7114bf 100644 --- a/AA2Snowflake/formMain.cs +++ b/AA2Snowflake/formMain.cs @@ -198,7 +198,7 @@ private void btnSaveBG_Click(object sender, EventArgs e) var sub = new Subfile(backgroundpath); sub.Name = "sp_04_01_0" + cmbBackground.SelectedIndex.ToString() + ".bmp"; PP.jg2e06_00_00.Subfiles[index] = sub; - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -218,7 +218,7 @@ private void btnRestoreBG_Click(object sender, EventArgs e) var index = PP.jg2e06_00_00.Subfiles.IndexOf(PP.jg2e06_00_00.Subfiles.First(pp => pp.Name == "sp_04_01_0" + cmbBackground.SelectedIndex.ToString() + ".bmp")); var sub = new Subfile(Paths.BACKUP + @"\sp_04_01_0" + cmbBackground.SelectedIndex.ToString() + ".bmp"); PP.jg2e06_00_00.Subfiles[index] = sub; - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -238,7 +238,7 @@ private void btnRestoreAllBG_Click(object sender, EventArgs e) var sub = new Subfile(Paths.BACKUP + @"\sp_04_01_0" + i.ToString() + ".bmp"); PP.jg2e06_00_00.Subfiles[index] = sub; } - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -296,7 +296,7 @@ private void btnRosterSave_Click(object sender, EventArgs e) var sub = new Subfile(rosterpath); sub.Name = "sp_04_03_0" + cmbRoster.SelectedIndex.ToString() + ".bmp"; PP.jg2e06_00_00.Subfiles[index] = sub; - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -316,7 +316,7 @@ private void btnRosterRestore_Click(object sender, EventArgs e) var index = PP.jg2e06_00_00.Subfiles.IndexOf(PP.jg2e06_00_00.Subfiles.First(pp => pp.Name == "sp_04_03_0" + cmbRoster.SelectedIndex.ToString() + ".bmp")); var sub = new Subfile(Paths.BACKUP + @"\sp_04_03_0" + cmbRoster.SelectedIndex.ToString() + ".bmp"); PP.jg2e06_00_00.Subfiles[index] = sub; - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -336,7 +336,7 @@ private void btnRosterRestoreAll_Click(object sender, EventArgs e) var sub = new Subfile(Paths.BACKUP + @"\sp_04_03_0" + i.ToString() + ".bmp"); PP.jg2e06_00_00.Subfiles[index] = sub; } - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -416,7 +416,7 @@ private void btnSaveBorder_Click(object sender, EventArgs e) var sub = new Subfile(borderpath); sub.Name = "sp_04_02_0" + cmbBorder.SelectedIndex.ToString() + ".tga"; PP.jg2e06_00_00.Subfiles[index] = sub; - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -436,7 +436,7 @@ private void btnRestoreBorder_Click(object sender, EventArgs e) var index = PP.jg2e06_00_00.Subfiles.IndexOf(PP.jg2e06_00_00.Subfiles.First(pp => pp.Name == "sp_04_02_0" + cmbBorder.SelectedIndex.ToString() + ".tga")); var sub = new Subfile(Paths.BACKUP + @"\sp_04_02_0" + cmbBorder.SelectedIndex.ToString() + ".tga"); PP.jg2e06_00_00.Subfiles[index] = sub; - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -456,7 +456,7 @@ private void btnRestoreAllBorder_Click(object sender, EventArgs e) var sub = new Subfile(Paths.BACKUP + @"\sp_04_02_0" + i.ToString() + ".tga"); PP.jg2e06_00_00.Subfiles[index] = sub; } - var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false, "bak", true); + var back = PP.jg2e06_00_00.WriteArchive(PP.jg2e06_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -514,7 +514,7 @@ private void btnSaveCHR_Click(object sender, EventArgs e) var sub = new Subfile(chrpath); sub.Name = "def0" + cmbCharacter.SelectedIndex.ToString() + ".png"; PP.jg2e01_00_00.Subfiles[index] = sub; - var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false, "bak", true); + var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -534,7 +534,7 @@ private void btnRestoreCHR_Click(object sender, EventArgs e) var index = PP.jg2e01_00_00.Subfiles.IndexOf(PP.jg2e01_00_00.Subfiles.First(pp => pp.Name == "def0" + cmbCharacter.SelectedIndex.ToString() + ".png")); var sub = new Subfile(Paths.BACKUP + @"\def0" + cmbCharacter.SelectedIndex.ToString() + ".png"); PP.jg2e01_00_00.Subfiles[index] = sub; - var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false, "bak", true); + var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -554,7 +554,7 @@ private void btnRestoreAllCHR_Click(object sender, EventArgs e) var sub = new Subfile(Paths.BACKUP + @"\def0" + i.ToString() + ".png"); PP.jg2e01_00_00.Subfiles[index] = sub; } - var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false, "bak", true); + var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -598,7 +598,7 @@ private void btnMove31_Click(object sender, EventArgs e) PP.jg2e01_00_00.Subfiles[index] = iw; } - var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false, "bak", true); + var back = PP.jg2e01_00_00.WriteArchive(PP.jg2e01_00_00.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -615,7 +615,7 @@ private void btnMove31_Click(object sender, EventArgs e) var sub = Tools.ManipulateLst(, 4, "51"); sub.Name = "jg2e_00_01_00_00.lst"; PP.jg2e00_00_00.Subfiles[index] = sub; - back = PP.jg2e00_00_00.WriteArchive(PP.jg2e00_00_00.FilePath, false, "bak", true); + back = PP.jg2e00_00_00.WriteArchive(PP.jg2e00_00_00.FilePath, false); back.RunWorkerAsync(); while (back.IsBusy) { @@ -675,7 +675,7 @@ private void btnSet32_Click(object sender, EventArgs e) //sub = Tools.ManipulateLst(sub, 4, "51"); //sub.Name = "jg2e_00_01_00_00.lst"; pp.Subfiles[index] = lst.ToSubfile(sub.Name); - var back = pp.WriteArchive(pp.FilePath, false, "bak", true); + var back = pp.WriteArchive(pp.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -720,9 +720,9 @@ private void btnRestore32_Click(object sender, EventArgs e) ppParser pp = personality.GetLstPP(); IWriteFile sub = personality.GetLst(); var index = pp.Subfiles.IndexOf(pp.Subfiles.First(iw => iw.Name == sub.Name)); - sub = new MemSubfile(new MemoryStream(backup[personality.LSTLocation]), sub.Name); + sub = new MemSubfile(backup[personality.LSTLocation], sub.Name); pp.Subfiles[index] = sub; - var back = pp.WriteArchive(pp.FilePath, false, "bak", true); + var back = pp.WriteArchive(pp.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -871,9 +871,9 @@ private void btnSet33_Click(object sender, EventArgs e) return; } - sub = new MemSubfile(new MemoryStream(icf.Export()), sub.Name); + sub = new MemSubfile(icf.Export(), sub.Name); pp.Subfiles[index] = sub; - var back = pp.WriteArchive(pp.FilePath, false, "bak", true); + var back = pp.WriteArchive(pp.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -899,9 +899,9 @@ private void btnRestore33_Click(object sender, EventArgs e) string name = "e" + cmbMode33.SelectedIndex.ToString("00") + "_" + personality.Slot.ToString("00") + "_" + cmbHeight33.SelectedIndex.ToString("00") + ".ICF"; var sub = pp.Subfiles.First(iw => iw.Name.ToLower() == name.ToLower()); var index = pp.Subfiles.IndexOf(pp.Subfiles.First(iw => iw.Name.ToLower() == name.ToLower())); - sub = new MemSubfile(new MemoryStream(backup[name.ToLower()]), name); + sub = new MemSubfile(backup[name.ToLower()], name); pp.Subfiles[index] = sub; - var back = pp.WriteArchive(pp.FilePath, false, "bak", true); + var back = pp.WriteArchive(pp.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -986,7 +986,7 @@ private void btnSetBlank34_Click(object sender, EventArgs e) sub = new Subfile(Paths.BACKUP + "\\personality_blank.tga", sub.Name); pp.Subfiles[index] = sub; - var back = pp.WriteArchive(pp.FilePath, false, "bak", true); + var back = pp.WriteArchive(pp.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) @@ -1018,7 +1018,7 @@ private void btnRestore34_Click(object sender, EventArgs e) sub = new Subfile(Paths.NATURE + "\\" + name, sub.Name); pp.Subfiles[index] = sub; - var back = pp.WriteArchive(pp.FilePath, false, "bak", true); + var back = pp.WriteArchive(pp.FilePath, false); ShowLoadingForm(); back.RunWorkerAsync(); while (back.IsBusy) diff --git a/AA2Snowflake/formMain.resx b/AA2Snowflake/formMain.resx index 32599a7..2705f09 100644 --- a/AA2Snowflake/formMain.resx +++ b/AA2Snowflake/formMain.resx @@ -123,9 +123,6 @@ 132, 17 - - 132, 17 - @@ -173,17 +170,17 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAKXSURBVDhPjZHdS1NxHMbPf9Btu+yumwgvspuggsAoSdBQ - gzJNTdrKiCTFl5wveJZ7OzqXumlrWb5s4tLp1M1ZTZaaHtucGIZFYflC6s7m9HTl0+8ctDBH+cDDj+/F - 9/N9znMok31KbbKyy4yV5TTm/5uxsJyxi9VSu2rqebcyHQhsb0QiiGzy//TqBo+VYBj1baPBnXWKEi6H - NyLQ9y5A3euDvK8D5kkdLP5KtPrKUedR4tYTA+43jyC/eRY/wjwY63tuZ52itCSWQK/vWwDdPwDzhA7t - 03kwTuSgfiwTDeNSKF0VkDa+QKHpA1a4KIAwATT2f4Pc0YI2crVhPBs1b69B6bkC+k0qNJ57uF6rQsmz - OSxzWwQwtRfAEYBx4DtK7WY8ZUvAeNNAv05G2XAiHg4lgnbfRhrzCGXPP2IpuLkfEIzwaB5cBG13QOdR - QOvNhHw4CYXOBJS6U1H8sgDSxy2obJvH0nqUBOukXZNrCTqHHwUWE+ieu6h2Z4N2ZaDIKkOWrobE90LR - 8Wk/QPi3a6RZs3tZhNTafXhQnoYqzTnQyrOQVySjvHUUmq4vUHZ+xmI0wGqIR6HlEvLb45HXegGGohMI - mC7DT2yrOo0cwxnyCRdxpy4FNzUJuFoatx2Xf6xYBKjNk9waAXjmX/22N2DD+FgT/LZcjMw5oe9ToMya - gd4ZPXyLTmhdUqRojyFWJlGRBAJgaw/gb6dXn0d3gEH3bC0EqYayoR3KwXHZIZ6qs7Jf14IhhEiRochP - cKJ5cGQO7ji+KAaOmSZxeVc903qclElAGW1staFzakQohrFE96ncI1A6b4B2povL9GD6nwQHUaxUUpmk - Ogq1M0u8LLzCLHZwUMVKDytiZJKwEFt4hZmiKOoXUO+A9qikSlYAAAAASUVORK5CYII= + gzJNTdrKiCTFl5wveJZ7OzqXumlrWb5s4tLp1M1ZTZaaHtumGIZFYflC6s7m9HTl0+8ctDBH+cDDj+/F + 9/N9znMok31KbbKyy4yV5TTm/5uxsJyxi9VSu2rqebfiDwS2NyIRRDb5f3p1g8dKMIz6ttHgzjpFCZfD + GxHoexeg7vVB3tcB86QOFn8lWn3lqPMoceuJAfebR5DfPIsfYR6M9T23s05RWhJLoNf3LYDuH4B5Qof2 + QB6MEzmoH8tEw7gUSlcFpI0vUGj6gBUuCiBMAI393yB3tKCNXG0Yz0bN22tQeq6AfpMKjecerteqUPJs + DsvcFgFM7QVwBGAc+I5SuxlP2RIw3jTQr5NRNpyIh0OJoN23kcY8Qtnzj1gKbu4HBCM8mgcXQdsd0HkU + 0HozIR9OQqEzAaXuVBS/LID0cQsq2+axtB4lwTpp1+Rags7hR4HFBLrnLqrd2aBdGSiyypClqyHxvVB0 + fNoPEP7tGmnW7F4WIbV2Hx6Up6FKcw608izkFckobx2FpusLlJ2fsRgNsBriUWi5hPz2eOS1XoCh6ASm + TZfhJ7ZVnUaO4Qz5hIu4U5eCm5oEXC2N247LP1YsAtTmSW6NADzzr37bO23D+FgT/LZcjMw5oe9ToMya + gd4ZPXyLTmhdUqRojyFWJlGRBAJgaw/gb6dXn0f3NIPu2VoIUg1lQzuUg+OyQzxVZ2W/rgVDCJEiQ5Gf + 4ETz4Mgc3HF8UQwcM03i8q56AnqclElAGW1staFzakQohrFE96ncI1A6b4B2povL9GD6nwQHUaxUUpmk + Ogq1M0u8LLzCLHZwUMVKDytiZJKwEFt4hZmiKOoXRZSA8+rdu2wAAAAASUVORK5CYII= diff --git a/AA2Snowflake/packages.config b/AA2Snowflake/packages.config index f83adfd..6057547 100644 --- a/AA2Snowflake/packages.config +++ b/AA2Snowflake/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/SB3UtilityPP/JchStream.cs b/SB3UtilityPP/JchStream.cs deleted file mode 100644 index 7e8d84f..0000000 --- a/SB3UtilityPP/JchStream.cs +++ /dev/null @@ -1,418 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.IO.Compression; - -namespace SB3Utility -{ - public class JchStream : Stream - { - private Stream stream; - private CompressionMode mode; - private bool leaveOpen; - - private List readBuf; - private bool hasReadHeader; - private byte compressByte; - private int copyPos; - private int fileSize; - private int totalRead; - - private MemoryStream writeBuf; - private int[] byteCount; - - public JchStream(Stream stream, CompressionMode mode) - : this(stream, mode, false) - { - } - - public JchStream(Stream stream, CompressionMode mode, bool leaveOpen) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - - if (mode == CompressionMode.Decompress) - { - if (!stream.CanRead) - { - throw new ArgumentException("The base stream is not writeable.", "stream"); - } - } - else if (mode == CompressionMode.Compress) - { - if (!stream.CanWrite) - { - throw new ArgumentException("The base stream is not readable.", "stream"); - } - } - else - { - throw new ArgumentException("Enum value was out of legal range.", "mode"); - } - - this.stream = stream; - this.mode = mode; - this.leaveOpen = leaveOpen; - if (mode == CompressionMode.Decompress) - { - readBuf = new List(0x20000); - hasReadHeader = false; - totalRead = 0; - } - else - { - writeBuf = new MemoryStream(); - byteCount = new int[256]; - } - } - - public Stream BaseStream - { - get - { - return stream; - } - } - - public override bool CanRead - { - get - { - return (stream != null) && (mode == CompressionMode.Decompress); - } - } - - public override bool CanWrite - { - get - { - return (stream != null) && (mode == CompressionMode.Compress); - } - } - - public override bool CanSeek - { - get - { - return false; - } - } - - public override long Length - { - get - { - throw new NotSupportedException("This operation is not supported."); - } - } - - public override long Position - { - get - { - throw new NotSupportedException("This operation is not supported."); - } - set - { - throw new NotSupportedException("This operation is not supported."); - } - } - - public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) - { - if (stream == null) - { - throw new ObjectDisposedException("stream"); - } - if (mode != CompressionMode.Decompress) - { - throw new NotSupportedException("This operation is not supported."); - } - return base.BeginRead(buffer, offset, count, callback, state); - } - - public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) - { - if (stream == null) - { - throw new ObjectDisposedException("stream"); - } - if (mode != CompressionMode.Compress) - { - throw new NotSupportedException("This operation is not supported."); - } - return base.BeginWrite(buffer, offset, count, callback, state); - } - - public override void Close() - { - if (stream != null) - { - if (mode == CompressionMode.Decompress) - { - readBuf = null; - } - else - { - int maxByteCount = 0; - for (int i = 0; i < byteCount.Length; i++) - { - if (byteCount[i] > maxByteCount) - { - compressByte = (byte)i; - maxByteCount = byteCount[i]; - } - } - - BinaryWriter writer = new BinaryWriter(stream); - writer.Write(compressByte); - writer.Write((int)writeBuf.Length); - - byte[] inputBuf = writeBuf.GetBuffer(); - int bufLength = (int)writeBuf.Length; - int windowStart = 0; - int windowEnd = 0; - for (int i = 0; i < bufLength; ) - { - Match maxMatch = new Match(); - int maxMatchLength = 0; - for (int windowIdx = windowStart; windowIdx < windowEnd; windowIdx++) - { - int blockSize = 0; - int numBlocks = 1; - if (inputBuf[i] == inputBuf[windowIdx]) - { - for (int k = 1; k < 0xFF; k++) - { - blockSize++; - int offset = i + k; - if ((offset >= bufLength) || ((windowIdx + k) >= windowEnd) || (inputBuf[offset] != inputBuf[windowIdx + k])) - { - break; - } - } - - for (int k = 1; k < 0xFF; k++) - { - bool addBlock = true; - for (int m = 0; m < blockSize; m++) - { - int offset = i + (blockSize * k) + m; - if ((offset >= bufLength) || (inputBuf[offset] != inputBuf[windowIdx + m])) - { - addBlock = false; - break; - } - } - if (addBlock) - { - numBlocks++; - } - else - { - break; - } - } - - int matchLength = blockSize * numBlocks; - if (matchLength > maxMatchLength) - { - maxMatch.blockSize = blockSize; - maxMatch.numBlocks = numBlocks; - maxMatch.distance = i - windowIdx; - maxMatch.length = matchLength; - maxMatchLength = matchLength; - } - } - } - - int windowOffset = 1; - if (maxMatchLength > 4) - { - writer.Write(compressByte); - if (maxMatch.distance == compressByte) - { - writer.Write((byte)0); - } - else - { - writer.Write((byte)maxMatch.distance); - } - writer.Write((byte)maxMatch.blockSize); - writer.Write((byte)maxMatch.numBlocks); - i += maxMatch.length; - windowOffset = maxMatch.length; - } - else - { - WriteSingleByte(writer, inputBuf[i], compressByte); - i++; - } - - windowEnd += windowOffset; - int windowSize = windowEnd - windowStart; - if (windowSize >= 0xFF) - { - windowStart += windowSize - 0xFF; - } - } - - writeBuf.Close(); - writeBuf = null; - byteCount = null; - } - - if (!leaveOpen) - { - stream.Close(); - } - - stream = null; - } - } - - private class Match - { - public int distance; - public int length; - public int blockSize; - public int numBlocks; - } - - private static void WriteSingleByte(BinaryWriter writer, byte b, byte compressedByte) - { - writer.Write(b); - - if (b == compressedByte) - { - writer.Write(b); - } - } - - public override int EndRead(IAsyncResult asyncResult) - { - return base.EndRead(asyncResult); - } - - public override void EndWrite(IAsyncResult asyncResult) - { - base.EndWrite(asyncResult); - } - - public override void Flush() - { - if (stream == null) - { - throw new ObjectDisposedException("stream"); - } - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (stream == null) - { - throw new ObjectDisposedException("stream"); - } - if (mode != CompressionMode.Decompress) - { - throw new NotSupportedException("This operation is not supported."); - } - - BinaryReader reader = new BinaryReader(stream); - if (!hasReadHeader) - { - compressByte = reader.ReadByte(); - fileSize = reader.ReadInt32(); - - hasReadHeader = true; - } - - if (totalRead >= fileSize) - { - return 0; - } - - if ((totalRead + count) > fileSize) - { - count = fileSize - totalRead; - } - - while (readBuf.Count - copyPos < count) - { - byte b = reader.ReadByte(); - if (b == compressByte) - { - byte distance = reader.ReadByte(); - if (distance == compressByte) - { - readBuf.Add(distance); - } - else - { - if (distance == 0) - { - distance = compressByte; - } - byte blockSize = reader.ReadByte(); - byte numBlocks = reader.ReadByte(); - byte[] block = new byte[blockSize]; - readBuf.CopyTo(readBuf.Count - distance, block, 0, blockSize); - - for (int i = 0; i < numBlocks; i++) - { - readBuf.AddRange(block); - } - } - } - else - { - readBuf.Add(b); - } - } - - readBuf.CopyTo(copyPos, buffer, offset, count); - copyPos += count; - if (copyPos > 255) - { - int remove = copyPos - 255; - readBuf.RemoveRange(0, remove); - copyPos -= remove; - } - - totalRead += count; - return count; - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException("This operation is not supported."); - } - - public override void SetLength(long value) - { - throw new NotSupportedException("This operation is not supported."); - } - - public override void Write(byte[] buffer, int offset, int count) - { - if (stream == null) - { - throw new ObjectDisposedException("stream"); - } - if (mode != CompressionMode.Compress) - { - throw new NotSupportedException("This operation is not supported."); - } - - for (int i = 0; i < count; i++) - { - byteCount[buffer[offset + i]]++; - } - - writeBuf.Write(buffer, offset, count); - } - } -} diff --git a/SB3UtilityPP/MemSubfile.cs b/SB3UtilityPP/MemSubfile.cs index 53bc339..8381ffa 100644 --- a/SB3UtilityPP/MemSubfile.cs +++ b/SB3UtilityPP/MemSubfile.cs @@ -6,38 +6,41 @@ namespace SB3Utility { - public class MemSubfile: IReadFile, IWriteFile + public class MemSubfile : IReadFile, IWriteFile, IDisposable { public string Name { get; set; } - public MemoryStream data; + public byte[] data; - public MemSubfile(MemoryStream mem, string name) + public MemSubfile(byte[] data, string name) { - data = mem; + this.data = data; Name = name; } public void WriteTo(Stream stream) { using (BinaryReader reader = new BinaryReader(CreateReadStream())) - { - BinaryWriter writer = new BinaryWriter(stream); - byte[] buf; - while ((buf = reader.ReadBytes(Utility.BufSize)).Length == Utility.BufSize) + if (reader.BaseStream.Length > 0) { + BinaryWriter writer = new BinaryWriter(stream); + byte[] buf; + int bufsize = Utility.EstBufSize(reader.BaseStream.Length); + while ((buf = reader.ReadBytes(bufsize)).Length == bufsize) + { + writer.Write(buf); + } writer.Write(buf); } - writer.Write(buf); - } } public Stream CreateReadStream() { - MemoryStream mem = new MemoryStream(); - data.Position = 0; - data.CopyTo(mem); - mem.Position = 0; - return mem; + return new MemoryStream(data); + } + + public void Dispose() + { + data = null; } } } diff --git a/SB3UtilityPP/Report.cs b/SB3UtilityPP/Report.cs deleted file mode 100644 index 5a7a475..0000000 --- a/SB3UtilityPP/Report.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace SB3Utility -{ - public static class Report - { - public static event Action Log; - public static event Action Status; - - public static void ReportLog(string msg) - { - if (Log != null) - { - Log(msg); - } - } - - public static void ReportStatus(string msg) - { - if (Status != null) - { - Status(msg); - } - } - } -} diff --git a/SB3UtilityPP/SB3UtilityPP.csproj b/SB3UtilityPP/SB3UtilityPP.csproj index 1c984c5..bbebb69 100644 --- a/SB3UtilityPP/SB3UtilityPP.csproj +++ b/SB3UtilityPP/SB3UtilityPP.csproj @@ -28,7 +28,7 @@ ..\..\bin\plugins\ TRACE true - none + full AnyCPU prompt true @@ -36,6 +36,27 @@ false true SB3UtilityPP.ruleset + true + + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + SB3UtilityPP.ruleset + + + true + bin\Release\ + TRACE + true + full + AnyCPU + false + prompt + SB3UtilityPP.ruleset @@ -43,30 +64,24 @@ - - - - + - - - + -