GBA I/O: Fix writing to DISPCNT CGB flag (fixes #902)

This commit is contained in:
Vicki Pfau 2018-01-14 21:03:10 -08:00
parent 7792960587
commit 67e03bda91
4 changed files with 11 additions and 1 deletions

View File

@ -40,6 +40,7 @@ Bugfixes:
- GB MBC: Fix MBC2 saves (fixes mgba.io/i/954) - GB MBC: Fix MBC2 saves (fixes mgba.io/i/954)
- GBA Memory: Fix copy-on-write memory leak - GBA Memory: Fix copy-on-write memory leak
- Core: Fix ROM patches not being unloaded when disabled (fixes mgba.io/i/962) - Core: Fix ROM patches not being unloaded when disabled (fixes mgba.io/i/962)
- GBA I/O: Fix writing to DISPCNT CGB flag (fixes mgba.io/i/902)
Misc: Misc:
- GBA Timer: Use global cycles for timers - GBA Timer: Use global cycles for timers
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)

View File

@ -171,11 +171,16 @@ static uint16_t* _vramBlock(struct mVideoLogger* logger, uint32_t address) {
uint16_t GBAVideoProxyRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) { uint16_t GBAVideoProxyRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
struct GBAVideoProxyRenderer* proxyRenderer = (struct GBAVideoProxyRenderer*) renderer; struct GBAVideoProxyRenderer* proxyRenderer = (struct GBAVideoProxyRenderer*) renderer;
switch (address) { switch (address) {
case REG_DISPCNT:
value &= 0xFFF7;
break;
case REG_BG0CNT: case REG_BG0CNT:
case REG_BG1CNT: case REG_BG1CNT:
value &= 0xDFFF;
break;
case REG_BG2CNT: case REG_BG2CNT:
case REG_BG3CNT: case REG_BG3CNT:
value &= 0xFFCF; value &= 0xFFFF;
break; break;
case REG_BG0HOFS: case REG_BG0HOFS:
case REG_BG0VOFS: case REG_BG0VOFS:

View File

@ -157,6 +157,7 @@ static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRender
switch (address) { switch (address) {
case REG_DISPCNT: case REG_DISPCNT:
value &= 0xFFF7;
softwareRenderer->dispcnt = value; softwareRenderer->dispcnt = value;
GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer); GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer);
break; break;

View File

@ -217,6 +217,9 @@ static uint16_t GBAVideoDummyRendererWriteVideoRegister(struct GBAVideoRenderer*
GBAVideoCacheWriteVideoRegister(renderer->cache, address, value); GBAVideoCacheWriteVideoRegister(renderer->cache, address, value);
} }
switch (address) { switch (address) {
case REG_DISPCNT:
value &= 0xFFF7;
break;
case REG_BG0CNT: case REG_BG0CNT:
case REG_BG1CNT: case REG_BG1CNT:
value &= 0xDFFF; value &= 0xDFFF;