diff --git a/Advanced badge editor.sln b/Advanced badge editor.sln new file mode 100644 index 0000000..3773bae --- /dev/null +++ b/Advanced badge editor.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Advanced badge editor", "Advanced badge editor\Advanced badge editor.csproj", "{4C035059-D88A-4011-89FA-D0960CA77BEA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4C035059-D88A-4011-89FA-D0960CA77BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C035059-D88A-4011-89FA-D0960CA77BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C035059-D88A-4011-89FA-D0960CA77BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C035059-D88A-4011-89FA-D0960CA77BEA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Advanced badge editor/Advanced badge editor icon 4.ico b/Advanced badge editor/Advanced badge editor icon 4.ico new file mode 100644 index 0000000..cc315e0 Binary files /dev/null and b/Advanced badge editor/Advanced badge editor icon 4.ico differ diff --git a/Advanced badge editor/Advanced badge editor.csproj b/Advanced badge editor/Advanced badge editor.csproj new file mode 100644 index 0000000..2a6bd8a --- /dev/null +++ b/Advanced badge editor/Advanced badge editor.csproj @@ -0,0 +1,96 @@ + + + + + Debug + AnyCPU + {4C035059-D88A-4011-89FA-D0960CA77BEA} + WinExe + Properties + Advanced_badge_editor + Advanced badge editor + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + Advanced badge editor icon 4.ico + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + \ No newline at end of file diff --git a/Advanced badge editor/App.config b/Advanced badge editor/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Advanced badge editor/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Advanced badge editor/Form1.Designer.cs b/Advanced badge editor/Form1.Designer.cs new file mode 100644 index 0000000..e460678 --- /dev/null +++ b/Advanced badge editor/Form1.Designer.cs @@ -0,0 +1,829 @@ +namespace Advanced_badge_editor +{ + partial class Form1 + { + /// + /// 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.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.label1 = new System.Windows.Forms.Label(); + this.uniqueBadgesLabel = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.totalBadgesLabel = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.setsLabel = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.NNIDLabel = new System.Windows.Forms.Label(); + this.createBadgeButton = new System.Windows.Forms.Button(); + this.createSetButton = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.badgeNameInput = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.badgeIdNumer = new System.Windows.Forms.NumericUpDown(); + this.label8 = new System.Windows.Forms.Label(); + this.badgeSidNumer = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); + this.badgeQuantityNumer = new System.Windows.Forms.NumericUpDown(); + this.importBadgeImg = new System.Windows.Forms.Button(); + this.exportBadgeImg = new System.Windows.Forms.Button(); + this.exportBadgeShp = new System.Windows.Forms.Button(); + this.importBadgeShp = new System.Windows.Forms.Button(); + this.fillBadgeShp = new System.Windows.Forms.Button(); + this.selectedBadgeNumer = new System.Windows.Forms.NumericUpDown(); + this.badge255each = new System.Windows.Forms.Button(); + this.selectSetNumer = new System.Windows.Forms.NumericUpDown(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.setNameInput = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.setIdNumer = new System.Windows.Forms.NumericUpDown(); + this.label14 = new System.Windows.Forms.Label(); + this.setStartingNumer = new System.Windows.Forms.NumericUpDown(); + this.label10 = new System.Windows.Forms.Label(); + this.setUniqueBadgesLabel = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.setTotalBadgesLabel = new System.Windows.Forms.Label(); + this.exportSetImgButton = new System.Windows.Forms.Button(); + this.importSetImgButton = new System.Windows.Forms.Button(); + this.exportBadgeImg32 = new System.Windows.Forms.Button(); + this.importBadgeImg32 = new System.Windows.Forms.Button(); + this.importBadgeShp32 = new System.Windows.Forms.Button(); + this.exportBadgeShp32 = new System.Windows.Forms.Button(); + this.fillBadgeShp32 = new System.Windows.Forms.Button(); + this.label16 = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.badgeSetIdNumer = new System.Windows.Forms.NumericUpDown(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.badgeIdNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.badgeSidNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.badgeQuantityNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.selectedBadgeNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.selectSetNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.setIdNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.setStartingNumer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.badgeSetIdNumer)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem}); + this.menuStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow; + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(710, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openDataToolStripMenuItem, + this.saveDataToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // openDataToolStripMenuItem + // + this.openDataToolStripMenuItem.Name = "openDataToolStripMenuItem"; + this.openDataToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.openDataToolStripMenuItem.Text = "Open data"; + this.openDataToolStripMenuItem.Click += new System.EventHandler(this.openDataToolStripMenuItem_Click); + // + // saveDataToolStripMenuItem + // + this.saveDataToolStripMenuItem.Enabled = false; + this.saveDataToolStripMenuItem.Name = "saveDataToolStripMenuItem"; + this.saveDataToolStripMenuItem.Size = new System.Drawing.Size(129, 22); + this.saveDataToolStripMenuItem.Text = "Save data"; + this.saveDataToolStripMenuItem.Click += new System.EventHandler(this.saveDataToolStripMenuItem_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 39); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(82, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Unique badges:"; + // + // uniqueBadgesLabel + // + this.uniqueBadgesLabel.AutoSize = true; + this.uniqueBadgesLabel.Location = new System.Drawing.Point(94, 40); + this.uniqueBadgesLabel.Name = "uniqueBadgesLabel"; + this.uniqueBadgesLabel.Size = new System.Drawing.Size(13, 13); + this.uniqueBadgesLabel.TabIndex = 2; + this.uniqueBadgesLabel.Text = "0"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 60); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(72, 13); + this.label2.TabIndex = 3; + this.label2.Text = "Total badges:"; + // + // totalBadgesLabel + // + this.totalBadgesLabel.AutoSize = true; + this.totalBadgesLabel.Location = new System.Drawing.Point(94, 61); + this.totalBadgesLabel.Name = "totalBadgesLabel"; + this.totalBadgesLabel.Size = new System.Drawing.Size(13, 13); + this.totalBadgesLabel.TabIndex = 4; + this.totalBadgesLabel.Text = "0"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 81); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 13); + this.label3.TabIndex = 5; + this.label3.Text = "Sets:"; + // + // setsLabel + // + this.setsLabel.AutoSize = true; + this.setsLabel.Location = new System.Drawing.Point(94, 82); + this.setsLabel.Name = "setsLabel"; + this.setsLabel.Size = new System.Drawing.Size(13, 13); + this.setsLabel.TabIndex = 6; + this.setsLabel.Text = "0"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(12, 102); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(37, 13); + this.label4.TabIndex = 7; + this.label4.Text = "NNID:"; + // + // NNIDLabel + // + this.NNIDLabel.AutoSize = true; + this.NNIDLabel.Location = new System.Drawing.Point(94, 103); + this.NNIDLabel.Name = "NNIDLabel"; + this.NNIDLabel.Size = new System.Drawing.Size(13, 13); + this.NNIDLabel.TabIndex = 8; + this.NNIDLabel.Text = "0"; + // + // createBadgeButton + // + this.createBadgeButton.Enabled = false; + this.createBadgeButton.Location = new System.Drawing.Point(15, 126); + this.createBadgeButton.Name = "createBadgeButton"; + this.createBadgeButton.Size = new System.Drawing.Size(108, 23); + this.createBadgeButton.TabIndex = 9; + this.createBadgeButton.Text = "Create new badge"; + this.createBadgeButton.UseVisualStyleBackColor = true; + this.createBadgeButton.Click += new System.EventHandler(this.createBadgeButton_Click); + // + // createSetButton + // + this.createSetButton.Enabled = false; + this.createSetButton.Location = new System.Drawing.Point(15, 155); + this.createSetButton.Name = "createSetButton"; + this.createSetButton.Size = new System.Drawing.Size(108, 23); + this.createSetButton.TabIndex = 10; + this.createSetButton.Text = "Create new set"; + this.createSetButton.UseVisualStyleBackColor = true; + this.createSetButton.Click += new System.EventHandler(this.createSetButton_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(262, 39); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(82, 13); + this.label5.TabIndex = 11; + this.label5.Text = "Select a badge:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(176, 91); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(70, 13); + this.label6.TabIndex = 13; + this.label6.Text = "Badge name:"; + // + // badgeNameInput + // + this.badgeNameInput.Enabled = false; + this.badgeNameInput.Location = new System.Drawing.Point(259, 87); + this.badgeNameInput.MaxLength = 69; + this.badgeNameInput.Name = "badgeNameInput"; + this.badgeNameInput.Size = new System.Drawing.Size(169, 20); + this.badgeNameInput.TabIndex = 14; + this.badgeNameInput.Text = "None"; + this.badgeNameInput.TextChanged += new System.EventHandler(this.badgeNameInput_TextChanged); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(176, 114); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(55, 13); + this.label7.TabIndex = 15; + this.label7.Text = "Badge ID:"; + // + // badgeIdNumer + // + this.badgeIdNumer.Enabled = false; + this.badgeIdNumer.Hexadecimal = true; + this.badgeIdNumer.Increment = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.badgeIdNumer.Location = new System.Drawing.Point(259, 110); + this.badgeIdNumer.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.badgeIdNumer.Name = "badgeIdNumer"; + this.badgeIdNumer.Size = new System.Drawing.Size(169, 20); + this.badgeIdNumer.TabIndex = 16; + this.badgeIdNumer.ValueChanged += new System.EventHandler(this.badgeIdNumer_ValueChanged); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(176, 137); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(77, 13); + this.label8.TabIndex = 17; + this.label8.Text = "Badge Sub ID:"; + // + // badgeSidNumer + // + this.badgeSidNumer.Enabled = false; + this.badgeSidNumer.Hexadecimal = true; + this.badgeSidNumer.Increment = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.badgeSidNumer.Location = new System.Drawing.Point(259, 133); + this.badgeSidNumer.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.badgeSidNumer.Name = "badgeSidNumer"; + this.badgeSidNumer.Size = new System.Drawing.Size(169, 20); + this.badgeSidNumer.TabIndex = 18; + this.badgeSidNumer.ValueChanged += new System.EventHandler(this.badgeSidNumer_ValueChanged); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(176, 183); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(49, 13); + this.label9.TabIndex = 19; + this.label9.Text = "Quantity:"; + // + // badgeQuantityNumer + // + this.badgeQuantityNumer.Enabled = false; + this.badgeQuantityNumer.Increment = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.badgeQuantityNumer.Location = new System.Drawing.Point(259, 179); + this.badgeQuantityNumer.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.badgeQuantityNumer.Name = "badgeQuantityNumer"; + this.badgeQuantityNumer.Size = new System.Drawing.Size(169, 20); + this.badgeQuantityNumer.TabIndex = 20; + this.badgeQuantityNumer.ValueChanged += new System.EventHandler(this.badgeQuantityNumer_ValueChanged); + // + // importBadgeImg + // + this.importBadgeImg.Enabled = false; + this.importBadgeImg.Location = new System.Drawing.Point(307, 227); + this.importBadgeImg.Name = "importBadgeImg"; + this.importBadgeImg.Size = new System.Drawing.Size(121, 23); + this.importBadgeImg.TabIndex = 21; + this.importBadgeImg.Text = "Import badge image"; + this.importBadgeImg.UseVisualStyleBackColor = true; + this.importBadgeImg.Click += new System.EventHandler(this.importBadgeImg_Click); + // + // exportBadgeImg + // + this.exportBadgeImg.Enabled = false; + this.exportBadgeImg.Location = new System.Drawing.Point(179, 227); + this.exportBadgeImg.Name = "exportBadgeImg"; + this.exportBadgeImg.Size = new System.Drawing.Size(121, 23); + this.exportBadgeImg.TabIndex = 22; + this.exportBadgeImg.Text = "Export badge image"; + this.exportBadgeImg.UseVisualStyleBackColor = true; + this.exportBadgeImg.Click += new System.EventHandler(this.exportBadgeImg_Click); + // + // exportBadgeShp + // + this.exportBadgeShp.Enabled = false; + this.exportBadgeShp.Location = new System.Drawing.Point(179, 253); + this.exportBadgeShp.Name = "exportBadgeShp"; + this.exportBadgeShp.Size = new System.Drawing.Size(121, 23); + this.exportBadgeShp.TabIndex = 23; + this.exportBadgeShp.Text = "Export badge shape"; + this.exportBadgeShp.UseVisualStyleBackColor = true; + this.exportBadgeShp.Click += new System.EventHandler(this.exportBadgeShp_Click); + // + // importBadgeShp + // + this.importBadgeShp.Enabled = false; + this.importBadgeShp.Location = new System.Drawing.Point(307, 253); + this.importBadgeShp.Name = "importBadgeShp"; + this.importBadgeShp.Size = new System.Drawing.Size(121, 23); + this.importBadgeShp.TabIndex = 24; + this.importBadgeShp.Text = "Import badge shape"; + this.importBadgeShp.UseVisualStyleBackColor = true; + this.importBadgeShp.Click += new System.EventHandler(this.importBadgeShp_Click); + // + // fillBadgeShp + // + this.fillBadgeShp.Enabled = false; + this.fillBadgeShp.Location = new System.Drawing.Point(179, 279); + this.fillBadgeShp.Name = "fillBadgeShp"; + this.fillBadgeShp.Size = new System.Drawing.Size(249, 23); + this.fillBadgeShp.TabIndex = 25; + this.fillBadgeShp.Text = "Fill badge shape to image size"; + this.fillBadgeShp.UseVisualStyleBackColor = true; + this.fillBadgeShp.Click += new System.EventHandler(this.fillBadgeShp_Click); + // + // selectedBadgeNumer + // + this.selectedBadgeNumer.Enabled = false; + this.selectedBadgeNumer.Location = new System.Drawing.Point(179, 59); + this.selectedBadgeNumer.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.selectedBadgeNumer.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.selectedBadgeNumer.Name = "selectedBadgeNumer"; + this.selectedBadgeNumer.Size = new System.Drawing.Size(249, 20); + this.selectedBadgeNumer.TabIndex = 27; + this.selectedBadgeNumer.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.selectedBadgeNumer.ValueChanged += new System.EventHandler(this.selectedBadgeNumer_ValueChanged); + // + // badge255each + // + this.badge255each.Enabled = false; + this.badge255each.Location = new System.Drawing.Point(15, 184); + this.badge255each.Name = "badge255each"; + this.badge255each.Size = new System.Drawing.Size(108, 23); + this.badge255each.TabIndex = 28; + this.badge255each.Text = "255 of each badge"; + this.badge255each.UseVisualStyleBackColor = true; + this.badge255each.Click += new System.EventHandler(this.badge255each_Click); + // + // selectSetNumer + // + this.selectSetNumer.Enabled = false; + this.selectSetNumer.Location = new System.Drawing.Point(443, 59); + this.selectSetNumer.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.selectSetNumer.Name = "selectSetNumer"; + this.selectSetNumer.Size = new System.Drawing.Size(249, 20); + this.selectSetNumer.TabIndex = 30; + this.selectSetNumer.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.selectSetNumer.ValueChanged += new System.EventHandler(this.selectSetNumer_ValueChanged); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(534, 39); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(66, 13); + this.label11.TabIndex = 31; + this.label11.Text = "Select a set:"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(440, 91); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(55, 13); + this.label12.TabIndex = 32; + this.label12.Text = "Set name:"; + // + // setNameInput + // + this.setNameInput.Enabled = false; + this.setNameInput.Location = new System.Drawing.Point(523, 87); + this.setNameInput.Name = "setNameInput"; + this.setNameInput.Size = new System.Drawing.Size(169, 20); + this.setNameInput.TabIndex = 33; + this.setNameInput.Text = "None"; + this.setNameInput.TextChanged += new System.EventHandler(this.setNameInput_TextChanged); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(440, 114); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(40, 13); + this.label13.TabIndex = 34; + this.label13.Text = "Set ID:"; + // + // setIdNumer + // + this.setIdNumer.Enabled = false; + this.setIdNumer.Hexadecimal = true; + this.setIdNumer.Increment = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.setIdNumer.Location = new System.Drawing.Point(523, 110); + this.setIdNumer.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.setIdNumer.Name = "setIdNumer"; + this.setIdNumer.Size = new System.Drawing.Size(169, 20); + this.setIdNumer.TabIndex = 35; + this.setIdNumer.ValueChanged += new System.EventHandler(this.setIdNumer_ValueChanged); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(440, 137); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(79, 13); + this.label14.TabIndex = 36; + this.label14.Text = "Starting badge:"; + // + // setStartingNumer + // + this.setStartingNumer.Enabled = false; + this.setStartingNumer.Location = new System.Drawing.Point(523, 133); + this.setStartingNumer.Maximum = new decimal(new int[] { + 0, + 1, + 0, + 0}); + this.setStartingNumer.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.setStartingNumer.Name = "setStartingNumer"; + this.setStartingNumer.Size = new System.Drawing.Size(169, 20); + this.setStartingNumer.TabIndex = 37; + this.setStartingNumer.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.setStartingNumer.ValueChanged += new System.EventHandler(this.setStartingNumer_ValueChanged); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(440, 160); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(82, 13); + this.label10.TabIndex = 38; + this.label10.Text = "Unique badges:"; + // + // setUniqueBadgesLabel + // + this.setUniqueBadgesLabel.AutoSize = true; + this.setUniqueBadgesLabel.Location = new System.Drawing.Point(523, 161); + this.setUniqueBadgesLabel.Name = "setUniqueBadgesLabel"; + this.setUniqueBadgesLabel.Size = new System.Drawing.Size(13, 13); + this.setUniqueBadgesLabel.TabIndex = 39; + this.setUniqueBadgesLabel.Text = "0"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(440, 183); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(72, 13); + this.label15.TabIndex = 40; + this.label15.Text = "Total badges:"; + // + // setTotalBadgesLabel + // + this.setTotalBadgesLabel.AutoSize = true; + this.setTotalBadgesLabel.Location = new System.Drawing.Point(523, 184); + this.setTotalBadgesLabel.Name = "setTotalBadgesLabel"; + this.setTotalBadgesLabel.Size = new System.Drawing.Size(13, 13); + this.setTotalBadgesLabel.TabIndex = 41; + this.setTotalBadgesLabel.Text = "0"; + // + // exportSetImgButton + // + this.exportSetImgButton.Enabled = false; + this.exportSetImgButton.Location = new System.Drawing.Point(443, 204); + this.exportSetImgButton.Name = "exportSetImgButton"; + this.exportSetImgButton.Size = new System.Drawing.Size(121, 23); + this.exportSetImgButton.TabIndex = 42; + this.exportSetImgButton.Text = "Export set image"; + this.exportSetImgButton.UseVisualStyleBackColor = true; + this.exportSetImgButton.Click += new System.EventHandler(this.exportSetImgButton_Click); + // + // importSetImgButton + // + this.importSetImgButton.Enabled = false; + this.importSetImgButton.Location = new System.Drawing.Point(571, 204); + this.importSetImgButton.Name = "importSetImgButton"; + this.importSetImgButton.Size = new System.Drawing.Size(121, 23); + this.importSetImgButton.TabIndex = 43; + this.importSetImgButton.Text = "Import set image"; + this.importSetImgButton.UseVisualStyleBackColor = true; + this.importSetImgButton.Click += new System.EventHandler(this.importSetImgButton_Click); + // + // exportBadgeImg32 + // + this.exportBadgeImg32.Enabled = false; + this.exportBadgeImg32.Location = new System.Drawing.Point(179, 330); + this.exportBadgeImg32.Name = "exportBadgeImg32"; + this.exportBadgeImg32.Size = new System.Drawing.Size(121, 23); + this.exportBadgeImg32.TabIndex = 22; + this.exportBadgeImg32.Text = "Export badge image"; + this.exportBadgeImg32.UseVisualStyleBackColor = true; + this.exportBadgeImg32.Click += new System.EventHandler(this.exportBadgeImg32_Click); + // + // importBadgeImg32 + // + this.importBadgeImg32.Enabled = false; + this.importBadgeImg32.Location = new System.Drawing.Point(307, 330); + this.importBadgeImg32.Name = "importBadgeImg32"; + this.importBadgeImg32.Size = new System.Drawing.Size(121, 23); + this.importBadgeImg32.TabIndex = 21; + this.importBadgeImg32.Text = "Import badge image"; + this.importBadgeImg32.UseVisualStyleBackColor = true; + this.importBadgeImg32.Click += new System.EventHandler(this.importBadgeImg32_Click); + // + // importBadgeShp32 + // + this.importBadgeShp32.Enabled = false; + this.importBadgeShp32.Location = new System.Drawing.Point(307, 356); + this.importBadgeShp32.Name = "importBadgeShp32"; + this.importBadgeShp32.Size = new System.Drawing.Size(121, 23); + this.importBadgeShp32.TabIndex = 24; + this.importBadgeShp32.Text = "Import badge shape"; + this.importBadgeShp32.UseVisualStyleBackColor = true; + this.importBadgeShp32.Click += new System.EventHandler(this.importBadgeShp32_Click); + // + // exportBadgeShp32 + // + this.exportBadgeShp32.Enabled = false; + this.exportBadgeShp32.Location = new System.Drawing.Point(179, 356); + this.exportBadgeShp32.Name = "exportBadgeShp32"; + this.exportBadgeShp32.Size = new System.Drawing.Size(121, 23); + this.exportBadgeShp32.TabIndex = 23; + this.exportBadgeShp32.Text = "Export badge shape"; + this.exportBadgeShp32.UseVisualStyleBackColor = true; + this.exportBadgeShp32.Click += new System.EventHandler(this.exportBadgeShp32_Click); + // + // fillBadgeShp32 + // + this.fillBadgeShp32.Enabled = false; + this.fillBadgeShp32.Location = new System.Drawing.Point(179, 382); + this.fillBadgeShp32.Name = "fillBadgeShp32"; + this.fillBadgeShp32.Size = new System.Drawing.Size(249, 23); + this.fillBadgeShp32.TabIndex = 25; + this.fillBadgeShp32.Text = "Fill badge shape to image size"; + this.fillBadgeShp32.UseVisualStyleBackColor = true; + this.fillBadgeShp32.Click += new System.EventHandler(this.fillBadgeShp32_Click); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(254, 206); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(99, 13); + this.label16.TabIndex = 44; + this.label16.Text = "64px x 64px Image:"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(254, 309); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(99, 13); + this.label17.TabIndex = 44; + this.label17.Text = "32px x 32px Image:"; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(176, 160); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(74, 13); + this.label18.TabIndex = 45; + this.label18.Text = "Badge Set ID:"; + // + // badgeSetIdNumer + // + this.badgeSetIdNumer.Enabled = false; + this.badgeSetIdNumer.Hexadecimal = true; + this.badgeSetIdNumer.Increment = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.badgeSetIdNumer.Location = new System.Drawing.Point(259, 156); + this.badgeSetIdNumer.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.badgeSetIdNumer.Name = "badgeSetIdNumer"; + this.badgeSetIdNumer.Size = new System.Drawing.Size(169, 20); + this.badgeSetIdNumer.TabIndex = 46; + this.badgeSetIdNumer.ValueChanged += new System.EventHandler(this.badgeSetIdNumer_ValueChanged); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(710, 435); + this.Controls.Add(this.badgeSetIdNumer); + this.Controls.Add(this.label18); + this.Controls.Add(this.label17); + this.Controls.Add(this.label16); + this.Controls.Add(this.importSetImgButton); + this.Controls.Add(this.exportSetImgButton); + this.Controls.Add(this.setTotalBadgesLabel); + this.Controls.Add(this.label15); + this.Controls.Add(this.setUniqueBadgesLabel); + this.Controls.Add(this.label10); + this.Controls.Add(this.setStartingNumer); + this.Controls.Add(this.label14); + this.Controls.Add(this.setIdNumer); + this.Controls.Add(this.label13); + this.Controls.Add(this.setNameInput); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.selectSetNumer); + this.Controls.Add(this.badge255each); + this.Controls.Add(this.selectedBadgeNumer); + this.Controls.Add(this.fillBadgeShp32); + this.Controls.Add(this.fillBadgeShp); + this.Controls.Add(this.importBadgeShp32); + this.Controls.Add(this.importBadgeShp); + this.Controls.Add(this.exportBadgeShp32); + this.Controls.Add(this.exportBadgeShp); + this.Controls.Add(this.exportBadgeImg32); + this.Controls.Add(this.exportBadgeImg); + this.Controls.Add(this.importBadgeImg32); + this.Controls.Add(this.importBadgeImg); + this.Controls.Add(this.badgeQuantityNumer); + this.Controls.Add(this.label9); + this.Controls.Add(this.badgeSidNumer); + this.Controls.Add(this.label8); + this.Controls.Add(this.badgeIdNumer); + this.Controls.Add(this.label7); + this.Controls.Add(this.badgeNameInput); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.createSetButton); + this.Controls.Add(this.createBadgeButton); + this.Controls.Add(this.NNIDLabel); + this.Controls.Add(this.label4); + this.Controls.Add(this.setsLabel); + this.Controls.Add(this.label3); + this.Controls.Add(this.totalBadgesLabel); + this.Controls.Add(this.label2); + this.Controls.Add(this.uniqueBadgesLabel); + this.Controls.Add(this.label1); + this.Controls.Add(this.menuStrip1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Name = "Form1"; + this.Text = "Advanced badge editor"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.badgeIdNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.badgeSidNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.badgeQuantityNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.selectedBadgeNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.selectSetNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.setIdNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.setStartingNumer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.badgeSetIdNumer)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openDataToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveDataToolStripMenuItem; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label uniqueBadgesLabel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label totalBadgesLabel; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label setsLabel; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label NNIDLabel; + private System.Windows.Forms.Button createBadgeButton; + private System.Windows.Forms.Button createSetButton; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox badgeNameInput; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.NumericUpDown badgeIdNumer; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.NumericUpDown badgeSidNumer; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.NumericUpDown badgeQuantityNumer; + private System.Windows.Forms.Button importBadgeImg; + private System.Windows.Forms.Button exportBadgeImg; + private System.Windows.Forms.Button exportBadgeShp; + private System.Windows.Forms.Button importBadgeShp; + private System.Windows.Forms.Button fillBadgeShp; + private System.Windows.Forms.NumericUpDown selectedBadgeNumer; + private System.Windows.Forms.Button badge255each; + private System.Windows.Forms.NumericUpDown selectSetNumer; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox setNameInput; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.NumericUpDown setIdNumer; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.NumericUpDown setStartingNumer; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label setUniqueBadgesLabel; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label setTotalBadgesLabel; + private System.Windows.Forms.Button exportSetImgButton; + private System.Windows.Forms.Button importSetImgButton; + private System.Windows.Forms.Button exportBadgeImg32; + private System.Windows.Forms.Button importBadgeImg32; + private System.Windows.Forms.Button importBadgeShp32; + private System.Windows.Forms.Button exportBadgeShp32; + private System.Windows.Forms.Button fillBadgeShp32; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.NumericUpDown badgeSetIdNumer; + } +} + diff --git a/Advanced badge editor/Form1.cs b/Advanced badge editor/Form1.cs new file mode 100644 index 0000000..fd48d80 --- /dev/null +++ b/Advanced badge editor/Form1.cs @@ -0,0 +1,623 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; + +namespace Advanced_badge_editor +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + // + // Folder browser + // + FolderBrowserDialog openData = new FolderBrowserDialog(); + FileInfo badgeData = null; + FileInfo badgeMng = null; + // + // Save info + // + uint uniqueBadges = 0; + uint totalBadges = 0; + uint sets = 0; + uint NNID = 0; + // + // + // + uint[] badgeIds = new uint[1000]; + uint[] badgeSetIds = new uint[1000]; + ushort[] badgeSids = new ushort[1000]; + ushort[] badgeQuants = new ushort[1000]; + string[] badgeNames = new string[1000]; + ushort[] badgeIndexs = new ushort[1000]; + byte[][] badgeImgs32 = new byte[1000][]; + byte[][] badgeShps32 = new byte[1000][]; + byte[][] badgeImgs64 = new byte[1000][]; + byte[][] badgeShps64 = new byte[1000][]; + // + // + // + uint[] setIds = new uint[100]; + uint[] setUniqueBadges = new uint[100]; + uint[] setTotalBadges = new uint[100]; + uint[] setBadgeIndexs = new uint[100]; + uint[] setIndexs = new uint[100]; + string[] setNames = new string[100]; + byte[][] setImgs = new byte[100][]; + // + // + // + byte[] bclim32rgb565 = { 0x43, 0x4C, 0x49, 0x4D, 0xFF, 0xFE, 0x14, 0x00, 0x00, 0x00, 0x02, 0x02, 0x28, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00 }; + byte[] bclim64rgb565 = { 0x43, 0x4C, 0x49, 0x4D, 0xFF, 0xFE, 0x14, 0x00, 0x00, 0x00, 0x02, 0x02, 0x28, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 }; + byte[] bclim32a4 = { 0x43, 0x4C, 0x49, 0x4D, 0xFF, 0xFE, 0x14, 0x00, 0x00, 0x00, 0x02, 0x02, 0x28, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00 }; + byte[] bclim64a4 = { 0x43, 0x4C, 0x49, 0x4D, 0xFF, 0xFE, 0x14, 0x00, 0x00, 0x00, 0x02, 0x02, 0x28, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00 }; + // + // + // + public void resetInfo() + { + badgeIds = new uint[1000]; + badgeSetIds = new uint[1000]; + badgeSids = new ushort[1000]; + badgeQuants = new ushort[1000]; + badgeNames = new string[1000]; + badgeIndexs = new ushort[1000]; + badgeImgs32 = new byte[1000][]; + badgeShps32 = new byte[1000][]; + badgeImgs64 = new byte[1000][]; + badgeShps64 = new byte[1000][]; + + setIds = new uint[100]; + setUniqueBadges = new uint[100]; + setTotalBadges = new uint[100]; + setBadgeIndexs = new uint[100]; + setIndexs = new uint[100]; + setNames = new string[100]; + setImgs = new byte[100][]; + + selectedBadgeNumer.Value = 1; + selectSetNumer.Value = 1; + } + // + // Open data prompt: + // + private void openDataToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openData.ShowDialog() == DialogResult.OK) + { + if (File.Exists(openData.SelectedPath + "/BadgeMngFile.dat") && File.Exists(openData.SelectedPath + "/BadgeData.dat")) + { + resetInfo(); + + badgeData = new FileInfo(openData.SelectedPath + "/BadgeData.dat"); + badgeMng = new FileInfo(openData.SelectedPath + "/BadgeMngFile.dat"); + + // Using BinaryReader to read the Hex data of each file + BinaryReader data = new BinaryReader(badgeMng.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None)); + + data.BaseStream.Position = 0x4; + sets = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + data.BaseStream.Position = 0x8; + uniqueBadges = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + data.BaseStream.Position = 0x18; + totalBadges = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + data.BaseStream.Position = 0x1C; + NNID = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + + for (int i = 0; i < uniqueBadges; i++) + { + data.BaseStream.Position = 0x3E8 + i * 0x28 + 0x4; + badgeIds[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + badgeSetIds[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + badgeIndexs[i] = BitConverter.ToUInt16(data.ReadBytes(0x2), 0); + badgeSids[i] = BitConverter.ToUInt16(data.ReadBytes(0x2), 0); + data.BaseStream.Position += 0x2; + badgeQuants[i] = BitConverter.ToUInt16(data.ReadBytes(0x2), 0); + } + + for (int i = 0; i < sets; i++) + { + data.BaseStream.Position = 0xA028 + i * 0x30 + 0x10; + setIds[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + setIndexs[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + data.BaseStream.Position += 0x4; + setUniqueBadges[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + setTotalBadges[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + setBadgeIndexs[i] = BitConverter.ToUInt32(data.ReadBytes(0x4), 0); + } + + data = new BinaryReader(badgeData.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None)); + + for (int i = 0; i < uniqueBadges; i++) + { + data.BaseStream.Position = i * 0x8A0 + 0x35E80; + badgeNames[i] = Encoding.Unicode.GetString(data.ReadBytes(0x8A)); + data.BaseStream.Position = i * 0x2800 + 0x318F80; + badgeImgs64[i] = data.ReadBytes(0x2000); + badgeShps64[i] = data.ReadBytes(0x800); + data.BaseStream.Position = i * 0xA00 + 0xCDCF80; + badgeImgs32[i] = data.ReadBytes(0x800); + badgeShps32[i] = data.ReadBytes(0x200); + } + + for (int i = 0; i < sets; i++) + { + data.BaseStream.Position = i * 0x8A0; + setNames[i] = Encoding.Unicode.GetString(data.ReadBytes(0x8A)); + data.BaseStream.Position = i * 0x2000 + 0x250F80; + setImgs[i] = data.ReadBytes(0x2000); + } + + data.Close(); + // ----- + + + + // Update the interface + badgeOptions(true); + setOptions(true); + + selectedBadgeNumer.Enabled = true; + selectedBadgeNumer.Maximum = uniqueBadges; + + selectSetNumer.Enabled = true; + selectSetNumer.Maximum = sets; + + createBadgeButton.Enabled = true; + createSetButton.Enabled = true; + badge255each.Enabled = true; + + updateAll(); + setStartingNumer.Maximum = setBadgeIndexs[1]; + saveDataToolStripMenuItem.Enabled = true; + } + else + { + MessageBox.Show("The folder you selected doesn't contain BadgeMngFile.dat nor BadgeData.dat!", "Error opening files", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + // + // Update main info about the badge data + // + public void updateAll() + { + totalBadges = 0; + foreach (ushort i in badgeQuants) + { + totalBadges += i; + } + setsLabel.Text = sets.ToString(); + totalBadgesLabel.Text = totalBadges.ToString(); + uniqueBadgesLabel.Text = uniqueBadges.ToString(); + NNIDLabel.Text = NNID.ToString(); + + updateBadgeInfo(); + updateSetInfo(); + } + // + // Enable/disable badge editing options + // + public void badgeOptions(bool enable) + { + badgeNameInput.Enabled = enable; + badgeIdNumer.Enabled = enable; + badgeSidNumer.Enabled = enable; + badgeQuantityNumer.Enabled = enable; + badgeSetIdNumer.Enabled = enable; + exportBadgeImg.Enabled = enable; + importBadgeImg.Enabled = enable; + exportBadgeShp.Enabled = enable; + importBadgeShp.Enabled = enable; + exportBadgeImg32.Enabled = enable; + importBadgeImg32.Enabled = enable; + exportBadgeShp32.Enabled = enable; + importBadgeShp32.Enabled = enable; + fillBadgeShp.Enabled = enable; + fillBadgeShp32.Enabled = enable; + } + public void setOptions(bool enable) + { + setNameInput.Enabled = enable; + setIdNumer.Enabled = enable; + setStartingNumer.Enabled = enable; + exportSetImgButton.Enabled = enable; + importSetImgButton.Enabled = enable; + } + // + // Update the information about the currently selected badge or the currently selected set + // + public void updateBadgeInfo() + { + badgeNameInput.Text = badgeNames[badgeIndexs[(int)selectedBadgeNumer.Value - 1]]; + badgeIdNumer.Value = badgeIds[(int)selectedBadgeNumer.Value - 1]; + badgeSidNumer.Value = badgeSids[(int)selectedBadgeNumer.Value - 1]; + badgeQuantityNumer.Value = badgeQuants[(int)selectedBadgeNumer.Value - 1]; + badgeSetIdNumer.Value = badgeSetIds[(int)selectedBadgeNumer.Value - 1]; + } + public void updateSetInfo() + { + setTotalBadges = new uint[100]; + setUniqueBadges = new uint[100]; + for (int i = 0; i < sets; i++) + { + for (int ii = 0; ii < uniqueBadges; ii++) + { + if ((ii >= setBadgeIndexs[i] && ii < setBadgeIndexs[i + 1]) || (i + 1 == sets && ii >= setBadgeIndexs[i])) + { + setTotalBadges[i] += badgeQuants[ii]; + setUniqueBadges[i] += 1; + } + } + } + setNameInput.Text = setNames[setIndexs[(int)selectSetNumer.Value - 1]]; + setIdNumer.Value = setIds[(int)selectSetNumer.Value - 1]; + setStartingNumer.Value = setBadgeIndexs[(int)selectSetNumer.Value - 1] + 1; + setUniqueBadgesLabel.Text = setUniqueBadges[(int)selectSetNumer.Value - 1].ToString(); + setTotalBadgesLabel.Text = setTotalBadges[(int)selectSetNumer.Value - 1].ToString(); + } + // + // Every time the badge number is changed, it updates the form with the newly selected badge's data; + // + private void selectedBadgeNumer_ValueChanged(object sender, EventArgs e) + { + updateBadgeInfo(); + } + private void selectSetNumer_ValueChanged(object sender, EventArgs e) + { + setStartingNumer.Minimum = 1; + setStartingNumer.Maximum = 4294967296; + updateSetInfo(); + if (selectSetNumer.Value > 1) + { + setStartingNumer.Minimum = setBadgeIndexs[(int)selectSetNumer.Value - 2] + 2; + } + else + { + setStartingNumer.Minimum = 1; + } + if (selectSetNumer.Value < sets) + { + setStartingNumer.Maximum = setBadgeIndexs[(int)selectSetNumer.Value]; + } + else + { + setStartingNumer.Maximum = uniqueBadges; + } + } + // + // Give 255 of each badge + // + private void badge255each_Click(object sender, EventArgs e) + { + for (int i = 0; i < uniqueBadges; i++) + { + badgeQuants[i] = 255; + } + updateAll(); + } + // + // Save the data + // + private async void saveDataToolStripMenuItem_Click(object sender, EventArgs e) + { + + if (MessageBox.Show("Are you sure you want to overwrite the old data?", "Overwrite?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + while (IsFileLocked(badgeMng)) + await Task.Delay(25); + BinaryWriter data = new BinaryWriter(badgeMng.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None)); + + data.BaseStream.Position = 0x04; + data.Write(sets); + data.Write(uniqueBadges); + data.BaseStream.Position = 0x18; + data.Write(totalBadges); + + for (int i = 0; i < uniqueBadges; i++) + { + data.BaseStream.Position = 0x3E8 + i * 0x28 + 0x4; + data.Write(badgeIds[i]); + data.Write(badgeSetIds[i]); + data.Write(badgeIndexs[i]); + data.Write(badgeSids[i]); + data.BaseStream.Position += 0x2; + data.Write(badgeQuants[i]); + } + for (int i = 0; i < sets; i++) + { + data.BaseStream.Position = 0xA028 + i * 0x30 + 0x10; + data.Write(setIds[i]); + data.Write(setIndexs[i]); + data.BaseStream.Position += 0x4; + data.Write(setUniqueBadges[i]); + data.Write(setTotalBadges[i]); + data.Write(setBadgeIndexs[i]); + } + + data.Close(); + + data = new BinaryWriter(badgeData.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None)); + + for (int i = 0; i < uniqueBadges; i++) + { + for (int ii = 0; ii < 16; ii++) + { + data.BaseStream.Position = (badgeIndexs[i] * 0x8A0) + (ii * 0x8A) + 0x35E80; + data.Write(Encoding.Unicode.GetBytes(badgeNames[badgeIndexs[i]])); + } + data.BaseStream.Position = badgeIndexs[i] * 0x2800 + 0x318F80; + data.Write(badgeImgs64[badgeIndexs[i]]); + data.Write(badgeShps64[badgeIndexs[i]]); + data.BaseStream.Position = badgeIndexs[i] * 0xA00 + 0xCDCF80; + data.Write(badgeImgs32[badgeIndexs[i]]); + data.Write(badgeShps32[badgeIndexs[i]]); + } + for (int i = 0; i < sets; i++) + { + for (int ii = 0; ii < 16; ii++) + { + data.BaseStream.Position = (setIndexs[i] * 0x8A0) + (ii * 0x8A); + data.Write(Encoding.Unicode.GetBytes(setNames[setIndexs[i]])); + } + data.BaseStream.Position = setIndexs[i] * 0x2000 + 0x250F80; + data.Write(setImgs[setIndexs[i]]); + } + + data.Close(); + } + } + // + // Allows the user to create a new badge + // + private void createBadgeButton_Click(object sender, EventArgs e) + { + uniqueBadges++; + totalBadges++; + badgeIds[uniqueBadges - 1] = uniqueBadges; + badgeSetIds[uniqueBadges - 1] = setIds[sets - 1]; + badgeSids[uniqueBadges - 1] = 0; + badgeQuants[uniqueBadges - 1] = 1; + badgeNames[uniqueBadges - 1] = "New badge"; + badgeIndexs[uniqueBadges - 1] = (ushort)(uniqueBadges - 1); + + badgeImgs64[uniqueBadges - 1] = new byte[0x2000]; + badgeShps64[uniqueBadges - 1] = new byte[0x800]; + badgeImgs32[uniqueBadges - 1] = new byte[0x800]; + badgeShps32[uniqueBadges - 1] = new byte[0x200]; + + selectedBadgeNumer.Maximum++; + selectedBadgeNumer.Value = uniqueBadges; + + updateAll(); + } + private void createSetButton_Click(object sender, EventArgs e) + { + if (setBadgeIndexs[sets - 1] < uniqueBadges - 1) + { + sets++; + setIds[sets - 1] = sets; + setNames[sets - 1] = "New set"; + setBadgeIndexs[sets - 1] = uniqueBadges - 1; + setTotalBadges[sets - 1] = 1; + setUniqueBadges[sets - 1] = 1; + setIndexs[sets - 1] = sets - 1; + setImgs[sets - 1] = new byte[0x2000]; + selectSetNumer.Maximum++; + selectSetNumer.Value = sets; + } + else + { + MessageBox.Show("Not enough unique badges for a new set!", "Not enough badges", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + // + // Allows the user to export badge and set images + // + private void exportBadgeImg_Click(object sender, EventArgs e) + { + bclimExportPrompt(badgeImgs64[badgeIndexs[(int)selectedBadgeNumer.Value - 1]], bclim64rgb565); + } + private void exportBadgeShp_Click(object sender, EventArgs e) + { + bclimExportPrompt(badgeShps64[badgeIndexs[(int)selectedBadgeNumer.Value - 1]], bclim64a4); + } + private void exportBadgeImg32_Click(object sender, EventArgs e) + { + bclimExportPrompt(badgeImgs32[badgeIndexs[(int)selectedBadgeNumer.Value - 1]], bclim32rgb565); + } + private void exportBadgeShp32_Click(object sender, EventArgs e) + { + bclimExportPrompt(badgeShps32[badgeIndexs[(int)selectedBadgeNumer.Value - 1]], bclim32a4); + } + private void exportSetImgButton_Click(object sender, EventArgs e) + { + bclimExportPrompt(setImgs[setIndexs[(int)selectSetNumer.Value - 1]], bclim64rgb565); + } + // + // Allows the user to import badge and set images + // + private void importBadgeImg_Click(object sender, EventArgs e) + { + byte[] imported = bclimImportPrompt(0x2000, bclim64rgb565); + if (imported == null) + { + MessageBox.Show("The file you imported doesn't have the right format...", "Error opening files", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + badgeImgs64[badgeIndexs[(int)selectedBadgeNumer.Value - 1]] = imported; + } + } + private void importBadgeShp_Click(object sender, EventArgs e) + { + byte[] imported = bclimImportPrompt(0x800, bclim64a4); + if (imported == null) + { + MessageBox.Show("The file you imported doesn't have the right format...", "Error opening files", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + badgeShps64[badgeIndexs[(int)selectedBadgeNumer.Value - 1]] = imported; + } + } + private void importBadgeImg32_Click(object sender, EventArgs e) + { + byte[] imported = bclimImportPrompt(0x800, bclim32rgb565); + if (imported == null) + { + MessageBox.Show("The file you imported doesn't have the right format...", "Error opening files", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + badgeImgs32[badgeIndexs[(int)selectedBadgeNumer.Value - 1]] = imported; + } + } + private void importBadgeShp32_Click(object sender, EventArgs e) + { + byte[] imported = bclimImportPrompt(0x200, bclim32a4); + if (imported == null) + { + MessageBox.Show("The file you imported doesn't have the right format...", "Error opening files", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + badgeShps32[badgeIndexs[(int)selectedBadgeNumer.Value - 1]] = imported; + } + } + private void importSetImgButton_Click(object sender, EventArgs e) + { + byte[] imported = bclimImportPrompt(0x2000, bclim64rgb565); + if (imported == null) + { + MessageBox.Show("The file you imported doesn't have the right format...", "Error opening files", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + setImgs[setIndexs[(int)selectSetNumer.Value - 1]] = imported; + } + } + // + // A file prompt for exporting a bclim file type + // + public void bclimExportPrompt(byte[] dataArray, byte[] bclimFooter) + { + SaveFileDialog export = new SaveFileDialog(); + export.Filter = "CTR-LIM File (*.bclim)|*.bclim"; + export.DefaultExt = "*.bclim"; + export.AddExtension = true; + if (export.ShowDialog() == DialogResult.OK) + { + if (File.Exists(export.FileName)) { File.Delete(export.FileName); } + BinaryWriter data = new BinaryWriter(File.OpenWrite(export.FileName)); + + data.Write(dataArray); + data.Write(bclimFooter); + + data.Close(); + } + } + public byte[] bclimImportPrompt(int length, byte[] bclimFooter) + { + OpenFileDialog import = new OpenFileDialog(); + import.Filter = "CTR-LIM File (*.bclim)|*.bclim"; + import.DefaultExt = "*.bclim"; + import.AddExtension = true; + byte[] toImport = null; + if (import.ShowDialog() == DialogResult.OK) + { + BinaryReader data = new BinaryReader(File.OpenRead(import.FileName)); + + data.BaseStream.Position = length; + if (BitConverter.ToString(data.ReadBytes(0x28)) == BitConverter.ToString(bclimFooter)) + { + data.BaseStream.Position = 0; + toImport = data.ReadBytes(length); + } + data.Close(); + } + return toImport; + } + // + // Save values to arrays + // + private void badgeNameInput_TextChanged(object sender, EventArgs e) + { + badgeNames[badgeIndexs[(int)selectedBadgeNumer.Value - 1]] = badgeNameInput.Text; + } + private void badgeIdNumer_ValueChanged(object sender, EventArgs e) + { + badgeIds[(int)selectedBadgeNumer.Value - 1] = (uint)badgeIdNumer.Value; + } + private void badgeSidNumer_ValueChanged(object sender, EventArgs e) + { + badgeSids[(int)selectedBadgeNumer.Value - 1] = (ushort)badgeSidNumer.Value; + } + private void badgeQuantityNumer_ValueChanged(object sender, EventArgs e) + { + badgeQuants[(int)selectedBadgeNumer.Value - 1] = (ushort)badgeQuantityNumer.Value; + updateAll(); + } + private void badgeSetIdNumer_ValueChanged(object sender, EventArgs e) + { + badgeSetIds[(int)selectedBadgeNumer.Value - 1] = (uint)badgeSetIdNumer.Value; + } + + private void setNameInput_TextChanged(object sender, EventArgs e) + { + setNames[setIndexs[(int)selectSetNumer.Value - 1]] = setNameInput.Text; + } + private void setIdNumer_ValueChanged(object sender, EventArgs e) + { + setIds[(int)selectSetNumer.Value - 1] = (uint)setIdNumer.Value; + } + private void setStartingNumer_ValueChanged(object sender, EventArgs e) + { + setBadgeIndexs[(int)selectSetNumer.Value - 1] = (uint)setStartingNumer.Value - 1; + updateSetInfo(); + } + + private void fillBadgeShp_Click(object sender, EventArgs e) + { + for (int i = 0; i < 0x800; i++) + { + badgeShps64[badgeIndexs[(int)selectedBadgeNumer.Value - 1]][i] = 0XFF; + } + } + private void fillBadgeShp32_Click(object sender, EventArgs e) + { + for (int i = 0; i < 0x200; i++) + { + badgeShps32[badgeIndexs[(int)selectedBadgeNumer.Value - 1]][i] = 0XFF; + } + } + + protected virtual bool IsFileLocked(FileInfo file) + { + FileStream stream = null; + try + { + stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None); + } + catch (IOException) + { + return true; + } + finally + { + if (stream != null) + stream.Close(); + } + return false; + } + } +} diff --git a/Advanced badge editor/Form1.resx b/Advanced badge editor/Form1.resx new file mode 100644 index 0000000..91374d5 --- /dev/null +++ b/Advanced badge editor/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 9, 9 + + \ No newline at end of file diff --git a/Advanced badge editor/Program.cs b/Advanced badge editor/Program.cs new file mode 100644 index 0000000..4a1949f --- /dev/null +++ b/Advanced badge editor/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Advanced_badge_editor +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Advanced badge editor/Properties/AssemblyInfo.cs b/Advanced badge editor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..41e0ab1 --- /dev/null +++ b/Advanced badge editor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Advanced badge editor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Advanced badge editor")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4c035059-d88a-4011-89fa-d0960ca77bea")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Advanced badge editor/Properties/Resources.Designer.cs b/Advanced badge editor/Properties/Resources.Designer.cs new file mode 100644 index 0000000..69e2787 --- /dev/null +++ b/Advanced badge editor/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Advanced_badge_editor.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Advanced_badge_editor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Advanced badge editor/Properties/Resources.resx b/Advanced badge editor/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Advanced badge editor/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Advanced badge editor/Properties/Settings.Designer.cs b/Advanced badge editor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f300f6d --- /dev/null +++ b/Advanced badge editor/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Advanced_badge_editor.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Advanced badge editor/Properties/Settings.settings b/Advanced badge editor/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Advanced badge editor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +