GBHawk: Add ROM domain, add Green palette option

This commit is contained in:
alyosha-tas 2017-11-22 14:42:12 -05:00
parent afe5a7cd11
commit b2bc602398
4 changed files with 41 additions and 2 deletions

View File

@ -20,6 +20,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
//Console.WriteLine("-----------------------FRAME-----------------------");
//Update the color palette if a setting changed
if(_settings.Palette == GBSettings.PaletteType.BW)
{
color_palette[0] = color_palette_BW[0];
color_palette[1] = color_palette_BW[1];
color_palette[2] = color_palette_BW[2];
color_palette[3] = color_palette_BW[3];
}
else
{
color_palette[0] = color_palette_Gr[0];
color_palette[1] = color_palette_Gr[1];
color_palette[2] = color_palette_Gr[2];
color_palette[3] = color_palette_Gr[3];
}
if (_tracer.Enabled)
{
cpu.TraceCallback = s => _tracer.Put(s);
@ -165,7 +182,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public int VsyncNumerator => _frameHz;
public int VsyncDenominator => 1;
public static readonly uint[] color_palette = { 0xFFFFFFFF , 0xFFAAAAAA, 0xFF555555, 0xFF000000 };
public static readonly uint[] color_palette_BW = { 0xFFFFFFFF , 0xFFAAAAAA, 0xFF555555, 0xFF000000 };
public static readonly uint[] color_palette_Gr = { 0xFFA4C505, 0xFF88A905, 0xFF1D551D, 0xFF052505 };
public uint[] color_palette = new uint[4];
#endregion
}

View File

@ -34,6 +34,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
MemoryDomain.Endian.Little,
addr => PeekSystemBus(addr),
(addr, value) => PokeSystemBus(addr, value),
1),
new MemoryDomainDelegate(
"ROM",
_rom.Length,
MemoryDomain.Endian.Little,
addr => _rom[addr],
(addr, value) => ZP_RAM[addr] = value,
1)
};

View File

@ -38,6 +38,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public class GBSettings
{
public enum PaletteType
{
BW,
Gr
}
[DisplayName("Console Mode")]
[Description("Pick which console to run, 'Auto' chooses from ROM header, 'GB' and 'GBC' chooses the respective system")]
[DefaultValue(PaletteType.BW)]
public PaletteType Palette { get; set; }
public GBSettings Clone()
{
return (GBSettings)MemberwiseClone();

View File

@ -720,7 +720,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
// based on sprite priority and pixel values, pick a final pixel color
Core._vidbuffer[LY * 160 + pixel_counter] = (int)GBHawk.color_palette[pixel];
Core._vidbuffer[LY * 160 + pixel_counter] = (int)Core.color_palette[pixel];
pixel_counter++;
if (pixel_counter == 160)