From 561147f7a418aab71a8e90632f72d4a47209319d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 30 Apr 2023 22:18:43 +0100
Subject: [PATCH] chore: master priority set mode enabled

---
 src/ppu.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ppu.rs b/src/ppu.rs
index c1ff7a30..e0663411 100644
--- a/src/ppu.rs
+++ b/src/ppu.rs
@@ -368,6 +368,8 @@ pub struct Ppu {
     mode_clock: u16,
 
     /// Controls if the background is going to be drawn to screen.
+    /// In CGB mode this flag controls the master priority instead
+    /// enabling or disabling complex priority rules.
     switch_bg: bool,
 
     /// Controls if the sprites/objects are going to be drawn to screen.
@@ -985,7 +987,7 @@ impl Ppu {
         if self.first_frame {
             return;
         }
-        if self.switch_bg {
+        if self.gb_mode != GameBoyMode::Dmg || self.switch_bg {
             self.render_map(self.bg_map, self.scx, self.scy, 0, 0, self.ly);
         }
         if self.switch_window {
-- 
GitLab