diff --git a/CodeGenerator.Designer.cs b/CodeGenerator.Designer.cs
index acf64bdaf..543336e19 100644
--- a/CodeGenerator.Designer.cs
+++ b/CodeGenerator.Designer.cs
@@ -34,18 +34,20 @@ private void InitializeComponent()
this.L_Write = new System.Windows.Forms.Label();
this.L_Source = new System.Windows.Forms.Label();
this.CB_Source = new System.Windows.Forms.ComboBox();
- this.B_CnE = new System.Windows.Forms.Button();
+ this.B_Save = new System.Windows.Forms.Button();
this.L_Box = new System.Windows.Forms.Label();
this.L_Slot = new System.Windows.Forms.Label();
- this.comboBox2 = new System.Windows.Forms.ComboBox();
- this.comboBox3 = new System.Windows.Forms.ComboBox();
- this.L_Info = new System.Windows.Forms.Label();
+ this.CB_Slot = new System.Windows.Forms.ComboBox();
+ this.CB_Box = new System.Windows.Forms.ComboBox();
+ this.B_Load = new System.Windows.Forms.Button();
+ this.B_Add = new System.Windows.Forms.Button();
+ this.B_Clear = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// RTB_Code
//
this.RTB_Code.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.RTB_Code.Location = new System.Drawing.Point(12, 71);
+ this.RTB_Code.Location = new System.Drawing.Point(12, 100);
this.RTB_Code.Name = "RTB_Code";
this.RTB_Code.ReadOnly = true;
this.RTB_Code.Size = new System.Drawing.Size(210, 175);
@@ -85,21 +87,22 @@ private void InitializeComponent()
this.CB_Source.FormattingEnabled = true;
this.CB_Source.Items.AddRange(new object[] {
"Loaded EKX (Tabs)",
- "Box EKX ",
- "Wondercard"});
+ "Box EKX "});
this.CB_Source.Location = new System.Drawing.Point(90, 23);
this.CB_Source.Name = "CB_Source";
this.CB_Source.Size = new System.Drawing.Size(132, 21);
this.CB_Source.TabIndex = 6;
+ this.CB_Source.SelectedIndexChanged += new System.EventHandler(this.changeDataSource);
//
- // B_CnE
+ // B_Save
//
- this.B_CnE.Location = new System.Drawing.Point(37, 252);
- this.B_CnE.Name = "B_CnE";
- this.B_CnE.Size = new System.Drawing.Size(157, 23);
- this.B_CnE.TabIndex = 9;
- this.B_CnE.Text = "Create && Export Code File";
- this.B_CnE.UseVisualStyleBackColor = true;
+ this.B_Save.Location = new System.Drawing.Point(12, 71);
+ this.B_Save.Name = "B_Save";
+ this.B_Save.Size = new System.Drawing.Size(69, 23);
+ this.B_Save.TabIndex = 9;
+ this.B_Save.Text = "Save Code";
+ this.B_Save.UseVisualStyleBackColor = true;
+ this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// L_Box
//
@@ -119,52 +122,105 @@ private void InitializeComponent()
this.L_Slot.TabIndex = 11;
this.L_Slot.Text = "Slot:";
//
- // comboBox2
+ // CB_Slot
//
- this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox2.FormattingEnabled = true;
- this.comboBox2.Items.AddRange(new object[] {
+ this.CB_Slot.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.CB_Slot.FormattingEnabled = true;
+ this.CB_Slot.Items.AddRange(new object[] {
"Loaded EKX (Tabs)",
"Box EKX ",
"Wondercard"});
- this.comboBox2.Location = new System.Drawing.Point(187, 44);
- this.comboBox2.Name = "comboBox2";
- this.comboBox2.Size = new System.Drawing.Size(35, 21);
- this.comboBox2.TabIndex = 12;
+ this.CB_Slot.Location = new System.Drawing.Point(187, 44);
+ this.CB_Slot.Name = "CB_Slot";
+ this.CB_Slot.Size = new System.Drawing.Size(35, 21);
+ this.CB_Slot.TabIndex = 12;
+ this.CB_Slot.SelectedIndexChanged += new System.EventHandler(this.changeSourceIndex);
//
- // comboBox3
+ // CB_Box
//
- this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox3.FormattingEnabled = true;
- this.comboBox3.Items.AddRange(new object[] {
- "Loaded EKX (Tabs)",
- "Box EKX ",
- "Wondercard"});
- this.comboBox3.Location = new System.Drawing.Point(115, 44);
- this.comboBox3.Name = "comboBox3";
- this.comboBox3.Size = new System.Drawing.Size(35, 21);
- this.comboBox3.TabIndex = 13;
+ this.CB_Box.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.CB_Box.FormattingEnabled = true;
+ this.CB_Box.Items.AddRange(new object[] {
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10",
+ "11",
+ "12",
+ "13",
+ "14",
+ "15",
+ "16",
+ "17",
+ "18",
+ "19",
+ "20",
+ "21",
+ "22",
+ "23",
+ "24",
+ "25",
+ "26",
+ "27",
+ "28",
+ "29",
+ "30",
+ "31"});
+ this.CB_Box.Location = new System.Drawing.Point(120, 44);
+ this.CB_Box.Name = "CB_Box";
+ this.CB_Box.Size = new System.Drawing.Size(35, 21);
+ this.CB_Box.TabIndex = 13;
+ this.CB_Box.SelectedIndexChanged += new System.EventHandler(this.changeSourceIndex);
//
- // L_Info
+ // B_Load
//
- this.L_Info.AutoSize = true;
- this.L_Info.Location = new System.Drawing.Point(12, 48);
- this.L_Info.Name = "L_Info";
- this.L_Info.Size = new System.Drawing.Size(31, 13);
- this.L_Info.TabIndex = 14;
- this.L_Info.Text = "(Info)";
+ this.B_Load.Location = new System.Drawing.Point(12, 48);
+ this.B_Load.Name = "B_Load";
+ this.B_Load.Size = new System.Drawing.Size(69, 23);
+ this.B_Load.TabIndex = 14;
+ this.B_Load.Text = "Load Code";
+ this.B_Load.UseVisualStyleBackColor = true;
+ this.B_Load.Click += new System.EventHandler(this.B_Load_Click);
+ //
+ // B_Add
+ //
+ this.B_Add.Location = new System.Drawing.Point(162, 71);
+ this.B_Add.Name = "B_Add";
+ this.B_Add.Size = new System.Drawing.Size(60, 23);
+ this.B_Add.TabIndex = 15;
+ this.B_Add.Text = "Add ↓";
+ this.B_Add.UseVisualStyleBackColor = true;
+ this.B_Add.Click += new System.EventHandler(this.B_Add_Click);
+ //
+ // B_Clear
+ //
+ this.B_Clear.Location = new System.Drawing.Point(90, 71);
+ this.B_Clear.Name = "B_Clear";
+ this.B_Clear.Size = new System.Drawing.Size(60, 23);
+ this.B_Clear.TabIndex = 16;
+ this.B_Clear.Text = "Clear All";
+ this.B_Clear.UseVisualStyleBackColor = true;
+ this.B_Clear.Click += new System.EventHandler(this.B_Clear_Click);
//
// CodeGenerator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(230, 282);
- this.Controls.Add(this.L_Info);
- this.Controls.Add(this.comboBox3);
- this.Controls.Add(this.comboBox2);
+ this.Controls.Add(this.B_Clear);
+ this.Controls.Add(this.B_Add);
+ this.Controls.Add(this.B_Load);
+ this.Controls.Add(this.CB_Box);
+ this.Controls.Add(this.CB_Slot);
this.Controls.Add(this.L_Slot);
this.Controls.Add(this.L_Box);
- this.Controls.Add(this.B_CnE);
+ this.Controls.Add(this.B_Save);
this.Controls.Add(this.CB_Source);
this.Controls.Add(this.L_Source);
this.Controls.Add(this.L_Write);
@@ -175,6 +231,7 @@ private void InitializeComponent()
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CodeGenerator";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "CodeGenerator";
this.ResumeLayout(false);
this.PerformLayout();
@@ -188,11 +245,13 @@ private void InitializeComponent()
private System.Windows.Forms.Label L_Write;
private System.Windows.Forms.Label L_Source;
private System.Windows.Forms.ComboBox CB_Source;
- private System.Windows.Forms.Button B_CnE;
+ private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.Label L_Box;
private System.Windows.Forms.Label L_Slot;
- private System.Windows.Forms.ComboBox comboBox2;
- private System.Windows.Forms.ComboBox comboBox3;
- private System.Windows.Forms.Label L_Info;
+ private System.Windows.Forms.ComboBox CB_Slot;
+ private System.Windows.Forms.ComboBox CB_Box;
+ private System.Windows.Forms.Button B_Load;
+ private System.Windows.Forms.Button B_Add;
+ private System.Windows.Forms.Button B_Clear;
}
}
\ No newline at end of file
diff --git a/CodeGenerator.cs b/CodeGenerator.cs
index c9a42a836..5df70e172 100644
--- a/CodeGenerator.cs
+++ b/CodeGenerator.cs
@@ -6,14 +6,226 @@
using System.Linq;
using System.Text;
using System.Windows.Forms;
+using System.Globalization;
+using System.IO;
+using System.Text.RegularExpressions;
namespace PKHeX
{
public partial class CodeGenerator : Form
{
- public CodeGenerator()
+ Form1 m_parent;
+ byte[] codedata = new Byte[232];
+ byte[] newdata = new Byte[232];
+ SaveGames.SaveStruct SaveGame = new SaveGames.SaveStruct(null);
+
+ public CodeGenerator(Form1 frm1)
{
InitializeComponent();
+ this.CenterToParent();
+ RTB_Code.Clear();
+ TB_Write.Clear();
+ m_parent = frm1;
+ SaveGame = m_parent.SaveGame;
+ CB_Box.Items.Clear();
+ for (int i = 1; i <= 31; i++)
+ CB_Box.Items.Add(i.ToString());
+
+ CB_Source.SelectedIndex = 0;
+ CB_Slot.SelectedIndex = 0;
+ CB_Box.SelectedIndex = 0;
+ }
+ private bool loaddata()
+ {
+ if (CB_Source.SelectedIndex == 0)
+ {
+ if (m_parent.verifiedpkx())
+ {
+ byte[] pkx = m_parent.preparepkx(m_parent.buff);
+ newdata = new Byte[232];
+ Array.Copy(m_parent.encryptArray(pkx), newdata, 232);
+ }
+ else return false;
+
+ }
+ else if (CB_Source.SelectedIndex == 1)
+ {
+ newdata = new Byte[0xE8];
+ Array.Copy(m_parent.savefile,
+ SaveGame.Box // Box Offset
+ + CB_Box.SelectedIndex * (232 * 30) // Box Shift
+ + CB_Slot.SelectedIndex * 232, // Slot Shift
+ newdata, 0, 0xE8);
+ }
+ else if (CB_Source.SelectedIndex == 2)
+ {
+ // Wondercard
+ newdata = new Byte[0x108];
+ // Wondercard #
+ int wcn = CB_Slot.SelectedIndex;
+ // copy from save, the chosen wondercard offset, to new data
+ Array.Copy(m_parent.savefile, SaveGame.Wondercard + wcn * 0x108, newdata, 0, 0x108);
+ }
+ return true;
+ }
+ private void changeDataSource(object sender, EventArgs e)
+ {
+ int sourceindex = CB_Source.SelectedIndex;
+ B_Add.Enabled = true;
+
+ if (sourceindex == 0)
+ {
+ // Hide Box/Etc
+ CB_Box.Visible = false;
+ L_Box.Visible = false;
+ CB_Slot.Visible = false;
+ L_Slot.Visible = false;
+
+ B_Add.Enabled = m_parent.verifiedpkx();
+ }
+ else if (sourceindex == 1)
+ {
+ CB_Box.Visible = true;
+ L_Box.Visible = true;
+ CB_Slot.Visible = true;
+ L_Slot.Visible = true;
+
+ L_Slot.Text = "Slot:";
+
+ CB_Slot.Items.Clear();
+ for (int i = 1; i <= 30; i++)
+ CB_Slot.Items.Add(i.ToString());
+
+ CB_Slot.SelectedIndex = 0;
+ }
+ else if (sourceindex == 2)
+ {
+ CB_Box.Visible = false;
+ L_Box.Visible = false;
+ CB_Slot.Visible = true;
+ L_Slot.Visible = true;
+
+ L_Slot.Text = "Card:";
+
+ // Set up cards
+ CB_Slot.Items.Clear();
+ for (int i = 1; i <= 24; i++)
+ CB_Slot.Items.Add(i.ToString());
+
+ CB_Slot.SelectedIndex = 0;
+ }
+ }
+
+ private void changeSourceIndex(object sender, EventArgs e)
+ {
+ }
+
+ public static string RemoveTroublesomeCharacters(TextBox tb)
+ {
+ string inString = tb.Text;
+ if (inString == null) return null;
+
+ StringBuilder newString = new StringBuilder();
+ char ch;
+
+ for (int i = 0; i < inString.Length; i++)
+ {
+ ch = inString[i];
+ // filter for hex
+ if ((ch < 0x0047 && ch > 0x002F) || (ch < 0x0067 && ch > 0x0060))
+ newString.Append(ch);
+ else
+ System.Media.SystemSounds.Beep.Play();
+ }
+ if (newString.Length == 0)
+ newString.Append("0");
+ uint value = UInt32.Parse(newString.ToString(), NumberStyles.HexNumber);
+ tb.Text = value.ToString("X8");
+ return newString.ToString();
+
+ }
+ private uint getHEXval(TextBox tb)
+ {
+ if (tb.Text == null)
+ return 0;
+ string str = RemoveTroublesomeCharacters(tb);
+ return UInt32.Parse(str, NumberStyles.HexNumber);
+ }
+ private void B_Add_Click(object sender, EventArgs e)
+ {
+ // Add the new code to the textbox.
+ if (!loaddata()) return;
+ uint writeoffset = getHEXval(TB_Write);
+ for (int i = 0; i < newdata.Length / (4); i++)
+ {
+ // Add Operator
+
+ RTB_Code.AppendText("00000001 "); // 01 00 00 00
+ RTB_Code.AppendText((writeoffset + i * 4).ToString("X8") + " ");
+ RTB_Code.AppendText(BitConverter.ToUInt32(newdata,i*4).ToString("X8") + "\n");
+ }
+ }
+
+ private void B_Clear_Click(object sender, EventArgs e)
+ {
+ RTB_Code.Clear();
+ }
+
+ private void B_Load_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog ofd = new OpenFileDialog();
+ ofd.Filter = "Code File|*.bin";
+ if (ofd.ShowDialog() == DialogResult.OK)
+ {
+ string path = ofd.FileName;
+ byte[] ncf = File.ReadAllBytes(path);
+ uint length = BitConverter.ToUInt32(ncf, 0);
+
+ if (ncf.Length != length + 4)
+ {
+ MessageBox.Show("Not a valid code file.", "Error");
+ return;
+ }
+ if (RTB_Code.Text.Length > 0)
+ {
+ DialogResult ld = MessageBox.Show("Replace current code?","Alert",MessageBoxButtons.YesNo);
+ if (ld == DialogResult.Yes)
+ RTB_Code.Clear();
+ else if (ld != DialogResult.No)
+ return;
+ }
+ for (int i = 4; i <= ncf.Length-12; i+=12)
+ {
+ RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 0 * 4).ToString("X8") + " ");
+ RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 1 * 4).ToString("X8") + " ");
+ RTB_Code.AppendText(BitConverter.ToUInt32(ncf, i + 2 * 4).ToString("X8") + "\n");
+ }
+ }
+ }
+
+ private void B_Save_Click(object sender, EventArgs e)
+ {
+ // Gotta read in the textbox.
+ if (RTB_Code.Text.Length < 1) return;
+
+ byte[] ncf = new Byte[4 + RTB_Code.Lines.Count() * (3 * 4)];
+ Array.Copy(BitConverter.GetBytes(ncf.Length - 4), ncf, 4);
+
+ for (int i = 0; i < RTB_Code.Lines.Count()-1; i++)
+ {
+ string line = RTB_Code.Lines[i];
+ string[] rip = Regex.Split(line, " ");
+
+ // Write the 3 u32's to an array.
+ Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[0], NumberStyles.HexNumber)),0,ncf,4+i*12+0,4);
+ Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[1], NumberStyles.HexNumber)),0,ncf,4+i*12+4,4);
+ Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[2], NumberStyles.HexNumber)),0,ncf,4+i*12+8,4);
+ }
+ int z = 0;
+
+ SaveFileDialog sfd = new SaveFileDialog();
+ sfd.FileName = "code.bin";
+ sfd.Filter = "Code File|*.bin";
}
}
}
diff --git a/CodeGenerator.resx b/CodeGenerator.resx
index 49f6fd123..6ce057076 100644
--- a/CodeGenerator.resx
+++ b/CodeGenerator.resx
@@ -117,9 +117,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- True
-
True
@@ -132,22 +129,16 @@
True
-
- True
-
True
True
-
+
True
-
- True
-
-
+
True
diff --git a/PKHeX.csproj b/PKHeX.csproj
index b455dccdf..d83ad33c8 100644
--- a/PKHeX.csproj
+++ b/PKHeX.csproj
@@ -71,6 +71,12 @@
+
+ Form
+
+
+ CodeGenerator.cs
+
Form
@@ -156,6 +162,9 @@
SplashScreen.cs
+
+ CodeGenerator.cs
+
f1-Main.cs
Designer
diff --git a/f1-Main.Designer.cs b/f1-Main.Designer.cs
index c448dcd0f..31c6f6086 100644
--- a/f1-Main.Designer.cs
+++ b/f1-Main.Designer.cs
@@ -153,6 +153,10 @@ public void InitializeComponent()
this.GB_CurrentMoves = new System.Windows.Forms.GroupBox();
this.Label_CurPP = new System.Windows.Forms.Label();
this.Label_PPups = new System.Windows.Forms.Label();
+ this.TB_PP4 = new System.Windows.Forms.TextBox();
+ this.TB_PP3 = new System.Windows.Forms.TextBox();
+ this.TB_PP2 = new System.Windows.Forms.TextBox();
+ this.TB_PP1 = new System.Windows.Forms.TextBox();
this.CB_PPu4 = new System.Windows.Forms.ComboBox();
this.CB_PPu3 = new System.Windows.Forms.ComboBox();
this.CB_PPu2 = new System.Windows.Forms.ComboBox();
@@ -316,10 +320,7 @@ public void InitializeComponent()
this.B_OpenPokedex = new System.Windows.Forms.Button();
this.GB_SAVtools = new System.Windows.Forms.GroupBox();
this.L_SAVINDEX = new System.Windows.Forms.Label();
- this.TB_PP4 = new System.Windows.Forms.TextBox();
- this.TB_PP3 = new System.Windows.Forms.TextBox();
- this.TB_PP2 = new System.Windows.Forms.TextBox();
- this.TB_PP1 = new System.Windows.Forms.TextBox();
+ this.codeGeneratorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabMain.SuspendLayout();
this.Tab_Main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit();
@@ -1847,6 +1848,42 @@ public void InitializeComponent()
this.Label_PPups.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.Label_PPups.Click += new System.EventHandler(this.Label_PPups_Click);
//
+ // TB_PP4
+ //
+ this.TB_PP4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.TB_PP4.Location = new System.Drawing.Point(133, 93);
+ this.TB_PP4.MaxLength = 2;
+ this.TB_PP4.Name = "TB_PP4";
+ this.TB_PP4.Size = new System.Drawing.Size(31, 20);
+ this.TB_PP4.TabIndex = 11;
+ //
+ // TB_PP3
+ //
+ this.TB_PP3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.TB_PP3.Location = new System.Drawing.Point(133, 71);
+ this.TB_PP3.MaxLength = 2;
+ this.TB_PP3.Name = "TB_PP3";
+ this.TB_PP3.Size = new System.Drawing.Size(31, 20);
+ this.TB_PP3.TabIndex = 8;
+ //
+ // TB_PP2
+ //
+ this.TB_PP2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.TB_PP2.Location = new System.Drawing.Point(133, 49);
+ this.TB_PP2.MaxLength = 2;
+ this.TB_PP2.Name = "TB_PP2";
+ this.TB_PP2.Size = new System.Drawing.Size(31, 20);
+ this.TB_PP2.TabIndex = 5;
+ //
+ // TB_PP1
+ //
+ this.TB_PP1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.TB_PP1.Location = new System.Drawing.Point(133, 27);
+ this.TB_PP1.MaxLength = 2;
+ this.TB_PP1.Name = "TB_PP1";
+ this.TB_PP1.Size = new System.Drawing.Size(31, 20);
+ this.TB_PP1.TabIndex = 2;
+ //
// CB_PPu4
//
this.CB_PPu4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -2503,7 +2540,8 @@ public void InitializeComponent()
this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Menu_OpenBoxUI,
this.Menu_ImportGen5,
- this.Menu_BoxIO});
+ this.Menu_BoxIO,
+ this.codeGeneratorToolStripMenuItem});
this.Menu_Tools.Name = "Menu_Tools";
this.Menu_Tools.Size = new System.Drawing.Size(48, 20);
this.Menu_Tools.Text = "Tools";
@@ -3745,41 +3783,12 @@ public void InitializeComponent()
this.L_SAVINDEX.TabIndex = 16;
this.L_SAVINDEX.Text = "0";
//
- // TB_PP4
+ // codeGeneratorToolStripMenuItem
//
- this.TB_PP4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.TB_PP4.Location = new System.Drawing.Point(133, 93);
- this.TB_PP4.MaxLength = 2;
- this.TB_PP4.Name = "TB_PP4";
- this.TB_PP4.Size = new System.Drawing.Size(31, 20);
- this.TB_PP4.TabIndex = 11;
- //
- // TB_PP3
- //
- this.TB_PP3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.TB_PP3.Location = new System.Drawing.Point(133, 71);
- this.TB_PP3.MaxLength = 2;
- this.TB_PP3.Name = "TB_PP3";
- this.TB_PP3.Size = new System.Drawing.Size(31, 20);
- this.TB_PP3.TabIndex = 8;
- //
- // TB_PP2
- //
- this.TB_PP2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.TB_PP2.Location = new System.Drawing.Point(133, 49);
- this.TB_PP2.MaxLength = 2;
- this.TB_PP2.Name = "TB_PP2";
- this.TB_PP2.Size = new System.Drawing.Size(31, 20);
- this.TB_PP2.TabIndex = 5;
- //
- // TB_PP1
- //
- this.TB_PP1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.TB_PP1.Location = new System.Drawing.Point(133, 27);
- this.TB_PP1.MaxLength = 2;
- this.TB_PP1.Name = "TB_PP1";
- this.TB_PP1.Size = new System.Drawing.Size(31, 20);
- this.TB_PP1.TabIndex = 2;
+ this.codeGeneratorToolStripMenuItem.Name = "codeGeneratorToolStripMenuItem";
+ this.codeGeneratorToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
+ this.codeGeneratorToolStripMenuItem.Text = "Code Generator";
+ this.codeGeneratorToolStripMenuItem.Click += new System.EventHandler(this.codeGeneratorToolStripMenuItem_Click);
//
// Form1
//
@@ -4198,6 +4207,7 @@ public void InitializeComponent()
private System.Windows.Forms.TextBox TB_PP3;
private System.Windows.Forms.TextBox TB_PP2;
private System.Windows.Forms.TextBox TB_PP1;
+ private System.Windows.Forms.ToolStripMenuItem codeGeneratorToolStripMenuItem;
}
}
diff --git a/f1-Main.cs b/f1-Main.cs
index ba22dce97..2791010be 100644
--- a/f1-Main.cs
+++ b/f1-Main.cs
@@ -6262,7 +6262,7 @@ private void openhistory(object sender, EventArgs e)
f4.ShowDialog();
}
// Open/Save Array Manipulation //
- private byte[] shuffleArray(byte[] pkx, uint sv)
+ public byte[] shuffleArray(byte[] pkx, uint sv)
{
byte[] ekx = new Byte[260];
Array.Copy(pkx, ekx, 8);
@@ -6291,7 +6291,7 @@ private byte[] shuffleArray(byte[] pkx, uint sv)
}
return ekx;
}
- private byte[] decryptArray(byte[] ekx)
+ public byte[] decryptArray(byte[] ekx)
{
byte[] pkx = ekx;
uint pv = BitConverter.ToUInt32(pkx, 0);
@@ -6327,7 +6327,7 @@ private byte[] decryptArray(byte[] ekx)
return pkx;
}
- private byte[] encryptArray(byte[] pkx)
+ public byte[] encryptArray(byte[] pkx)
{
// Shuffle
uint pv = BitConverter.ToUInt32(pkx, 0);
@@ -6595,7 +6595,7 @@ private byte[] convertPK5toPK6(byte[] pkm)
return pkx; // Done!
}
- private bool verifiedpkx()
+ public bool verifiedpkx()
{
// Make sure the PKX Fields are filled out properly (color check)
#region ComboBoxes
@@ -6657,7 +6657,7 @@ private bool verifiedpkx()
}
- private byte[] preparepkx(byte[] buff)
+ public byte[] preparepkx(byte[] buff)
{
// Stuff the Buff
// Create a new storage so we don't muck up things with the original
@@ -8512,6 +8512,13 @@ private void InitializeStrings()
UpdateIVs(null, null); // Prompt an update for the characteristics
}
+
+ private void codeGeneratorToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ // Open Code Generator
+ CodeGenerator CodeGen = new PKHeX.CodeGenerator(this);
+ CodeGen.Show();
+ }
}
#region Structs & Classes
public class cbItem