all repos — mgba @ e810f1b9f061fa0e40235b249f2cf2342decb104

mGBA Game Boy Advance Emulator

GBA Video: Clear video buffer when starting
Jeffrey Pfau jeffrey@endrift.com
Tue, 03 Mar 2015 21:18:53 -0800
commit

e810f1b9f061fa0e40235b249f2cf2342decb104

parent

0ab8cfe6ad84afbeca3ed220d591b78cae90fcca

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

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

@@ -37,6 +37,7 @@ };

static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer); static void GBAVideoSoftwareRendererDeinit(struct GBAVideoRenderer* renderer); +static void GBAVideoSoftwareRendererReset(struct GBAVideoRenderer* renderer); static void GBAVideoSoftwareRendererWriteOAM(struct GBAVideoRenderer* renderer, uint32_t oam); static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value); static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value);

@@ -77,7 +78,7 @@ static void _breakWindowInner(struct GBAVideoSoftwareRenderer* softwareRenderer, struct WindowN* win);

void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer) { renderer->d.init = GBAVideoSoftwareRendererInit; - renderer->d.reset = GBAVideoSoftwareRendererInit; + renderer->d.reset = GBAVideoSoftwareRendererReset; renderer->d.deinit = GBAVideoSoftwareRendererDeinit; renderer->d.writeVideoRegister = GBAVideoSoftwareRendererWriteVideoRegister; renderer->d.writeOAM = GBAVideoSoftwareRendererWriteOAM;

@@ -89,6 +90,21 @@ renderer->d.putPixels = GBAVideoSoftwareRendererPutPixels;

} static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer) { + GBAVideoSoftwareRendererReset(renderer); + + struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; + + int y; + for (y = 0; y < VIDEO_VERTICAL_PIXELS; ++y) { + color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y]; + int x; + for (x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x) { + row[x] = GBA_COLOR_WHITE; + } + } +} + +static void GBAVideoSoftwareRendererReset(struct GBAVideoRenderer* renderer) { struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; int i;