DS Video: Fix display capture wrap

This commit is contained in:
Vicki Pfau 2017-03-20 15:42:28 -07:00
parent c0498276b5
commit 06a9d3265b
1 changed files with 3 additions and 3 deletions

View File

@ -221,7 +221,7 @@ static void _performCapture(struct DSVideo* video, int y) {
if (!video->p->memory.vramMode[block][4]) { if (!video->p->memory.vramMode[block][4]) {
return; return;
} }
uint16_t* vram = &video->vram[0x10000 * block + DSRegisterDISPCAPCNTGetWriteOffset(dispcap) * 0x4000]; uint16_t* vram = &video->vram[0x10000 * block];
const color_t* pixelsA; const color_t* pixelsA;
color_t pixels[DS_VIDEO_HORIZONTAL_PIXELS]; color_t pixels[DS_VIDEO_HORIZONTAL_PIXELS];
int width = DS_VIDEO_HORIZONTAL_PIXELS; int width = DS_VIDEO_HORIZONTAL_PIXELS;
@ -241,7 +241,6 @@ static void _performCapture(struct DSVideo* video, int y) {
break; break;
} }
video->p->gx.renderer->getScanline(video->p->gx.renderer, y, &pixelsA);
if (DSRegisterDISPCAPCNTIsSourceA(dispcap)) { if (DSRegisterDISPCAPCNTIsSourceA(dispcap)) {
// TODO: Process scanline regardless of output type // TODO: Process scanline regardless of output type
video->p->gx.renderer->getScanline(video->p->gx.renderer, y, &pixelsA); video->p->gx.renderer->getScanline(video->p->gx.renderer, y, &pixelsA);
@ -250,6 +249,7 @@ static void _performCapture(struct DSVideo* video, int y) {
pixelsA = pixels; pixelsA = pixels;
} }
uint32_t base = DSRegisterDISPCAPCNTGetWriteOffset(dispcap) * 0x8000;
uint16_t pixel; uint16_t pixel;
int x; int x;
// TODO: Blending // TODO: Blending
@ -267,7 +267,7 @@ static void _performCapture(struct DSVideo* video, int y) {
pixel |= (colorA >> 6) & 0x03E0; pixel |= (colorA >> 6) & 0x03E0;
pixel |= (colorA >> 3) & 0x001F; pixel |= (colorA >> 3) & 0x001F;
#endif #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);
} }
} }