gambatte dmg palette editor. blah.

This commit is contained in:
goyuken 2012-09-12 22:18:51 +00:00
parent ae4dfbc00e
commit 03caa3b32f
8 changed files with 939 additions and 242 deletions

View File

@ -117,6 +117,12 @@
<Compile Include="Consoles\Intellivision\MemoryMap.cs" />
<Compile Include="Consoles\Intellivision\PSG.cs" />
<Compile Include="Consoles\Intellivision\STIC.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\ColorChooserForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Consoles\Nintendo\Gameboy\ColorChooserForm.Designer.cs">
<DependentUpon>ColorChooserForm.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\Gameboy\Gambatte.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\LibGambatte.cs" />
<Compile Include="Consoles\Nintendo\NES\APU.cs" />
@ -428,6 +434,11 @@
<None Include="Consoles\Nintendo\NES\Docs\MapperCompatibilityList.url" />
<None Include="Consoles\Nintendo\NES\Docs\nesasm.pdf" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Consoles\Nintendo\Gameboy\ColorChooserForm.resx">
<DependentUpon>ColorChooserForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">"$(SolutionDir)subwcrev.bat" "$(ProjectDir)"</PreBuildEvent>

View File

@ -0,0 +1,366 @@
namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
{
partial class ColorChooserForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.panel9 = new System.Windows.Forms.Panel();
this.panel10 = new System.Windows.Forms.Panel();
this.panel11 = new System.Windows.Forms.Panel();
this.panel12 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel13 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Location = new System.Drawing.Point(42, 34);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(40, 32);
this.panel1.TabIndex = 0;
this.panel1.Click += new System.EventHandler(this.panel12_Click);
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel2.Location = new System.Drawing.Point(88, 34);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(40, 32);
this.panel2.TabIndex = 1;
this.panel2.Click += new System.EventHandler(this.panel12_Click);
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel3.Location = new System.Drawing.Point(134, 34);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(40, 32);
this.panel3.TabIndex = 2;
this.panel3.Click += new System.EventHandler(this.panel12_Click);
//
// panel4
//
this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel4.Location = new System.Drawing.Point(180, 34);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(40, 32);
this.panel4.TabIndex = 3;
this.panel4.Click += new System.EventHandler(this.panel12_Click);
//
// panel5
//
this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel5.Location = new System.Drawing.Point(42, 72);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(40, 32);
this.panel5.TabIndex = 4;
this.panel5.Click += new System.EventHandler(this.panel12_Click);
//
// panel6
//
this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel6.Location = new System.Drawing.Point(88, 72);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(40, 32);
this.panel6.TabIndex = 5;
this.panel6.Click += new System.EventHandler(this.panel12_Click);
//
// panel7
//
this.panel7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel7.Location = new System.Drawing.Point(134, 72);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(40, 32);
this.panel7.TabIndex = 6;
this.panel7.Click += new System.EventHandler(this.panel12_Click);
//
// panel8
//
this.panel8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel8.Location = new System.Drawing.Point(180, 72);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(40, 32);
this.panel8.TabIndex = 7;
this.panel8.Click += new System.EventHandler(this.panel12_Click);
//
// panel9
//
this.panel9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel9.Location = new System.Drawing.Point(42, 110);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(40, 32);
this.panel9.TabIndex = 8;
this.panel9.Click += new System.EventHandler(this.panel12_Click);
//
// panel10
//
this.panel10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel10.Location = new System.Drawing.Point(88, 110);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(40, 32);
this.panel10.TabIndex = 9;
this.panel10.Click += new System.EventHandler(this.panel12_Click);
//
// panel11
//
this.panel11.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel11.Location = new System.Drawing.Point(134, 110);
this.panel11.Name = "panel11";
this.panel11.Size = new System.Drawing.Size(40, 32);
this.panel11.TabIndex = 10;
this.panel11.Click += new System.EventHandler(this.panel12_Click);
//
// panel12
//
this.panel12.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel12.Location = new System.Drawing.Point(180, 110);
this.panel12.Name = "panel12";
this.panel12.Size = new System.Drawing.Size(40, 32);
this.panel12.TabIndex = 11;
this.panel12.Click += new System.EventHandler(this.panel12_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 43);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(22, 13);
this.label1.TabIndex = 12;
this.label1.Text = "BG";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 82);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(27, 13);
this.label2.TabIndex = 13;
this.label2.Text = "SP1";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(27, 13);
this.label3.TabIndex = 14;
this.label3.Text = "SP2";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(21, 150);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(15, 13);
this.label4.TabIndex = 15;
this.label4.Text = "R";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 176);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(15, 13);
this.label5.TabIndex = 16;
this.label5.Text = "G";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(22, 202);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(14, 13);
this.label6.TabIndex = 17;
this.label6.Text = "B";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(42, 148);
this.numericUpDown1.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(120, 20);
this.numericUpDown1.TabIndex = 18;
this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(42, 174);
this.numericUpDown2.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(120, 20);
this.numericUpDown2.TabIndex = 19;
this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
//
// numericUpDown3
//
this.numericUpDown3.Location = new System.Drawing.Point(42, 200);
this.numericUpDown3.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown3.Name = "numericUpDown3";
this.numericUpDown3.Size = new System.Drawing.Size(120, 20);
this.numericUpDown3.TabIndex = 20;
this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(45, 7);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(85, 13);
this.label7.TabIndex = 21;
this.label7.Text = "Select Pal Entry:";
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(42, 226);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 22;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(123, 226);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 23;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
//
// panel13
//
this.panel13.Location = new System.Drawing.Point(168, 150);
this.panel13.Name = "panel13";
this.panel13.Size = new System.Drawing.Size(52, 70);
this.panel13.TabIndex = 24;
//
// ColorChooserForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(231, 259);
this.Controls.Add(this.panel13);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label7);
this.Controls.Add(this.numericUpDown3);
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.panel12);
this.Controls.Add(this.panel11);
this.Controls.Add(this.panel10);
this.Controls.Add(this.panel9);
this.Controls.Add(this.panel8);
this.Controls.Add(this.panel7);
this.Controls.Add(this.panel6);
this.Controls.Add(this.panel5);
this.Controls.Add(this.panel4);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "ColorChooserForm";
this.Text = "ColorChooserForm";
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.Panel panel12;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.NumericUpDown numericUpDown3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Panel panel13;
}
}

