From 9b161ced561b5dd6799628237201045354b64ae3 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 29 Sep 2019 20:15:49 -0400 Subject: [PATCH] GBHawk: Clean up frame display routines --- .../Nintendo/GBHawk/GBHawk.IEmulator.cs | 24 ++++++++++++++----- .../GBHawkLink/GBHawkLink.IEmulator.cs | 2 -- .../GBHawkLink3x/GBHawkLink3x.IEmulator.cs | 3 --- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs index 614aa4830e..d726744ea0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBHawk.IEmulator.cs @@ -126,7 +126,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk // send the image on VBlank SendVideoBuffer(); - for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = _vidbuffer[j]; } } REG_FF0F_OLD = REG_FF0F; @@ -287,18 +286,31 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk return frame_buffer; } - public int[] SendVideoBuffer() + public void SendVideoBuffer() { - if (ppu.blank_frame) + if (GBC_compat) { - for (int i = 0; i < _vidbuffer.Length; i++) + if (!ppu.blank_frame) { - _vidbuffer[i] = (int)color_palette[0]; + for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = _vidbuffer[j]; } } + ppu.blank_frame = false; } + else + { + if (ppu.blank_frame) + { + for (int i = 0; i < _vidbuffer.Length; i++) + { + _vidbuffer[i] = (int)color_palette[0]; + } + } - return _vidbuffer; + for (int j = 0; j < frame_buffer.Length; j++) { frame_buffer[j] = _vidbuffer[j]; } + + ppu.blank_frame = false; + } } public int VirtualWidth => 160; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs index cdc8cd3b39..99e53c1e4b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs @@ -154,7 +154,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink // send the image on VBlank L.SendVideoBuffer(); - for (int j = 0; j < L._vidbuffer.Length; j++) { L.frame_buffer[j] = L._vidbuffer[j]; } L.vblank_rise = false; do_frame_fill = true; @@ -170,7 +169,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink // send the image on VBlank R.SendVideoBuffer(); - for (int j = 0; j < R._vidbuffer.Length; j++) { R.frame_buffer[j] = R._vidbuffer[j]; } R.vblank_rise = false; do_frame_fill = true; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.IEmulator.cs index b769d41ce7..fa84538add 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3x.IEmulator.cs @@ -274,7 +274,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x // send the image on VBlank L.SendVideoBuffer(); - for (int j = 0; j < L._vidbuffer.Length; j++) { L.frame_buffer[j] = L._vidbuffer[j]; } L.vblank_rise = false; do_frame_fill = true; @@ -289,7 +288,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x // send the image on VBlank C.SendVideoBuffer(); - for (int j = 0; j < C._vidbuffer.Length; j++) { C.frame_buffer[j] = C._vidbuffer[j]; } C.vblank_rise = false; do_frame_fill = true; @@ -304,7 +302,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x // send the image on VBlank R.SendVideoBuffer(); - for (int j = 0; j < R._vidbuffer.Length; j++) { R.frame_buffer[j] = R._vidbuffer[j]; } R.vblank_rise = false; do_frame_fill = true;