[GB] Properly set OPRI on startup

Previously, the OPRI register was always set to be in CGB mode when not
using the CGB BIOS, resulting in graphics corruption when running DMG
software in CGB mode without using the CGB BIOS. This fixes the issue by
properly setting bit 1 of the OPRI register as expected.

This was broken in #1119.
This commit is contained in:
Fabrice de Gans 2024-09-17 18:52:35 -07:00
parent 821b9176bd
commit d5e1a1f36b
1 changed files with 7 additions and 2 deletions

View File

@ -2969,8 +2969,13 @@ void gbReset()
inBios = true;
} else if (gbHardware & 0xa) {
// Set compatibility mode if it is a DMG ROM.
const uint8_t gbcFlag = g_gbCartData.SupportsCGB() ? 0x80 : 0x00;
gbMemory[0xff6c] = 0xfe | gbcFlag;
if (g_gbCartData.SupportsCGB()) {
// OPRI with bit 0 set to 0 = CGB mode.
gbMemory[0xff6c] = 0xfe;
} else {
// OPRI with bit 0 set to 1 = DMG mode.
gbMemory[0xff6c] = 0xff;
}
}
gbLine99Ticks = 1;