View File

@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
{
public partial class ColorChooserForm : Form
{
public ColorChooserForm()
{
InitializeComponent();
}
Color[] colors = new Color[12];
int selectedcolor = -1;
Panel currentpanel = null;
bool refreshingcolors = false;
private void RefreshColors(bool changenumeric)
{
refreshingcolors = true;
if (selectedcolor == -1)
{
panel13.BackColor = DefaultBackColor;
}
else
{
panel13.BackColor = colors[selectedcolor];
if (changenumeric)
{
numericUpDown1.Value = colors[selectedcolor].R;
numericUpDown2.Value = colors[selectedcolor].G;
numericUpDown3.Value = colors[selectedcolor].B;
}
if (currentpanel != null)
currentpanel.BackColor = colors[selectedcolor];
}
refreshingcolors = false;
}
private void panel12_Click(object _sender, EventArgs e)
{
Panel sender = (Panel)_sender;
int i;
if (sender == panel1)
i = 0;
else if (sender == panel2)
i = 1;
else if (sender == panel3)
i = 2;
else if (sender == panel4)
i = 3;
else if (sender == panel5)
i = 4;
else if (sender == panel6)
i = 5;
else if (sender == panel7)
i = 6;
else if (sender == panel8)
i = 7;
else if (sender == panel9)
i = 8;
else if (sender == panel10)
i = 9;
else if (sender == panel11)
i = 10;
else if (sender == panel12)
i = 11;
else
i = -1;
selectedcolor = i;
currentpanel = sender;
RefreshColors(true);
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
if (refreshingcolors)
return;
if (selectedcolor != -1)
{
colors[selectedcolor] = Color.FromArgb(
(int)numericUpDown1.Value,
(int)numericUpDown2.Value,
(int)numericUpDown3.Value
);
RefreshColors(false);
}
}
private void SetColorsOnce()
{
panel1.BackColor = colors[0];
panel2.BackColor = colors[1];
panel3.BackColor = colors[2];
panel4.BackColor = colors[3];
panel5.BackColor = colors[4];
panel6.BackColor = colors[5];
panel7.BackColor = colors[6];
panel8.BackColor = colors[7];
panel9.BackColor = colors[8];
panel10.BackColor = colors[9];
panel11.BackColor = colors[10];
panel12.BackColor = colors[11];
}
public static bool DoColorChooserFormDialog(int[] colors)
{
using (var dlg = new ColorChooserForm())
{
for (int i = 0; i < dlg.colors.Length; i++)
dlg.colors[i] = Color.FromArgb(255, Color.FromArgb(colors[i]));
dlg.SetColorsOnce();
var result = dlg.ShowDialog();
if (result != DialogResult.OK)
{
return false;
}
else
{
for (int i = 0; i < dlg.colors.Length; i++)
colors[i] = dlg.colors[i].ToArgb();
return true;
}
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -422,6 +422,43 @@ namespace BizHawk.Emulation.Consoles.GB
get { return 0; }
}
/// <summary>
/// palette colors to display in dmg mode
/// </summary>
int[] dmgcolors = { // these are gambatte's default colors
0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
};
/// <summary>
/// pops up a modal dialog which allows dmg palettes
/// </summary>
/// <param name="parent"></param>
public void EditDMGColors(System.Windows.Forms.IWin32Window parent)
{
int[] tempcolors = (int[])dmgcolors.Clone();
// fixme: everything gets all un-fun in msvs when folders don't match namespaces
if (BizHawk.Emulation.Consoles.Nintendo.Gameboy.ColorChooserForm.DoColorChooserFormDialog(tempcolors))
{
dmgcolors = tempcolors;
SendColorsToCore();
}
}
/// <summary>
/// update gambatte core's internal colors
/// </summary>
void SendColorsToCore()
{
for (int i = 0; i < dmgcolors.Length; i++)
LibGambatte.gambatte_setdmgpalettecolor(GambatteState, (LibGambatte.PalType)(i / 4), (uint)i % 4, (uint)dmgcolors[i]);
}
#endregion
#region ISoundProvider

View File

@ -93,8 +93,8 @@ namespace BizHawk.Emulation.Consoles.GB
///
/// </summary>
/// <param name="core">opaque state pointer</param>
/// <param name="palnum">0 <= palNum < 3. One of BG_PALETTE, SP1_PALETTE and SP2_PALETTE.</param>
/// <param name="colornum">0 <= colorNum < 4</param>
/// <param name="palnum">in [0, 2]: One of BG_PALETTE, SP1_PALETTE and SP2_PALETTE.</param>
/// <param name="colornum">in [0, 3]</param>
/// <param name="rgb32"></param>
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void gambatte_setdmgpalettecolor(IntPtr core, PalType palnum, uint colornum, uint rgb32);

File diff suppressed because it is too large Load Diff

View File

@ -3435,9 +3435,21 @@ namespace BizHawk.MultiClient
var sram = new byte[Global.Emulator.ReadSaveRam.Length];
if (Global.Emulator is LibsnesCore)
((LibsnesCore)Global.Emulator).StoreSaveRam(sram);
else Array.Copy(sram, Global.Emulator.ReadSaveRam, Global.Emulator.ReadSaveRam.Length);
else if (Global.Emulator is Gameboy)
// todo: i don't like this at all. there's no guarantee that a 0-filled sram is even an accurate clear?
throw new Exception("Please fix me!");
else
Array.Copy(sram, Global.Emulator.ReadSaveRam, Global.Emulator.ReadSaveRam.Length);
}
catch { }
}
private void changeDMGPalettesToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Global.Emulator is Gameboy)
{
((Gameboy)Global.Emulator).EditDMGColors(this);
}
}
}
}