From db96be98dcd40796597d96afe4776b7f4ceff928 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 7 May 2013 01:00:18 -0700 Subject: [PATCH] Deinit video when shutting down --- src/gba/gba-video.c | 4 ++++ src/gba/gba-video.h | 1 + src/gba/gba.c | 1 + 3 files changed, 6 insertions(+) diff --git a/src/gba/gba-video.c b/src/gba/gba-video.c index 8b9a80192..bb3c0f748 100644 --- a/src/gba/gba-video.c +++ b/src/gba/gba-video.c @@ -43,6 +43,10 @@ void GBAVideoInit(struct GBAVideo* video) { video->nextVcounterIRQ = 0; } +void GBAVideoDeinit(struct GBAVideo* video) { + GBAVideoAssociateRenderer(video, &dummyRenderer); +} + void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer) { video->renderer->deinit(video->renderer); video->renderer = renderer; diff --git a/src/gba/gba-video.h b/src/gba/gba-video.h index 2fcf33483..8706023f5 100644 --- a/src/gba/gba-video.h +++ b/src/gba/gba-video.h @@ -204,6 +204,7 @@ struct GBAVideo { }; void GBAVideoInit(struct GBAVideo* video); +void GBAVideoDeinit(struct GBAVideo* video); void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer); int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles); diff --git a/src/gba/gba.c b/src/gba/gba.c index 0db7af372..b40745002 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -52,6 +52,7 @@ void GBAInit(struct GBA* gba) { void GBADeinit(struct GBA* gba) { GBAMemoryDeinit(&gba->memory); + GBAVideoDeinit(&gba->video); } void GBABoardInit(struct GBABoard* board) {