Permalink
Browse files
GB: Fix VRAM/palette locking (fixes #1109)
- Loading branch information...
Showing
with
17 additions
and
7 deletions.
-
+1
−0
CHANGES
-
+8
−4
src/gb/io.c
-
+8
−3
src/gb/memory.c
|
|
@@ -62,6 +62,7 @@ Misc: |
|
|
- Qt: Add load alternate save option
|
|
|
- GB Audio: Improved audio quality
|
|
|
- GB, GBA Audio: Increase max audio volume
|
|
|
+ - GB: Fix VRAM/palette locking (fixes mgba.io/i/1109)
|
|
|
|
|
|
0.6.3: (2017-04-14)
|
|
|
Bugfixes:
|
|
|
|
|
|
@@ -489,17 +489,21 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) { |
|
|
gb->memory.io[REG_BCPD] = gb->video.palette[gb->video.bcpIndex >> 1] >> (8 * (gb->video.bcpIndex & 1));
|
|
|
break;
|
|
|
case REG_BCPD:
|
|
|
- GBVideoProcessDots(&gb->video, 0);
|
|
|
- GBVideoWritePalette(&gb->video, address, value);
|
|
|
+ if (gb->video.mode != 3) {
|
|
|
+ GBVideoProcessDots(&gb->video, 0);
|
|
|
+ GBVideoWritePalette(&gb->video, address, value);
|
|
|
+ }
|
|
|
return;
|
|
|
case REG_OCPS:
|
|
|
gb->video.ocpIndex = value & 0x3F;
|
|
|
gb->video.ocpIncrement = value & 0x80;
|
|
|
gb->memory.io[REG_OCPD] = gb->video.palette[8 * 4 + (gb->video.ocpIndex >> 1)] >> (8 * (gb->video.ocpIndex & 1));
|
|
|
break;
|
|
|
case REG_OCPD:
|
|
|
- GBVideoProcessDots(&gb->video, 0);
|
|
|
- GBVideoWritePalette(&gb->video, address, value);
|
|
|
+ if (gb->video.mode != 3) {
|
|
|
+ GBVideoProcessDots(&gb->video, 0);
|
|
|
+ GBVideoWritePalette(&gb->video, address, value);
|
|
|
+ }
|
|
|
return;
|
|
|
case REG_SVBK:
|
|
|
GBMemorySwitchWramBank(&gb->memory, value);
|
|
|
|
|
|
@@ -239,7 +239,10 @@ uint8_t GBLoad8(struct LR35902Core* cpu, uint16_t address) { |
|
|
return memory->romBank[address & (GB_SIZE_CART_BANK0 - 1)];
|
|
|
case GB_REGION_VRAM:
|
|
|
case GB_REGION_VRAM + 1:
|
|
|
- return gb->video.vramBank[address & (GB_SIZE_VRAM_BANK0 - 1)];
|
|
|
+ if (gb->video.mode != 3) {
|
|
|
+ return gb->video.vramBank[address & (GB_SIZE_VRAM_BANK0 - 1)];
|
|
|
+ }
|
|
|
+ return 0xFF;
|
|
|
case GB_REGION_EXTERNAL_RAM:
|
|
|
case GB_REGION_EXTERNAL_RAM + 1:
|
|
|
if (memory->rtcAccess) {
|
|
|
@@ -309,8 +312,10 @@ void GBStore8(struct LR35902Core* cpu, uint16_t address, int8_t value) { |
|
|
return;
|
|
|
case GB_REGION_VRAM:
|
|
|
case GB_REGION_VRAM + 1:
|
|
|
- gb->video.renderer->writeVRAM(gb->video.renderer, (address & (GB_SIZE_VRAM_BANK0 - 1)) | (GB_SIZE_VRAM_BANK0 * gb->video.vramCurrentBank));
|
|
|
- gb->video.vramBank[address & (GB_SIZE_VRAM_BANK0 - 1)] = value;
|
|
|
+ if (gb->video.mode != 3) {
|
|
|
+ gb->video.renderer->writeVRAM(gb->video.renderer, (address & (GB_SIZE_VRAM_BANK0 - 1)) | (GB_SIZE_VRAM_BANK0 * gb->video.vramCurrentBank));
|
|
|
+ gb->video.vramBank[address & (GB_SIZE_VRAM_BANK0 - 1)] = value;
|
|
|
+ }
|
|
|
return;
|
|
|
case GB_REGION_EXTERNAL_RAM:
|
|
|
case GB_REGION_EXTERNAL_RAM + 1:
|
|
|
|
0 comments on commit
e783336