(PS3) Starts working with new argc/argv building - only

broken usecase right now is Core Selection - we'll have to
mess directly with argc/argv for fixing that one - pretty
similar issue to the one on the Wii
This commit is contained in:
twinaphex 2014-06-03 06:37:57 +02:00
parent 2c5bde4f84
commit b5ab16fa53
4 changed files with 61 additions and 25 deletions

View File

@ -280,11 +280,12 @@ static void free_args(struct rarch_main_wrap *wrap_args,
char *argv_copy[])
{
int i;
if (!wrap_args->touched)
return;
for (i = 0; i < ARRAY_SIZE(argv_copy); i++)
if (argv_copy[i])
free(argv_copy[i]);
free(wrap_args);
}
returntype main_entry(signature())
@ -298,7 +299,7 @@ returntype main_entry(signature())
declare_argv();
args_type() args = (args_type())args_initial_ptr();
wrap_args = NULL;
wrap_args = (struct rarch_main_wrap*)calloc(1, sizeof(*wrap_args));
driver.frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
rarch_argv_ptr = (char**)argv;
rarch_argc_ptr = (int*)&argc;
@ -342,22 +343,20 @@ returntype main_entry(signature())
path_mkdir(default_paths.system_dir);
#endif
if (wrap_args)
if (wrap_args->touched)
{
g_extern.verbose = true;
rarch_main_init_wrap(wrap_args, &rarch_argc, rarch_argv);
if (rarch_argc > 0)
{
memcpy(argv_copy, rarch_argv, sizeof(rarch_argv));
rarch_argv_ptr = (char**)rarch_argv;
rarch_argc_ptr = (int*)&rarch_argc;
}
memcpy(argv_copy, rarch_argv, sizeof(rarch_argv));
rarch_argv_ptr = (char**)rarch_argv;
rarch_argc_ptr = (int*)&rarch_argc;
}
}
if ((ret = rarch_main_init(*rarch_argc_ptr, rarch_argv_ptr)))
{
free_args(wrap_args, argv_copy);
free(wrap_args);
return_var(ret);
}
@ -381,6 +380,7 @@ returntype main_entry(signature())
if (wrap_args)
free_args(wrap_args, argv_copy);
free(wrap_args);
#if defined(HAVE_MENU)
while (!main_entry_iterate(signature_expand(), args));

View File

@ -271,20 +271,20 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
#else
char path[PATH_MAX];
struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data;
args = (struct rarch_main_wrap*)malloc(sizeof(struct rarch_main_wrap));
if (!args)
return;
if (args)
{
fill_pathname_join(path, argv[1], argv[2], sizeof(path));
fill_pathname_join(path, argv[1], argv[2], sizeof(path));
args->no_rom = false;
args->verbose = false;
args->config_path = NULL;
args->sram_path = NULL;
args->state_path = NULL;
args->rom_path = path;
args->libretro_path = NULL;
args->touched = true;
args->no_rom = false;
args->verbose = false;
args->config_path = NULL;
args->sram_path = NULL;
args->state_path = NULL;
args->rom_path = path;
args->libretro_path = NULL;
}
#endif
}
#endif

View File

@ -202,7 +202,39 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
else
#endif
#ifndef IS_SALAMANDER
RARCH_WARN("Started from Salamander, auto-game start disabled.\n");
if (*argc > 1 && argv[1] != NULL && argv[1][0] != '\0')
{
char path[PATH_MAX];
struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data;
if (args)
{
strlcpy(path, argv[1], sizeof(path));
args->touched = true;
args->no_rom = false;
args->verbose = false;
args->config_path = NULL;
args->sram_path = NULL;
args->state_path = NULL;
args->rom_path = path;
args->libretro_path = NULL;
RARCH_LOG("argv[0]: %s\n", argv[0]);
RARCH_LOG("argv[1]: %s\n", argv[1]);
RARCH_LOG("argv[2]: %s\n", argv[2]);
RARCH_LOG("Auto-start game %s.\n", argv[1]);
}
}
else
RARCH_WARN("Started from Salamander, auto-game start disabled.\n");
//hack - this would break core selection
if (argv[1] != NULL && argv[1][0] == '\0')
{
RARCH_LOG("Broken core selection triggered.\n");
}
#endif
memset(&size, 0x00, sizeof(CellGameContentSize));
@ -337,12 +369,14 @@ static int frontend_ps3_process_args(int *argc, char *argv[], void *args)
bool original_verbose = g_extern.verbose;
g_extern.verbose = true;
if (*argc > 1)
#if 0
if (*argc > 1 && argv[1] != NULL)
{
strlcpy(g_extern.fullpath, argv[1], sizeof(g_extern.fullpath));
ret = 0;
RARCH_LOG("Auto-start game %s.\n", argv[1]);
}
#endif
g_extern.verbose = original_verbose;
#endif

View File

@ -706,6 +706,8 @@ struct rarch_main_wrap
const char *libretro_path;
bool verbose;
bool no_rom;
bool touched;
};
// Public data structures