GBHawk: minor fixes for GBvideoplayer

This commit is contained in:
alyosha-tas 2018-10-08 09:53:18 -05:00
parent d32b1824ed
commit 0ff7a07eaf
4 changed files with 18 additions and 8 deletions

View File

@ -720,6 +720,7 @@
</Compile>
<Compile Include="Consoles\Nintendo\GBA\VBARegisterHelper.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Audio.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_WisdomTree.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_RockMan8.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_Sachen_MMC2.cs" />
<Compile Include="Consoles\Nintendo\GBHawk\Mappers\Mapper_Sachen_MMC1.cs" />

View File

@ -109,6 +109,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
LCDC = value;
Console.WriteLine(value);
break;
case 0xFF41: // STAT
// writing to STAT during mode 0 or 2 causes a STAT IRQ
@ -363,6 +365,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
LY_inc = 1;
Core.in_vblank = false;
STAT &= 0xFC;
// special note here, the y coordiate of the window is kept if the window is deactivated
// meaning it will pick up where it left off if re-enabled later
// so we don't reset it in the scanline loop
@ -431,6 +435,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
Core.REG_FF0F |= 0x01;
}
if ((cycle == 84) && (LY == 144))
{
if (STAT.Bit(5)) { VBL_INT = false; }
}
if ((LY == 153) && (cycle == 6))
{
LY = 0;
@ -521,7 +530,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
else if ((cycle >= 80) && (LY < 144))
{
if (cycle == 84)
{
STAT &= 0xFC;
@ -613,8 +621,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
public override void render(int render_cycle)
{
{
// we are now in STAT mode 3
// NOTE: presumably the first necessary sprite is fetched at sprite evaulation
// i.e. just keeping track of the lowest x-value sprite
@ -768,7 +775,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
// There is another priority bit in GBC, that can still override sprite priority
if (LCDC.Bit(0) && tile_data_latch[2].Bit(7) && Core.GBC_compat)
if (LCDC.Bit(0) && tile_data_latch[2].Bit(7) && (ref_pixel != 0) && Core.GBC_compat)
{
use_sprite = false;
}

View File

@ -128,7 +128,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
cycle = 0;
LY += LY_inc;
Core.cpu.LY = LY;
@ -209,6 +208,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
Core.REG_FF0F |= 0x01;
}
if ((cycle == 84) && (LY == 144))
{
if (STAT.Bit(5)) { VBL_INT = false; }
}
if ((LY == 153) && (cycle == 6))
{
LY = 0;
@ -243,7 +247,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (cycle == 84)
{
STAT &= 0xFC;
STAT |= 0x03;
OAM_INT = false;
@ -340,7 +343,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
LYC_INT = false;
STAT &= 0xFB;
}
}
else if ((cycle == 4) && (LY != 0))
{
@ -419,7 +421,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
first_fetch = true;
no_sprites = false;
evaled_sprites = 0;
window_pre_render = false;
window_latch = LCDC.Bit(5);

View File

@ -22,6 +22,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
// some games have sizes that result in a degenerate ROM, account for it here
if (ROM_mask > 4) { ROM_mask |= 3; }
if (ROM_mask > 0x100) { ROM_mask |= 0xFF; }
RAM_mask = 0;
if (Core.cart_RAM != null)