From a87a9c1cd5d25edd2e8495f7533dd81b2bcf44d6 Mon Sep 17 00:00:00 2001 From: goyuken Date: Sun, 16 Sep 2012 17:09:52 +0000 Subject: [PATCH] add "Default CGB" button to gambatte color chooser for default CGB grayscale if no palette at all is available, the core will internally default to the "bsnes improved" palette --- .../Consoles/Nintendo/Gameboy/Gambatte.cs | 3 ++ .../GBtools/ColorChooserForm.Designer.cs | 31 +++++++++++++------ .../GBtools/ColorChooserForm.cs | 25 +++++++++++++-- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs index 103bf74416..acd85408e8 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -46,6 +46,9 @@ namespace BizHawk.Emulation.Consoles.GB if (LibGambatte.gambatte_load(GambatteState, romdata, (uint)romdata.Length, flags) != 0) throw new Exception("gambatte_load() returned non-zero (is this not a gb or gbc rom?)"); + // set real default colors (before anyone mucks with them at all) + ChangeDMGColors(new int[] { 10798341, 8956165, 1922333, 337157, 10798341, 8956165, 1922333, 337157, 10798341, 8956165, 1922333, 337157 }); + InitSound(); Frame = 0; diff --git a/BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs b/BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs index eb3b566ad8..0bdb84d96b 100644 --- a/BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs +++ b/BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs @@ -53,6 +53,7 @@ this.textBox1 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.DefaultButton = new System.Windows.Forms.Button(); + this.DefaultButtonCGB = new System.Windows.Forms.Button(); this.SuspendLayout(); // // panel1 @@ -194,7 +195,7 @@ // this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OK.Location = new System.Drawing.Point(140, 221); + this.OK.Location = new System.Drawing.Point(143, 221); this.OK.Name = "OK"; this.OK.Size = new System.Drawing.Size(75, 23); this.OK.TabIndex = 22; @@ -206,7 +207,7 @@ // this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(221, 221); + this.Cancel.Location = new System.Drawing.Point(224, 221); this.Cancel.Name = "Cancel"; this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.TabIndex = 23; @@ -245,7 +246,7 @@ // // buttonLoad // - this.buttonLoad.Location = new System.Drawing.Point(42, 137); + this.buttonLoad.Location = new System.Drawing.Point(17, 137); this.buttonLoad.Name = "buttonLoad"; this.buttonLoad.Size = new System.Drawing.Size(60, 23); this.buttonLoad.TabIndex = 28; @@ -255,7 +256,7 @@ // // buttonSave // - this.buttonSave.Location = new System.Drawing.Point(112, 137); + this.buttonSave.Location = new System.Drawing.Point(83, 137); this.buttonSave.Name = "buttonSave"; this.buttonSave.Size = new System.Drawing.Size(60, 23); this.buttonSave.TabIndex = 29; @@ -265,13 +266,13 @@ // // textBox1 // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.BackColor = System.Drawing.SystemColors.Control; this.textBox1.Location = new System.Drawing.Point(17, 195); this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(279, 20); + this.textBox1.Size = new System.Drawing.Size(282, 20); this.textBox1.TabIndex = 30; // // label4 @@ -286,7 +287,7 @@ // // DefaultButton // - this.DefaultButton.Location = new System.Drawing.Point(178, 137); + this.DefaultButton.Location = new System.Drawing.Point(149, 137); this.DefaultButton.Name = "DefaultButton"; this.DefaultButton.Size = new System.Drawing.Size(60, 23); this.DefaultButton.TabIndex = 32; @@ -294,6 +295,16 @@ this.DefaultButton.UseVisualStyleBackColor = true; this.DefaultButton.Click += new System.EventHandler(this.DefaultButton_Click); // + // DefaultButtonCGB + // + this.DefaultButtonCGB.Location = new System.Drawing.Point(215, 137); + this.DefaultButtonCGB.Name = "DefaultButtonCGB"; + this.DefaultButtonCGB.Size = new System.Drawing.Size(75, 23); + this.DefaultButtonCGB.TabIndex = 33; + this.DefaultButtonCGB.Text = "Default &CGB"; + this.DefaultButtonCGB.UseVisualStyleBackColor = true; + this.DefaultButtonCGB.Click += new System.EventHandler(this.DefaultButtonCGB_Click); + // // ColorChooserForm // this.AcceptButton = this.OK; @@ -301,7 +312,8 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(310, 254); + this.ClientSize = new System.Drawing.Size(313, 254); + this.Controls.Add(this.DefaultButtonCGB); this.Controls.Add(this.DefaultButton); this.Controls.Add(this.label4); this.Controls.Add(this.textBox1); @@ -364,5 +376,6 @@ private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button DefaultButton; + private System.Windows.Forms.Button DefaultButtonCGB; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/GBtools/ColorChooserForm.cs b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs index f8543a0329..21a9edf213 100644 --- a/BizHawk.MultiClient/GBtools/ColorChooserForm.cs +++ b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs @@ -31,13 +31,24 @@ namespace BizHawk.MultiClient.GBtools /// /// gambatte's default dmg colors /// - static readonly int[] DefaultColors = + static readonly int[] DefaultCGBColors = { 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000, 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000, 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000, }; + /// + /// bsnes's default dmg colors with slight tweaking + /// + static readonly int[] DefaultDMGColors = + { + 10798341, 8956165, 1922333, 337157, + 10798341, 8956165, 1922333, 337157, + 10798341, 8956165, 1922333, 337157, + }; + + private void RefreshAllBackdrops() { @@ -236,7 +247,7 @@ namespace BizHawk.MultiClient.GBtools //if (colors != null) // dlg.SetAllColors(colors); - dlg.SetAllColors(DefaultColors); + dlg.SetAllColors(DefaultDMGColors); dlg.textBox1.Text = "(none)"; dlg.currentfile = ""; dlg.filemodified = false; @@ -379,7 +390,15 @@ namespace BizHawk.MultiClient.GBtools textBox1.Text = "(none)"; currentfile = ""; filemodified = false; - SetAllColors(DefaultColors); + SetAllColors(DefaultDMGColors); + } + + private void DefaultButtonCGB_Click(object sender, EventArgs e) + { + textBox1.Text = "(none)"; + currentfile = ""; + filemodified = false; + SetAllColors(DefaultCGBColors); } } }