Permalink
Browse files

GB, GBA Video: Move VRAM allocation to init

  • Loading branch information...
endrift committed Dec 30, 2017
1 parent d0277a7 commit 748e1943f760d26382c422d6d1e52168f23f3b1f
Showing with 2 additions and 11 deletions.
  1. +1 −5 src/gb/video.c
  2. +1 −6 src/gba/video.c
View
@@ -56,7 +56,7 @@ void GBVideoInit(struct GBVideo* video) {
video->renderer = &dummyRenderer;
video->renderer->cache = NULL;
video->renderer->sgbRenderMode = 0;
- video->vram = 0;
+ video->vram = anonymousMemoryMap(GB_SIZE_VRAM);
video->frameskip = 0;
video->modeEvent.context = video;
@@ -99,10 +99,6 @@ void GBVideoReset(struct GBVideo* video) {
video->frameCounter = 0;
video->frameskipCounter = 0;
- if (video->vram) {
- mappedMemoryFree(video->vram, GB_SIZE_VRAM);
- }
- video->vram = anonymousMemoryMap(GB_SIZE_VRAM);
GBVideoSwitchBank(video, 0);
video->renderer->vram = video->vram;
memset(&video->oam, 0, sizeof(video->oam));
View
@@ -69,7 +69,7 @@ static struct GBAVideoRenderer dummyRenderer = {
void GBAVideoInit(struct GBAVideo* video) {
video->renderer = &dummyRenderer;
video->renderer->cache = NULL;
- video->vram = 0;
+ video->vram = anonymousMemoryMap(SIZE_VRAM);
video->frameskip = 0;
video->event.name = "GBA Video";
video->event.callback = NULL;
@@ -91,11 +91,6 @@ void GBAVideoReset(struct GBAVideo* video) {
video->frameCounter = 0;
video->frameskipCounter = 0;
-
- if (video->vram) {
- mappedMemoryFree(video->vram, SIZE_VRAM);
- }
- video->vram = anonymousMemoryMap(SIZE_VRAM);
video->renderer->vram = video->vram;
memset(video->palette, 0, sizeof(video->palette));

0 comments on commit 748e194

Please sign in to comment.