Undo Previous PR on Gambatte Colors and Implement an Option (#1918)

* Revert "New GBC LCD correction for Gambatte palette from documented shader research https://forums.libretro.com/t/real-gba-and-ds-phat-colors/1540"

This reverts commit 88cda24876.

* Implement the libretro GBC color palette as an added option instead of a change to the Gambatte option
This commit is contained in:
TiKevin83 2020-04-08 20:41:50 -04:00 committed by GitHub
parent b960351732
commit faf4b02c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 204 additions and 162 deletions

View File

@ -39,12 +39,14 @@
this.bmpView1 = new BizHawk.Client.EmuHawk.BmpView(); this.bmpView1 = new BizHawk.Client.EmuHawk.BmpView();
this.buttonOK = new System.Windows.Forms.Button(); this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button();
this.radioButton7 = new System.Windows.Forms.RadioButton();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.radioButton7);
this.groupBox1.Controls.Add(this.radioButton6); this.groupBox1.Controls.Add(this.radioButton6);
this.groupBox1.Controls.Add(this.radioButton5); this.groupBox1.Controls.Add(this.radioButton5);
this.groupBox1.Controls.Add(this.radioButton3); this.groupBox1.Controls.Add(this.radioButton3);
@ -57,6 +59,7 @@
this.groupBox1.TabIndex = 0; this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Preset Select"; this.groupBox1.Text = "Preset Select";
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
// //
// radioButton6 // radioButton6
// //
@ -170,6 +173,18 @@
this.buttonCancel.Text = "Cancel"; this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.UseVisualStyleBackColor = true;
// //
// radioButton7
//
this.radioButton7.AutoSize = true;
this.radioButton7.Location = new System.Drawing.Point(6, 157);
this.radioButton7.Name = "radioButton7";
this.radioButton7.Size = new System.Drawing.Size(85, 17);
this.radioButton7.TabIndex = 4;
this.radioButton7.TabStop = true;
this.radioButton7.Text = "Libretro GBC";
this.radioButton7.UseVisualStyleBackColor = true;
this.radioButton7.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
//
// CGBColorChooserForm // CGBColorChooserForm
// //
this.AcceptButton = this.buttonOK; this.AcceptButton = this.buttonOK;
@ -182,7 +197,6 @@
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::BizHawk.Client.EmuHawk.Properties.Resources.gambatte_MultiSize;
this.Name = "CGBColorChooserForm"; this.Name = "CGBColorChooserForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Game Boy Color Palette Config"; this.Text = "Game Boy Color Palette Config";
@ -206,5 +220,6 @@
private System.Windows.Forms.Button buttonOK; private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.RadioButton radioButton6; private System.Windows.Forms.RadioButton radioButton6;
private System.Windows.Forms.RadioButton radioButton7;
} }
} }

View File

@ -39,6 +39,9 @@ namespace BizHawk.Client.EmuHawk
case GBColors.ColorType.gba: case GBColors.ColorType.gba:
radioButton6.Checked = true; radioButton6.Checked = true;
break; break;
case GBColors.ColorType.libretrogbc:
radioButton7.Checked = true;
break;
} }
} }
@ -101,6 +104,11 @@ namespace BizHawk.Client.EmuHawk
_type = GBColors.ColorType.gba; _type = GBColors.ColorType.gba;
} }
if (sender == radioButton7)
{
_type = GBColors.ColorType.libretrogbc;
}
if (sender is RadioButton radioButton && radioButton.Checked) if (sender is RadioButton radioButton && radioButton.Checked)
{ {
RefreshType(); RefreshType();
@ -117,5 +125,10 @@ namespace BizHawk.Client.EmuHawk
s.CGBColors = dlg._type; s.CGBColors = dlg._type;
} }
} }
private void groupBox1_Enter(object sender, EventArgs e)
{
}
} }
} }

View File

@ -51,6 +51,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
public static Triple GambatteColor(Triple c) public static Triple GambatteColor(Triple c)
{ {
Triple ret; Triple ret;
ret.r = (c.r * 13 + c.g * 2 + c.b) >> 1;
ret.g = (c.g * 3 + c.b) << 1;
ret.b = (c.r * 3 + c.g * 2 + c.b * 11) >> 1;
return ret;
}
public static Triple LibretroGBCColor(Triple c)
{
Triple ret;
ret.r = (c.r * 13 + c.g * 2 + c.b) >> 1;
ret.g = (c.g * 3 + c.b) << 1;
ret.b = (c.r * 3 + c.g * 2 + c.b * 11) >> 1;
double gammaR = Math.Pow((double)c.r / 31, 2.2); double gammaR = Math.Pow((double)c.r / 31, 2.2);
double gammaG = Math.Pow((double)c.g / 31, 2.2); double gammaG = Math.Pow((double)c.g / 31, 2.2);
double gammaB = Math.Pow((double)c.b / 31, 2.2); double gammaB = Math.Pow((double)c.b / 31, 2.2);
@ -130,7 +142,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
vbavivid, vbavivid,
vbagbnew, vbagbnew,
vbabgbold, vbabgbold,
gba gba,
libretrogbc
} }
public static int[] GetLut(ColorType c) public static int[] GetLut(ColorType c)
@ -151,6 +164,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
case ColorType.vbagbnew: f = NewVBAColor; break; case ColorType.vbagbnew: f = NewVBAColor; break;
case ColorType.vbabgbold: f = OldVBAColor; break; case ColorType.vbabgbold: f = OldVBAColor; break;
case ColorType.gba: f = GBAColor; break; case ColorType.gba: f = GBAColor; break;
case ColorType.libretrogbc: f = LibretroGBCColor; break;
} }
int i = 0; int i = 0;