Move retroarch_get_launch_arguments() function call outside

of frontend driver - should be called by Salamander too which
has no conception of RetroArch launch arguments
This commit is contained in:
twinaphex 2020-02-01 17:42:18 +01:00
parent c2852bdefe
commit 85d64602ff
17 changed files with 57 additions and 59 deletions

View File

@ -489,17 +489,17 @@ void discord_init(const char *discord_app_id)
#ifdef _WIN32
fill_pathname_application_path(full_path, sizeof(full_path));
if (strstr(get_retroarch_launch_arguments(), full_path))
strlcpy(command, get_retroarch_launch_arguments(), sizeof(command));
if (strstr(retroarch_get_launch_arguments(), full_path))
strlcpy(command, retroarch_get_launch_arguments(), sizeof(command));
else
{
path_basedir(full_path);
snprintf(command, sizeof(command), "%s%s",
full_path, get_retroarch_launch_arguments());
full_path, retroarch_get_launch_arguments());
}
#else
snprintf(command, sizeof(command), "sh -c %s",
get_retroarch_launch_arguments());
retroarch_get_launch_arguments());
#endif
RARCH_LOG("[discord] registering startup command: %s\n", command);
Discord_Register(discord_app_id, command);

View File

@ -300,7 +300,7 @@ static bool frontend_ctr_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_ctr_exitspawn(char* s, size_t len)
static void frontend_ctr_exitspawn(char* s, size_t len, char *args)
{
bool should_load_game = false;
#ifndef IS_SALAMANDER

View File

@ -366,7 +366,7 @@ static void frontend_gx_exec(const char *path, bool should_load_game)
#endif
}
static void frontend_gx_exitspawn(char *s, size_t len)
static void frontend_gx_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
#if defined(IS_SALAMANDER)

View File

@ -293,7 +293,7 @@ static bool frontend_orbis_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_orbis_exitspawn(char *s, size_t len)
static void frontend_orbis_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
#ifndef IS_SALAMANDER

View File

@ -298,9 +298,9 @@ static bool frontend_ps2_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_ps2_exitspawn(char *core_path, size_t core_path_size)
static void frontend_ps2_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
bool should_load_content = false;
#ifndef IS_SALAMANDER
if (ps2_fork_mode == FRONTEND_FORK_NONE)
return;
@ -308,14 +308,14 @@ static void frontend_ps2_exitspawn(char *core_path, size_t core_path_size)
switch (ps2_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_game = true;
should_load_content = true;
break;
case FRONTEND_FORK_NONE:
default:
break;
}
#endif
frontend_ps2_exec(core_path, should_load_game);
frontend_ps2_exec(s, should_load_content);
}
static void frontend_ps2_shutdown(bool unused)

View File

@ -465,7 +465,7 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
#endif
}
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
static void frontend_ps3_exitspawn(char *s, size_t len, char *args)
{
#ifdef HAVE_RARCH_EXEC
bool should_load_game = false;
@ -495,7 +495,7 @@ static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size)
}
#endif
frontend_ps3_exec(core_path, should_load_game);
frontend_ps3_exec(s, should_load_game);
#ifdef IS_SALAMANDER
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);

View File

@ -374,9 +374,9 @@ static bool frontend_psp_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_psp_exitspawn(char *s, size_t len)
static void frontend_psp_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
bool should_load_content = false;
#ifndef IS_SALAMANDER
if (psp_fork_mode == FRONTEND_FORK_NONE)
return;
@ -384,14 +384,14 @@ static void frontend_psp_exitspawn(char *s, size_t len)
switch (psp_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_game = true;
should_load_content = true;
break;
case FRONTEND_FORK_NONE:
default:
break;
}
#endif
frontend_psp_exec(s, should_load_game);
frontend_psp_exec(s, should_load_content);
}
static int frontend_psp_get_rating(void)

View File

@ -395,9 +395,9 @@ static bool frontend_switch_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_switch_exitspawn(char *s, size_t len)
static void frontend_switch_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
bool should_load_content = false;
#ifndef IS_SALAMANDER
if (switch_fork_mode == FRONTEND_FORK_NONE)
return;
@ -405,13 +405,13 @@ static void frontend_switch_exitspawn(char *s, size_t len)
switch (switch_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_game = true;
should_load_content = true;
break;
default:
break;
}
#endif
frontend_switch_exec(s, should_load_game);
frontend_switch_exec(s, should_load_content);
}
#if 0

