mirror of https://github.com/mgba-emu/mgba.git
GB Video: Increment BCPS/OCPS even in mode 3 (fixes #1462)
This commit is contained in:
parent
fe459b323e
commit
0accea9621
1
CHANGES
1
CHANGES
|
@ -2,6 +2,7 @@
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
- GBA Video: Fix wrapped sprite mosaic clamping (fixes mgba.io/i/1432)
|
- GBA Video: Fix wrapped sprite mosaic clamping (fixes mgba.io/i/1432)
|
||||||
- GBA Memory: Fix STM to VRAM (fixes mgba.io/i/1430)
|
- GBA Memory: Fix STM to VRAM (fixes mgba.io/i/1430)
|
||||||
|
- GB Video: Increment BCPS/OCPS even in mode 3 (fixes mgba.io/i/1462)
|
||||||
Other fixes:
|
Other fixes:
|
||||||
- Switch: Fix threading-related crash on second launch
|
- Switch: Fix threading-related crash on second launch
|
||||||
- Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421)
|
- Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421)
|
||||||
|
|
|
@ -497,8 +497,8 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
||||||
case REG_BCPD:
|
case REG_BCPD:
|
||||||
if (gb->video.mode != 3) {
|
if (gb->video.mode != 3) {
|
||||||
GBVideoProcessDots(&gb->video, 0);
|
GBVideoProcessDots(&gb->video, 0);
|
||||||
GBVideoWritePalette(&gb->video, address, value);
|
|
||||||
}
|
}
|
||||||
|
GBVideoWritePalette(&gb->video, address, value);
|
||||||
return;
|
return;
|
||||||
case REG_OCPS:
|
case REG_OCPS:
|
||||||
gb->video.ocpIndex = value & 0x3F;
|
gb->video.ocpIndex = value & 0x3F;
|
||||||
|
@ -508,8 +508,8 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
||||||
case REG_OCPD:
|
case REG_OCPD:
|
||||||
if (gb->video.mode != 3) {
|
if (gb->video.mode != 3) {
|
||||||
GBVideoProcessDots(&gb->video, 0);
|
GBVideoProcessDots(&gb->video, 0);
|
||||||
GBVideoWritePalette(&gb->video, address, value);
|
|
||||||
}
|
}
|
||||||
|
GBVideoWritePalette(&gb->video, address, value);
|
||||||
return;
|
return;
|
||||||
case REG_SVBK:
|
case REG_SVBK:
|
||||||
GBMemorySwitchWramBank(&gb->memory, value);
|
GBMemorySwitchWramBank(&gb->memory, value);
|
||||||
|
|
|
@ -505,14 +505,16 @@ void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value)
|
||||||
} else {
|
} else {
|
||||||
switch (address) {
|
switch (address) {
|
||||||
case REG_BCPD:
|
case REG_BCPD:
|
||||||
if (video->bcpIndex & 1) {
|
if (video->mode != 3) {
|
||||||
video->palette[video->bcpIndex >> 1] &= 0x00FF;
|
if (video->bcpIndex & 1) {
|
||||||
video->palette[video->bcpIndex >> 1] |= value << 8;
|
video->palette[video->bcpIndex >> 1] &= 0x00FF;
|
||||||
} else {
|
video->palette[video->bcpIndex >> 1] |= value << 8;
|
||||||
video->palette[video->bcpIndex >> 1] &= 0xFF00;
|
} else {
|
||||||
video->palette[video->bcpIndex >> 1] |= value;
|
video->palette[video->bcpIndex >> 1] &= 0xFF00;
|
||||||
|
video->palette[video->bcpIndex >> 1] |= value;
|
||||||
|
}
|
||||||
|
video->renderer->writePalette(video->renderer, video->bcpIndex >> 1, video->palette[video->bcpIndex >> 1]);
|
||||||
}
|
}
|
||||||
video->renderer->writePalette(video->renderer, video->bcpIndex >> 1, video->palette[video->bcpIndex >> 1]);
|
|
||||||
if (video->bcpIncrement) {
|
if (video->bcpIncrement) {
|
||||||
++video->bcpIndex;
|
++video->bcpIndex;
|
||||||
video->bcpIndex &= 0x3F;
|
video->bcpIndex &= 0x3F;
|
||||||
|
@ -522,14 +524,16 @@ void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value)
|
||||||
video->p->memory.io[REG_BCPD] = video->palette[video->bcpIndex >> 1] >> (8 * (video->bcpIndex & 1));
|
video->p->memory.io[REG_BCPD] = video->palette[video->bcpIndex >> 1] >> (8 * (video->bcpIndex & 1));
|
||||||
break;
|
break;
|
||||||
case REG_OCPD:
|
case REG_OCPD:
|
||||||
if (video->ocpIndex & 1) {
|
if (video->mode != 3) {
|
||||||
video->palette[8 * 4 + (video->ocpIndex >> 1)] &= 0x00FF;
|
if (video->ocpIndex & 1) {
|
||||||
video->palette[8 * 4 + (video->ocpIndex >> 1)] |= value << 8;
|
video->palette[8 * 4 + (video->ocpIndex >> 1)] &= 0x00FF;
|
||||||
} else {
|
video->palette[8 * 4 + (video->ocpIndex >> 1)] |= value << 8;
|
||||||
video->palette[8 * 4 + (video->ocpIndex >> 1)] &= 0xFF00;
|
} else {
|
||||||
video->palette[8 * 4 + (video->ocpIndex >> 1)] |= value;
|
video->palette[8 * 4 + (video->ocpIndex >> 1)] &= 0xFF00;
|
||||||
|
video->palette[8 * 4 + (video->ocpIndex >> 1)] |= value;
|
||||||
|
}
|
||||||
|
video->renderer->writePalette(video->renderer, 8 * 4 + (video->ocpIndex >> 1), video->palette[8 * 4 + (video->ocpIndex >> 1)]);
|
||||||
}
|
}
|
||||||
video->renderer->writePalette(video->renderer, 8 * 4 + (video->ocpIndex >> 1), video->palette[8 * 4 + (video->ocpIndex >> 1)]);
|
|
||||||
if (video->ocpIncrement) {
|
if (video->ocpIncrement) {
|
||||||
++video->ocpIndex;
|
++video->ocpIndex;
|
||||||
video->ocpIndex &= 0x3F;
|
video->ocpIndex &= 0x3F;
|
||||||
|
|
Loading…
Reference in New Issue