GB, GBA Video: Move VRAM allocation to init

This commit is contained in:
Vicki Pfau 2017-12-30 14:20:37 -05:00
parent d0277a7125
commit 748e1943f7
2 changed files with 2 additions and 11 deletions

View File

@ -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 File

@ -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));