all repos — mgba @ cf9a7224a37c75b0e015ae857d32dbdde2febca9

mGBA Game Boy Advance Emulator

Init video memory from the dummy renderer
Jeffrey Pfau jeffrey@endrift.com
Sat, 20 Apr 2013 02:51:40 -0700
commit

cf9a7224a37c75b0e015ae857d32dbdde2febca9

parent

1972e73bec4031a6697784da1111073170a47f01

2 files changed, 7 insertions(+), 6 deletions(-)

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

@@ -4,15 +4,16 @@ #include "gba.h"

#include "gba-io.h" #include <limits.h> +#include <string.h> -static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer); +static void GBAVideoRendererInit(struct GBAVideoRenderer* renderer); + static void GBAVideoDummyRendererDeinit(struct GBAVideoRenderer* renderer); static uint16_t GBAVideoDummyRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value); static void GBAVideoDummyRendererDrawScanline(struct GBAVideoRenderer* renderer, int y); static void GBAVideoDummyRendererFinishFrame(struct GBAVideoRenderer* renderer); static struct GBAVideoRenderer dummyRenderer = { - .init = GBAVideoDummyRendererInit, .deinit = GBAVideoDummyRendererDeinit, .writeVideoRegister = GBAVideoDummyRendererWriteVideoRegister, .drawScanline = GBAVideoDummyRendererDrawScanline,

@@ -127,9 +128,10 @@ uint16_t GBAVideoReadDISPSTAT(struct GBAVideo* video) {

return (video->inVblank) | (video->inHblank << 1) | (video->vcounter << 2); } -static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer) { - (void)(renderer); - // Nothing to do +static void GBAVideoRendererInit(struct GBAVideoRenderer* renderer) { + memset(renderer->palette, 0, sizeof(renderer->palette)); + memset(renderer->vram, 0, sizeof(renderer->vram)); + memset(&renderer->oam, 0, sizeof(renderer->oam)); } static void GBAVideoDummyRendererDeinit(struct GBAVideoRenderer* renderer) {
M src/gba/gba-video.hsrc/gba/gba-video.h

@@ -89,7 +89,6 @@ uint16_t raw[512];

}; struct GBAVideoRenderer { - void (*init)(struct GBAVideoRenderer* renderer); void (*deinit)(struct GBAVideoRenderer* renderer); uint16_t (*writeVideoRegister)(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value);