DS Video: Simplify VRAM mapping

This commit is contained in:
Vicki Pfau 2017-07-16 15:58:49 -07:00
parent f80bcfaf5d
commit de55e44152
5 changed files with 156 additions and 188 deletions

View File

@ -7,6 +7,7 @@ Bugfixes:
Misc:
- DS GX: Clean up and unify texture mapping
- DS Core: Add symbol loading
- DS Video: Simplify VRAM mapping
0.7.0: (Future)
Features:

View File

@ -699,9 +699,6 @@ static void DSVideoSoftwareRendererPutPixels(struct DSVideoRenderer* renderer, s
} \
uint32_t charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + ((localY & 0x700) >> 5) + ((localX & 0x700) >> 8); \
uint16_t* vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
continue; \
} \
pixelData = ((uint8_t*) vram)[charBase & VRAM_BLOCK_MASK];
#define EXT_0_MOSAIC(COORD, PAL) \
@ -839,9 +836,6 @@ void DSVideoSoftwareRendererDrawBackgroundExt1(struct GBAVideoSoftwareRenderer*
if (!mosaicWait) {
uint32_t address = (localX >> 8) + (localY >> 8) * width + screenBase;
uint8_t* vram = (uint8_t*) renderer->d.vramBG[address >> VRAM_BLOCK_OFFSET];
if (UNLIKELY(!vram)) {
continue;
}
color = vram[address & VRAM_BLOCK_MASK];
mosaicWait = mosaicH;
} else {
@ -896,9 +890,6 @@ void DSVideoSoftwareRendererDrawBackgroundExt2(struct GBAVideoSoftwareRenderer*
if (!mosaicWait) {
uint32_t address = ((localX >> 8) + (localY >> 8) * width + screenBase) << 1;
uint16_t* vram = renderer->d.vramBG[address >> VRAM_BLOCK_OFFSET];
if (UNLIKELY(!vram)) {
continue;
}
LOAD_16(color, address & VRAM_BLOCK_MASK, vram);
#ifndef COLOR_16_BIT
unsigned color32;

View File

@ -45,6 +45,8 @@ static const uint32_t _vramSize[9] = {
0x04000
};
static uint16_t _zeroes[0x2000] = {};
enum DSVRAMBankMode {
MODE_A_BG = 0,
MODE_B_BG = 1,
@ -186,6 +188,20 @@ void DSVideoReset(struct DSVideo* video) {
video->p->memory.vramBank[7] = &video->vram[0x4C000];
video->p->memory.vramBank[8] = &video->vram[0x50000];
int i;
for (i = 0; i < 32; ++i) {
video->renderer->vramABG[i] = _zeroes;
video->renderer->vramBBG[i] = _zeroes;
video->renderer->vramAOBJ[i] = _zeroes;
video->renderer->vramBOBJ[i] = _zeroes;
}
for (i = 0; i < 4; ++i) {
video->renderer->vramABGExtPal[i] = NULL;
video->renderer->vramBBGExtPal[i] = NULL;
}
video->renderer->vramAOBJExtPal = NULL;
video->renderer->vramBOBJExtPal = NULL;
video->renderer->deinit(video->renderer);
video->renderer->init(video->renderer);
}
@ -499,8 +515,8 @@ void DSVideoConfigureVRAM(struct DS* ds, int index, uint8_t value, uint8_t oldVa
for (j = offset; j < 0x20; j += oldInfo.mirrorSize) {
for (i = 0; i < size; ++i) {
if (ds->video.vramABG[i + j] == &memory->vramBank[index][i << (DS_VRAM_OFFSET - 1)]) {
ds->video.vramABG[i + j] = NULL;
ds->video.renderer->vramABG[i + j] = NULL;
ds->video.vramABG[i + j] = _zeroes;
ds->video.renderer->vramABG[i + j] = _zeroes;
}
}
}
@ -509,8 +525,8 @@ void DSVideoConfigureVRAM(struct DS* ds, int index, uint8_t value, uint8_t oldVa
for (j = offset; j < 0x20; j += oldInfo.mirrorSize) {
for (i = 0; i < size; ++i) {
if (ds->video.vramBBG[i + j] == &memory->vramBank[index][i << (DS_VRAM_OFFSET - 1)]) {
ds->video.vramBBG[i + j] = NULL;
ds->video.renderer->vramBBG[i + j] = NULL;
ds->video.vramBBG[i + j] = _zeroes;
ds->video.renderer->vramBBG[i + j] = _zeroes;
}
}
}
@ -519,8 +535,8 @@ void DSVideoConfigureVRAM(struct DS* ds, int index, uint8_t value, uint8_t oldVa
for (j = offset; j < 0x20; j += oldInfo.mirrorSize) {
for (i = 0; i < size; ++i) {
if (ds->video.vramAOBJ[i + j] == &memory->vramBank[index][i << (DS_VRAM_OFFSET - 1)]) {
ds->video.vramAOBJ[i + j] = NULL;
ds->video.renderer->vramAOBJ[i + j] = NULL;
ds->video.vramAOBJ[i + j] = _zeroes;
ds->video.renderer->vramAOBJ[i + j] = _zeroes;
}
}
}
@ -529,8 +545,8 @@ void DSVideoConfigureVRAM(struct DS* ds, int index, uint8_t value, uint8_t oldVa
for (j = offset; j < 0x20; j += oldInfo.mirrorSize) {
for (i = 0; i < size; ++i) {
if (ds->video.vramBOBJ[i + j] == &memory->vramBank[index][i << (DS_VRAM_OFFSET - 1)]) {
ds->video.vramBOBJ[i + j] = NULL;
ds->video.renderer->vramBOBJ[i + j] = NULL;
ds->video.vramBOBJ[i + j] = _zeroes;
ds->video.renderer->vramBOBJ[i + j] = _zeroes;
}
}
}
@ -569,16 +585,16 @@ void DSVideoConfigureVRAM(struct DS* ds, int index, uint8_t value, uint8_t oldVa
break;
case MODE_3D_TEX:
if (ds->gx.tex[offset] == memory->vramBank[index]) {
ds->gx.tex[offset] = NULL;
ds->gx.renderer->tex[offset] = NULL;
ds->gx.tex[offset] = _zeroes;
ds->gx.renderer->tex[offset] = _zeroes;
ds->gx.renderer->invalidateTex(ds->gx.renderer, offset);
}
break;
case MODE_3D_TEX_PAL:
for (i = 0; i < oldInfo.mirrorSize; ++i) {
if (ds->gx.texPal[offset + i] == &memory->vramBank[index][i << 13]) {
ds->gx.texPal[offset + i] = NULL;
ds->gx.renderer->texPal[offset + i] = NULL;
ds->gx.texPal[offset + i] = _zeroes;
ds->gx.renderer->texPal[offset + i] = _zeroes;
}
}
break;

View File

@ -15,9 +15,6 @@
} \
screenBase = background->screenBase + yBase + (xBase >> 2); \
uint16_t* screenBlock = renderer->d.vramBG[screenBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!screenBlock)) { \
return; \
} \
LOAD_16(mapData, screenBase & VRAM_BLOCK_MASK, screenBlock); \
localY = inY & 0x7; \
if (GBA_TEXT_MAP_VFLIP(mapData)) { \
@ -29,26 +26,21 @@
palette = &mainPalette[paletteData]; \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (LIKELY(vram)) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
tileData >>= 4 * mod8; \
for (; outX < end; ++outX) { \
BACKGROUND_DRAW_PIXEL_16(BLEND, OBJWIN, 0); \
} \
} else { \
for (outX = end - 1; outX >= renderer->start; --outX) { \
BACKGROUND_DRAW_PIXEL_16(BLEND, OBJWIN, 0); \
} \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
tileData >>= 4 * mod8; \
for (; outX < end; ++outX) { \
BACKGROUND_DRAW_PIXEL_16(BLEND, OBJWIN, 0); \
} \
} else { \
for (outX = end - 1; outX >= renderer->start; --outX) { \
BACKGROUND_DRAW_PIXEL_16(BLEND, OBJWIN, 0); \
} \
}
#define DRAW_BACKGROUND_MODE_0_TILE_PREFIX_16(BLEND, OBJWIN) \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
return; \
} \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
palette = &mainPalette[paletteData]; \
@ -91,23 +83,19 @@
} \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
carryData = 0; \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
palette = &mainPalette[paletteData]; \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
tileData >>= 4 * baseX; \
} else { \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
palette = &mainPalette[paletteData]; \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
tileData >>= 4 * baseX; \
} else { \
tileData >>= 4 * (7 - baseX); \
} \
tileData &= 0xF; \
tileData |= tileData << 4; \
tileData |= tileData << 8; \
tileData |= tileData << 16; \
carryData = tileData; \
tileData >>= 4 * (7 - baseX); \
} \
tileData &= 0xF; \
tileData |= tileData << 4; \
tileData |= tileData << 8; \
tileData |= tileData << 16; \
carryData = tileData; \
} \
for (; length; ++tileX) { \
BACKGROUND_TEXT_SELECT_CHARACTER; \
@ -116,23 +104,19 @@
tileData = carryData; \
for (; x < 8 && length; ++x, --length) { \
if (!mosaicWait) { \
if (UNLIKELY(!vram)) { \
carryData = 0; \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
palette = &mainPalette[paletteData]; \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
tileData >>= x * 4; \
} else { \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 4; \
palette = &mainPalette[paletteData]; \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
tileData >>= x * 4; \
} else { \
tileData >>= (7 - x) * 4; \
} \
tileData &= 0xF; \
tileData |= tileData << 4; \
tileData |= tileData << 8; \
tileData |= tileData << 16; \
carryData = tileData; \
tileData >>= (7 - x) * 4; \
} \
tileData &= 0xF; \
tileData |= tileData << 4; \
tileData |= tileData << 8; \
tileData |= tileData << 16; \
carryData = tileData; \
mosaicWait = mosaicH; \
} \
--mosaicWait; \
@ -149,10 +133,6 @@
palette = &mainPalette[paletteData]; \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 5)) + (localY << 2); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
outX += 8; \
continue; \
} \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (tileData) { \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
@ -182,47 +162,42 @@
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
int end2 = end - 4; \
if (LIKELY(vram)) { \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
int shift = inX & 0x3; \
if (end2 > outX) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= 8 * shift; \
shift = 0; \
for (; outX < end2; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} \
\
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= 8 * shift; \
for (; outX < end; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} else { \
int start = outX; \
outX = end - 1; \
if (end2 > start) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= end2; --outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
charBase += 4; \
} \
\
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
int shift = inX & 0x3; \
if (end2 > outX) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= renderer->start; --outX) { \
tileData >>= 8 * shift; \
shift = 0; \
for (; outX < end2; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} \
\
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= 8 * shift; \
for (; outX < end; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} else { \
int start = outX; \
outX = end - 1; \
if (end2 > start) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= end2; --outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
charBase += 4; \
} \
\
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= renderer->start; --outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
}
#define DRAW_BACKGROUND_MODE_0_TILE_PREFIX_256(BLEND, OBJWIN) \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
return; \
} \
int end = mod8 - 4; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (end > 0) { \
@ -266,10 +241,6 @@
BACKGROUND_TEXT_SELECT_CHARACTER; \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
outX += 8; \
continue; \
} \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (tileData) { \
@ -315,29 +286,25 @@
tileData = carryData; \
for (x = 0; x < 8; ++x) { \
if (!mosaicWait) { \
if (UNLIKELY(!vram)) { \
carryData = 0; \
} else { \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
} \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
} \
tileData &= 0xFF; \
carryData = tileData; \
} \
tileData &= 0xFF; \
carryData = tileData; \
mosaicWait = mosaicH; \
} \
tileData |= tileData << 8; \
@ -351,49 +318,44 @@
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
int end2 = end - 4; \
if (LIKELY(vram)) { \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 8; \
palette = &mainPalette[paletteData]; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
int shift = inX & 0x3; \
if (end2 > outX) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= 8 * shift; \
shift = 0; \
for (; outX < end2; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} \
\
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= 8 * shift; \
for (; outX < end; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} else { \
int start = outX; \
outX = end - 1; \
if (end2 > start) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= end2; --outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
charBase += 4; \
} \
\
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 8; \
palette = &mainPalette[paletteData]; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
int shift = inX & 0x3; \
if (end2 > outX) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= renderer->start; --outX) { \
tileData >>= 8 * shift; \
shift = 0; \
for (; outX < end2; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} \
\
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= 8 * shift; \
for (; outX < end; ++outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
} else { \
int start = outX; \
outX = end - 1; \
if (end2 > start) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= end2; --outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
charBase += 4; \
} \
\
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
for (; outX >= renderer->start; --outX) { \
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN, 0); \
} \
}
#define DRAW_BACKGROUND_MODE_0_TILE_PREFIX_256EXT(BLEND, OBJWIN) \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
return; \
} \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 8; \
palette = &mainPalette[paletteData]; \
int end = mod8 - 4; \
@ -441,10 +403,6 @@
palette = &mainPalette[paletteData]; \
charBase = (background->charBase + (GBA_TEXT_MAP_TILE(mapData) << 6)) + (localY << 3); \
vram = renderer->d.vramBG[charBase >> VRAM_BLOCK_OFFSET]; \
if (UNLIKELY(!vram)) { \
outX += 8; \
continue; \
} \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
if (tileData) { \
@ -490,31 +448,27 @@
tileData = carryData; \
for (x = 0; x < 8; ++x) { \
if (!mosaicWait) { \
if (UNLIKELY(!vram)) { \
carryData = 0; \
} else { \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 8; \
palette = &mainPalette[paletteData]; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
paletteData = GBA_TEXT_MAP_PALETTE(mapData) << 8; \
palette = &mainPalette[paletteData]; \
if (!GBA_TEXT_MAP_HFLIP(mapData)) { \
if (x >= 4) { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (x - 4) * 8; \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
} \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= x * 8; \
} \
} else { \
if (x >= 4) { \
LOAD_32(tileData, charBase & VRAM_BLOCK_MASK, vram); \
tileData >>= (7 - x) * 8; \
} else { \
LOAD_32(tileData, (charBase + 4) & VRAM_BLOCK_MASK, vram); \
tileData >>= (3 - x) * 8; \
} \
tileData &= 0xFF; \
carryData = tileData; \
} \
tileData &= 0xFF; \
carryData = tileData; \
mosaicWait = mosaicH; \
} \
tileData |= tileData << 8; \

View File

@ -32,6 +32,8 @@ static void GBAVideoDummyRendererPutPixels(struct GBAVideoRenderer* renderer, si
static void _startHblank(struct mTiming*, void* context, uint32_t cyclesLate);
static void _startHdraw(struct mTiming*, void* context, uint32_t cyclesLate);
static uint16_t _zeroes[0x2000] = {};
const int GBAVideoObjSizes[16][2] = {
{ 8, 8 },
{ 16, 16 },
@ -103,6 +105,8 @@ void GBAVideoReset(struct GBAVideo* video) {
memset(video->renderer->vramOBJ, 0, sizeof(video->renderer->vramOBJ));
video->renderer->vramOBJ[0] = &video->vram[0x8000];
video->renderer->vramOBJ[1] = &video->vram[0xA000];
video->renderer->vramOBJ[2] = _zeroes;
video->renderer->vramOBJ[3] = _zeroes;
memset(video->palette, 0, sizeof(video->palette));
memset(video->oam.raw, 0, sizeof(video->oam.raw));
@ -129,6 +133,8 @@ void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer*
memset(renderer->vramOBJ, 0, sizeof(renderer->vramOBJ));
renderer->vramOBJ[0] = &video->vram[0x8000];
renderer->vramOBJ[1] = &video->vram[0xA000];
renderer->vramOBJ[2] = _zeroes;
renderer->vramOBJ[3] = _zeroes;
renderer->oam = &video->oam;
video->renderer->init(video->renderer);
}