Deinit video when shutting down

This commit is contained in:
Jeffrey Pfau 2013-05-07 01:00:18 -07:00
parent 8bc5ec4222
commit db96be98dc
3 changed files with 6 additions and 0 deletions

View File

@ -43,6 +43,10 @@ void GBAVideoInit(struct GBAVideo* video) {
video->nextVcounterIRQ = 0; video->nextVcounterIRQ = 0;
} }
void GBAVideoDeinit(struct GBAVideo* video) {
GBAVideoAssociateRenderer(video, &dummyRenderer);
}
void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer) { void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer) {
video->renderer->deinit(video->renderer); video->renderer->deinit(video->renderer);
video->renderer = renderer; video->renderer = renderer;

View File

@ -204,6 +204,7 @@ struct GBAVideo {
}; };
void GBAVideoInit(struct GBAVideo* video); void GBAVideoInit(struct GBAVideo* video);
void GBAVideoDeinit(struct GBAVideo* video);
void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer); void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer);
int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles); int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles);

View File

@ -52,6 +52,7 @@ void GBAInit(struct GBA* gba) {
void GBADeinit(struct GBA* gba) { void GBADeinit(struct GBA* gba) {
GBAMemoryDeinit(&gba->memory); GBAMemoryDeinit(&gba->memory);
GBAVideoDeinit(&gba->video);
} }
void GBABoardInit(struct GBABoard* board) { void GBABoardInit(struct GBABoard* board) {