[discord] nasty hack to register the application with the current runtime args

basically saves the whole argv string to reuse it on game launch

Not working due to:
https://github.com/discordapp/discord-rpc/issues/240
https://github.com/discordapp/discord-rpc/issues/163
This commit is contained in:
radius 2018-10-16 22:53:42 -05:00
parent d4b8e1c4fd
commit 325d85ed4b
3 changed files with 18 additions and 4 deletions

View File

@ -227,12 +227,13 @@ void discord_init(void)
handlers.spectateGame = handle_discord_spectate;
handlers.joinRequest = handle_discord_join_request;
/* To-Do: Add the arguments RetroArch was started with to the register URI*/
const char command[256] = "retroarch";
Discord_Initialize(settings->arrays.discord_app_id, &handlers, 0, NULL);
Discord_Register(settings->arrays.discord_app_id, NULL);
char command[PATH_MAX_LENGTH];
strlcpy(command, _argv, sizeof(command));
RARCH_LOG("[Discord] registering startup command: %s\n", command);
Discord_Register(settings->arrays.discord_app_id, command);
discord_ready = true;
}

View File

@ -637,6 +637,16 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
bool explicit_menu = false;
global_t *global = global_get_ptr();
/* Nasty hack to copy the args into a global so discord can register the same arguments for launch */
char buf[4096];
for (unsigned i = 0; i < argc; i++)
{
snprintf(buf, sizeof(buf), "%s %s", _argv, argv[i]);
strlcpy(_argv, buf, sizeof(_argv));
}
_argc = argc;
string_trim_whitespace_left(_argv);
const struct option opts[] = {
#ifdef HAVE_DYNAMIC
{ "libretro", 1, NULL, 'L' },

View File

@ -305,6 +305,9 @@ typedef struct global
#endif
} global_t;
unsigned _argc;
char _argv[4096];
bool rarch_ctl(enum rarch_ctl_state state, void *data);
int retroarch_get_capabilities(enum rarch_capabilities type,