GBHawk: update clearing screen for subgbhawk and linked modes

This commit is contained in:
alyosha-tas 2020-12-14 11:41:19 -05:00
parent b85e7cac2c
commit 3df6dfb350
5 changed files with 89 additions and 18 deletions

View File

@ -167,21 +167,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
// GBC games need to clear slow enough that games that turn the screen off briefly for cinematics still look smooth // GBC games need to clear slow enough that games that turn the screen off briefly for cinematics still look smooth
if (ppu.clear_screen) if (ppu.clear_screen)
{ {
if (is_GBC) clear_screen_func();
{
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)(frame_buffer[j] | (0x30303 << (clear_counter * 2))); }
clear_counter++;
if (clear_counter == 4)
{
ppu.clear_screen = false;
}
}
else
{
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)ppu.color_palette[0]; }
ppu.clear_screen = false;
}
} }
} }
@ -369,6 +355,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
} }
} }
public void clear_screen_func()
{
if (is_GBC)
{
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)(frame_buffer[j] | (0x30303 << (clear_counter * 2))); }
clear_counter++;
if (clear_counter == 4)
{
ppu.clear_screen = false;
}
}
else
{
for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = (int)ppu.color_palette[0]; }
ppu.clear_screen = false;
}
}
public void SetIntRegs(byte r) public void SetIntRegs(byte r)
{ {
// For timer interrupts or serial interrupts that occur on the same cycle as the IRQ clear // For timer interrupts or serial interrupts that occur on the same cycle as the IRQ clear

View File

@ -84,7 +84,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
FillVideoBuffer(); FillVideoBuffer();
} }
_islag = L._islag & R._islag; _islag = L._islag & R._islag;
if (_islag) if (_islag)
@ -202,6 +201,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
do_frame_fill = true; do_frame_fill = true;
} }
} }
// clear the screens as needed
if (L.ppu.clear_screen)
{
L.clear_screen_func();
do_frame_fill = true;
}
if (R.ppu.clear_screen)
{
R.clear_screen_func();
do_frame_fill = true;
}
} }
public void GetControllerState(IController controller) public void GetControllerState(IController controller)

View File

@ -389,6 +389,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
do_frame_fill = true; do_frame_fill = true;
} }
} }
// clear the screens as needed
if (L.ppu.clear_screen)
{
L.clear_screen_func();
do_frame_fill = true;
}
if (C.ppu.clear_screen)
{
C.clear_screen_func();
do_frame_fill = true;
}
if (R.ppu.clear_screen)
{
R.clear_screen_func();
do_frame_fill = true;
}
} }
public void GetControllerState(IController controller) public void GetControllerState(IController controller)

View File

@ -960,7 +960,32 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
D.vblank_rise = false; D.vblank_rise = false;
do_frame_fill = true; do_frame_fill = true;
} }
} }
// clear the screens as needed
if (A.ppu.clear_screen)
{
A.clear_screen_func();
do_frame_fill = true;
}
if (B.ppu.clear_screen)
{
B.clear_screen_func();
do_frame_fill = true;
}
if (C.ppu.clear_screen)
{
C.clear_screen_func();
do_frame_fill = true;
}
if (D.ppu.clear_screen)
{
D.clear_screen_func();
do_frame_fill = true;
}
} }
public void GetControllerState(IController controller) public void GetControllerState(IController controller)

View File

@ -60,7 +60,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubGBHawk
bool ret = pass_a_frame; bool ret = pass_a_frame;
if (pass_a_frame) { frame_cycle = 0; } if (pass_a_frame)
{
// clear the screen as needed
if (_GBCore.ppu.clear_screen)
{
_GBCore.clear_screen_func();
}
// reset the frame cycle counter
frame_cycle = 0;
}
current_cycle = 0; current_cycle = 0;
_isLag = pass_a_frame; _isLag = pass_a_frame;