From 42f2d068a7da28122c1eae5b6626985abff6e324 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 13 Sep 2012 06:28:22 +0200 Subject: [PATCH] (Android) Set up rarch_main_init_wrap so that it can load dynamic libretro cores if supported --- console/rarch_console.h | 2 ++ console/rarch_console_main_wrap.c | 9 ++++++++- console/rarch_console_main_wrap.h | 3 ++- gx/frontend/main.c | 5 +++-- ps3/frontend/main.c | 5 +++-- xdk/frontend/main.c | 3 ++- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/console/rarch_console.h b/console/rarch_console.h index 87d439ba2c..c1853389a4 100644 --- a/console/rarch_console.h +++ b/console/rarch_console.h @@ -106,6 +106,8 @@ typedef struct char shader_file[MAXIMUM_PATH]; char shader_dir[MAXIMUM_PATH]; #endif + char libretro_path[MAXIMUM_PATH]; /* set this to NULL if libretro cores + cannot be loaded dynamically. */ char salamander_file[MAXIMUM_PATH]; char sram_dir[MAXIMUM_PATH]; char system_dir[MAXIMUM_PATH]; diff --git a/console/rarch_console_main_wrap.c b/console/rarch_console_main_wrap.c index b32fe8a593..4f8368bfff 100644 --- a/console/rarch_console_main_wrap.c +++ b/console/rarch_console_main_wrap.c @@ -49,6 +49,12 @@ static int rarch_main_init_wrap(const struct rarch_main_wrap *args) argv[argc++] = strdup(args->config_path); } + if (args->libretro_path) + { + argv[argc++] = strdup("-L"); + argv[argc++] = strdup(args->libretro_path); + } + if (args->verbose) argv[argc++] = strdup("-v"); @@ -71,7 +77,7 @@ static int rarch_main_init_wrap(const struct rarch_main_wrap *args) return ret; } -bool rarch_startup (const char * config_path) +bool rarch_startup (const char * config_path, const char * libretro_path) { bool retval = false; @@ -84,6 +90,7 @@ bool rarch_startup (const char * config_path) args.verbose = g_extern.verbose; args.config_path = config_path; + args.libretro_path = libretro_path; args.sram_path = g_console.default_sram_dir_enable ? g_console.default_sram_dir : NULL, args.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL, args.rom_path = g_console.rom_path; diff --git a/console/rarch_console_main_wrap.h b/console/rarch_console_main_wrap.h index 919cb84fac..76de427f1f 100644 --- a/console/rarch_console_main_wrap.h +++ b/console/rarch_console_main_wrap.h @@ -23,9 +23,10 @@ struct rarch_main_wrap const char *sram_path; const char *state_path; const char *config_path; + const char *libretro_path; bool verbose; }; -bool rarch_startup (const char * config_path); +bool rarch_startup (const char *config_path, const char *libretro_path); #endif diff --git a/gx/frontend/main.c b/gx/frontend/main.c index 04748bad58..b57bbe2668 100644 --- a/gx/frontend/main.c +++ b/gx/frontend/main.c @@ -433,6 +433,7 @@ static void get_environment_settings(void) snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.port_dir); strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension)); strlcpy(default_paths.salamander_file, "boot.dol", sizeof(default_paths.salamander_file)); + default_paths.libretro_path = NULL: } #define MAKE_FILE(x) {\ @@ -558,7 +559,7 @@ int main(int argc, char *argv[]) rarch_render_cached_frame(); gx->menu_render = false; - rarch_startup(default_paths.config_file); + rarch_startup(default_paths.config_file, default_paths.libretro_path); } else { @@ -587,7 +588,7 @@ begin_loop: menu_loop(); if (g_console.mode_switch != MODE_EXIT) - rarch_startup(default_paths.config_file); + rarch_startup(default_paths.config_file, default_paths.libretro_path); } else goto begin_shutdown; diff --git a/ps3/frontend/main.c b/ps3/frontend/main.c index 1174a516bf..e05079d25c 100644 --- a/ps3/frontend/main.c +++ b/ps3/frontend/main.c @@ -225,6 +225,7 @@ static void get_environment_settings(int argc, char *argv[]) #endif snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "EBOOT.BIN"); + default_paths.libretro_path = NULL: } g_extern.verbose = false; @@ -330,7 +331,7 @@ int main(int argc, char *argv[]) RARCH_LOG("Started from multiMAN, will auto-start game.\n"); strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path)); rarch_settings_change(S_START_RARCH); - rarch_startup(default_paths.config_file); + rarch_startup(default_paths.config_file, default_paths.libretro_path); break; #endif default: @@ -355,7 +356,7 @@ begin_loop: menu_loop(); if (g_console.mode_switch != MODE_EXIT) - rarch_startup(default_paths.config_file); + rarch_startup(default_paths.config_file, default_paths.libretro_path); } else goto begin_shutdown; diff --git a/xdk/frontend/main.c b/xdk/frontend/main.c index 78460fcf47..6dc3e4696b 100644 --- a/xdk/frontend/main.c +++ b/xdk/frontend/main.c @@ -127,6 +127,7 @@ static void get_environment_settings (void) strlcpy(default_paths.filebrowser_startup_dir, "game:", sizeof(default_paths.filebrowser_startup_dir)); snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "default.xex"); #endif + default_paths.libretro_path = NULL; } static void system_init(void) @@ -201,7 +202,7 @@ begin_loop: menu_loop(); if (g_console.mode_switch != MODE_EXIT) - rarch_startup(default_paths.config_file); + rarch_startup(default_paths.config_file, default_paths.libretro_path); } else goto begin_shutdown;