diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index b41c4e7ed3..efc5488022 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -117,12 +117,6 @@
-
- Form
-
-
- ColorChooserForm.cs
-
@@ -436,11 +430,6 @@
-
-
- ColorChooserForm.cs
-
-
"$(SolutionDir)subwcrev.bat" "$(ProjectDir)"
diff --git a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs
index 9160e5af2e..1f99a24019 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/Gameboy/Gambatte.cs
@@ -82,7 +82,14 @@ namespace BizHawk.Emulation.Consoles.GB
return CurrentButtons;
}
-
+ ///
+ /// true if the emulator is currently emulating CGB
+ ///
+ ///
+ public bool IsCGBMode()
+ {
+ return (LibGambatte.gambatte_iscgb(GambatteState));
+ }
public void FrameAdvance(bool render)
{
@@ -461,38 +468,13 @@ namespace BizHawk.Emulation.Consoles.GB
#region palette
- ///
- /// palette colors to display in dmg mode
- ///
- int[] dmgcolors = { // these are gambatte's default colors
- 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
- 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
- 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
- };
-
- ///
- /// pops up a modal dialog which allows dmg palettes
- ///
- ///
- 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();
- }
- }
-
///
/// update gambatte core's internal colors
///
- void SendColorsToCore()
+ public void ChangeDMGColors(int[] colors)
{
- for (int i = 0; i < dmgcolors.Length; i++)
- LibGambatte.gambatte_setdmgpalettecolor(GambatteState, (LibGambatte.PalType)(i / 4), (uint)i % 4, (uint)dmgcolors[i]);
+ for (int i = 0; i < 12; i++)
+ LibGambatte.gambatte_setdmgpalettecolor(GambatteState, (LibGambatte.PalType)(i / 4), (uint)i % 4, (uint)colors[i]);
}
#endregion
diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
index db0ac50454..9fea92f0b6 100644
--- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj
+++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
@@ -188,6 +188,12 @@
+
+ Form
+
+
+ ColorChooserForm.cs
+
@@ -382,6 +388,9 @@
GifAnimator.cs
+
+ ColorChooserForm.cs
+
MainForm.cs
Designer
diff --git a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.Designer.cs b/BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs
similarity index 96%
rename from BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.Designer.cs
rename to BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs
index b064c6e538..24bf66cb70 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.Designer.cs
+++ b/BizHawk.MultiClient/GBtools/ColorChooserForm.Designer.cs
@@ -1,4 +1,4 @@
-namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
+namespace BizHawk.MultiClient.GBtools
{
partial class ColorChooserForm
{
diff --git a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.cs b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs
similarity index 87%
rename from BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.cs
rename to BizHawk.MultiClient/GBtools/ColorChooserForm.cs
index 125cc0c14e..59b8f11fc6 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.cs
+++ b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs
@@ -8,7 +8,7 @@ using System.Text;
using System.Windows.Forms;
using System.IO;
-namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
+namespace BizHawk.MultiClient.GBtools
{
public partial class ColorChooserForm : Form
{
@@ -19,6 +19,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
Color[] colors = new Color[12];
+ ///
+ /// gambatte's default dmg colors
+ ///
+ static readonly int[] DefaultColors =
+ {
+ 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
+ 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
+ 0x00ffffff, 0x00aaaaaa, 0x00555555, 0x00000000,
+ };
+
+
private void RefreshAllBackdrops()
{
panel1.BackColor = colors[0];
@@ -203,21 +214,25 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
RefreshAllBackdrops();
}
- public static bool DoColorChooserFormDialog(int[] colors)
+ public static bool DoColorChooserFormDialog(Action ColorUpdater, IWin32Window parent)
{
using (var dlg = new ColorChooserForm())
{
- dlg.SetAllColors(colors);
+ //if (colors != null)
+ // dlg.SetAllColors(colors);
+ dlg.SetAllColors(DefaultColors);
- var result = dlg.ShowDialog();
+ var result = dlg.ShowDialog(parent);
if (result != DialogResult.OK)
{
return false;
}
else
{
- for (int i = 0; i < dlg.colors.Length; i++)
- colors[i] = dlg.colors[i].ToArgb();
+ int[] colorints = new int[12];
+ for (int i = 0; i < 12; i++)
+ colorints[i] = dlg.colors[i].ToArgb();
+ ColorUpdater(colorints);
return true;
}
}
diff --git a/BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.resx b/BizHawk.MultiClient/GBtools/ColorChooserForm.resx
similarity index 100%
rename from BizHawk.Emulation/Consoles/Nintendo/Gameboy/ColorChooserForm.resx
rename to BizHawk.MultiClient/GBtools/ColorChooserForm.resx
diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs
index 815b4ea3f3..1d892c448c 100644
--- a/BizHawk.MultiClient/MainForm.MenuItems.cs
+++ b/BizHawk.MultiClient/MainForm.MenuItems.cs
@@ -1658,6 +1658,13 @@ namespace BizHawk.MultiClient
private void gBToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
+ // the palettes have no effect when CGB mode is active
+ if (Global.Emulator is Emulation.Consoles.GB.Gameboy)
+ {
+ changeDMGPalettesToolStripMenuItem.Enabled =
+ !((Emulation.Consoles.GB.Gameboy)Global.Emulator).IsCGBMode();
+ }
+
//skipBIOSIntroToolStripMenuItem.Checked = Global.Config.GameBoySkipBIOS;
forceDMGModeToolStripMenuItem.Checked = Global.Config.GB_ForceDMG;
gBAInCGBModeToolStripMenuItem.Checked = Global.Config.GB_GBACGB;
diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs
index a6f36ae408..01be8237cd 100644
--- a/BizHawk.MultiClient/MainForm.cs
+++ b/BizHawk.MultiClient/MainForm.cs
@@ -3529,7 +3529,7 @@ namespace BizHawk.MultiClient
{
if (Global.Emulator is Gameboy)
{
- ((Gameboy)Global.Emulator).EditDMGColors(this);
+ GBtools.ColorChooserForm.DoColorChooserFormDialog(((Gameboy)Global.Emulator).ChangeDMGColors, this);
}
}