From 80bf8812285db40a91227400b1a83d7742e4ea16 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Tue, 21 Nov 2017 09:10:08 -0500 Subject: [PATCH] GBHawk: PPU Fixes --- .../Consoles/Nintendo/GBHawk/Audio.cs | 2 -- .../Consoles/Nintendo/GBHawk/PPU.cs | 15 +++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs index 89d268f60f..3b94dc01de 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Audio.cs @@ -454,8 +454,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk // NOTE: Make sure to do the power off first since it will call the write_reg function again if ((value & 0x80) == 0) { power_off(); } AUD_CTRL_power = (value & 0x80) > 0; - Console.Write("NR52"); - Console.WriteLine(value); break; // wave ram table diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/PPU.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/PPU.cs index edf4110745..6a3e8652e1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/PPU.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/PPU.cs @@ -174,9 +174,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk if ((DMA_clock % 4) == 1) { // the cpu can't access memory during this time, but we still need the ppu to be able to. - DMA_start = false; + OAM_access_read = true; DMA_byte = Core.ReadMemory((ushort)((DMA_addr << 8) + DMA_inc)); - DMA_start = true; + OAM_access_read = false; } else if ((DMA_clock % 4) == 3) { @@ -637,7 +637,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { pixel = tile_data_latch[0].Bit(7 - (render_counter % 8)) ? 1 : 0; pixel |= tile_data_latch[1].Bit(7 - (render_counter % 8)) ? 2 : 0; + + int ref_pixel = pixel; pixel = (BGP >> (pixel * 2)) & 3; + // now we have the BG pixel, we next need the sprite pixel if (!no_sprites) { @@ -682,9 +685,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk { if (!sprite_attr.Bit(7)) { - if (s_pixel != 0) { use_sprite = true; } + use_sprite = true; } - else if (pixel == 0) + else if (ref_pixel == 0) { use_sprite = true; } @@ -704,7 +707,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk else { pixel = (obj_pal_0 >> (s_pixel * 2)) & 3; - } + } } } } @@ -1029,7 +1032,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk LY = 0; LYC = 0; DMA_addr = 0; - BGP = 0; + BGP = 0xFF; obj_pal_0 = 0xFF; obj_pal_1 = 0xFF; window_y = 0;