mirror of
https://github.com/libretro/RetroArch
synced 2024-12-28 18:31:05 +00:00
Refactor load_menu_game/main function some more
This commit is contained in:
parent
df75b586a2
commit
e104698f7e
@ -295,12 +295,7 @@ returntype main_entry(signature())
|
||||
char *rarch_argv[MAX_ARGS] = {NULL};
|
||||
char *argv_copy[MAX_ARGS] = {NULL};
|
||||
|
||||
wrap_args = (struct rarch_main_wrap*)calloc(1, sizeof(*wrap_args));
|
||||
rarch_assert(wrap_args);
|
||||
|
||||
driver.frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
|
||||
rarch_argv_ptr = (char**)argv;
|
||||
rarch_argc_ptr = (int*)&argc;
|
||||
|
||||
if (!driver.frontend_ctx)
|
||||
RARCH_WARN("Frontend context could not be initialized.\n");
|
||||
@ -311,6 +306,12 @@ returntype main_entry(signature())
|
||||
rarch_main_clear_state();
|
||||
rarch_init_msg_queue();
|
||||
|
||||
wrap_args = (struct rarch_main_wrap*)calloc(1, sizeof(*wrap_args));
|
||||
rarch_assert(wrap_args);
|
||||
|
||||
rarch_argv_ptr = (char**)argv;
|
||||
rarch_argc_ptr = (int*)&argc;
|
||||
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->environment_get)
|
||||
{
|
||||
driver.frontend_ctx->environment_get(rarch_argc_ptr, rarch_argv_ptr, args, wrap_args);
|
||||
@ -336,15 +337,15 @@ returntype main_entry(signature())
|
||||
path_mkdir(g_defaults.sram_dir);
|
||||
if (*g_defaults.system_dir)
|
||||
path_mkdir(g_defaults.system_dir);
|
||||
}
|
||||
|
||||
if (wrap_args->touched)
|
||||
{
|
||||
g_extern.verbosity = true;
|
||||
rarch_main_init_wrap(wrap_args, &rarch_argc, rarch_argv);
|
||||
memcpy(argv_copy, rarch_argv, sizeof(rarch_argv));
|
||||
rarch_argv_ptr = (char**)rarch_argv;
|
||||
rarch_argc_ptr = (int*)&rarch_argc;
|
||||
}
|
||||
if (wrap_args->touched)
|
||||
{
|
||||
g_extern.verbosity = true;
|
||||
rarch_main_init_wrap(wrap_args, &rarch_argc, rarch_argv);
|
||||
memcpy(argv_copy, rarch_argv, sizeof(rarch_argv));
|
||||
rarch_argv_ptr = (char**)rarch_argv;
|
||||
rarch_argc_ptr = (int*)&rarch_argc;
|
||||
}
|
||||
|
||||
if (g_extern.main_is_init)
|
||||
|
@ -179,6 +179,20 @@ static void menu_update_libretro_info(menu_handle_t *menu)
|
||||
menu_update_system_info(menu, NULL);
|
||||
}
|
||||
|
||||
static void menu_environment_get(int *argc, char *argv[], void *args, void *params_data)
|
||||
{
|
||||
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)params_data;
|
||||
|
||||
wrap_args->no_rom = driver.menu->load_no_rom;
|
||||
wrap_args->verbose = g_extern.verbosity;
|
||||
wrap_args->config_path = *g_extern.config_path ? g_extern.config_path : NULL;
|
||||
wrap_args->sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL;
|
||||
wrap_args->state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL;
|
||||
wrap_args->rom_path = *g_extern.fullpath ? g_extern.fullpath : NULL;
|
||||
wrap_args->libretro_path = *g_settings.libretro ? g_settings.libretro : NULL;
|
||||
wrap_args->touched = true;
|
||||
}
|
||||
|
||||
bool load_menu_game(void)
|
||||
{
|
||||
int *rarch_argc_ptr;
|
||||
@ -194,14 +208,7 @@ bool load_menu_game(void)
|
||||
wrap_args = (struct rarch_main_wrap*)calloc(1, sizeof(*wrap_args));
|
||||
rarch_assert(wrap_args);
|
||||
|
||||
wrap_args->no_rom = driver.menu->load_no_rom;
|
||||
wrap_args->verbose = g_extern.verbosity;
|
||||
wrap_args->config_path = *g_extern.config_path ? g_extern.config_path : NULL;
|
||||
wrap_args->sram_path = *g_extern.savefile_dir ? g_extern.savefile_dir : NULL;
|
||||
wrap_args->state_path = *g_extern.savestate_dir ? g_extern.savestate_dir : NULL;
|
||||
wrap_args->rom_path = *g_extern.fullpath ? g_extern.fullpath : NULL;
|
||||
wrap_args->libretro_path = *g_settings.libretro ? g_settings.libretro : NULL;
|
||||
wrap_args->touched = true;
|
||||
menu_environment_get(rarch_argc_ptr, rarch_argv_ptr, NULL, wrap_args);
|
||||
|
||||
if (wrap_args->touched)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user