diff --git a/src/mmu.rs b/src/mmu.rs index 974b97ae1ab119a0a4823673a87eddbe9f9c8923..a7a1f141ce3d09bde3ca1abca25075222a6347df 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -349,7 +349,7 @@ impl Mmu { // 0xFF4C - KEY0 (CGB only) 0x4c => { self.key0 = value; - if self.key0 == 0x04 { + if value == 0x04 { self.ppu().set_dmg_compat(true); } } diff --git a/src/ppu.rs b/src/ppu.rs index f2e7ab5c755d2f6e5035c8c42c062341f1d71f0d..c77830225de9229bd83329920cb8fc683cc425fb 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -930,6 +930,14 @@ impl Ppu { pub fn set_dmg_compat(&mut self, value: bool) { self.dmg_compat = value; + + // if we're switching to the DMG compat mode + // then we need to recompute the palettes so + // that the colors are correct according to + // the compat palettes set by the Boot ROM + if value { + self.compute_palettes(); + } } pub fn gb_mode(&self) -> GameBoyMode {