move ColorChooserForm to the MultiClient
also disable its menu item if the emulator is currently in CGB mode (since it doesn't do anything)
This commit is contained in:
parent
1d9b6d5fbc
commit
a7bdd745c6
|
@ -117,12 +117,6 @@
|
|||
<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" />
|
||||
|
@ -436,11 +430,6 @@
|
|||
<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>
|
||||
|
|
|
@ -82,7 +82,14 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
return CurrentButtons;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// true if the emulator is currently emulating CGB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsCGBMode()
|
||||
{
|
||||
return (LibGambatte.gambatte_iscgb(GambatteState));
|
||||
}
|
||||
|
||||
public void FrameAdvance(bool render)
|
||||
{
|
||||
|
@ -461,38 +468,13 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
|
||||
#region palette
|
||||
|
||||
/// <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()
|
||||
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
|
||||
|
|
|
@ -188,6 +188,12 @@
|
|||
</Compile>
|
||||
<Compile Include="DisplayManager\DisplayManager.cs" />
|
||||
<Compile Include="DisplayManager\Filters\Hq2x.cs" />
|
||||
<Compile Include="GBtools\ColorChooserForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GBtools\ColorChooserForm.designer.cs">
|
||||
<DependentUpon>ColorChooserForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="HawkFile.cs" />
|
||||
<Compile Include="Input\ControllerBinding.cs" />
|
||||
|
@ -382,6 +388,9 @@
|
|||
<EmbeddedResource Include="config\GifAnimator.resx">
|
||||
<DependentUpon>GifAnimator.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GBtools\ColorChooserForm.resx">
|
||||
<DependentUpon>ColorChooserForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace BizHawk.Emulation.Consoles.Nintendo.Gameboy
|
||||
namespace BizHawk.MultiClient.GBtools
|
||||
{
|
||||
partial class ColorChooserForm
|
||||
{
|
|
@ -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];
|
||||
|
||||
/// <summary>
|
||||
/// gambatte's default dmg colors
|
||||
/// </summary>
|
||||
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<int[]> 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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue