all repos — mgba @ 5f6b57734df02fb928aec763a13dca530e880486

mGBA Game Boy Advance Emulator

Implement character mapping
Jeffrey Pfau jeffrey@endrift.com
Sun, 28 Apr 2013 01:43:39 -0700
commit

5f6b57734df02fb928aec763a13dca530e880486

parent

8072ff7d2cb38aa60488ce3db932568ff8d29fc2

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

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -470,7 +470,7 @@ if (sprite->vflip) {

inY = height - inY - 1; } unsigned charBase = BASE_TILE + sprite->tile * 0x20; - unsigned yBase = (inY & ~0x7) * 0x80 + (inY & 0x7) * 4; + unsigned yBase = (inY & ~0x7) * (renderer->dispcnt.objCharacterMapping ? width >> 1 : 0x80) + (inY & 0x7) * 4; for (int outX = x >= 0 ? x : 0; outX < x + width && outX < VIDEO_HORIZONTAL_PIXELS; ++outX) { int inX = outX - x; if (sprite->hflip) {

@@ -523,7 +523,7 @@ if (localX < 0 || localX >= width || localY < 0 || localY >= height) {

continue; } - unsigned yBase = (localY & ~0x7) * 0x80 + (localY & 0x7) * 4; + unsigned yBase = (localY & ~0x7) * (renderer->dispcnt.objCharacterMapping ? width >> 1 : 0x80) + (localY & 0x7) * 4; unsigned xBase = (localX & ~0x7) * 4 + ((localX >> 1) & 2); uint16_t tileData = renderer->d.vram[(yBase + charBase + xBase) >> 1]; tileData = (tileData >> ((localX & 3) << 2)) & 0xF;