put frontend_ctx variable into driver struct

This commit is contained in:
twinaphex 2014-05-13 20:23:15 +02:00
parent 3879f1214d
commit 8821a54aba
3 changed files with 22 additions and 21 deletions

View File

@ -1,5 +1,6 @@
/* RetroArch - A frontend for libretro. /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * 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 * 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- * of the GNU General Public License as published by the Free Software Found-
@ -28,6 +29,7 @@
#include "gfx/filters/softfilter.h" #include "gfx/filters/softfilter.h"
#include "audio/filters/rarch_dsp.h" #include "audio/filters/rarch_dsp.h"
#include "input/overlay.h" #include "input/overlay.h"
#include "frontend/frontend_context.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
@ -448,6 +450,7 @@ enum rarch_display_type
typedef struct driver typedef struct driver
{ {
const frontend_ctx_driver_t *frontend_ctx;
const audio_driver_t *audio; const audio_driver_t *audio;
const image_ctx_driver_t *image; const image_ctx_driver_t *image;
const video_driver_t *video; const video_driver_t *video;

View File

@ -21,7 +21,6 @@
#include "../file.h" #include "../file.h"
#include "frontend_context.h" #include "frontend_context.h"
frontend_ctx_driver_t *frontend_ctx;
#if defined(HAVE_MENU) #if defined(HAVE_MENU)
#include "menu/menu_input_line_cb.h" #include "menu/menu_input_line_cb.h"
@ -153,8 +152,8 @@ static int main_entry_iterate_content(args_type() args)
if (r) if (r)
{ {
if (frontend_ctx && frontend_ctx->process_events) if (driver.frontend_ctx && driver.frontend_ctx->process_events)
frontend_ctx->process_events(args); driver.frontend_ctx->process_events(args);
} }
else else
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME); 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 (menu_iterate(driver.menu))
{ {
if (frontend_ctx && frontend_ctx->process_events) if (driver.frontend_ctx && driver.frontend_ctx->process_events)
frontend_ctx->process_events(args); driver.frontend_ctx->process_events(args);
} }
else else
{ {
@ -314,17 +313,17 @@ void main_exit(args_type() args)
g_extern.log_file = NULL; g_extern.log_file = NULL;
#endif #endif
if (frontend_ctx && frontend_ctx->deinit) if (driver.frontend_ctx && driver.frontend_ctx->deinit)
frontend_ctx->deinit(args); driver.frontend_ctx->deinit(args);
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN) && frontend_ctx if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN) && driver.frontend_ctx
&& frontend_ctx->exitspawn) && driver.frontend_ctx->exitspawn)
frontend_ctx->exitspawn(); driver.frontend_ctx->exitspawn();
rarch_main_clear_state(); rarch_main_clear_state();
if (frontend_ctx && frontend_ctx->shutdown) if (driver.frontend_ctx && driver.frontend_ctx->shutdown)
frontend_ctx->shutdown(false); driver.frontend_ctx->shutdown(false);
} }
returntype main_entry(signature()) returntype main_entry(signature())
@ -333,15 +332,15 @@ returntype main_entry(signature())
declare_argv(); declare_argv();
args_type() args = (args_type())args_initial_ptr(); 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"); RARCH_WARN("Frontend context could not be initialized.\n");
} }
if (frontend_ctx && frontend_ctx->init) if (driver.frontend_ctx && driver.frontend_ctx->init)
frontend_ctx->init(args); driver.frontend_ctx->init(args);
if (!ra_preinited) if (!ra_preinited)
{ {
@ -349,9 +348,9 @@ returntype main_entry(signature())
rarch_init_msg_queue(); 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(); rarch_get_environment_console();
} }
@ -370,8 +369,8 @@ returntype main_entry(signature())
returnfunc(); returnfunc();
} }
if (frontend_ctx && frontend_ctx->process_args) if (driver.frontend_ctx && driver.frontend_ctx->process_args)
frontend_ctx->process_args(argc, argv, args); driver.frontend_ctx->process_args(argc, argv, args);
g_extern.lifecycle_state |= initial_menu_lifecycle_state; g_extern.lifecycle_state |= initial_menu_lifecycle_state;

View File

@ -18,7 +18,6 @@
#define __FRONTEND_CONTEXT_H #define __FRONTEND_CONTEXT_H
#include "../boolean.h" #include "../boolean.h"
#include "../driver.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"