From 33ae5b3e3d5d180b39ca9b79c7de841de0fa0571 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 8 Jan 2013 03:56:17 +0100 Subject: [PATCH] (RARCH_CONSOLE) Do early initing of audio/video/input - add hack to settings.c to progress beyond assert --- frontend/frontend_console.c | 32 +++++++++++++++++++++----------- settings.c | 6 ++++++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/frontend/frontend_console.c b/frontend/frontend_console.c index 8f4e5d6d92..d136f4fa65 100644 --- a/frontend/frontend_console.c +++ b/frontend/frontend_console.c @@ -25,6 +25,26 @@ #include "frontend_ps3.c" #endif +#undef main + +static void init_drivers_console(void) +{ + config_set_defaults(); + rarch_settings_set_default(); + + init_drivers_pre(); + + rarch_config_load(); + + driver.input_data = driver.input->init(); + rarch_input_set_controls_default(driver.input); + + driver.input->post_init(); + + driver.video->start(); + init_audio(); +} + int main(int argc, char *argv[]) { system_init(); @@ -32,14 +52,7 @@ int main(int argc, char *argv[]) rarch_main_clear_state(); get_environment_settings(argc, argv); - config_set_defaults(); - - init_drivers_pre(); - driver.input->init(); - - rarch_settings_set_default(); - rarch_input_set_controls_default(driver.input); - rarch_config_load(); + init_drivers_console(); #ifdef HAVE_LIBRETRO_MANAGEMENT char core_exe_path[PATH_MAX]; @@ -62,11 +75,8 @@ int main(int argc, char *argv[]) init_libretro_sym(); - driver.input->post_init(); system_post_init(); - driver.video->start(); - menu_init(); system_process_args(argc, argv); diff --git a/settings.c b/settings.c index dfe944806e..c02f79347f 100644 --- a/settings.c +++ b/settings.c @@ -216,6 +216,12 @@ void config_set_defaults(void) g_settings.network_cmd_port = network_cmd_port; g_settings.stdin_cmd_enable = stdin_cmd_enable; +#ifdef RARCH_CONSOLE + //hack - need this to get past assert() during premature video/audio/input + //init on consoles + g_settings.audio.in_rate = out_rate; +#endif + rarch_assert(sizeof(g_settings.input.binds[0]) >= sizeof(retro_keybinds_1)); rarch_assert(sizeof(g_settings.input.binds[1]) >= sizeof(retro_keybinds_rest)); memcpy(g_settings.input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1));