Move init_console_drivers and uninit_console_drivers to driver.c

and rename them global_init_drivers and global_unit_drivers -
we'll need this for Blackberry, starting RetroArch with RGUI
at startup AND consoles
This commit is contained in:
twinaphex 2013-03-13 04:16:56 +01:00
parent d67e96c603
commit c28bb3a3fd
3 changed files with 32 additions and 30 deletions

View File

@ -264,6 +264,33 @@ void driver_set_monitor_refresh_rate(float hz)
}
// Only called once on init and deinit.
// Video and input drivers need to be active (owned)
// before retroarch core starts.
// Core handles audio.
void global_init_drivers(void)
{
init_drivers_pre(); // Set driver.* function callbacks.
driver.video->start(); // Statically starts video driver. Sets driver.video_data.
driver.input_data = driver.input->init();
}
void global_uninit_drivers(void)
{
if (driver.video_data)
{
driver.video->stop();
driver.video_data = NULL;
}
if (driver.input_data)
{
driver.input->free(NULL);
driver.input_data = NULL;
}
}
void init_drivers(void)
{
driver.video_data_own = !driver.video_data;

View File

@ -347,6 +347,9 @@ void init_drivers(void);
void init_drivers_pre(void);
void uninit_drivers(void);
void global_init_drivers(void);
void global_uninit_drivers(void);
void init_video_input(void);
void uninit_video_input(void);
void init_audio(void);

View File

@ -188,36 +188,8 @@ static bool install_libretro_core(const char *core_exe_path, const char *tmp_pat
return true;
}
#endif
// Only called once on init and deinit.
// Video and input drivers need to be active (owned)
// before retroarch core starts.
static void init_console_drivers(void)
{
init_drivers_pre(); // Set driver.* function callbacks.
driver.video->start(); // Statically starts video driver. Sets driver.video_data.
driver.input_data = driver.input->init();
// Core handles audio.
}
static void uninit_console_drivers(void)
{
if (driver.video_data)
{
driver.video->stop();
driver.video_data = NULL;
}
if (driver.input_data)
{
driver.input->free(NULL);
driver.input_data = NULL;
}
}
int rarch_main(int argc, char *argv[])
{
system_init();
@ -232,7 +204,7 @@ int rarch_main(int argc, char *argv[])
init_libretro_sym();
rarch_init_system_info();
init_console_drivers();
global_init_drivers();
#ifdef HAVE_LIBRETRO_MANAGEMENT
char core_exe_path[PATH_MAX];
@ -337,7 +309,7 @@ begin_shutdown:
rarch_main_deinit();
menu_free();
uninit_console_drivers();
global_uninit_drivers();
#ifdef PERF_TEST
rarch_perf_log();