GBHawk: optimizations
This commit is contained in:
parent
e6e70b6e35
commit
07e7a83243
|
@ -20,6 +20,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
|
|
||||||
// unsaved variables
|
// unsaved variables
|
||||||
public bool checker;
|
public bool checker;
|
||||||
|
byte interrupt_src_reg, interrupt_enable_reg;
|
||||||
|
|
||||||
public void BuildInstructionTable()
|
public void BuildInstructionTable()
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,12 +86,15 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory Access
|
// Memory Access
|
||||||
|
|
||||||
public Func<ushort, byte> ReadMemory;
|
public Func<ushort, byte> ReadMemory;
|
||||||
public Action<ushort, byte> WriteMemory;
|
public Action<ushort, byte> WriteMemory;
|
||||||
public Func<ushort, byte> PeekMemory;
|
public Func<ushort, byte> PeekMemory;
|
||||||
public Func<ushort, byte> DummyReadMemory;
|
public Func<ushort, byte> DummyReadMemory;
|
||||||
|
|
||||||
|
// Get external interrupt registers
|
||||||
|
public Func<ushort, byte> GetIntRegs;
|
||||||
|
public Action<byte> SetIntRegs;
|
||||||
|
|
||||||
// Special Function for Speed switching executed on a STOP
|
// Special Function for Speed switching executed on a STOP
|
||||||
public Func<int, int> SpeedFunc;
|
public Func<int, int> SpeedFunc;
|
||||||
|
|
||||||
|
@ -134,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute instructions
|
// Execute instructions
|
||||||
public void ExecuteOne(ref byte interrupt_src, byte interrupt_enable)
|
public void ExecuteOne()
|
||||||
{
|
{
|
||||||
switch (instr_table[instr_pntr++])
|
switch (instr_table[instr_pntr++])
|
||||||
{
|
{
|
||||||
|
@ -425,6 +428,8 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
stop_check = true;
|
stop_check = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interrupt_src_reg = GetIntRegs(0);
|
||||||
|
|
||||||
if (stop_time > 0)
|
if (stop_time > 0)
|
||||||
{
|
{
|
||||||
stop_time--;
|
stop_time--;
|
||||||
|
@ -449,7 +454,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
instr_pntr = 256 * 60 * 2 + 60 * 5; // point to stop loop
|
instr_pntr = 256 * 60 * 2 + 60 * 5; // point to stop loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (interrupt_src.Bit(4)) // button pressed, not actually an interrupt though
|
else if (interrupt_src_reg.Bit(4)) // button pressed, not actually an interrupt though
|
||||||
{
|
{
|
||||||
TraceCallback?.Invoke(new TraceInfo
|
TraceCallback?.Invoke(new TraceInfo
|
||||||
{
|
{
|
||||||
|
@ -506,7 +511,10 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
ushort bit_check = instr_table[instr_pntr++];
|
ushort bit_check = instr_table[instr_pntr++];
|
||||||
//Console.WriteLine(interrupt_src + " " + interrupt_enable + " " + TotalExecutedCycles);
|
//Console.WriteLine(interrupt_src + " " + interrupt_enable + " " + TotalExecutedCycles);
|
||||||
|
|
||||||
if (interrupt_src.Bit(bit_check) && interrupt_enable.Bit(bit_check)) { int_src = bit_check; int_clear = (byte)(1 << bit_check); }
|
interrupt_src_reg = GetIntRegs(0);
|
||||||
|
interrupt_enable_reg = GetIntRegs(1);
|
||||||
|
|
||||||
|
if (interrupt_src_reg.Bit(bit_check) && interrupt_enable_reg.Bit(bit_check)) { int_src = bit_check; int_clear = (byte)(1 << bit_check); }
|
||||||
/*
|
/*
|
||||||
if (interrupt_src.Bit(0) && interrupt_enable.Bit(0)) { int_src = 0; int_clear = 1; }
|
if (interrupt_src.Bit(0) && interrupt_enable.Bit(0)) { int_src = 0; int_clear = 1; }
|
||||||
else if (interrupt_src.Bit(1) && interrupt_enable.Bit(1)) { int_src = 1; int_clear = 2; }
|
else if (interrupt_src.Bit(1) && interrupt_enable.Bit(1)) { int_src = 1; int_clear = 2; }
|
||||||
|
@ -530,9 +538,14 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
Halt_bug_2 = false;
|
Halt_bug_2 = false;
|
||||||
break;
|
break;
|
||||||
case IRQ_CLEAR:
|
case IRQ_CLEAR:
|
||||||
if (interrupt_src.Bit(int_src)) { interrupt_src -= int_clear; }
|
interrupt_src_reg = GetIntRegs(0);
|
||||||
|
interrupt_enable_reg = GetIntRegs(1);
|
||||||
|
|
||||||
if ((interrupt_src & interrupt_enable) == 0) { FlagI = false; }
|
if (interrupt_src_reg.Bit(int_src)) { interrupt_src_reg -= int_clear; }
|
||||||
|
|
||||||
|
SetIntRegs(interrupt_src_reg);
|
||||||
|
|
||||||
|
if ((interrupt_src_reg & interrupt_enable_reg) == 0) { FlagI = false; }
|
||||||
|
|
||||||
// reset back to default state
|
// reset back to default state
|
||||||
int_src = 5;
|
int_src = 5;
|
||||||
|
|
|
@ -884,22 +884,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
{
|
{
|
||||||
if (use_sprite)
|
if (use_sprite)
|
||||||
{
|
{
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)OBJ_palette[pal_num * 4 + s_pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = OBJ_palette[pal_num * 4 + s_pixel];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)BG_palette[pal_num * 4 + pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = BG_palette[pal_num * 4 + pixel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (use_sprite)
|
if (use_sprite)
|
||||||
{
|
{
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)OBJ_palette[pal_num * 4 + pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = OBJ_palette[pal_num * 4 + pixel];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)BG_palette[pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = BG_palette[pixel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -862,11 +862,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
// based on sprite priority and pixel values, pick a final pixel color
|
// based on sprite priority and pixel values, pick a final pixel color
|
||||||
if (use_sprite)
|
if (use_sprite)
|
||||||
{
|
{
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)OBJ_palette[pal_num * 4 + s_pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = OBJ_palette[pal_num * 4 + s_pixel];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)BG_palette[pal_num * 4 + pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = BG_palette[pal_num * 4 + pixel];
|
||||||
}
|
}
|
||||||
|
|
||||||
pixel_counter++;
|
pixel_counter++;
|
||||||
|
|
|
@ -25,17 +25,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
//Update the color palette if a setting changed
|
//Update the color palette if a setting changed
|
||||||
if (_settings.Palette == GBSettings.PaletteType.BW)
|
if (_settings.Palette == GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
color_palette[0] = color_palette_BW[0];
|
ppu.color_palette[0] = color_palette_BW[0];
|
||||||
color_palette[1] = color_palette_BW[1];
|
ppu.color_palette[1] = color_palette_BW[1];
|
||||||
color_palette[2] = color_palette_BW[2];
|
ppu.color_palette[2] = color_palette_BW[2];
|
||||||
color_palette[3] = color_palette_BW[3];
|
ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color_palette[0] = color_palette_Gr[0];
|
ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
color_palette[1] = color_palette_Gr[1];
|
ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
color_palette[2] = color_palette_Gr[2];
|
ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
color_palette[3] = color_palette_Gr[3];
|
ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
@ -90,14 +90,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
// Note that DMA is halted when the CPU is halted
|
// Note that DMA is halted when the CPU is halted
|
||||||
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(ref REG_FF0F, REG_FFFF);
|
cpu.ExecuteOne();
|
||||||
timer.tick();
|
timer.tick();
|
||||||
|
|
||||||
if (double_speed)
|
if (double_speed)
|
||||||
{
|
{
|
||||||
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(ref REG_FF0F, REG_FFFF);
|
cpu.ExecuteOne();
|
||||||
timer.tick();
|
timer.tick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
// But some GB gams, ex Battletoads, turn off the screen for a long time from the middle of the frame, so need to be cleared.
|
// But some GB gams, ex Battletoads, turn off the screen for a long time from the middle of the frame, so need to be cleared.
|
||||||
if (ppu.clear_screen)
|
if (ppu.clear_screen)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)color_palette[0]; }
|
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)ppu.color_palette[0]; }
|
||||||
ppu.clear_screen = false;
|
ppu.clear_screen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,14 +154,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
// These things all tick twice as fast in GBC double speed mode
|
// These things all tick twice as fast in GBC double speed mode
|
||||||
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(ref REG_FF0F, REG_FFFF);
|
cpu.ExecuteOne();
|
||||||
timer.tick();
|
timer.tick();
|
||||||
|
|
||||||
if (double_speed)
|
if (double_speed)
|
||||||
{
|
{
|
||||||
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
if (ppu.DMA_start && !cpu.halted) { ppu.DMA_tick(); }
|
||||||
serialport.serial_transfer_tick();
|
serialport.serial_transfer_tick();
|
||||||
cpu.ExecuteOne(ref REG_FF0F, REG_FFFF);
|
cpu.ExecuteOne();
|
||||||
timer.tick();
|
timer.tick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
Acc_Y_state = _controllerDeck.ReadAccY1(controller);
|
Acc_Y_state = _controllerDeck.ReadAccY1(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte GetIntRegs(ushort r)
|
||||||
|
{
|
||||||
|
if (r==0)
|
||||||
|
{
|
||||||
|
return REG_FF0F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return REG_FFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetIntRegs(byte r)
|
||||||
|
{
|
||||||
|
REG_FF0F = r;
|
||||||
|
}
|
||||||
|
|
||||||
public int Frame => _frame;
|
public int Frame => _frame;
|
||||||
|
|
||||||
|
@ -280,10 +295,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
|
|
||||||
#region Video provider
|
#region Video provider
|
||||||
|
|
||||||
public int[] _vidbuffer;
|
|
||||||
|
|
||||||
public int[] frame_buffer;
|
public int[] frame_buffer;
|
||||||
|
|
||||||
|
|
||||||
|
public uint[] vid_buffer;
|
||||||
|
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer()
|
||||||
{
|
{
|
||||||
return frame_buffer;
|
return frame_buffer;
|
||||||
|
@ -295,7 +312,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
{
|
{
|
||||||
if (!ppu.blank_frame)
|
if (!ppu.blank_frame)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = _vidbuffer[j]; }
|
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)vid_buffer[j]; }
|
||||||
}
|
}
|
||||||
|
|
||||||
ppu.blank_frame = false;
|
ppu.blank_frame = false;
|
||||||
|
@ -304,13 +321,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
{
|
{
|
||||||
if (ppu.blank_frame)
|
if (ppu.blank_frame)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _vidbuffer.Length; i++)
|
for (int i = 0; i < vid_buffer.Length; i++)
|
||||||
{
|
{
|
||||||
_vidbuffer[i] = (int)color_palette[0];
|
vid_buffer[i] = ppu.color_palette[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = _vidbuffer[j]; }
|
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)vid_buffer[j]; }
|
||||||
|
|
||||||
ppu.blank_frame = false;
|
ppu.blank_frame = false;
|
||||||
}
|
}
|
||||||
|
@ -324,11 +341,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
public int VsyncNumerator => 262144;
|
public int VsyncNumerator => 262144;
|
||||||
public int VsyncDenominator => 4389;
|
public int VsyncDenominator => 4389;
|
||||||
|
|
||||||
public static readonly uint[] color_palette_BW = { 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 static readonly uint[] color_palette_Gr = { 0xFFA4C505, 0xFF88A905, 0xFF1D551D, 0xFF052505 };
|
||||||
|
|
||||||
public uint[] color_palette = new uint[4];
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
ser.Sync(nameof(addr_access), ref addr_access);
|
ser.Sync(nameof(addr_access), ref addr_access);
|
||||||
|
|
||||||
ser.Sync(nameof(frame_buffer), ref frame_buffer, false);
|
ser.Sync(nameof(frame_buffer), ref frame_buffer, false);
|
||||||
ser.Sync(nameof(_vidbuffer), ref _vidbuffer, false);
|
ser.Sync(nameof(vid_buffer), ref vid_buffer, false);
|
||||||
|
|
||||||
// probably a better way to do this
|
// probably a better way to do this
|
||||||
if (cart_RAM != null)
|
if (cart_RAM != null)
|
||||||
|
|
|
@ -97,6 +97,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
DummyReadMemory = ReadMemory,
|
DummyReadMemory = ReadMemory,
|
||||||
OnExecFetch = ExecFetch,
|
OnExecFetch = ExecFetch,
|
||||||
SpeedFunc = SpeedFunc,
|
SpeedFunc = SpeedFunc,
|
||||||
|
GetIntRegs = GetIntRegs,
|
||||||
|
SetIntRegs = SetIntRegs
|
||||||
};
|
};
|
||||||
|
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
|
@ -193,8 +195,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
|
|
||||||
iptr0 = Marshal.AllocHGlobal(VRAM.Length + 1);
|
iptr0 = Marshal.AllocHGlobal(VRAM.Length + 1);
|
||||||
iptr1 = Marshal.AllocHGlobal(OAM.Length + 1);
|
iptr1 = Marshal.AllocHGlobal(OAM.Length + 1);
|
||||||
iptr2 = Marshal.AllocHGlobal(color_palette.Length * 8 * 8 + 1);
|
iptr2 = Marshal.AllocHGlobal(ppu.color_palette.Length * 8 * 8 + 1);
|
||||||
iptr3 = Marshal.AllocHGlobal(color_palette.Length * 8 * 8 + 1);
|
iptr3 = Marshal.AllocHGlobal(ppu.color_palette.Length * 8 * 8 + 1);
|
||||||
|
|
||||||
_scanlineCallback = null;
|
_scanlineCallback = null;
|
||||||
}
|
}
|
||||||
|
@ -233,15 +235,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
int[] cp2 = new int[8];
|
int[] cp2 = new int[8];
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
cp2[i] = (int)color_palette[(ppu.obj_pal_0 >> (i * 2)) & 3];
|
cp2[i] = (int)ppu.color_palette[(ppu.obj_pal_0 >> (i * 2)) & 3];
|
||||||
cp2[i + 4] = (int)color_palette[(ppu.obj_pal_1 >> (i * 2)) & 3];
|
cp2[i + 4] = (int)ppu.color_palette[(ppu.obj_pal_1 >> (i * 2)) & 3];
|
||||||
}
|
}
|
||||||
Marshal.Copy(cp2, 0, iptr2, cp2.Length);
|
Marshal.Copy(cp2, 0, iptr2, cp2.Length);
|
||||||
|
|
||||||
int[] cp = new int[4];
|
int[] cp = new int[4];
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
cp[i] = (int)color_palette[(ppu.BGP >> (i * 2)) & 3];
|
cp[i] = (int)ppu.color_palette[(ppu.BGP >> (i * 2)) & 3];
|
||||||
}
|
}
|
||||||
Marshal.Copy(cp, 0, iptr3, cp.Length);
|
Marshal.Copy(cp, 0, iptr3, cp.Length);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +300,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
mapper.Reset();
|
mapper.Reset();
|
||||||
cpu.Reset();
|
cpu.Reset();
|
||||||
|
|
||||||
_vidbuffer = new int[VirtualWidth * VirtualHeight];
|
vid_buffer = new uint[VirtualWidth * VirtualHeight];
|
||||||
frame_buffer = new int[VirtualWidth * VirtualHeight];
|
frame_buffer = new int[VirtualWidth * VirtualHeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -610,7 +610,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
// based on sprite priority and pixel values, pick a final pixel color
|
// based on sprite priority and pixel values, pick a final pixel color
|
||||||
Core._vidbuffer[LY * 160 + pixel_counter] = (int)Core.color_palette[pixel];
|
Core.vid_buffer[LY * 160 + pixel_counter] = color_palette[pixel];
|
||||||
pixel_counter++;
|
pixel_counter++;
|
||||||
|
|
||||||
if (pixel_counter == 160)
|
if (pixel_counter == 160)
|
||||||
|
|
|
@ -63,46 +63,50 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
}
|
}
|
||||||
else if ((addr >= 0xFF80))
|
else if ((addr >= 0xFF80))
|
||||||
{
|
{
|
||||||
|
// register FFFF?
|
||||||
return ZP_RAM[addr - 0xFF80];
|
return ZP_RAM[addr - 0xFF80];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr < 0x900)
|
if (addr < 0x8000)
|
||||||
{
|
{
|
||||||
if (addr < 0x100)
|
if (addr >= 0x900)
|
||||||
{
|
|
||||||
// return Either BIOS ROM or Game ROM
|
|
||||||
if ((GB_bios_register & 0x1) == 0)
|
|
||||||
{
|
|
||||||
return _bios[addr]; // Return BIOS
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mapper.ReadMemory(addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (addr >= 0x200)
|
|
||||||
{
|
|
||||||
// return Either BIOS ROM or Game ROM
|
|
||||||
if (((GB_bios_register & 0x1) == 0) && is_GBC)
|
|
||||||
{
|
|
||||||
return _bios[addr]; // Return BIOS
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mapper.ReadMemory(addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return mapper.ReadMemory(addr);
|
return mapper.ReadMemory(addr);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (addr < 0x8000)
|
{
|
||||||
{
|
if (addr < 0x100)
|
||||||
return mapper.ReadMemory(addr);
|
{
|
||||||
|
// return Either BIOS ROM or Game ROM
|
||||||
|
if ((GB_bios_register & 0x1) == 0)
|
||||||
|
{
|
||||||
|
return _bios[addr]; // Return BIOS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mapper.ReadMemory(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (addr >= 0x200)
|
||||||
|
{
|
||||||
|
// return Either BIOS ROM or Game ROM
|
||||||
|
if (((GB_bios_register & 0x1) == 0) && is_GBC)
|
||||||
|
{
|
||||||
|
return _bios[addr]; // Return BIOS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mapper.ReadMemory(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mapper.ReadMemory(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (addr < 0xA000)
|
else if (addr < 0xA000)
|
||||||
{
|
{
|
||||||
|
@ -113,21 +117,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
{
|
{
|
||||||
return mapper.ReadMemory(addr);
|
return mapper.ReadMemory(addr);
|
||||||
}
|
}
|
||||||
else if (addr < 0xD000)
|
|
||||||
{
|
|
||||||
return RAM[addr - 0xC000];
|
|
||||||
}
|
|
||||||
else if (addr < 0xE000)
|
|
||||||
{
|
|
||||||
return RAM[(RAM_Bank * 0x1000) + (addr - 0xD000)];
|
|
||||||
}
|
|
||||||
else if (addr < 0xF000)
|
|
||||||
{
|
|
||||||
return RAM[addr - 0xE000];
|
|
||||||
}
|
|
||||||
else if (addr < 0xFE00)
|
else if (addr < 0xFE00)
|
||||||
{
|
{
|
||||||
return RAM[(RAM_Bank * 0x1000) + (addr - 0xF000)];
|
addr = (ushort)(RAM_Bank * (addr & 0x1000) + (addr & 0xFFF));
|
||||||
|
return RAM[addr];
|
||||||
}
|
}
|
||||||
else if (addr < 0xFEA0)
|
else if (addr < 0xFEA0)
|
||||||
{
|
{
|
||||||
|
@ -186,82 +179,77 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr < 0x900)
|
// Writes are more likely from the top down
|
||||||
|
if (addr >= 0xFF00)
|
||||||
{
|
{
|
||||||
if (addr < 0x100)
|
if (addr < 0xFF80)
|
||||||
{
|
{
|
||||||
if ((GB_bios_register & 0x1) == 0)
|
Write_Registers(addr, value);
|
||||||
{
|
|
||||||
// No Writing to BIOS
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mapper.WriteMemory(addr, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (addr >= 0x200)
|
else if (addr < 0xFFFF)
|
||||||
{
|
{
|
||||||
if (((GB_bios_register & 0x1) == 0) && is_GBC)
|
ZP_RAM[addr - 0xFF80] = value;
|
||||||
{
|
|
||||||
// No Writing to BIOS
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mapper.WriteMemory(addr, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapper.WriteMemory(addr, value);
|
Write_Registers(addr, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (addr < 0x8000)
|
else if (addr >= 0xFE00)
|
||||||
|
{
|
||||||
|
if ((addr < 0xFEA0) && ppu.OAM_access_write)
|
||||||
|
{
|
||||||
|
OAM[addr - 0xFE00] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (addr >= 0xC000)
|
||||||
|
{
|
||||||
|
addr = (ushort)(RAM_Bank * (addr & 0x1000) + (addr & 0xFFF));
|
||||||
|
RAM[addr] = value;
|
||||||
|
}
|
||||||
|
else if (addr >= 0xA000)
|
||||||
{
|
{
|
||||||
mapper.WriteMemory(addr, value);
|
mapper.WriteMemory(addr, value);
|
||||||
}
|
}
|
||||||
else if (addr < 0xA000)
|
else if (addr >= 0x8000)
|
||||||
{
|
{
|
||||||
if (ppu.VRAM_access_write) { VRAM[(VRAM_Bank * 0x2000) + (addr - 0x8000)] = value; }
|
if (ppu.VRAM_access_write) { VRAM[(VRAM_Bank * 0x2000) + (addr - 0x8000)] = value; }
|
||||||
}
|
}
|
||||||
else if (addr < 0xC000)
|
|
||||||
{
|
|
||||||
mapper.WriteMemory(addr, value);
|
|
||||||
}
|
|
||||||
else if (addr < 0xD000)
|
|
||||||
{
|
|
||||||
RAM[addr - 0xC000] = value;
|
|
||||||
}
|
|
||||||
else if (addr < 0xE000)
|
|
||||||
{
|
|
||||||
RAM[(RAM_Bank * 0x1000) + (addr - 0xD000)] = value;
|
|
||||||
}
|
|
||||||
else if (addr < 0xF000)
|
|
||||||
{
|
|
||||||
RAM[addr - 0xE000] = value;
|
|
||||||
}
|
|
||||||
else if (addr < 0xFE00)
|
|
||||||
{
|
|
||||||
RAM[(RAM_Bank * 0x1000) + (addr - 0xF000)] = value;
|
|
||||||
}
|
|
||||||
else if (addr < 0xFEA0)
|
|
||||||
{
|
|
||||||
if (ppu.OAM_access_write) { OAM[addr - 0xFE00] = value; }
|
|
||||||
}
|
|
||||||
else if (addr < 0xFF00)
|
|
||||||
{
|
|
||||||
// unmapped, writing has no effect
|
|
||||||
}
|
|
||||||
else if (addr < 0xFF80)
|
|
||||||
{
|
|
||||||
Write_Registers(addr, value);
|
|
||||||
}
|
|
||||||
else if (addr < 0xFFFF)
|
|
||||||
{
|
|
||||||
ZP_RAM[addr - 0xFF80] = value;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write_Registers(addr, value);
|
if (addr >= 0x900)
|
||||||
|
{
|
||||||
|
mapper.WriteMemory(addr, value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (addr < 0x100)
|
||||||
|
{
|
||||||
|
if ((GB_bios_register & 0x1) == 0)
|
||||||
|
{
|
||||||
|
// No Writing to BIOS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapper.WriteMemory(addr, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (addr >= 0x200)
|
||||||
|
{
|
||||||
|
if (((GB_bios_register & 0x1) == 0) && is_GBC)
|
||||||
|
{
|
||||||
|
// No Writing to BIOS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapper.WriteMemory(addr, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapper.WriteMemory(addr, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,40 +293,43 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr < 0x900)
|
if (addr < 0x8000)
|
||||||
{
|
{
|
||||||
if (addr < 0x100)
|
if (addr >= 0x900)
|
||||||
{
|
|
||||||
// return Either BIOS ROM or Game ROM
|
|
||||||
if ((GB_bios_register & 0x1) == 0)
|
|
||||||
{
|
|
||||||
return _bios[addr]; // Return BIOS
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mapper.ReadMemory(addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (addr >= 0x200)
|
|
||||||
{
|
|
||||||
// return Either BIOS ROM or Game ROM
|
|
||||||
if (((GB_bios_register & 0x1) == 0) && is_GBC)
|
|
||||||
{
|
|
||||||
return _bios[addr]; // Return BIOS
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mapper.ReadMemory(addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return mapper.ReadMemory(addr);
|
return mapper.ReadMemory(addr);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (addr < 0x8000)
|
{
|
||||||
{
|
if (addr < 0x100)
|
||||||
return mapper.PeekMemory(addr);
|
{
|
||||||
|
// return Either BIOS ROM or Game ROM
|
||||||
|
if ((GB_bios_register & 0x1) == 0)
|
||||||
|
{
|
||||||
|
return _bios[addr]; // Return BIOS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mapper.ReadMemory(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (addr >= 0x200)
|
||||||
|
{
|
||||||
|
// return Either BIOS ROM or Game ROM
|
||||||
|
if (((GB_bios_register & 0x1) == 0) && is_GBC)
|
||||||
|
{
|
||||||
|
return _bios[addr]; // Return BIOS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mapper.ReadMemory(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mapper.ReadMemory(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (addr < 0xA000)
|
else if (addr < 0xA000)
|
||||||
{
|
{
|
||||||
|
@ -349,21 +340,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
{
|
{
|
||||||
return mapper.PeekMemory(addr);
|
return mapper.PeekMemory(addr);
|
||||||
}
|
}
|
||||||
else if (addr < 0xD000)
|
|
||||||
{
|
|
||||||
return RAM[addr - 0xC000];
|
|
||||||
}
|
|
||||||
else if (addr < 0xE000)
|
|
||||||
{
|
|
||||||
return RAM[(RAM_Bank * 0x1000) + (addr - 0xD000)];
|
|
||||||
}
|
|
||||||
else if (addr < 0xF000)
|
|
||||||
{
|
|
||||||
return RAM[addr - 0xE000];
|
|
||||||
}
|
|
||||||
else if (addr < 0xFE00)
|
else if (addr < 0xFE00)
|
||||||
{
|
{
|
||||||
return RAM[(RAM_Bank * 0x1000) + (addr - 0xF000)];
|
addr = (ushort)(RAM_Bank * (addr & 0x1000) + (addr & 0xFFF));
|
||||||
|
return RAM[addr];
|
||||||
}
|
}
|
||||||
else if (addr < 0xFEA0)
|
else if (addr < 0xFEA0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
public uint[] BG_palette = new uint[32];
|
public uint[] BG_palette = new uint[32];
|
||||||
public uint[] OBJ_palette = new uint[32];
|
public uint[] OBJ_palette = new uint[32];
|
||||||
|
|
||||||
|
public uint[] color_palette = new uint[4];
|
||||||
|
|
||||||
public bool HDMA_active;
|
public bool HDMA_active;
|
||||||
public bool clear_screen;
|
public bool clear_screen;
|
||||||
|
|
||||||
|
|
|
@ -16,32 +16,32 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
||||||
//Update the color palette if a setting changed
|
//Update the color palette if a setting changed
|
||||||
if (linkSettings.Palette_L == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (linkSettings.Palette_L == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
L.color_palette[0] = color_palette_BW[0];
|
L.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
L.color_palette[1] = color_palette_BW[1];
|
L.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
L.color_palette[2] = color_palette_BW[2];
|
L.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
L.color_palette[3] = color_palette_BW[3];
|
L.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
L.color_palette[0] = color_palette_Gr[0];
|
L.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
L.color_palette[1] = color_palette_Gr[1];
|
L.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
L.color_palette[2] = color_palette_Gr[2];
|
L.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
L.color_palette[3] = color_palette_Gr[3];
|
L.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkSettings.Palette_R == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (linkSettings.Palette_R == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
R.color_palette[0] = color_palette_BW[0];
|
R.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
R.color_palette[1] = color_palette_BW[1];
|
R.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
R.color_palette[2] = color_palette_BW[2];
|
R.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
R.color_palette[3] = color_palette_BW[3];
|
R.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R.color_palette[0] = color_palette_Gr[0];
|
R.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
R.color_palette[1] = color_palette_Gr[1];
|
R.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
R.color_palette[2] = color_palette_Gr[2];
|
R.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
R.color_palette[3] = color_palette_Gr[3];
|
R.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
|
|
@ -16,47 +16,47 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
||||||
//Update the color palette if a setting changed
|
//Update the color palette if a setting changed
|
||||||
if (Link3xSettings.Palette_L == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link3xSettings.Palette_L == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
L.color_palette[0] = color_palette_BW[0];
|
L.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
L.color_palette[1] = color_palette_BW[1];
|
L.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
L.color_palette[2] = color_palette_BW[2];
|
L.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
L.color_palette[3] = color_palette_BW[3];
|
L.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
L.color_palette[0] = color_palette_Gr[0];
|
L.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
L.color_palette[1] = color_palette_Gr[1];
|
L.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
L.color_palette[2] = color_palette_Gr[2];
|
L.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
L.color_palette[3] = color_palette_Gr[3];
|
L.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Link3xSettings.Palette_C == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link3xSettings.Palette_C == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
C.color_palette[0] = color_palette_BW[0];
|
C.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
C.color_palette[1] = color_palette_BW[1];
|
C.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
C.color_palette[2] = color_palette_BW[2];
|
C.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
C.color_palette[3] = color_palette_BW[3];
|
C.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
C.color_palette[0] = color_palette_Gr[0];
|
C.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
C.color_palette[1] = color_palette_Gr[1];
|
C.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
C.color_palette[2] = color_palette_Gr[2];
|
C.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
C.color_palette[3] = color_palette_Gr[3];
|
C.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Link3xSettings.Palette_R == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link3xSettings.Palette_R == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
R.color_palette[0] = color_palette_BW[0];
|
R.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
R.color_palette[1] = color_palette_BW[1];
|
R.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
R.color_palette[2] = color_palette_BW[2];
|
R.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
R.color_palette[3] = color_palette_BW[3];
|
R.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R.color_palette[0] = color_palette_Gr[0];
|
R.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
R.color_palette[1] = color_palette_Gr[1];
|
R.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
R.color_palette[2] = color_palette_Gr[2];
|
R.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
R.color_palette[3] = color_palette_Gr[3];
|
R.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
|
|
@ -16,62 +16,62 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
|
||||||
//Update the color palette if a setting changed
|
//Update the color palette if a setting changed
|
||||||
if (Link4xSettings.Palette_A == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link4xSettings.Palette_A == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
A.color_palette[0] = color_palette_BW[0];
|
A.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
A.color_palette[1] = color_palette_BW[1];
|
A.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
A.color_palette[2] = color_palette_BW[2];
|
A.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
A.color_palette[3] = color_palette_BW[3];
|
A.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
A.color_palette[0] = color_palette_Gr[0];
|
A.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
A.color_palette[1] = color_palette_Gr[1];
|
A.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
A.color_palette[2] = color_palette_Gr[2];
|
A.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
A.color_palette[3] = color_palette_Gr[3];
|
A.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Link4xSettings.Palette_B == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link4xSettings.Palette_B == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
B.color_palette[0] = color_palette_BW[0];
|
B.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
B.color_palette[1] = color_palette_BW[1];
|
B.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
B.color_palette[2] = color_palette_BW[2];
|
B.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
B.color_palette[3] = color_palette_BW[3];
|
B.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
B.color_palette[0] = color_palette_Gr[0];
|
B.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
B.color_palette[1] = color_palette_Gr[1];
|
B.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
B.color_palette[2] = color_palette_Gr[2];
|
B.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
B.color_palette[3] = color_palette_Gr[3];
|
B.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Link4xSettings.Palette_C == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link4xSettings.Palette_C == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
C.color_palette[0] = color_palette_BW[0];
|
C.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
C.color_palette[1] = color_palette_BW[1];
|
C.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
C.color_palette[2] = color_palette_BW[2];
|
C.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
C.color_palette[3] = color_palette_BW[3];
|
C.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
C.color_palette[0] = color_palette_Gr[0];
|
C.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
C.color_palette[1] = color_palette_Gr[1];
|
C.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
C.color_palette[2] = color_palette_Gr[2];
|
C.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
C.color_palette[3] = color_palette_Gr[3];
|
C.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Link4xSettings.Palette_D == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (Link4xSettings.Palette_D == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
D.color_palette[0] = color_palette_BW[0];
|
D.ppu.color_palette[0] = color_palette_BW[0];
|
||||||
D.color_palette[1] = color_palette_BW[1];
|
D.ppu.color_palette[1] = color_palette_BW[1];
|
||||||
D.color_palette[2] = color_palette_BW[2];
|
D.ppu.color_palette[2] = color_palette_BW[2];
|
||||||
D.color_palette[3] = color_palette_BW[3];
|
D.ppu.color_palette[3] = color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
D.color_palette[0] = color_palette_Gr[0];
|
D.ppu.color_palette[0] = color_palette_Gr[0];
|
||||||
D.color_palette[1] = color_palette_Gr[1];
|
D.ppu.color_palette[1] = color_palette_Gr[1];
|
||||||
D.color_palette[2] = color_palette_Gr[2];
|
D.ppu.color_palette[2] = color_palette_Gr[2];
|
||||||
D.color_palette[3] = color_palette_Gr[3];
|
D.ppu.color_palette[3] = color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
|
|
@ -15,17 +15,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk
|
||||||
//Update the color palette if a setting changed
|
//Update the color palette if a setting changed
|
||||||
if (GetSettings().Palette == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
if (GetSettings().Palette == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||||
{
|
{
|
||||||
_GBCore.color_palette[0] = GBHawk.GBHawk.color_palette_BW[0];
|
_GBCore.ppu.color_palette[0] = GBHawk.GBHawk.color_palette_BW[0];
|
||||||
_GBCore.color_palette[1] = GBHawk.GBHawk.color_palette_BW[1];
|
_GBCore.ppu.color_palette[1] = GBHawk.GBHawk.color_palette_BW[1];
|
||||||
_GBCore.color_palette[2] = GBHawk.GBHawk.color_palette_BW[2];
|
_GBCore.ppu.color_palette[2] = GBHawk.GBHawk.color_palette_BW[2];
|
||||||
_GBCore.color_palette[3] = GBHawk.GBHawk.color_palette_BW[3];
|
_GBCore.ppu.color_palette[3] = GBHawk.GBHawk.color_palette_BW[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_GBCore.color_palette[0] = GBHawk.GBHawk.color_palette_Gr[0];
|
_GBCore.ppu.color_palette[0] = GBHawk.GBHawk.color_palette_Gr[0];
|
||||||
_GBCore.color_palette[1] = GBHawk.GBHawk.color_palette_Gr[1];
|
_GBCore.ppu.color_palette[1] = GBHawk.GBHawk.color_palette_Gr[1];
|
||||||
_GBCore.color_palette[2] = GBHawk.GBHawk.color_palette_Gr[2];
|
_GBCore.ppu.color_palette[2] = GBHawk.GBHawk.color_palette_Gr[2];
|
||||||
_GBCore.color_palette[3] = GBHawk.GBHawk.color_palette_Gr[3];
|
_GBCore.ppu.color_palette[3] = GBHawk.GBHawk.color_palette_Gr[3];
|
||||||
}
|
}
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue