all repos — mgba @ c0498276b534663b1496b0b346aa454ae35e5d4b

mGBA Game Boy Advance Emulator

DS Video: Fix offsets for extended modes 1.x
Vicki Pfau vi@endrift.com
Mon, 20 Mar 2017 15:42:13 -0700
commit

c0498276b534663b1496b0b346aa454ae35e5d4b

parent

6215bca45ba0922061c3f17b9e0e8b86ee0cf858

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

jump to
M src/ds/renderers/software.csrc/ds/renderers/software.c

@@ -743,6 +743,7 @@

void DSVideoSoftwareRendererDrawBackgroundExt1(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int inY) { BACKGROUND_BITMAP_INIT; + uint32_t screenBase = (background->screenBase & 0x1F00) * 8; uint8_t color; int width, height; switch (background->size) {

@@ -769,7 +770,7 @@ for (outX = renderer->start; outX < renderer->end; ++outX) {

BACKGROUND_BITMAP_ITERATE(width, height); if (!mosaicWait) { - uint32_t address = (localX >> 8) + (localY >> 8) * width; + uint32_t address = (localX >> 8) + (localY >> 8) * width + screenBase; uint8_t* vram = (uint8_t*) renderer->d.vramBG[address >> 17]; if (UNLIKELY(!vram)) { continue;

@@ -799,6 +800,7 @@

void DSVideoSoftwareRendererDrawBackgroundExt2(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* background, int inY) { BACKGROUND_BITMAP_INIT; + uint32_t screenBase = (background->screenBase & 0x1F00) * 4; uint32_t color; int width, height; switch (background->size) {

@@ -825,7 +827,7 @@ for (outX = renderer->start; outX < renderer->end; ++outX) {

BACKGROUND_BITMAP_ITERATE(width, height); if (!mosaicWait) { - uint32_t address = ((localX >> 8) + (localY >> 8) * width) << 1; + uint32_t address = ((localX >> 8) + (localY >> 8) * width + screenBase) << 1; uint16_t* vram = renderer->d.vramBG[address >> 17]; if (UNLIKELY(!vram)) { continue;