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
This commit is contained in:
goyuken 2012-09-16 17:09:52 +00:00
parent 77564c6daa
commit a87a9c1cd5
3 changed files with 47 additions and 12 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -31,13 +31,24 @@ namespace BizHawk.MultiClient.GBtools
/// <summary>
/// gambatte's default dmg colors
/// </summary>
static readonly int[] DefaultColors =
static readonly int[] DefaultCGBColors =
{
0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
};
/// <summary>
/// bsnes's default dmg colors with slight tweaking
/// </summary>
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);
}
}
}