View File

@ -2066,7 +2066,7 @@ static bool frontend_unix_set_fork(enum frontend_fork fork_mode)
return true;
}
static void frontend_unix_exec(const char *path, bool should_load_game)
static void frontend_unix_exec(const char *path, bool should_load_content)
{
char *newargv[] = { NULL, NULL };
size_t len = strlen(path);
@ -2078,9 +2078,9 @@ static void frontend_unix_exec(const char *path, bool should_load_game)
execv(path, newargv);
}
static void frontend_unix_exitspawn(char *core_path, size_t core_path_size)
static void frontend_unix_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
bool should_load_content = false;
if (unix_fork_mode == FRONTEND_FORK_NONE)
return;
@ -2088,14 +2088,14 @@ static void frontend_unix_exitspawn(char *core_path, size_t core_path_size)
switch (unix_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_game = true;
should_load_content = true;
break;
case FRONTEND_FORK_NONE:
default:
break;
}
frontend_unix_exec(core_path, should_load_game);
frontend_unix_exec(s, should_load_content);
}
#endif

View File

@ -192,7 +192,7 @@ static int frontend_wiiu_parse_drive_list(void *data, bool load_content)
return 0;
}
static void frontend_wiiu_exec(const char *path, bool should_load_game)
static void frontend_wiiu_exec(const char *path, bool should_load_content)
{
struct
@ -219,7 +219,7 @@ static void frontend_wiiu_exec(const char *path, bool should_load_game)
RARCH_LOG("Attempt to load core: [%s].\n", path);
#ifndef IS_SALAMANDER
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
if (should_load_content && !path_is_empty(RARCH_PATH_CONTENT))
{
strcpy(param->args + len, path_get(RARCH_PATH_CONTENT));
param->argv[param->argc] = param->args + len;
@ -273,9 +273,9 @@ static bool frontend_wiiu_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_wiiu_exitspawn(char *s, size_t len)
static void frontend_wiiu_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
bool should_load_content = false;
#ifndef IS_SALAMANDER
if (wiiu_fork_mode == FRONTEND_FORK_NONE)
return;
@ -283,13 +283,13 @@ static void frontend_wiiu_exitspawn(char *s, size_t len)
switch (wiiu_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_game = true;
should_load_content = true;
break;
default:
break;
}
#endif
frontend_wiiu_exec(s, should_load_game);
frontend_wiiu_exec(s, should_load_content);
}
frontend_ctx_driver_t frontend_ctx_wiiu =

View File

@ -45,7 +45,6 @@
#include "../frontend_driver.h"
#include "../../configuration.h"
#include "../../defaults.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../../ui/drivers/ui_win32.h"
#include "../../paths.h"
@ -69,9 +68,8 @@ static char win32_cpu_model_name[64] = {0};
VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
static bool dwm_composition_disabled;
static bool console_needs_free;
static bool dwm_composition_disabled = false;
static bool console_needs_free = false;
#if defined(HAVE_LANGEXTRA) && !defined(_XBOX)
#if (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500) || !defined(_MSC_VER)
@ -676,7 +674,7 @@ enum retro_language frontend_win32_get_user_language(void)
#if defined(_WIN32) && !defined(_XBOX)
enum frontend_fork win32_fork_mode;
static void frontend_win32_respawn(char *s, size_t len)
static void frontend_win32_respawn(char *s, size_t len, char *args)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
@ -685,17 +683,17 @@ static void frontend_win32_respawn(char *s, size_t len)
if (win32_fork_mode != FRONTEND_FORK_RESTART)
return;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
memset(&pi, 0, sizeof(pi));
fill_pathname_application_path(executable_path,
sizeof(executable_path));
path_set(RARCH_PATH_CORE, executable_path);
RARCH_LOG("Restarting RetroArch with commandline: %s and %s\n",
executable_path, get_retroarch_launch_arguments());
executable_path, args);
if(!CreateProcess( executable_path, get_retroarch_launch_arguments(),
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
memset(&pi, 0, sizeof(pi));
if(!CreateProcess( executable_path, args,
NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
RARCH_LOG("Failed to restart RetroArch\n");

View File

@ -251,7 +251,7 @@ static void frontend_xdk_init(void *data)
#endif
}
static void frontend_xdk_exec(const char *path, bool should_load_game)
static void frontend_xdk_exec(const char *path, bool should_load_content)
{
#ifndef IS_SALAMANDER
bool original_verbose = verbosity_is_enabled();
@ -261,7 +261,6 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
#elif defined(_XBOX360)
char game_path[1024] = {0};
#endif
(void)should_load_game;
#ifdef IS_SALAMANDER
if (!string_is_empty(path))
@ -270,13 +269,13 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
#if defined(_XBOX1)
memset(&ptr, 0, sizeof(ptr));
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
if (should_load_content && !path_is_empty(RARCH_PATH_CONTENT))
snprintf((char*)ptr.Data, sizeof(ptr.Data), "%s", path_get(RARCH_PATH_CONTENT));
if (!string_is_empty(path))
XLaunchNewImage(path, !string_is_empty((const char*)ptr.Data) ? &ptr : NULL);
#elif defined(_XBOX360)
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
if (should_load_content && !path_is_empty(RARCH_PATH_CONTENT))
{
strlcpy(game_path, path_get(RARCH_PATH_CONTENT), sizeof(game_path));
XSetLaunchData(game_path, MAX_LAUNCH_DATA_SIZE);
@ -322,9 +321,9 @@ static bool frontend_xdk_set_fork(enum frontend_fork fork_mode)
}
#endif
static void frontend_xdk_exitspawn(char *s, size_t len)
static void frontend_xdk_exitspawn(char *s, size_t len, char *args)
{
bool should_load_game = false;
bool should_load_content = false;
#ifndef IS_SALAMANDER
if (xdk_fork_mode == FRONTEND_FORK_NONE)
return;
@ -332,14 +331,14 @@ static void frontend_xdk_exitspawn(char *s, size_t len)
switch (xdk_fork_mode)
{
case FRONTEND_FORK_CORE_WITH_ARGS:
should_load_game = true;
should_load_content = true;
break;
case FRONTEND_FORK_NONE:
default:
break;
}
#endif
frontend_xdk_exec(s, should_load_game);
frontend_xdk_exec(s, should_load_content);
}
static int frontend_xdk_get_rating(void)

View File

@ -368,12 +368,12 @@ const struct video_driver *frontend_driver_get_video_driver(void)
return frontend->get_video_driver();
}
void frontend_driver_exitspawn(char *s, size_t len)
void frontend_driver_exitspawn(char *s, size_t len, char *args)
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
if (!frontend || !frontend->exitspawn)
return;
frontend->exitspawn(s, len);
frontend->exitspawn(s, len, args);
}
void frontend_driver_deinit(void *args)

View File

@ -81,7 +81,7 @@ typedef struct frontend_ctx_driver
environment_get_t environment_get;
void (*init)(void *data);
void (*deinit)(void *data);
void (*exitspawn)(char *s, size_t len);
void (*exitspawn)(char *s, size_t len, char *args);
process_args_t process_args;
void (*exec)(const char *, bool);
@ -185,7 +185,7 @@ void frontend_driver_shutdown(bool a);
void frontend_driver_deinit(void *args);
void frontend_driver_exitspawn(char *s, size_t len);
void frontend_driver_exitspawn(char *s, size_t len, char *args);
bool frontend_driver_has_fork(void);

View File

@ -192,7 +192,7 @@ int main(int argc, char *argv[])
frontend_ctx->deinit(args);
if (frontend_ctx && frontend_ctx->exitspawn)
frontend_ctx->exitspawn(libretro_path, sizeof(libretro_path));
frontend_ctx->exitspawn(libretro_path, sizeof(libretro_path), NULL);
return 1;
}

View File

@ -7949,7 +7949,8 @@ void main_exit(void *args)
frontend_driver_deinit(args);
frontend_driver_exitspawn(
path_get_ptr(RARCH_PATH_CORE),
path_get_realsize(RARCH_PATH_CORE));
path_get_realsize(RARCH_PATH_CORE),
retroarch_get_launch_arguments());
has_set_username = false;
rarch_is_inited = false;
@ -27795,7 +27796,7 @@ struct retro_system_info *runloop_get_libretro_system_info(void)
return &runloop_system.info;
}
char *get_retroarch_launch_arguments(void)
char *retroarch_get_launch_arguments(void)
{
return launch_arguments;
}

View File

@ -371,7 +371,7 @@ void retroarch_menu_running(void);
void retroarch_menu_running_finished(bool quit);
char *get_retroarch_launch_arguments(void);
char *retroarch_get_launch_arguments(void);
rarch_system_info_t *runloop_get_system_info(void);