From 8821a54aba13d210b2bbb534e2a10392e28bf2f8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 13 May 2014 20:23:15 +0200 Subject: [PATCH] put frontend_ctx variable into driver struct --- driver.h | 3 +++ frontend/frontend.c | 39 ++++++++++++++++++------------------- frontend/frontend_context.h | 1 - 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/driver.h b/driver.h index 43464c1fcb..d4e8cee1cc 100644 --- a/driver.h +++ b/driver.h @@ -1,5 +1,6 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2014 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -28,6 +29,7 @@ #include "gfx/filters/softfilter.h" #include "audio/filters/rarch_dsp.h" #include "input/overlay.h" +#include "frontend/frontend_context.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -448,6 +450,7 @@ enum rarch_display_type typedef struct driver { + const frontend_ctx_driver_t *frontend_ctx; const audio_driver_t *audio; const image_ctx_driver_t *image; const video_driver_t *video; diff --git a/frontend/frontend.c b/frontend/frontend.c index 1861ecd2c6..7ad8f64e28 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -21,7 +21,6 @@ #include "../file.h" #include "frontend_context.h" -frontend_ctx_driver_t *frontend_ctx; #if defined(HAVE_MENU) #include "menu/menu_input_line_cb.h" @@ -153,8 +152,8 @@ static int main_entry_iterate_content(args_type() args) if (r) { - if (frontend_ctx && frontend_ctx->process_events) - frontend_ctx->process_events(args); + if (driver.frontend_ctx && driver.frontend_ctx->process_events) + driver.frontend_ctx->process_events(args); } else g_extern.lifecycle_state &= ~(1ULL << MODE_GAME); @@ -230,8 +229,8 @@ static int main_entry_iterate_menu(args_type() args) { if (menu_iterate(driver.menu)) { - if (frontend_ctx && frontend_ctx->process_events) - frontend_ctx->process_events(args); + if (driver.frontend_ctx && driver.frontend_ctx->process_events) + driver.frontend_ctx->process_events(args); } else { @@ -314,17 +313,17 @@ void main_exit(args_type() args) g_extern.log_file = NULL; #endif - if (frontend_ctx && frontend_ctx->deinit) - frontend_ctx->deinit(args); + if (driver.frontend_ctx && driver.frontend_ctx->deinit) + driver.frontend_ctx->deinit(args); - if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN) && frontend_ctx - && frontend_ctx->exitspawn) - frontend_ctx->exitspawn(); + if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN) && driver.frontend_ctx + && driver.frontend_ctx->exitspawn) + driver.frontend_ctx->exitspawn(); rarch_main_clear_state(); - if (frontend_ctx && frontend_ctx->shutdown) - frontend_ctx->shutdown(false); + if (driver.frontend_ctx && driver.frontend_ctx->shutdown) + driver.frontend_ctx->shutdown(false); } returntype main_entry(signature()) @@ -333,15 +332,15 @@ returntype main_entry(signature()) declare_argv(); args_type() args = (args_type())args_initial_ptr(); - frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first(); + driver.frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first(); - if (!frontend_ctx) + if (!driver.frontend_ctx) { RARCH_WARN("Frontend context could not be initialized.\n"); } - if (frontend_ctx && frontend_ctx->init) - frontend_ctx->init(args); + if (driver.frontend_ctx && driver.frontend_ctx->init) + driver.frontend_ctx->init(args); if (!ra_preinited) { @@ -349,9 +348,9 @@ returntype main_entry(signature()) rarch_init_msg_queue(); } - if (frontend_ctx && frontend_ctx->environment_get) + if (driver.frontend_ctx && driver.frontend_ctx->environment_get) { - frontend_ctx->environment_get(argc, argv, args); + driver.frontend_ctx->environment_get(argc, argv, args); rarch_get_environment_console(); } @@ -370,8 +369,8 @@ returntype main_entry(signature()) returnfunc(); } - if (frontend_ctx && frontend_ctx->process_args) - frontend_ctx->process_args(argc, argv, args); + if (driver.frontend_ctx && driver.frontend_ctx->process_args) + driver.frontend_ctx->process_args(argc, argv, args); g_extern.lifecycle_state |= initial_menu_lifecycle_state; diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h index 3cf88c0260..bc5afcc769 100644 --- a/frontend/frontend_context.h +++ b/frontend/frontend_context.h @@ -18,7 +18,6 @@ #define __FRONTEND_CONTEXT_H #include "../boolean.h" -#include "../driver.h" #ifdef HAVE_CONFIG_H #include "../config.h"