all repos — mgba @ 06a9d3265b81cfc12f3058453ecba719b330ac1e

mGBA Game Boy Advance Emulator

DS Video: Fix display capture wrap
Vicki Pfau vi@endrift.com
Mon, 20 Mar 2017 15:42:28 -0700
commit

06a9d3265b81cfc12f3058453ecba719b330ac1e

parent

c0498276b534663b1496b0b346aa454ae35e5d4b

1 files changed, 3 insertions(+), 3 deletions(-)

jump to
M src/ds/video.csrc/ds/video.c

@@ -221,7 +221,7 @@ int block = DSRegisterDISPCAPCNTGetWriteBlock(dispcap);

if (!video->p->memory.vramMode[block][4]) { return; } - uint16_t* vram = &video->vram[0x10000 * block + DSRegisterDISPCAPCNTGetWriteOffset(dispcap) * 0x4000]; + uint16_t* vram = &video->vram[0x10000 * block]; const color_t* pixelsA; color_t pixels[DS_VIDEO_HORIZONTAL_PIXELS]; int width = DS_VIDEO_HORIZONTAL_PIXELS;

@@ -241,7 +241,6 @@ default:

break; } - video->p->gx.renderer->getScanline(video->p->gx.renderer, y, &pixelsA); if (DSRegisterDISPCAPCNTIsSourceA(dispcap)) { // TODO: Process scanline regardless of output type video->p->gx.renderer->getScanline(video->p->gx.renderer, y, &pixelsA);

@@ -250,6 +249,7 @@ video->renderer->drawScanlineDirectly(video->renderer, y, pixels);

pixelsA = pixels; } + uint32_t base = DSRegisterDISPCAPCNTGetWriteOffset(dispcap) * 0x8000; uint16_t pixel; int x; // TODO: Blending

@@ -267,7 +267,7 @@ pixel = (colorA >> 9) & 0x7C00;

pixel |= (colorA >> 6) & 0x03E0; pixel |= (colorA >> 3) & 0x001F; #endif - STORE_16(pixel, (x + y * DS_VIDEO_HORIZONTAL_PIXELS) * 2, vram); + STORE_16(pixel, ((x + y * DS_VIDEO_HORIZONTAL_PIXELS) * 2 + base) & 0x1FFFE, vram); } }