From dbcf569103347e6a3d26d490fbcdf88d6f14ac93 Mon Sep 17 00:00:00 2001 From: suloku Date: Sat, 13 Mar 2021 22:53:12 +0100 Subject: [PATCH] * Memory Link: Props are now imported from BW savegame Added button to unlock all props --- BW_tool/Editors/MemoryLink.Designer.cs | 59 +++++++++++++++++++++++--- BW_tool/Editors/MemoryLink.cs | 23 +++++++++- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/BW_tool/Editors/MemoryLink.Designer.cs b/BW_tool/Editors/MemoryLink.Designer.cs index 3643739..e053135 100644 --- a/BW_tool/Editors/MemoryLink.Designer.cs +++ b/BW_tool/Editors/MemoryLink.Designer.cs @@ -77,6 +77,8 @@ namespace BW_tool this.memory_export = new System.Windows.Forms.Button(); this.memory_import = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.PROP = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); this.name = new System.Windows.Forms.TextBox(); this.sid = new System.Windows.Forms.NumericUpDown(); this.tid = new System.Windows.Forms.NumericUpDown(); @@ -99,6 +101,8 @@ namespace BW_tool this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.starter = new System.Windows.Forms.ComboBox(); + this.label10 = new System.Windows.Forms.Label(); + this.PropUnlockBut = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.sid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tid)).BeginInit(); @@ -206,19 +210,37 @@ namespace BW_tool // // groupBox1 // + this.groupBox1.Controls.Add(this.PROP); + this.groupBox1.Controls.Add(this.label11); this.groupBox1.Controls.Add(this.b2_import); this.groupBox1.Controls.Add(this.b1m_import); this.groupBox1.Controls.Add(this.b1_import); this.groupBox1.Controls.Add(this.b2_export); this.groupBox1.Controls.Add(this.b1m_export); this.groupBox1.Controls.Add(this.b1_export); - this.groupBox1.Location = new System.Drawing.Point(391, 149); + this.groupBox1.Location = new System.Drawing.Point(398, 140); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(256, 156); + this.groupBox1.Size = new System.Drawing.Size(249, 165); this.groupBox1.TabIndex = 30; this.groupBox1.TabStop = false; this.groupBox1.Text = "Research Purposes"; // + // PROP + // + this.PROP.Location = new System.Drawing.Point(55, 142); + this.PROP.Name = "PROP"; + this.PROP.Size = new System.Drawing.Size(195, 20); + this.PROP.TabIndex = 55; + this.PROP.Text = "0"; + // + // label11 + // + this.label11.Location = new System.Drawing.Point(6, 142); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(67, 20); + this.label11.TabIndex = 54; + this.label11.Text = "Props: 0x"; + // // name // this.name.Location = new System.Drawing.Point(116, 74); @@ -368,7 +390,7 @@ namespace BW_tool // // label5 // - this.label5.Location = new System.Drawing.Point(398, 24); + this.label5.Location = new System.Drawing.Point(396, 28); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(147, 37); this.label5.TabIndex = 47; @@ -376,7 +398,7 @@ namespace BW_tool // // label6 // - this.label6.Location = new System.Drawing.Point(465, 10); + this.label6.Location = new System.Drawing.Point(463, 5); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(132, 23); this.label6.TabIndex = 48; @@ -384,7 +406,7 @@ namespace BW_tool // // label7 // - this.label7.Location = new System.Drawing.Point(465, 24); + this.label7.Location = new System.Drawing.Point(463, 19); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(132, 23); this.label7.TabIndex = 49; @@ -392,7 +414,7 @@ namespace BW_tool // // label8 // - this.label8.Location = new System.Drawing.Point(465, 39); + this.label8.Location = new System.Drawing.Point(463, 34); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(132, 23); this.label8.TabIndex = 50; @@ -418,11 +440,31 @@ namespace BW_tool this.starter.Size = new System.Drawing.Size(121, 21); this.starter.TabIndex = 52; // + // label10 + // + this.label10.Location = new System.Drawing.Point(463, 48); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(132, 23); + this.label10.TabIndex = 53; + this.label10.Text = "- Props"; + // + // PropUnlockBut + // + this.PropUnlockBut.Location = new System.Drawing.Point(282, 103); + this.PropUnlockBut.Name = "PropUnlockBut"; + this.PropUnlockBut.Size = new System.Drawing.Size(121, 23); + this.PropUnlockBut.TabIndex = 54; + this.PropUnlockBut.Text = "Unlock All Props"; + this.PropUnlockBut.UseVisualStyleBackColor = true; + this.PropUnlockBut.Click += new System.EventHandler(this.PropUnlockButClick); + // // MemoryLink // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(659, 317); + this.Controls.Add(this.PropUnlockBut); + this.Controls.Add(this.label10); this.Controls.Add(this.starter); this.Controls.Add(this.label9); this.Controls.Add(this.label8); @@ -452,12 +494,17 @@ namespace BW_tool this.Controls.Add(this.Saveexit_but); this.Name = "MemoryLink"; this.Text = "Memory Link Editor"; + this.Load += new System.EventHandler(this.MemoryLinkLoad); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.sid)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tid)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } + private System.Windows.Forms.Button PropUnlockBut; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label PROP; + private System.Windows.Forms.Label label10; private System.Windows.Forms.ComboBox starter; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; diff --git a/BW_tool/Editors/MemoryLink.cs b/BW_tool/Editors/MemoryLink.cs index b6ddb38..81900ec 100644 --- a/BW_tool/Editors/MemoryLink.cs +++ b/BW_tool/Editors/MemoryLink.cs @@ -78,6 +78,8 @@ namespace BW_tool flag6.Checked = ml.block2.checkflag(5); flag7.Checked = ml.block2.checkflag(6); flag8.Checked = ml.block2.checkflag(7); + + PROP.Text = BitConverter.ToString(ml.block2.getData(0x94, 13)).Replace("-", string.Empty); } void set_data() @@ -214,6 +216,7 @@ namespace BW_tool ml.block2.STARTER = bw1save.Data[0x20160]; ml.block2.set_hof(bw1.Skip(0x23B00).Take(0x168).ToArray()); + ml.block2.set_props(bw1.Skip(0x1F958).Take(0x13).ToArray()); UInt32 newseed = (UInt32)(rand.Next(0xFFFF+1)<<16); ml.block1.crypt_seed = newseed; @@ -222,7 +225,7 @@ namespace BW_tool //Reload all data load_data(); - MessageBox.Show("Imported: Trainer Name, TID, SID, Starter, Hall of Fame"); + MessageBox.Show("Imported: Trainer Name, TID, SID, Starter, Hall of Fame, Props"); } else{ @@ -528,9 +531,13 @@ namespace BW_tool public void set_hof(byte[] input) { - //setData(input.Skip(0x23B00).Take(0x168).ToArray(), 0xB8); setData(input, 0xB8); } + + public void set_props(byte[] input) + { + setData(input, 0x94); + } } } @@ -753,5 +760,17 @@ namespace BW_tool 0x00, 0x00, 0x93, 0x01, 0x39, 0x00, 0x13, 0x00, 0x88, 0x01, 0x00, 0x00 }; + + void PropUnlockButClick(object sender, EventArgs e) + { + ml.block2.set_props(default_memories.Skip(0x894).Take(0x13).ToArray()); + MessageBox.Show("All props have been unlocked for memory link."); + PROP.Text = BitConverter.ToString(ml.block2.getData(0x94, 13)).Replace("-", string.Empty); + } + + void MemoryLinkLoad(object sender, EventArgs e) + { + + } } }