Create frontend_get_ptr

This commit is contained in:
twinaphex 2015-04-08 00:08:53 +02:00
parent 1c2a96ac0b
commit 5a2ed01eec
3 changed files with 33 additions and 15 deletions

View File

@ -87,11 +87,12 @@ void main_exit_save_config(void)
**/
void main_exit(args_type() args)
{
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
global->system.shutdown = false;
global->system.shutdown = false;
main_exit_save_config();
@ -110,17 +111,23 @@ void main_exit(args_type() args)
logger_shutdown();
#endif
if (driver->frontend_ctx && driver->frontend_ctx->deinit)
driver->frontend_ctx->deinit(args);
if (frontend)
{
if (frontend->deinit)
frontend->deinit(args);
if (driver->frontend_ctx && driver->frontend_ctx->exitspawn)
driver->frontend_ctx->exitspawn(settings->libretro,
sizeof(settings->libretro));
if (frontend->exitspawn)
frontend->exitspawn(settings->libretro,
sizeof(settings->libretro));
}
rarch_main_free();
if (driver->frontend_ctx && driver->frontend_ctx->shutdown)
driver->frontend_ctx->shutdown(false);
if (frontend)
{
if (frontend->shutdown)
frontend->shutdown(false);
}
driver_free();
}
@ -281,10 +288,10 @@ returntype main_entry(signature())
{
declare_argc();
declare_argv();
args_type() args = (args_type())args_initial_ptr();
int ret = 0;
settings_t *settings = NULL;
driver_t *driver = NULL;
args_type() args = (args_type())args_initial_ptr();
int ret = 0;
settings_t *settings = NULL;
driver_t *driver = NULL;
rarch_main_alloc();

View File

@ -15,6 +15,7 @@
*/
#include "frontend_driver.h"
#include "../driver.h"
#include <string.h>
#ifdef HAVE_CONFIG_H
@ -90,3 +91,11 @@ const frontend_ctx_driver_t *frontend_ctx_init_first(void)
return NULL;
}
const frontend_ctx_driver_t *frontend_get_ptr(void)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return NULL;
return driver->frontend_ctx;
}

View File

@ -74,6 +74,8 @@ extern const frontend_ctx_driver_t frontend_ctx_null;
**/
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident);
const frontend_ctx_driver_t *frontend_get_ptr(void);
/**
* frontend_ctx_init_first:
*