diff --git a/pk3DS/Main.Designer.cs b/pk3DS/Main.Designer.cs index cb076d7..a07d7f7 100644 --- a/pk3DS/Main.Designer.cs +++ b/pk3DS/Main.Designer.cs @@ -65,6 +65,7 @@ private void InitializeComponent() this.Menu_Rebuild = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_RomFS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_ExeFS = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_CRO = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_3DS = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Patch = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_SMDH = new System.Windows.Forms.ToolStripMenuItem(); @@ -73,9 +74,13 @@ private void InitializeComponent() this.CB_Lang = new System.Windows.Forms.ToolStripComboBox(); this.Menu_About = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_GARCs = new System.Windows.Forms.ToolStripMenuItem(); + this.GB_CRO = new System.Windows.Forms.GroupBox(); + this.B_TypeChart = new System.Windows.Forms.Button(); + this.B_Starter = new System.Windows.Forms.Button(); this.GB_RomFS.SuspendLayout(); this.GB_ExeFS.SuspendLayout(); this.menuStrip1.SuspendLayout(); + this.GB_CRO.SuspendLayout(); this.SuspendLayout(); // // TB_Path @@ -257,7 +262,7 @@ private void InitializeComponent() // this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pBar1.Location = new System.Drawing.Point(12, 202); + this.pBar1.Location = new System.Drawing.Point(12, 257); this.pBar1.Name = "pBar1"; this.pBar1.Size = new System.Drawing.Size(430, 14); this.pBar1.TabIndex = 6; @@ -334,7 +339,7 @@ private void InitializeComponent() this.RTB_Status.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.RTB_Status.Location = new System.Drawing.Point(12, 222); + this.RTB_Status.Location = new System.Drawing.Point(12, 277); this.RTB_Status.Name = "RTB_Status"; this.RTB_Status.ReadOnly = true; this.RTB_Status.Size = new System.Drawing.Size(430, 85); @@ -436,6 +441,7 @@ private void InitializeComponent() this.Menu_Rebuild.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_RomFS, this.Menu_ExeFS, + this.Menu_CRO, this.Menu_3DS, this.Menu_Patch}); this.Menu_Rebuild.Name = "Menu_Rebuild"; @@ -446,7 +452,7 @@ private void InitializeComponent() // this.Menu_RomFS.Enabled = false; this.Menu_RomFS.Name = "Menu_RomFS"; - this.Menu_RomFS.Size = new System.Drawing.Size(152, 22); + this.Menu_RomFS.Size = new System.Drawing.Size(111, 22); this.Menu_RomFS.Text = "RomFS"; this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS); // @@ -454,15 +460,23 @@ private void InitializeComponent() // this.Menu_ExeFS.Enabled = false; this.Menu_ExeFS.Name = "Menu_ExeFS"; - this.Menu_ExeFS.Size = new System.Drawing.Size(152, 22); + this.Menu_ExeFS.Size = new System.Drawing.Size(111, 22); this.Menu_ExeFS.Text = "ExeFS"; this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS); // + // Menu_CRO + // + this.Menu_CRO.Enabled = false; + this.Menu_CRO.Name = "Menu_CRO"; + this.Menu_CRO.Size = new System.Drawing.Size(111, 22); + this.Menu_CRO.Text = "CRO"; + this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR); + // // Menu_3DS // this.Menu_3DS.Enabled = false; this.Menu_3DS.Name = "Menu_3DS"; - this.Menu_3DS.Size = new System.Drawing.Size(152, 22); + this.Menu_3DS.Size = new System.Drawing.Size(111, 22); this.Menu_3DS.Text = ".3DS"; this.Menu_3DS.Click += new System.EventHandler(this.B_Rebuild3DS_Click); // @@ -470,7 +484,7 @@ private void InitializeComponent() // this.Menu_Patch.Enabled = false; this.Menu_Patch.Name = "Menu_Patch"; - this.Menu_Patch.Size = new System.Drawing.Size(152, 22); + this.Menu_Patch.Size = new System.Drawing.Size(111, 22); this.Menu_Patch.Text = "Patch"; this.Menu_Patch.Click += new System.EventHandler(this.B_Patch_Click); // @@ -531,11 +545,46 @@ private void InitializeComponent() this.Menu_GARCs.Text = "About GARCs"; this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click); // + // GB_CRO + // + this.GB_CRO.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.GB_CRO.Controls.Add(this.B_TypeChart); + this.GB_CRO.Controls.Add(this.B_Starter); + this.GB_CRO.Enabled = false; + this.GB_CRO.Location = new System.Drawing.Point(12, 202); + this.GB_CRO.Name = "GB_CRO"; + this.GB_CRO.Size = new System.Drawing.Size(430, 50); + this.GB_CRO.TabIndex = 7; + this.GB_CRO.TabStop = false; + this.GB_CRO.Text = "CRO Editing Tools"; + // + // B_TypeChart + // + this.B_TypeChart.Location = new System.Drawing.Point(6, 19); + this.B_TypeChart.Name = "B_TypeChart"; + this.B_TypeChart.Size = new System.Drawing.Size(100, 23); + this.B_TypeChart.TabIndex = 0; + this.B_TypeChart.Text = "Type Chart"; + this.B_TypeChart.UseVisualStyleBackColor = true; + this.B_TypeChart.Click += new System.EventHandler(this.B_TypeChart_Click); + // + // B_Starter + // + this.B_Starter.Location = new System.Drawing.Point(112, 19); + this.B_Starter.Name = "B_Starter"; + this.B_Starter.Size = new System.Drawing.Size(100, 23); + this.B_Starter.TabIndex = 1; + this.B_Starter.Text = "Starters"; + this.B_Starter.UseVisualStyleBackColor = true; + this.B_Starter.Click += new System.EventHandler(this.B_Starter_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(454, 317); + this.ClientSize = new System.Drawing.Size(454, 372); + this.Controls.Add(this.GB_CRO); this.Controls.Add(this.RTB_Status); this.Controls.Add(this.GB_ExeFS); this.Controls.Add(this.pBar1); @@ -544,7 +593,7 @@ private void InitializeComponent() this.Controls.Add(this.TB_Path); this.Controls.Add(this.menuStrip1); this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(470, 500); + this.MaximumSize = new System.Drawing.Size(470, 555); this.MinimumSize = new System.Drawing.Size(470, 264); this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -554,6 +603,7 @@ private void InitializeComponent() this.GB_ExeFS.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); + this.GB_CRO.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -606,5 +656,9 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem Menu_About; private System.Windows.Forms.ToolStripMenuItem Menu_GARCs; private System.Windows.Forms.ToolStripMenuItem Menu_SMDH; + private System.Windows.Forms.GroupBox GB_CRO; + private System.Windows.Forms.Button B_TypeChart; + private System.Windows.Forms.Button B_Starter; + private System.Windows.Forms.ToolStripMenuItem Menu_CRO; } } \ No newline at end of file diff --git a/pk3DS/Main.cs b/pk3DS/Main.cs index cce0678..95eeb7f 100644 --- a/pk3DS/Main.cs +++ b/pk3DS/Main.cs @@ -204,7 +204,7 @@ private void openQuick(string path) Util.Alert("pk3DS will function best if you keep your Game Files folder clean and free of unnecessary folders."); // Enable buttons if applicable - GB_RomFS.Enabled = Menu_Restore.Enabled = (RomFSPath != null); + GB_RomFS.Enabled = Menu_Restore.Enabled = GB_CRO.Enabled = Menu_CRO.Enabled = (RomFSPath != null); GB_ExeFS.Enabled = (RomFSPath != null && ExeFSPath != null); B_MoveTutor.Enabled = oras; // Default false unless loaded if (RomFSPath != null) @@ -597,6 +597,36 @@ private void B_OPower_Click(object sender, EventArgs e) if (ExeFSPath != null) new OPower().Show(); } + // CRO Subform Items + private void patchCRO_CRR(object sender, EventArgs e) + { + if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; } + if (RomFSPath == null) return; + Util.Alert("Not implemented yet!"); + } + private void B_Starter_Click(object sender, EventArgs e) + { + if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; } + string CRO = Path.Combine(RomFSPath, "DllPoke3Select.cro"); + if (!File.Exists(CRO)) + { + Util.Error("File Missing!", "DllPoke3Select.cro was not found in your RomFS folder!"); + return; + } + new Starters().ShowDialog(); + } + private void B_TypeChart_Click(object sender, EventArgs e) + { + if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; } + string CRO = Path.Combine(RomFSPath, "DllBattle.cro"); + if (!File.Exists(CRO)) + { + Util.Error("File Missing!", "DllPoke3Select.cro was not found in your RomFS folder!"); + return; + } + new TypeChart().ShowDialog(); + } + // 3DS Building private void B_Rebuild3DS_Click(object sender, EventArgs e) { diff --git a/pk3DS/Subforms/Starters.Designer.cs b/pk3DS/Subforms/Starters.Designer.cs new file mode 100644 index 0000000..fca42c9 --- /dev/null +++ b/pk3DS/Subforms/Starters.Designer.cs @@ -0,0 +1,533 @@ +namespace pk3DS +{ + partial class Starters + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.PB_G1_0 = new System.Windows.Forms.PictureBox(); + this.CB_G1_0 = new System.Windows.Forms.ComboBox(); + this.CB_G1_1 = new System.Windows.Forms.ComboBox(); + this.PB_G1_1 = new System.Windows.Forms.PictureBox(); + this.CB_G1_2 = new System.Windows.Forms.ComboBox(); + this.PB_G1_2 = new System.Windows.Forms.PictureBox(); + this.CB_G2_2 = new System.Windows.Forms.ComboBox(); + this.PB_G2_2 = new System.Windows.Forms.PictureBox(); + this.CB_G2_1 = new System.Windows.Forms.ComboBox(); + this.PB_G2_1 = new System.Windows.Forms.PictureBox(); + this.CB_G2_0 = new System.Windows.Forms.ComboBox(); + this.PB_G2_0 = new System.Windows.Forms.PictureBox(); + this.CB_G3_2 = new System.Windows.Forms.ComboBox(); + this.PB_G3_2 = new System.Windows.Forms.PictureBox(); + this.CB_G3_1 = new System.Windows.Forms.ComboBox(); + this.PB_G3_1 = new System.Windows.Forms.PictureBox(); + this.CB_G3_0 = new System.Windows.Forms.ComboBox(); + this.PB_G3_0 = new System.Windows.Forms.PictureBox(); + this.CB_G4_2 = new System.Windows.Forms.ComboBox(); + this.PB_G4_2 = new System.Windows.Forms.PictureBox(); + this.CB_G4_1 = new System.Windows.Forms.ComboBox(); + this.PB_G4_1 = new System.Windows.Forms.PictureBox(); + this.CB_G4_0 = new System.Windows.Forms.ComboBox(); + this.PB_G4_0 = new System.Windows.Forms.PictureBox(); + this.B_Save = new System.Windows.Forms.Button(); + this.B_Cancel = new System.Windows.Forms.Button(); + this.B_Randomize = new System.Windows.Forms.Button(); + this.L_Set1 = new System.Windows.Forms.Label(); + this.L_Set3 = new System.Windows.Forms.Label(); + this.L_Set4 = new System.Windows.Forms.Label(); + this.L_Set2 = new System.Windows.Forms.Label(); + this.CHK_Gen = new System.Windows.Forms.CheckBox(); + this.CHK_BST = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G1_0)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G1_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G1_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G2_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G2_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G2_0)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G3_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G3_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G3_0)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G4_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G4_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G4_0)).BeginInit(); + this.SuspendLayout(); + // + // PB_G1_0 + // + this.PB_G1_0.Location = new System.Drawing.Point(12, 30); + this.PB_G1_0.Name = "PB_G1_0"; + this.PB_G1_0.Size = new System.Drawing.Size(120, 90); + this.PB_G1_0.TabIndex = 440; + this.PB_G1_0.TabStop = false; + // + // CB_G1_0 + // + this.CB_G1_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G1_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G1_0.FormattingEnabled = true; + this.CB_G1_0.Location = new System.Drawing.Point(12, 126); + this.CB_G1_0.Name = "CB_G1_0"; + this.CB_G1_0.Size = new System.Drawing.Size(120, 21); + this.CB_G1_0.TabIndex = 441; + this.CB_G1_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // CB_G1_1 + // + this.CB_G1_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G1_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G1_1.FormattingEnabled = true; + this.CB_G1_1.Location = new System.Drawing.Point(138, 126); + this.CB_G1_1.Name = "CB_G1_1"; + this.CB_G1_1.Size = new System.Drawing.Size(120, 21); + this.CB_G1_1.TabIndex = 443; + this.CB_G1_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G1_1 + // + this.PB_G1_1.Location = new System.Drawing.Point(138, 30); + this.PB_G1_1.Name = "PB_G1_1"; + this.PB_G1_1.Size = new System.Drawing.Size(120, 90); + this.PB_G1_1.TabIndex = 442; + this.PB_G1_1.TabStop = false; + // + // CB_G1_2 + // + this.CB_G1_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G1_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G1_2.FormattingEnabled = true; + this.CB_G1_2.Location = new System.Drawing.Point(264, 126); + this.CB_G1_2.Name = "CB_G1_2"; + this.CB_G1_2.Size = new System.Drawing.Size(120, 21); + this.CB_G1_2.TabIndex = 445; + this.CB_G1_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G1_2 + // + this.PB_G1_2.Location = new System.Drawing.Point(264, 30); + this.PB_G1_2.Name = "PB_G1_2"; + this.PB_G1_2.Size = new System.Drawing.Size(120, 90); + this.PB_G1_2.TabIndex = 444; + this.PB_G1_2.TabStop = false; + // + // CB_G2_2 + // + this.CB_G2_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CB_G2_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G2_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G2_2.FormattingEnabled = true; + this.CB_G2_2.Location = new System.Drawing.Point(264, 279); + this.CB_G2_2.Name = "CB_G2_2"; + this.CB_G2_2.Size = new System.Drawing.Size(120, 21); + this.CB_G2_2.TabIndex = 451; + this.CB_G2_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G2_2 + // + this.PB_G2_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.PB_G2_2.Location = new System.Drawing.Point(264, 183); + this.PB_G2_2.Name = "PB_G2_2"; + this.PB_G2_2.Size = new System.Drawing.Size(120, 90); + this.PB_G2_2.TabIndex = 450; + this.PB_G2_2.TabStop = false; + // + // CB_G2_1 + // + this.CB_G2_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CB_G2_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G2_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G2_1.FormattingEnabled = true; + this.CB_G2_1.Location = new System.Drawing.Point(138, 279); + this.CB_G2_1.Name = "CB_G2_1"; + this.CB_G2_1.Size = new System.Drawing.Size(120, 21); + this.CB_G2_1.TabIndex = 449; + this.CB_G2_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G2_1 + // + this.PB_G2_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.PB_G2_1.Location = new System.Drawing.Point(138, 183); + this.PB_G2_1.Name = "PB_G2_1"; + this.PB_G2_1.Size = new System.Drawing.Size(120, 90); + this.PB_G2_1.TabIndex = 448; + this.PB_G2_1.TabStop = false; + // + // CB_G2_0 + // + this.CB_G2_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CB_G2_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G2_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G2_0.FormattingEnabled = true; + this.CB_G2_0.Location = new System.Drawing.Point(12, 279); + this.CB_G2_0.Name = "CB_G2_0"; + this.CB_G2_0.Size = new System.Drawing.Size(120, 21); + this.CB_G2_0.TabIndex = 447; + this.CB_G2_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G2_0 + // + this.PB_G2_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.PB_G2_0.Location = new System.Drawing.Point(12, 183); + this.PB_G2_0.Name = "PB_G2_0"; + this.PB_G2_0.Size = new System.Drawing.Size(120, 90); + this.PB_G2_0.TabIndex = 446; + this.PB_G2_0.TabStop = false; + // + // CB_G3_2 + // + this.CB_G3_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.CB_G3_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G3_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G3_2.FormattingEnabled = true; + this.CB_G3_2.Location = new System.Drawing.Point(672, 126); + this.CB_G3_2.Name = "CB_G3_2"; + this.CB_G3_2.Size = new System.Drawing.Size(120, 21); + this.CB_G3_2.TabIndex = 457; + this.CB_G3_2.Visible = false; + this.CB_G3_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G3_2 + // + this.PB_G3_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.PB_G3_2.Location = new System.Drawing.Point(672, 30); + this.PB_G3_2.Name = "PB_G3_2"; + this.PB_G3_2.Size = new System.Drawing.Size(120, 90); + this.PB_G3_2.TabIndex = 456; + this.PB_G3_2.TabStop = false; + this.PB_G3_2.Visible = false; + // + // CB_G3_1 + // + this.CB_G3_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.CB_G3_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G3_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G3_1.FormattingEnabled = true; + this.CB_G3_1.Location = new System.Drawing.Point(546, 126); + this.CB_G3_1.Name = "CB_G3_1"; + this.CB_G3_1.Size = new System.Drawing.Size(120, 21); + this.CB_G3_1.TabIndex = 455; + this.CB_G3_1.Visible = false; + this.CB_G3_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G3_1 + // + this.PB_G3_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.PB_G3_1.Location = new System.Drawing.Point(546, 30); + this.PB_G3_1.Name = "PB_G3_1"; + this.PB_G3_1.Size = new System.Drawing.Size(120, 90); + this.PB_G3_1.TabIndex = 454; + this.PB_G3_1.TabStop = false; + this.PB_G3_1.Visible = false; + // + // CB_G3_0 + // + this.CB_G3_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.CB_G3_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G3_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G3_0.FormattingEnabled = true; + this.CB_G3_0.Location = new System.Drawing.Point(420, 126); + this.CB_G3_0.Name = "CB_G3_0"; + this.CB_G3_0.Size = new System.Drawing.Size(120, 21); + this.CB_G3_0.TabIndex = 453; + this.CB_G3_0.Visible = false; + this.CB_G3_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G3_0 + // + this.PB_G3_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.PB_G3_0.Location = new System.Drawing.Point(420, 30); + this.PB_G3_0.Name = "PB_G3_0"; + this.PB_G3_0.Size = new System.Drawing.Size(120, 90); + this.PB_G3_0.TabIndex = 452; + this.PB_G3_0.TabStop = false; + this.PB_G3_0.Visible = false; + // + // CB_G4_2 + // + this.CB_G4_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CB_G4_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G4_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G4_2.FormattingEnabled = true; + this.CB_G4_2.Location = new System.Drawing.Point(672, 279); + this.CB_G4_2.Name = "CB_G4_2"; + this.CB_G4_2.Size = new System.Drawing.Size(120, 21); + this.CB_G4_2.TabIndex = 463; + this.CB_G4_2.Visible = false; + this.CB_G4_2.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G4_2 + // + this.PB_G4_2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.PB_G4_2.Location = new System.Drawing.Point(672, 183); + this.PB_G4_2.Name = "PB_G4_2"; + this.PB_G4_2.Size = new System.Drawing.Size(120, 90); + this.PB_G4_2.TabIndex = 462; + this.PB_G4_2.TabStop = false; + this.PB_G4_2.Visible = false; + // + // CB_G4_1 + // + this.CB_G4_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CB_G4_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G4_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G4_1.FormattingEnabled = true; + this.CB_G4_1.Location = new System.Drawing.Point(546, 279); + this.CB_G4_1.Name = "CB_G4_1"; + this.CB_G4_1.Size = new System.Drawing.Size(120, 21); + this.CB_G4_1.TabIndex = 461; + this.CB_G4_1.Visible = false; + this.CB_G4_1.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G4_1 + // + this.PB_G4_1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.PB_G4_1.Location = new System.Drawing.Point(546, 183); + this.PB_G4_1.Name = "PB_G4_1"; + this.PB_G4_1.Size = new System.Drawing.Size(120, 90); + this.PB_G4_1.TabIndex = 460; + this.PB_G4_1.TabStop = false; + this.PB_G4_1.Visible = false; + // + // CB_G4_0 + // + this.CB_G4_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CB_G4_0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_G4_0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_G4_0.FormattingEnabled = true; + this.CB_G4_0.Location = new System.Drawing.Point(420, 279); + this.CB_G4_0.Name = "CB_G4_0"; + this.CB_G4_0.Size = new System.Drawing.Size(120, 21); + this.CB_G4_0.TabIndex = 459; + this.CB_G4_0.Visible = false; + this.CB_G4_0.SelectedIndexChanged += new System.EventHandler(this.changeSpecies); + // + // PB_G4_0 + // + this.PB_G4_0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.PB_G4_0.Location = new System.Drawing.Point(420, 183); + this.PB_G4_0.Name = "PB_G4_0"; + this.PB_G4_0.Size = new System.Drawing.Size(120, 90); + this.PB_G4_0.TabIndex = 458; + this.PB_G4_0.TabStop = false; + this.PB_G4_0.Visible = false; + // + // B_Save + // + this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Save.Location = new System.Drawing.Point(717, 317); + this.B_Save.Name = "B_Save"; + this.B_Save.Size = new System.Drawing.Size(75, 23); + this.B_Save.TabIndex = 464; + this.B_Save.Text = "Save"; + this.B_Save.UseVisualStyleBackColor = true; + this.B_Save.Click += new System.EventHandler(this.B_Save_Click); + // + // B_Cancel + // + this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Cancel.Location = new System.Drawing.Point(636, 317); + this.B_Cancel.Name = "B_Cancel"; + this.B_Cancel.Size = new System.Drawing.Size(75, 23); + this.B_Cancel.TabIndex = 465; + this.B_Cancel.Text = "Cancel"; + this.B_Cancel.UseVisualStyleBackColor = true; + this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); + // + // B_Randomize + // + this.B_Randomize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.B_Randomize.Location = new System.Drawing.Point(12, 317); + this.B_Randomize.Name = "B_Randomize"; + this.B_Randomize.Size = new System.Drawing.Size(75, 23); + this.B_Randomize.TabIndex = 466; + this.B_Randomize.Text = "Randomize!"; + this.B_Randomize.UseVisualStyleBackColor = true; + this.B_Randomize.Click += new System.EventHandler(this.B_Randomize_Click); + // + // L_Set1 + // + this.L_Set1.AutoSize = true; + this.L_Set1.ForeColor = System.Drawing.Color.Red; + this.L_Set1.Location = new System.Drawing.Point(9, 14); + this.L_Set1.Name = "L_Set1"; + this.L_Set1.Size = new System.Drawing.Size(32, 13); + this.L_Set1.TabIndex = 467; + this.L_Set1.Text = "Set 1"; + // + // L_Set3 + // + this.L_Set3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.L_Set3.AutoSize = true; + this.L_Set3.ForeColor = System.Drawing.Color.Green; + this.L_Set3.Location = new System.Drawing.Point(416, 14); + this.L_Set3.Name = "L_Set3"; + this.L_Set3.Size = new System.Drawing.Size(32, 13); + this.L_Set3.TabIndex = 468; + this.L_Set3.Text = "Set 3"; + this.L_Set3.Visible = false; + // + // L_Set4 + // + this.L_Set4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.L_Set4.AutoSize = true; + this.L_Set4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.L_Set4.Location = new System.Drawing.Point(416, 167); + this.L_Set4.Name = "L_Set4"; + this.L_Set4.Size = new System.Drawing.Size(32, 13); + this.L_Set4.TabIndex = 469; + this.L_Set4.Text = "Set 4"; + this.L_Set4.Visible = false; + // + // L_Set2 + // + this.L_Set2.AutoSize = true; + this.L_Set2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.L_Set2.Location = new System.Drawing.Point(9, 167); + this.L_Set2.Name = "L_Set2"; + this.L_Set2.Size = new System.Drawing.Size(32, 13); + this.L_Set2.TabIndex = 470; + this.L_Set2.Text = "Set 2"; + // + // CHK_Gen + // + this.CHK_Gen.AutoSize = true; + this.CHK_Gen.Location = new System.Drawing.Point(93, 314); + this.CHK_Gen.Name = "CHK_Gen"; + this.CHK_Gen.Size = new System.Drawing.Size(104, 17); + this.CHK_Gen.TabIndex = 471; + this.CHK_Gen.Text = "Keep Same Gen"; + this.CHK_Gen.UseVisualStyleBackColor = true; + // + // CHK_BST + // + this.CHK_BST.AutoSize = true; + this.CHK_BST.Checked = true; + this.CHK_BST.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_BST.Location = new System.Drawing.Point(93, 328); + this.CHK_BST.Name = "CHK_BST"; + this.CHK_BST.Size = new System.Drawing.Size(108, 17); + this.CHK_BST.TabIndex = 472; + this.CHK_BST.Text = "Keep Similar BST"; + this.CHK_BST.UseVisualStyleBackColor = true; + // + // Starters + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(804, 352); + this.Controls.Add(this.CHK_BST); + this.Controls.Add(this.CHK_Gen); + this.Controls.Add(this.L_Set2); + this.Controls.Add(this.L_Set4); + this.Controls.Add(this.L_Set3); + this.Controls.Add(this.L_Set1); + this.Controls.Add(this.B_Randomize); + this.Controls.Add(this.B_Cancel); + this.Controls.Add(this.B_Save); + this.Controls.Add(this.CB_G4_2); + this.Controls.Add(this.PB_G4_2); + this.Controls.Add(this.CB_G4_1); + this.Controls.Add(this.PB_G4_1); + this.Controls.Add(this.CB_G4_0); + this.Controls.Add(this.PB_G4_0); + this.Controls.Add(this.CB_G3_2); + this.Controls.Add(this.PB_G3_2); + this.Controls.Add(this.CB_G3_1); + this.Controls.Add(this.PB_G3_1); + this.Controls.Add(this.CB_G3_0); + this.Controls.Add(this.PB_G3_0); + this.Controls.Add(this.CB_G2_2); + this.Controls.Add(this.PB_G2_2); + this.Controls.Add(this.CB_G2_1); + this.Controls.Add(this.PB_G2_1); + this.Controls.Add(this.CB_G2_0); + this.Controls.Add(this.PB_G2_0); + this.Controls.Add(this.CB_G1_2); + this.Controls.Add(this.PB_G1_2); + this.Controls.Add(this.CB_G1_1); + this.Controls.Add(this.PB_G1_1); + this.Controls.Add(this.CB_G1_0); + this.Controls.Add(this.PB_G1_0); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(410, 390); + this.Name = "Starters"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Starter Editor"; + ((System.ComponentModel.ISupportInitialize)(this.PB_G1_0)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G1_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G1_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G2_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G2_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G2_0)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G3_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G3_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G3_0)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G4_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G4_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_G4_0)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox PB_G1_0; + private System.Windows.Forms.ComboBox CB_G1_0; + private System.Windows.Forms.ComboBox CB_G1_1; + private System.Windows.Forms.PictureBox PB_G1_1; + private System.Windows.Forms.ComboBox CB_G1_2; + private System.Windows.Forms.PictureBox PB_G1_2; + private System.Windows.Forms.ComboBox CB_G2_2; + private System.Windows.Forms.PictureBox PB_G2_2; + private System.Windows.Forms.ComboBox CB_G2_1; + private System.Windows.Forms.PictureBox PB_G2_1; + private System.Windows.Forms.ComboBox CB_G2_0; + private System.Windows.Forms.PictureBox PB_G2_0; + private System.Windows.Forms.ComboBox CB_G3_2; + private System.Windows.Forms.PictureBox PB_G3_2; + private System.Windows.Forms.ComboBox CB_G3_1; + private System.Windows.Forms.PictureBox PB_G3_1; + private System.Windows.Forms.ComboBox CB_G3_0; + private System.Windows.Forms.PictureBox PB_G3_0; + private System.Windows.Forms.ComboBox CB_G4_2; + private System.Windows.Forms.PictureBox PB_G4_2; + private System.Windows.Forms.ComboBox CB_G4_1; + private System.Windows.Forms.PictureBox PB_G4_1; + private System.Windows.Forms.ComboBox CB_G4_0; + private System.Windows.Forms.PictureBox PB_G4_0; + private System.Windows.Forms.Button B_Save; + private System.Windows.Forms.Button B_Cancel; + private System.Windows.Forms.Button B_Randomize; + private System.Windows.Forms.Label L_Set1; + private System.Windows.Forms.Label L_Set3; + private System.Windows.Forms.Label L_Set4; + private System.Windows.Forms.Label L_Set2; + private System.Windows.Forms.CheckBox CHK_Gen; + private System.Windows.Forms.CheckBox CHK_BST; + + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Starters.cs b/pk3DS/Subforms/Starters.cs new file mode 100644 index 0000000..101407c --- /dev/null +++ b/pk3DS/Subforms/Starters.cs @@ -0,0 +1,150 @@ +using System; +using System.IO; +using System.Windows.Forms; + +namespace pk3DS +{ + public partial class Starters : Form + { + private byte[][] personal; + public Starters() + { + specieslist[0] = "---"; + Array.Resize(ref specieslist, 722); + + string[] personalList = Directory.GetFiles("personal"); + personal = new byte[personalList.Length][]; + for (int i = 0; i < personalList.Length; i++) + personal[i] = File.ReadAllBytes("personal" + Path.DirectorySeparatorChar + i.ToString("000") + ".bin"); + if (!File.Exists(CROPath)) + { + Util.Error("CRO does not exist! Closing.", CROPath); + Close(); + } + InitializeComponent(); + + // 2 sets of Starters for X/Y + // 4 sets of Starters for OR/AS + Choices = new[] + { + new[] {CB_G1_0, CB_G1_1, CB_G1_2}, + new[] {CB_G2_0, CB_G2_1, CB_G2_2}, + new[] {CB_G3_0, CB_G3_1, CB_G3_2}, + new[] {CB_G4_0, CB_G4_1, CB_G4_2}, + }; + Previews = new[] + { + new[] {PB_G1_0, PB_G1_1, PB_G1_2}, + new[] {PB_G2_0, PB_G2_1, PB_G2_2}, + new[] {PB_G3_0, PB_G3_1, PB_G3_2}, + new[] {PB_G4_0, PB_G4_1, PB_G4_2}, + }; + Labels = new[] { L_Set1, L_Set2, L_Set3, L_Set4 }; + + Width = Main.oras ? Width : Width/2 + 2; + loadData(); + } + internal static string CROPath = Path.Combine(Main.RomFSPath, "DllPoke3Select.cro"); + private string[] specieslist = Main.getText((Main.oras) ? 98 : 80); + private ComboBox[][] Choices; + private PictureBox[][] Previews; + private Label[] Labels; + private string[] StarterSummary = Main.oras + ? new[] { "Gen 3 Starters", "Gen 2 Starters", "Gen 4 Starters", "Gen 5 Starters" } + : new[] { "Gen 6 Starters", "Gen 1 Starters" }; + private byte[] Data; + private int Count = Main.oras ? 4 : 2; + private int offset = Main.oras ? 0x9FFC : 0x8E58; + private void B_Save_Click(object sender, EventArgs e) + { + saveData(); + Close(); + } + private void B_Cancel_Click(object sender, EventArgs e) + { + Close(); + } + + private void loadData() + { + Data = File.ReadAllBytes(CROPath); + for (int i = 0; i < Count; i++) + { + Labels[i].Visible = true; + Labels[i].Text = StarterSummary[i]; + for (int j = 0; j < 3; j++) + { + foreach (string s in specieslist) + Choices[i][j].Items.Add(s); + int species = BitConverter.ToUInt16(Data, offset + (i*3 + j)*0x54); + Choices[i][j].SelectedIndex = species; // changing index prompts loading of sprite + + Choices[i][j].Visible = Previews[i][j].Visible = true; + } + } + } + private void saveData() + { + for (int i = 0; i < Count; i++) + for (int j = 0; j < 3; j++) + Array.Copy( + BitConverter.GetBytes((ushort) Choices[i][j].SelectedIndex), 0, + Data, offset + (i*3 + j)*0x54, 2); + + File.WriteAllBytes(CROPath, Data); + } + + private void changeSpecies(object sender, EventArgs e) + { + // Fetch the corresponding PictureBox to update + string name = (sender as ComboBox).Name; + int group = Int32.Parse(name[4]+"") - 1; + int index = Int32.Parse(name[6]+""); + + int species = (sender as ComboBox).SelectedIndex; + Previews[group][index].Image = Util.scaleImage(Util.getSprite(species, 0, 0, 0), 3); + } + + private void B_Randomize_Click(object sender, EventArgs e) + { + bool blind = DialogResult.Yes == + Util.Prompt(MessageBoxButtons.YesNo, "Hide randomization, save, and close?", + "If you want the Starters to be a surprise :)"); + if (blind) + Hide(); + + // Iterate for each group of Starters + for (int i = 0; i < Count; i++) + { + // Get Species List + int gen = Int32.Parse(Labels[i].Text[4]+""); + int[] sL = CHK_Gen.Checked + ? Randomizer.getSpeciesList(gen==1, gen==2, gen==3, gen==4, gen==5, gen==6, false, false, false) + : Randomizer.getSpeciesList(true, true, true, true, true, true, false, false, false); + int ctr = 0; + // Assign Species + for (int j = 0; j < 3; j++) + { + int species = Randomizer.getRandomSpecies(ref sL, ref ctr); + + if (CHK_BST.Checked) // Enforce BST + { + PersonalInfo oldpkm = new PersonalInfo(personal[BitConverter.ToUInt16(Data, offset + (i * 3 + j) * 0x54)]); // Use original species cuz why not. + PersonalInfo pkm = new PersonalInfo(personal[species]); + + while (!(pkm.BST * 5 / 6 < oldpkm.BST && pkm.BST * 6 / 5 > oldpkm.BST)) + { species = Randomizer.getRandomSpecies(ref sL, ref ctr); pkm = new PersonalInfo(personal[species]); } + } + + Choices[i][j].SelectedIndex = species; + } + } + + if (blind) + { + saveData(); + Close(); + } + } + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/Starters.resx b/pk3DS/Subforms/Starters.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/pk3DS/Subforms/Starters.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/pk3DS/Subforms/TypeChart.Designer.cs b/pk3DS/Subforms/TypeChart.Designer.cs new file mode 100644 index 0000000..7566ca9 --- /dev/null +++ b/pk3DS/Subforms/TypeChart.Designer.cs @@ -0,0 +1,108 @@ +namespace pk3DS +{ + partial class TypeChart + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.PB_Chart = new System.Windows.Forms.PictureBox(); + this.B_Cancel = new System.Windows.Forms.Button(); + this.B_Save = new System.Windows.Forms.Button(); + this.L_Hover = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.PB_Chart)).BeginInit(); + this.SuspendLayout(); + // + // PB_Chart + // + this.PB_Chart.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.PB_Chart.Location = new System.Drawing.Point(12, 12); + this.PB_Chart.Name = "PB_Chart"; + this.PB_Chart.Size = new System.Drawing.Size(579, 579); + this.PB_Chart.TabIndex = 0; + this.PB_Chart.TabStop = false; + this.PB_Chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.clickMouse); + this.PB_Chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.moveMouse); + // + // B_Cancel + // + this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Cancel.Location = new System.Drawing.Point(436, 602); + this.B_Cancel.Name = "B_Cancel"; + this.B_Cancel.Size = new System.Drawing.Size(75, 23); + this.B_Cancel.TabIndex = 467; + this.B_Cancel.Text = "Cancel"; + this.B_Cancel.UseVisualStyleBackColor = true; + this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); + // + // B_Save + // + this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Save.Location = new System.Drawing.Point(517, 602); + this.B_Save.Name = "B_Save"; + this.B_Save.Size = new System.Drawing.Size(75, 23); + this.B_Save.TabIndex = 466; + this.B_Save.Text = "Save"; + this.B_Save.UseVisualStyleBackColor = true; + this.B_Save.Click += new System.EventHandler(this.B_Save_Click); + // + // L_Hover + // + this.L_Hover.AutoSize = true; + this.L_Hover.Location = new System.Drawing.Point(12, 607); + this.L_Hover.Name = "L_Hover"; + this.L_Hover.Size = new System.Drawing.Size(117, 13); + this.L_Hover.TabIndex = 468; + this.L_Hover.Text = "Effectiveness Summary"; + // + // TypeChart + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(604, 637); + this.Controls.Add(this.L_Hover); + this.Controls.Add(this.B_Cancel); + this.Controls.Add(this.B_Save); + this.Controls.Add(this.PB_Chart); + this.MaximizeBox = false; + this.MinimumSize = new System.Drawing.Size(355, 220); + this.Name = "TypeChart"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Type Chart Editor"; + ((System.ComponentModel.ISupportInitialize)(this.PB_Chart)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox PB_Chart; + private System.Windows.Forms.Button B_Cancel; + private System.Windows.Forms.Button B_Save; + private System.Windows.Forms.Label L_Hover; + + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/TypeChart.cs b/pk3DS/Subforms/TypeChart.cs new file mode 100644 index 0000000..c818318 --- /dev/null +++ b/pk3DS/Subforms/TypeChart.cs @@ -0,0 +1,159 @@ +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Windows.Forms; + +namespace pk3DS +{ + public partial class TypeChart : Form + { + internal static string CROPath = Path.Combine(Main.RomFSPath, "DllBattle.cro"); + private string[] types = Main.getText((Main.oras) ? 18 : 17); + private int offset = Main.oras ? 0x000DB428 : 0x000D12A8; + private byte[] chart = new byte[0x144]; + private byte[] CROData; + uint[] Colors = { 0xFF000000, + 0, // unused + 0xFFFF0000, + 0, // unused + 0xFFFFFFFF, + 0, 0, 0, // unused + 0xFF008000 }; + public TypeChart() + { + if (!File.Exists(CROPath)) + { + Util.Error("CRO does not exist! Closing.", CROPath); + Close(); + } + InitializeComponent(); + + CROData = File.ReadAllBytes(CROPath); + Array.Copy(CROData, offset, chart, 0, chart.Length); + + populateChart(); + } + + private void populateChart() + { + PB_Chart.Image = getGrid(32, 18, chart); + } + private Bitmap getGrid(int itemsize, int itemsPerRow, byte[] vals) + { + // set up image + int width = itemsize * itemsPerRow, + height = itemsize * vals.Length / itemsPerRow; + byte[] bmpData = new byte[4 * width * height]; + + // loop over area + for (int i = 0; i < vals.Length; i++) + { + int X = i % itemsPerRow; + int Y = i / itemsPerRow; + + uint itemColor = Colors[vals[i]]; + + // Plop into image + for (int x = 0; x < itemsize * itemsize; x++) + Buffer.BlockCopy(BitConverter.GetBytes(itemColor), 0, bmpData, + ((Y * itemsize + x % itemsize) * width * 4) + ((X * itemsize + x / itemsize) * 4), 4); + } + // slap on a grid + for (int i = 0; i < width * height; i++) + if (i % (itemsize) == 0 || (i / (itemsize * itemsPerRow)) % (itemsize) == 0) + Buffer.BlockCopy(BitConverter.GetBytes(0x17000000), 0, bmpData, + ((i / (itemsize * itemsPerRow)) * width * 4) + ((i % (itemsize * itemsPerRow)) * 4), 4); + + // assemble image + Bitmap b = new Bitmap(width, height, PixelFormat.Format32bppArgb); + BitmapData bData = b.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + System.Runtime.InteropServices.Marshal.Copy(bmpData, 0, bData.Scan0, bmpData.Length); + b.UnlockBits(bData); + return b; + } + private void B_Save_Click(object sender, EventArgs e) + { + Array.Copy(chart, 0, CROData, offset, chart.Length); + File.WriteAllBytes(CROPath, CROData); + Close(); + } + private void B_Cancel_Click(object sender, EventArgs e) + { + Close(); + } + + private void moveMouse(object sender, MouseEventArgs e) + { + int X = e.X / (32); + int Y = e.Y / (32); + if (e.X == (sender as PictureBox).Width - 1 - 2) // tweak because the furthest pixel is unused for transparent effect, and 2 px are used for border + X -= 1; + if (e.Y == (sender as PictureBox).Height - 1 - 2) + Y -= 1; + + int index = Y*18 + X; + updateLabel(X, Y, chart[index]); + } + private void clickMouse(object sender, MouseEventArgs e) + { + int X = e.X / (32); + int Y = e.Y / (32); + if (e.X == (sender as PictureBox).Width - 1 - 2) // tweak because the furthest pixel is unused for transparent effect, and 2 px are used for border + X -= 1; + if (e.Y == (sender as PictureBox).Height - 1 - 2) + Y -= 1; + + int index = Y * 18 + X; + if (e.Button == MouseButtons.Left) // Increase + switch (chart[index]) + { + case 08: + chart[index] = 4; + break; + case 04: + chart[index] = 2; + break; + case 02: + chart[index] = 0; + break; + case 00: + chart[index] = 8; + break; + } + else // Decrease + switch (chart[index]) + { + case 08: + chart[index] = 0; + break; + case 04: + chart[index] = 8; + break; + case 02: + chart[index] = 4; + break; + case 00: + chart[index] = 2; + break; + } + updateLabel(X, Y, chart[index]); + populateChart(); + } + private void updateLabel(int X, int Y, int value) + { + L_Hover.Text = String.Format("[{0}x{1}: {2}] {4} attacking {3} {5}", X.ToString("00"), Y.ToString("00"), + value.ToString("00"), types[X], types[Y], effects[value]); + } + private string[] effects = + { + "has no effect!", + "", + "is not very effective.", + "", + "does regular damage.", + "", "", "", + "is super effective!" + }; + } +} \ No newline at end of file diff --git a/pk3DS/Subforms/TypeChart.resx b/pk3DS/Subforms/TypeChart.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/pk3DS/Subforms/TypeChart.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/pk3DS/pk3DS.csproj b/pk3DS/pk3DS.csproj index 776ebbe..5298472 100644 --- a/pk3DS/pk3DS.csproj +++ b/pk3DS/pk3DS.csproj @@ -68,6 +68,18 @@ + + Form + + + TypeChart.cs + + + Form + + + Starters.cs + Form @@ -221,6 +233,12 @@ Main.cs + + TypeChart.cs + + + Starters.cs + Patch.cs