no longer make frontend driver dependent on driver_t
This commit is contained in:
parent
c36b8e1ae9
commit
70e5283d66
1
driver.h
1
driver.h
|
@ -192,7 +192,6 @@ enum
|
|||
|
||||
typedef struct driver
|
||||
{
|
||||
frontend_ctx_driver_t *frontend_ctx;
|
||||
const ui_companion_driver_t *ui_companion;
|
||||
const camera_driver_t *camera;
|
||||
const location_driver_t *location;
|
||||
|
|
|
@ -45,7 +45,6 @@ void main_exit(void *args)
|
|||
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();
|
||||
const ui_companion_driver_t *ui = ui_companion_get_ptr();
|
||||
|
||||
event_command(EVENT_CMD_MENU_SAVE_CURRENT_CONFIG);
|
||||
|
@ -65,15 +64,9 @@ void main_exit(void *args)
|
|||
logger_shutdown();
|
||||
#endif
|
||||
|
||||
if (frontend)
|
||||
{
|
||||
if (frontend->deinit)
|
||||
frontend->deinit(args);
|
||||
|
||||
if (frontend->exitspawn)
|
||||
frontend->exitspawn(settings->libretro,
|
||||
sizeof(settings->libretro));
|
||||
}
|
||||
frontend_driver_deinit(args);
|
||||
frontend_driver_exitspawn(settings->libretro,
|
||||
sizeof(settings->libretro));
|
||||
|
||||
rarch_main_free();
|
||||
|
||||
|
@ -83,13 +76,10 @@ void main_exit(void *args)
|
|||
ui->deinit(driver->ui_companion_data);
|
||||
}
|
||||
|
||||
if (frontend)
|
||||
{
|
||||
if (frontend->shutdown)
|
||||
frontend->shutdown(false);
|
||||
}
|
||||
frontend_driver_shutdown(false);
|
||||
|
||||
driver_free();
|
||||
frontend_driver_free();
|
||||
}
|
||||
|
||||
static void check_defaults_dirs(void)
|
||||
|
|
|
@ -61,6 +61,8 @@ static frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static frontend_ctx_driver_t *current_frontend_ctx;
|
||||
|
||||
/**
|
||||
* frontend_ctx_find_driver:
|
||||
* @ident : Identifier name of driver to find.
|
||||
|
@ -106,10 +108,7 @@ frontend_ctx_driver_t *frontend_ctx_init_first(void)
|
|||
#ifndef IS_SALAMANDER
|
||||
frontend_ctx_driver_t *frontend_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return NULL;
|
||||
return driver->frontend_ctx;
|
||||
return current_frontend_ctx;
|
||||
}
|
||||
|
||||
int frontend_driver_parse_drive_list(void *data)
|
||||
|
@ -150,46 +149,73 @@ void frontend_driver_process_args(int *argc, char *argv[])
|
|||
|
||||
bool frontend_driver_is_inited(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver->frontend_ctx)
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void frontend_driver_init_first(void *args)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (driver)
|
||||
driver->frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
|
||||
current_frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
|
||||
|
||||
if (!driver || !driver->frontend_ctx)
|
||||
if (!current_frontend_ctx)
|
||||
RARCH_WARN("Frontend context could not be initialized.\n");
|
||||
|
||||
if (driver->frontend_ctx && driver->frontend_ctx->init)
|
||||
driver->frontend_ctx->init(args);
|
||||
if (current_frontend_ctx && current_frontend_ctx->init)
|
||||
current_frontend_ctx->init(args);
|
||||
}
|
||||
|
||||
void frontend_driver_free(void)
|
||||
{
|
||||
current_frontend_ctx = NULL;
|
||||
}
|
||||
|
||||
environment_get_t frontend_driver_environment_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver || !driver->frontend_ctx)
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend)
|
||||
return NULL;
|
||||
return driver->frontend_ctx->environment_get;
|
||||
return frontend->environment_get;
|
||||
}
|
||||
|
||||
bool frontend_driver_has_get_video_driver_func(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver || !driver->frontend_ctx || !driver->frontend_ctx->get_video_driver)
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->get_video_driver)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
const struct video_driver *frontend_driver_get_video_driver(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver || !driver->frontend_ctx || !driver->frontend_ctx->get_video_driver)
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->get_video_driver)
|
||||
return NULL;
|
||||
return driver->frontend_ctx->get_video_driver();
|
||||
return frontend->get_video_driver();
|
||||
}
|
||||
|
||||
void frontend_driver_exitspawn(char *s, size_t len)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->exitspawn)
|
||||
return;
|
||||
frontend->exitspawn(s, len);
|
||||
}
|
||||
|
||||
void frontend_driver_deinit(void *args)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->deinit)
|
||||
return;
|
||||
frontend->deinit(args);
|
||||
}
|
||||
|
||||
void frontend_driver_shutdown(bool a)
|
||||
{
|
||||
frontend_ctx_driver_t *frontend = frontend_get_ptr();
|
||||
if (!frontend || !frontend->shutdown)
|
||||
return NULL;
|
||||
return frontend->shutdown(a);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -122,11 +122,19 @@ bool frontend_driver_is_inited(void);
|
|||
|
||||
void frontend_driver_init_first(void *args);
|
||||
|
||||
void frontend_driver_free(void);
|
||||
|
||||
environment_get_t frontend_driver_environment_get_ptr(void);
|
||||
|
||||
bool frontend_driver_has_get_video_driver_func(void);
|
||||
|
||||
const struct video_driver *frontend_driver_get_video_driver(void);
|
||||
|
||||
void frontend_driver_shutdown(bool a);
|
||||
|
||||
void frontend_driver_deinit(void *args);
|
||||
|
||||
void frontend_driver_exitspawn(char *s, size_t len);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue