mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Make 'argc' into int pointer so that we can modify argc inside
get_environment callback
This commit is contained in:
parent
237ac1aa56
commit
908164868f
@ -306,7 +306,7 @@ returntype main_entry(signature())
|
||||
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->environment_get)
|
||||
{
|
||||
driver.frontend_ctx->environment_get(argc, argv, args);
|
||||
driver.frontend_ctx->environment_get(&argc, argv, args);
|
||||
#if defined(RARCH_CONSOLE) || defined(__QNX__)
|
||||
if (*default_paths.autoconfig_dir)
|
||||
path_mkdir(default_paths.autoconfig_dir);
|
||||
@ -340,7 +340,7 @@ returntype main_entry(signature())
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
if (driver.frontend_ctx && driver.frontend_ctx->process_args)
|
||||
driver.frontend_ctx->process_args(argc, argv, args);
|
||||
driver.frontend_ctx->process_args(&argc, argv, args);
|
||||
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
|
||||
|
||||
|
@ -31,13 +31,13 @@ extern "C" {
|
||||
|
||||
typedef struct frontend_ctx_driver
|
||||
{
|
||||
void (*environment_get)(int argc, char *argv[], void *args);
|
||||
void (*environment_get)(int *argc, char *argv[], void *args);
|
||||
|
||||
void (*init)(void *data);
|
||||
void (*deinit)(void *data);
|
||||
void (*exitspawn)(void);
|
||||
|
||||
int (*process_args)(int argc, char *argv[], void *args);
|
||||
int (*process_args)(int *argc, char *argv[], void *args);
|
||||
int (*process_events)(void *data);
|
||||
void (*exec)(const char *, bool);
|
||||
void (*shutdown)(bool);
|
||||
|
@ -376,7 +376,7 @@ static bool android_run_events (void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void frontend_android_get_environment_settings(int argc, char *argv[], void *data)
|
||||
static void frontend_android_get_environment_settings(int *argc, char *argv[], void *data)
|
||||
{
|
||||
JNIEnv *env;
|
||||
struct android_app* android_app = (struct android_app*)data;
|
||||
|
@ -100,12 +100,12 @@ void apple_refresh_config(void)
|
||||
init_drivers();
|
||||
}
|
||||
|
||||
int apple_rarch_load_content(int argc, char* argv[])
|
||||
int apple_rarch_load_content(int *argc, char* argv[])
|
||||
{
|
||||
rarch_main_clear_state();
|
||||
rarch_init_msg_queue();
|
||||
|
||||
if (rarch_main_init(argc, argv))
|
||||
if (rarch_main_init(*argc, argv))
|
||||
return 1;
|
||||
|
||||
if (!g_extern.libretro_dummy)
|
||||
|
@ -34,7 +34,7 @@ static void emscripten_mainloop(void)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int *argc, char *argv[])
|
||||
{
|
||||
emscripten_set_canvas_size(800, 600);
|
||||
|
||||
@ -42,7 +42,7 @@ int main(int argc, char *argv[])
|
||||
rarch_init_msg_queue();
|
||||
|
||||
int init_ret;
|
||||
if ((init_ret = rarch_main_init(argc, argv))) return init_ret;
|
||||
if ((init_ret = rarch_main_init(*argc, argv))) return init_ret;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
g_extern.lifecycle_state |= 1ULL << MODE_GAME;
|
||||
|
@ -217,7 +217,7 @@ int gx_logger_file(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||
extern char gx_rom_path[PATH_MAX];
|
||||
#endif
|
||||
|
||||
static void frontend_gx_get_environment_settings(int argc, char *argv[], void *args)
|
||||
static void frontend_gx_get_environment_settings(int *argc, char *argv[], void *args)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(HAVE_LOGGER)
|
||||
@ -246,26 +246,26 @@ static void frontend_gx_get_environment_settings(int argc, char *argv[], void *a
|
||||
fill_pathname_join(default_paths.savestate_dir, default_paths.port_dir, "savefiles", sizeof(default_paths.savestate_dir));
|
||||
|
||||
#ifdef IS_SALAMANDER
|
||||
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
fill_pathname_join(gx_rom_path, argv[1], argv[2], sizeof(gx_rom_path));
|
||||
else
|
||||
gx_rom_path[0] = '\0';
|
||||
#else
|
||||
#ifdef HW_RVL
|
||||
// needed on Wii; loaders follow a dumb standard where the path and filename are separate in the argument list
|
||||
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
{
|
||||
int i;
|
||||
char wii_new_argv1[PATH_MAX];
|
||||
fill_pathname_join(wii_new_argv1, argv[1], argv[2], sizeof(wii_new_argv1));
|
||||
argv[1] = strdup(wii_new_argv1);
|
||||
// shift over remaining args
|
||||
for (i = 3; i < argc; i++)
|
||||
for (i = 3; i < *argc; i++)
|
||||
{
|
||||
argv[i - 1] = argv[i];
|
||||
}
|
||||
argc--;
|
||||
argv[argc] = NULL;
|
||||
*argc = *argc - 1;
|
||||
argv[*argc] = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -348,21 +348,21 @@ static void frontend_gx_exitspawn(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int frontend_gx_process_args(int argc, char *argv[], void *args)
|
||||
static int frontend_gx_process_args(int *argc, char *argv[], void *args)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
// a big hack: sometimes salamander doesn't save the new core it loads on first boot,
|
||||
// so we make sure g_settings.libretro is set here
|
||||
if (!g_settings.libretro[0] && argc >= 1 && strrchr(argv[0], '/'))
|
||||
if (!g_settings.libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
strlcpy(path, strrchr(argv[0], '/') + 1, sizeof(path));
|
||||
rarch_environment_cb(RETRO_ENVIRONMENT_SET_LIBRETRO_PATH, path);
|
||||
}
|
||||
|
||||
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
|
||||
{
|
||||
fill_pathname_join(g_extern.fullpath, argv[1], argv[2], sizeof(g_extern.fullpath));
|
||||
ret = 1;
|
||||
|
@ -160,7 +160,7 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_ps3_get_environment_settings(int argc, char *argv[], void *args)
|
||||
static void frontend_ps3_get_environment_settings(int *argc, char *argv[], void *args)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbose;
|
||||
@ -186,7 +186,7 @@ static void frontend_ps3_get_environment_settings(int argc, char *argv[], void *
|
||||
#ifdef HAVE_MULTIMAN
|
||||
/* not launched from external launcher, set default path */
|
||||
// second param is multiMAN SELF file
|
||||
if(path_file_exists(argv[2]) && argc > 1 && (strcmp(argv[2], EMULATOR_CONTENT_DIR) == 0))
|
||||
if(path_file_exists(argv[2]) && *argc > 1 && (strcmp(argv[2], EMULATOR_CONTENT_DIR) == 0))
|
||||
{
|
||||
g_extern.lifecycle_state |= (1ULL << MODE_EXTLAUNCH_MULTIMAN);
|
||||
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
|
||||
@ -322,14 +322,14 @@ static void frontend_ps3_init(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int frontend_ps3_process_args(int argc, char *argv[], void *args)
|
||||
static int frontend_ps3_process_args(int *argc, char *argv[], void *args)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifndef IS_SALAMANDER
|
||||
bool original_verbose = g_extern.verbose;
|
||||
g_extern.verbose = true;
|
||||
|
||||
if (argc > 1)
|
||||
if (*argc > 1)
|
||||
{
|
||||
RARCH_LOG("Auto-start game %s.\n", argv[1]);
|
||||
strlcpy(g_extern.fullpath, argv[1], sizeof(g_extern.fullpath));
|
||||
|
@ -44,7 +44,7 @@ static int exit_callback(int arg1, int arg2, void *common)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void frontend_psp_get_environment_settings(int argc, char *argv[], void *args)
|
||||
static void frontend_psp_get_environment_settings(int *argc, char *argv[], void *args)
|
||||
{
|
||||
(void)args;
|
||||
#ifndef IS_SALAMANDER
|
||||
@ -107,7 +107,7 @@ static void frontend_psp_deinit(void *data)
|
||||
sceKernelExitGame();
|
||||
}
|
||||
|
||||
static int frontend_psp_process_args(int argc, char *argv[], void *args)
|
||||
static int frontend_psp_process_args(int *argc, char *argv[], void *args)
|
||||
{
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "../../dynamic.h"
|
||||
#include "../../libretro_private.h"
|
||||
|
||||
static void frontend_qnx_get_environment_settings(int argc, char *argv[], void *args)
|
||||
static void frontend_qnx_get_environment_settings(int *argc, char *argv[], void *args)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
@ -192,7 +192,7 @@ static HRESULT xbox_io_unmount(char *szDrive)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void frontend_xdk_get_environment_settings(int argc, char *argv[], void *args)
|
||||
static void frontend_xdk_get_environment_settings(int *argc, char *argv[], void *args)
|
||||
{
|
||||
HRESULT ret;
|
||||
(void)ret;
|
||||
@ -279,7 +279,7 @@ static void frontend_xdk_init(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int frontend_xdk_process_args(int argc, char *argv[], void *args)
|
||||
static int frontend_xdk_process_args(int *argc, char *argv[], void *args)
|
||||
{
|
||||
int ret;
|
||||
#ifndef IS_SALAMANDER
|
||||
|
Loading…
x
Reference in New Issue
Block a user