sameboy color correction option, make default for gambatte
This commit is contained in:
parent
e41d1a996e
commit
8642513572
|
@ -28,110 +28,48 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.bmpView1 = new BizHawk.Client.EmuHawk.BmpView();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.radioButton6 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton5 = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.radioButton0 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton3 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton4 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.bmpView1 = new BizHawk.Client.EmuHawk.BmpView();
|
||||
this.radioButton5 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton6 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton7 = new System.Windows.Forms.RadioButton();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.radioButton7 = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// bmpView1
|
||||
//
|
||||
this.bmpView1.Location = new System.Drawing.Point(6, 19);
|
||||
this.bmpView1.Name = "bmpView1";
|
||||
this.bmpView1.Size = new System.Drawing.Size(256, 128);
|
||||
this.bmpView1.TabIndex = 3;
|
||||
this.bmpView1.Text = "bmpView1";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.radioButton7);
|
||||
this.groupBox1.Controls.Add(this.radioButton6);
|
||||
this.groupBox1.Controls.Add(this.radioButton5);
|
||||
this.groupBox1.Controls.Add(this.radioButton0);
|
||||
this.groupBox1.Controls.Add(this.radioButton1);
|
||||
this.groupBox1.Controls.Add(this.radioButton2);
|
||||
this.groupBox1.Controls.Add(this.radioButton3);
|
||||
this.groupBox1.Controls.Add(this.radioButton4);
|
||||
this.groupBox1.Controls.Add(this.radioButton2);
|
||||
this.groupBox1.Controls.Add(this.radioButton1);
|
||||
this.groupBox1.Controls.Add(this.radioButton5);
|
||||
this.groupBox1.Controls.Add(this.radioButton6);
|
||||
this.groupBox1.Controls.Add(this.radioButton7);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(132, 182);
|
||||
this.groupBox1.Size = new System.Drawing.Size(132, 205);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Preset Select";
|
||||
//
|
||||
// radioButton6
|
||||
//
|
||||
this.radioButton6.AutoSize = true;
|
||||
this.radioButton6.Location = new System.Drawing.Point(6, 134);
|
||||
this.radioButton6.Name = "radioButton6";
|
||||
this.radioButton6.Size = new System.Drawing.Size(47, 17);
|
||||
this.radioButton6.TabIndex = 3;
|
||||
this.radioButton6.TabStop = true;
|
||||
this.radioButton6.Text = "GBA";
|
||||
this.radioButton6.UseVisualStyleBackColor = true;
|
||||
this.radioButton6.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton5
|
||||
//
|
||||
this.radioButton5.AutoSize = true;
|
||||
this.radioButton5.Location = new System.Drawing.Point(6, 111);
|
||||
this.radioButton5.Name = "radioButton5";
|
||||
this.radioButton5.Size = new System.Drawing.Size(117, 17);
|
||||
this.radioButton5.TabIndex = 2;
|
||||
this.radioButton5.TabStop = true;
|
||||
this.radioButton5.Text = "VBA Accurate (Old)";
|
||||
this.radioButton5.UseVisualStyleBackColor = true;
|
||||
this.radioButton5.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton3
|
||||
//
|
||||
this.radioButton3.AutoSize = true;
|
||||
this.radioButton3.Location = new System.Drawing.Point(6, 65);
|
||||
this.radioButton3.Name = "radioButton3";
|
||||
this.radioButton3.Size = new System.Drawing.Size(72, 17);
|
||||
this.radioButton3.TabIndex = 2;
|
||||
this.radioButton3.TabStop = true;
|
||||
this.radioButton3.Text = "VBA Vivid";
|
||||
this.radioButton3.UseVisualStyleBackColor = true;
|
||||
this.radioButton3.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton4
|
||||
//
|
||||
this.radioButton4.AutoSize = true;
|
||||
this.radioButton4.Location = new System.Drawing.Point(6, 88);
|
||||
this.radioButton4.Name = "radioButton4";
|
||||
this.radioButton4.Size = new System.Drawing.Size(92, 17);
|
||||
this.radioButton4.TabIndex = 1;
|
||||
this.radioButton4.TabStop = true;
|
||||
this.radioButton4.Text = "VBA Accurate";
|
||||
this.radioButton4.UseVisualStyleBackColor = true;
|
||||
this.radioButton4.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
this.radioButton2.AutoSize = true;
|
||||
this.radioButton2.Location = new System.Drawing.Point(6, 42);
|
||||
this.radioButton2.Name = "radioButton2";
|
||||
this.radioButton2.Size = new System.Drawing.Size(48, 17);
|
||||
this.radioButton2.TabIndex = 1;
|
||||
this.radioButton2.TabStop = true;
|
||||
this.radioButton2.Text = "Vivid";
|
||||
this.radioButton2.UseVisualStyleBackColor = true;
|
||||
this.radioButton2.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
this.radioButton1.AutoSize = true;
|
||||
this.radioButton1.Location = new System.Drawing.Point(6, 19);
|
||||
this.radioButton1.Name = "radioButton1";
|
||||
this.radioButton1.Size = new System.Drawing.Size(71, 17);
|
||||
this.radioButton1.TabIndex = 0;
|
||||
this.radioButton1.TabStop = true;
|
||||
this.radioButton1.Text = "Gambatte";
|
||||
this.radioButton1.UseVisualStyleBackColor = true;
|
||||
this.radioButton1.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.bmpView1);
|
||||
|
@ -142,19 +80,107 @@
|
|||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Preview";
|
||||
//
|
||||
// bmpView1
|
||||
// radioButton0
|
||||
//
|
||||
this.bmpView1.Location = new System.Drawing.Point(6, 19);
|
||||
this.bmpView1.Name = "bmpView1";
|
||||
this.bmpView1.Size = new System.Drawing.Size(256, 128);
|
||||
this.bmpView1.TabIndex = 3;
|
||||
this.bmpView1.Text = "bmpView1";
|
||||
this.radioButton0.AutoSize = true;
|
||||
this.radioButton0.Location = new System.Drawing.Point(6, 19);
|
||||
this.radioButton0.Name = "radioButton0";
|
||||
this.radioButton0.Size = new System.Drawing.Size(71, 17);
|
||||
this.radioButton0.TabIndex = 0;
|
||||
this.radioButton0.TabStop = true;
|
||||
this.radioButton0.Text = "SameBoy";
|
||||
this.radioButton0.UseVisualStyleBackColor = true;
|
||||
this.radioButton0.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
this.radioButton1.AutoSize = true;
|
||||
this.radioButton1.Location = new System.Drawing.Point(6, 42);
|
||||
this.radioButton1.Name = "radioButton1";
|
||||
this.radioButton1.Size = new System.Drawing.Size(71, 17);
|
||||
this.radioButton1.TabIndex = 0;
|
||||
this.radioButton1.TabStop = true;
|
||||
this.radioButton1.Text = "Gambatte";
|
||||
this.radioButton1.UseVisualStyleBackColor = true;
|
||||
this.radioButton1.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
this.radioButton2.AutoSize = true;
|
||||
this.radioButton2.Location = new System.Drawing.Point(6, 65);
|
||||
this.radioButton2.Name = "radioButton2";
|
||||
this.radioButton2.Size = new System.Drawing.Size(48, 17);
|
||||
this.radioButton2.TabIndex = 1;
|
||||
this.radioButton2.TabStop = true;
|
||||
this.radioButton2.Text = "Vivid";
|
||||
this.radioButton2.UseVisualStyleBackColor = true;
|
||||
this.radioButton2.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton3
|
||||
//
|
||||
this.radioButton3.AutoSize = true;
|
||||
this.radioButton3.Location = new System.Drawing.Point(6, 88);
|
||||
this.radioButton3.Name = "radioButton3";
|
||||
this.radioButton3.Size = new System.Drawing.Size(72, 17);
|
||||
this.radioButton3.TabIndex = 2;
|
||||
this.radioButton3.TabStop = true;
|
||||
this.radioButton3.Text = "VBA Vivid";
|
||||
this.radioButton3.UseVisualStyleBackColor = true;
|
||||
this.radioButton3.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton4
|
||||
//
|
||||
this.radioButton4.AutoSize = true;
|
||||
this.radioButton4.Location = new System.Drawing.Point(6, 111);
|
||||
this.radioButton4.Name = "radioButton4";
|
||||
this.radioButton4.Size = new System.Drawing.Size(92, 17);
|
||||
this.radioButton4.TabIndex = 1;
|
||||
this.radioButton4.TabStop = true;
|
||||
this.radioButton4.Text = "VBA Accurate";
|
||||
this.radioButton4.UseVisualStyleBackColor = true;
|
||||
this.radioButton4.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton5
|
||||
//
|
||||
this.radioButton5.AutoSize = true;
|
||||
this.radioButton5.Location = new System.Drawing.Point(6, 134);
|
||||
this.radioButton5.Name = "radioButton5";
|
||||
this.radioButton5.Size = new System.Drawing.Size(117, 17);
|
||||
this.radioButton5.TabIndex = 2;
|
||||
this.radioButton5.TabStop = true;
|
||||
this.radioButton5.Text = "VBA Accurate (Old)";
|
||||
this.radioButton5.UseVisualStyleBackColor = true;
|
||||
this.radioButton5.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton6
|
||||
//
|
||||
this.radioButton6.AutoSize = true;
|
||||
this.radioButton6.Location = new System.Drawing.Point(6, 157);
|
||||
this.radioButton6.Name = "radioButton6";
|
||||
this.radioButton6.Size = new System.Drawing.Size(47, 17);
|
||||
this.radioButton6.TabIndex = 3;
|
||||
this.radioButton6.TabStop = true;
|
||||
this.radioButton6.Text = "GBA";
|
||||
this.radioButton6.UseVisualStyleBackColor = true;
|
||||
this.radioButton6.CheckedChanged += new System.EventHandler(this.RadioButton1_CheckedChanged);
|
||||
//
|
||||
// radioButton7
|
||||
//
|
||||
this.radioButton7.AutoSize = true;
|
||||
this.radioButton7.Location = new System.Drawing.Point(6, 180);
|
||||
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);
|
||||
//
|
||||
// buttonOK
|
||||
//
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.buttonOK.Location = new System.Drawing.Point(263, 171);
|
||||
this.buttonOK.Location = new System.Drawing.Point(263, 194);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOK.TabIndex = 3;
|
||||
|
@ -165,32 +191,20 @@
|
|||
//
|
||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(344, 171);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(344, 194);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.Text = "Cancel";
|
||||
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
|
||||
//
|
||||
this.AcceptButton = this.buttonOK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.buttonCancel;
|
||||
this.ClientSize = new System.Drawing.Size(431, 206);
|
||||
this.ClientSize = new System.Drawing.Size(431, 236);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
|
@ -208,17 +222,18 @@
|
|||
|
||||
#endregion
|
||||
|
||||
private BmpView bmpView1;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.RadioButton radioButton2;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.RadioButton radioButton0;
|
||||
private System.Windows.Forms.RadioButton radioButton1;
|
||||
private System.Windows.Forms.RadioButton radioButton5;
|
||||
private System.Windows.Forms.RadioButton radioButton2;
|
||||
private System.Windows.Forms.RadioButton radioButton3;
|
||||
private System.Windows.Forms.RadioButton radioButton4;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private BmpView bmpView1;
|
||||
private System.Windows.Forms.Button buttonOK;
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
private System.Windows.Forms.RadioButton radioButton5;
|
||||
private System.Windows.Forms.RadioButton radioButton6;
|
||||
private System.Windows.Forms.RadioButton radioButton7;
|
||||
private System.Windows.Forms.Button buttonOK;
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
_type = s.CGBColors;
|
||||
switch (_type)
|
||||
{
|
||||
case GBColors.ColorType.sameboy:
|
||||
radioButton0.Checked = true;
|
||||
break;
|
||||
case GBColors.ColorType.gambatte:
|
||||
radioButton1.Checked = true;
|
||||
break;
|
||||
|
@ -76,6 +79,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void RadioButton1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender == radioButton0)
|
||||
{
|
||||
_type = GBColors.ColorType.sameboy;
|
||||
}
|
||||
|
||||
if (sender == radioButton1)
|
||||
{
|
||||
_type = GBColors.ColorType.gambatte;
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
GBColors.ColorType c = GBColors.ColorType.vivid;
|
||||
switch (o.ColorType)
|
||||
{
|
||||
case Settings.ColorTypes.SameBoy: c = GBColors.ColorType.sameboy; break;
|
||||
case Settings.ColorTypes.Gambatte: c = GBColors.ColorType.gambatte; break;
|
||||
case Settings.ColorTypes.Vivid: c = GBColors.ColorType.vivid; break;
|
||||
case Settings.ColorTypes.VbaVivid: c = GBColors.ColorType.vbavivid; break;
|
||||
|
@ -45,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
case Settings.ColorTypes.VbaGbOld: c = GBColors.ColorType.vbabgbold; break;
|
||||
case Settings.ColorTypes.BizhawkGba: c = GBColors.ColorType.gba; break;
|
||||
}
|
||||
GBColors.GetLut(c, palette);
|
||||
GBColors.GetLut(c, palette, agb: true);
|
||||
for (var i = 32768; i < 65536; i++)
|
||||
palette[i] = palette[i - 32768];
|
||||
LibmGBA.BizSetPalette(Core, palette);
|
||||
|
@ -104,6 +105,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
|
||||
public enum ColorTypes
|
||||
{
|
||||
[Display(Name = "SameBoy GBA")]
|
||||
SameBoy,
|
||||
[Display(Name = "Gambatte CGB")]
|
||||
Gambatte,
|
||||
[Display(Name = "Vivid")]
|
||||
|
|
|
@ -41,14 +41,65 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
return ret;
|
||||
}
|
||||
|
||||
private static readonly int[] sameboy_cgb_color_curve = new int[32] { 0, 6, 12, 20, 28, 36, 45, 56, 66, 76, 88, 100, 113, 125, 137, 149, 161, 172, 182, 192, 202, 210, 218, 225, 232, 238, 243, 247, 250, 252, 254, 255 };
|
||||
private static readonly int[] sameboy_agb_color_curve = new int[32] { 0, 3, 8, 14, 20, 26, 33, 40, 47, 54, 62, 70, 78, 86, 94, 103, 112, 120, 129, 138, 147, 157, 166, 176, 185, 195, 205, 215, 225, 235, 245, 255 };
|
||||
private static readonly int[] sameboy_sgb_color_curve = new int[32] { 0, 2, 5, 9, 15, 20, 27, 34, 42, 50, 58, 67, 76, 85, 94, 104, 114, 123, 133, 143, 153, 163, 173, 182, 192, 202, 211, 220, 229, 238, 247, 255 };
|
||||
|
||||
public Triple Bit5to8SameBoy(bool sgb, bool agb)
|
||||
{
|
||||
Triple ret;
|
||||
if (sgb)
|
||||
{
|
||||
ret.r = sameboy_sgb_color_curve[r];
|
||||
ret.g = sameboy_sgb_color_curve[g];
|
||||
ret.b = sameboy_sgb_color_curve[b];
|
||||
}
|
||||
else if (agb)
|
||||
{
|
||||
ret.r = sameboy_agb_color_curve[r];
|
||||
ret.g = sameboy_agb_color_curve[g];
|
||||
ret.b = sameboy_agb_color_curve[b];
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.r = sameboy_cgb_color_curve[r];
|
||||
ret.g = sameboy_cgb_color_curve[g];
|
||||
ret.b = sameboy_cgb_color_curve[b];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int ToARGB32()
|
||||
{
|
||||
return b | g << 8 | r << 16 | 255 << 24;
|
||||
}
|
||||
}
|
||||
|
||||
// sameboy's "emulate hardware" color conversion
|
||||
// this is probably the most "accurate" conversion we have
|
||||
// note: this differs based on sgb / agb being emulated
|
||||
// todo: maybe add in its "harsh reality" too? (""accuracy"")
|
||||
public static Triple SameBoyColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
Triple ret = c.Bit5to8SameBoy(sgb, agb);
|
||||
if (!sgb)
|
||||
{
|
||||
if (agb)
|
||||
{
|
||||
ret.g = (ret.g * 6 + ret.b) / 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.g = (ret.g * 3 + ret.b) / 4;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// the version of gambatte in bizhawk
|
||||
public static Triple GambatteColor(Triple c)
|
||||
public static Triple GambatteColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
Triple ret;
|
||||
ret.r = (c.r * 13 + c.g * 2 + c.b) >> 1;
|
||||
|
@ -57,7 +108,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static Triple LibretroGBCColor(Triple c)
|
||||
public static Triple LibretroGBCColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
Triple ret;
|
||||
double gammaR = Math.Pow((double)c.r / 31, 2.2);
|
||||
|
@ -73,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
}
|
||||
|
||||
// vba's default mode
|
||||
public static Triple VividVBAColor(Triple c)
|
||||
public static Triple VividVBAColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
return c.Bit5to8Bad();
|
||||
}
|
||||
|
@ -84,7 +135,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
return (int)(min + (float)(max - min) * (2.0 * (v / 31.0) - (v / 31.0) * (v / 31.0)));
|
||||
}
|
||||
|
||||
public static Triple OldVBAColor(Triple c)
|
||||
public static Triple OldVBAColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
Triple ret;
|
||||
ret.r = gbGetValue(gbGetValue(4, 14, c.g),
|
||||
|
@ -101,7 +152,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
}
|
||||
|
||||
// "gameboy colors" mode on newer versions of VBA
|
||||
public static Triple NewVBAColor(Triple c)
|
||||
public static Triple NewVBAColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
Triple ret;
|
||||
ret.r = (c.r * 13 + c.g * 2 + c.b * 1 + 8) >> 4;
|
||||
|
@ -111,7 +162,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
}
|
||||
|
||||
// as vivid as possible
|
||||
public static Triple UltraVividColor(Triple c)
|
||||
public static Triple UltraVividColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
return c.Bit5to8Good();
|
||||
}
|
||||
|
@ -123,7 +174,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
return (int)Math.Round(Math.Pow(input / 31.0, 3.5 / 2.2) * 255.0);
|
||||
}
|
||||
|
||||
public static Triple GBAColor(Triple c)
|
||||
public static Triple GBAColor(Triple c, bool sgb, bool agb)
|
||||
{
|
||||
Triple ret;
|
||||
ret.r = GBAGamma(c.r);
|
||||
|
@ -134,41 +185,43 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
public enum ColorType
|
||||
{
|
||||
sameboy,
|
||||
gambatte,
|
||||
vivid,
|
||||
vbavivid,
|
||||
vbagbnew,
|
||||
vbabgbold,
|
||||
gba,
|
||||
libretrogbc
|
||||
libretrogbc,
|
||||
}
|
||||
|
||||
public static int[] GetLut(ColorType c)
|
||||
public static int[] GetLut(ColorType c, bool sgb = false, bool agb = false)
|
||||
{
|
||||
int[] ret = new int[32768];
|
||||
GetLut(c, ret);
|
||||
GetLut(c, ret, sgb, agb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void GetLut(ColorType c, int[] dest, int offset = 0)
|
||||
public static void GetLut(ColorType c, int[] dest, bool sgb = false, bool agb = false)
|
||||
{
|
||||
Func<Triple, Triple> f = null;
|
||||
switch (c)
|
||||
Func<Triple, bool, bool, Triple> f = c switch
|
||||
{
|
||||
case ColorType.gambatte: f = GambatteColor; break;
|
||||
case ColorType.vivid: f = UltraVividColor; break;
|
||||
case ColorType.vbavivid: f = VividVBAColor; break;
|
||||
case ColorType.vbagbnew: f = NewVBAColor; break;
|
||||
case ColorType.vbabgbold: f = OldVBAColor; break;
|
||||
case ColorType.gba: f = GBAColor; break;
|
||||
case ColorType.libretrogbc: f = LibretroGBCColor; break;
|
||||
}
|
||||
ColorType.sameboy => SameBoyColor,
|
||||
ColorType.gambatte => GambatteColor,
|
||||
ColorType.vivid => UltraVividColor,
|
||||
ColorType.vbavivid => VividVBAColor,
|
||||
ColorType.vbagbnew => NewVBAColor,
|
||||
ColorType.vbabgbold => OldVBAColor,
|
||||
ColorType.gba => GBAColor,
|
||||
ColorType.libretrogbc => LibretroGBCColor,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(c)),
|
||||
};
|
||||
|
||||
int i = 0;
|
||||
for (int b = 0; b < 32; b++)
|
||||
for (int g = 0; g < 32; g++)
|
||||
for (int r = 0; r < 32; r++)
|
||||
dest[offset + i++] = f(new Triple(r, g, b)).ToARGB32();
|
||||
dest[i++] = f(new Triple(r, g, b), sgb, agb).ToARGB32();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public GambatteSettings()
|
||||
{
|
||||
GBPalette = (int[])DefaultPalette.Clone();
|
||||
CGBColors = GBColors.ColorType.gambatte;
|
||||
CGBColors = GBColors.ColorType.sameboy;
|
||||
RgbdsSyntax = true;
|
||||
ShowBorder = true;
|
||||
}
|
||||
|
|
|
@ -645,7 +645,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
public void SetCGBColors(GBColors.ColorType type)
|
||||
{
|
||||
int[] lut = GBColors.GetLut(type);
|
||||
int[] lut = GBColors.GetLut(type, IsSgb, _syncSettings.ConsoleMode is GambatteSyncSettings.ConsoleModeType.GBA);
|
||||
LibGambatte.gambatte_setcgbpalette(GambatteState, lut);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue