all repos — mgba @ 371f6913e7570a5cede360262f1e04bc1ef46435

mGBA Game Boy Advance Emulator

GB IO: Make palettes readable
Jeffrey Pfau jeffrey@endrift.com
Wed, 17 Feb 2016 19:42:06 -0800
commit

371f6913e7570a5cede360262f1e04bc1ef46435

parent

b9baee7370e8a0f94a5ce0fd8b374d256a6e494e

2 files changed, 7 insertions(+), 1 deletions(-)

jump to
M src/gb/io.csrc/gb/io.c

@@ -329,6 +329,7 @@ break;

case REG_BCPS: gb->video.bcpIndex = value & 0x3F; gb->video.bcpIncrement = value & 0x80; + gb->memory.io[REG_BCPD] = gb->video.palette[gb->video.bcpIndex >> 1]; break; case REG_BCPD: GBVideoProcessDots(&gb->video);

@@ -337,6 +338,7 @@ break;

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)]; break; case REG_OCPD: GBVideoProcessDots(&gb->video);

@@ -453,14 +455,16 @@ break;

default: if (gb->model >= GB_MODEL_CGB) { switch (address) { + case REG_KEY1: case REG_VBK: case REG_HDMA1: case REG_HDMA2: case REG_HDMA3: case REG_HDMA4: case REG_HDMA5: + case REG_BCPD: + case REG_OCPD: case REG_SVBK: - case REG_KEY1: // Handled transparently by the registers goto success; default:
M src/gb/video.csrc/gb/video.c

@@ -314,6 +314,7 @@ video->renderer->writePalette(video->renderer, video->bcpIndex >> 1, video->palette[video->bcpIndex >> 1]);

if (video->bcpIncrement) { ++video->bcpIndex; video->bcpIndex &= 0x3F; + video->p->memory.io[REG_BCPD] = video->palette[video->bcpIndex >> 1]; } break; case REG_OCPD:

@@ -328,6 +329,7 @@ video->renderer->writePalette(video->renderer, 8 * 4 + (video->ocpIndex >> 1), video->palette[8 * 4 + (video->ocpIndex >> 1)]);

if (video->ocpIncrement) { ++video->ocpIndex; video->ocpIndex &= 0x3F; + video->p->memory.io[REG_OCPD] = video->palette[8 * 4 + (video->ocpIndex >> 1)]; } break; }