GB Video: Fix sprite latching using old sprite data
Jeffrey Pfau jeffrey@endrift.com
Sun, 28 Aug 2016 03:42:38 -0700
3 files changed,
8 insertions(+),
8 deletions(-)
M
src/gb/renderers/software.c
→
src/gb/renderers/software.c
@@ -12,7 +12,7 @@ static void GBVideoSoftwareRendererInit(struct GBVideoRenderer* renderer, enum GBModel model);
static void GBVideoSoftwareRendererDeinit(struct GBVideoRenderer* renderer); static uint8_t GBVideoSoftwareRendererWriteVideoRegister(struct GBVideoRenderer* renderer, uint16_t address, uint8_t value); static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer, int index, uint16_t value); -static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj** obj, size_t oamMax); +static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj* obj, size_t oamMax); static void GBVideoSoftwareRendererFinishScanline(struct GBVideoRenderer* renderer, int y); static void GBVideoSoftwareRendererFinishFrame(struct GBVideoRenderer* renderer); static void GBVideoSoftwareRendererGetPixels(struct GBVideoRenderer* renderer, unsigned* stride, const void** pixels);@@ -101,7 +101,7 @@ #endif
softwareRenderer->palette[index] = color; } -static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj** obj, size_t oamMax) { +static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj* obj, size_t oamMax) { struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer; uint8_t* maps = &softwareRenderer->d.vram[GB_BASE_MAP]; if (GBRegisterLCDCIsTileMap(softwareRenderer->lcdc)) {@@ -128,7 +128,7 @@
if (GBRegisterLCDCIsObjEnable(softwareRenderer->lcdc)) { size_t i; for (i = 0; i < oamMax; ++i) { - GBVideoSoftwareRendererDrawObj(softwareRenderer, obj[i], startX, endX, y); + GBVideoSoftwareRendererDrawObj(softwareRenderer, &obj[i], startX, endX, y); } } color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
M
src/gb/video.c
→
src/gb/video.c
@@ -17,7 +17,7 @@ static void GBVideoDummyRendererInit(struct GBVideoRenderer* renderer, enum GBModel model);
static void GBVideoDummyRendererDeinit(struct GBVideoRenderer* renderer); static uint8_t GBVideoDummyRendererWriteVideoRegister(struct GBVideoRenderer* renderer, uint16_t address, uint8_t value); static void GBVideoDummyRendererWritePalette(struct GBVideoRenderer* renderer, int index, uint16_t value); -static void GBVideoDummyRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj** obj, size_t oamMax); +static void GBVideoDummyRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj* obj, size_t oamMax); static void GBVideoDummyRendererFinishScanline(struct GBVideoRenderer* renderer, int y); static void GBVideoDummyRendererFinishFrame(struct GBVideoRenderer* renderer); static void GBVideoDummyRendererGetPixels(struct GBVideoRenderer* renderer, unsigned* stride, const void** pixels);@@ -239,7 +239,7 @@ if (y < oy - 16 || y >= oy - 16 + spriteHeight) {
continue; } // TODO: Sort - video->objThisLine[o] = &video->oam.obj[i]; + video->objThisLine[o] = video->oam.obj[i]; ++o; if (o == 10) { break;@@ -410,7 +410,7 @@ UNUSED(index);
UNUSED(value); } -static void GBVideoDummyRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj** obj, size_t oamMax) { +static void GBVideoDummyRendererDrawRange(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj* obj, size_t oamMax) { UNUSED(renderer); UNUSED(endX); UNUSED(startX);
M
src/gb/video.h
→
src/gb/video.h
@@ -59,7 +59,7 @@ void (*deinit)(struct GBVideoRenderer* renderer);
uint8_t (*writeVideoRegister)(struct GBVideoRenderer* renderer, uint16_t address, uint8_t value); void (*writePalette)(struct GBVideoRenderer* renderer, int index, uint16_t value); - void (*drawRange)(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj** objOnLine, size_t nObj); + void (*drawRange)(struct GBVideoRenderer* renderer, int startX, int endX, int y, struct GBObj* objOnLine, size_t nObj); void (*finishScanline)(struct GBVideoRenderer* renderer, int y); void (*finishFrame)(struct GBVideoRenderer* renderer);@@ -111,7 +111,7 @@ uint8_t* vramBank;
int vramCurrentBank; union GBOAM oam; - struct GBObj* objThisLine[10]; + struct GBObj objThisLine[10]; int objMax; int bcpIndex;