diff --git a/config.def.h b/config.def.h index 9a10753805..20f37f8f1a 100644 --- a/config.def.h +++ b/config.def.h @@ -1170,6 +1170,8 @@ static char buildbot_server_url[] = "http://libretro.xbins.org/libretro/nightly/ static char buildbot_server_url[] = ""; #endif +static char netplay_lobby_url[] = "http://lobby.libretro.com/"; + static char buildbot_assets_server_url[] = "http://buildbot.libretro.com/assets/"; static char default_discord_app_id[] = "475456035851599874"; diff --git a/configuration.c b/configuration.c index 3cf434e697..d2bfa177cc 100644 --- a/configuration.c +++ b/configuration.c @@ -1203,6 +1203,7 @@ static struct config_path_setting *populate_settings_path(settings_t *settings, SETTING_PATH("netplay_password", settings->paths.netplay_password, false, NULL, true); SETTING_PATH("netplay_spectate_password", settings->paths.netplay_spectate_password, false, NULL, true); #endif + SETTING_PATH("netplay_lobby_url", settings->paths.netplay_lobby_url, false, NULL, true); SETTING_PATH("libretro_directory", settings->paths.directory_libretro, false, NULL, false); SETTING_PATH("core_options_path", @@ -2168,6 +2169,9 @@ void config_set_defaults(void *data) sizeof(settings->paths.network_buildbot_url)); strlcpy(settings->paths.network_buildbot_assets_url, buildbot_assets_server_url, sizeof(settings->paths.network_buildbot_assets_url)); + strlcpy(settings->paths.netplay_lobby_url, netplay_lobby_url, + sizeof(settings->paths.netplay_lobby_url)); + *settings->arrays.input_keyboard_layout = '\0'; diff --git a/configuration.h b/configuration.h index c14c307741..803800dfad 100644 --- a/configuration.h +++ b/configuration.h @@ -661,6 +661,7 @@ typedef struct settings char network_buildbot_assets_url[255]; char browse_url[4096]; char path_stream_url[8192]; + char netplay_lobby_url[PATH_MAX_LENGTH]; char path_menu_xmb_font[PATH_MAX_LENGTH]; char menu_content_show_settings_password[PATH_MAX_LENGTH]; diff --git a/discord/discord.c b/discord/discord.c index a93af9b250..a2d48defbe 100644 --- a/discord/discord.c +++ b/discord/discord.c @@ -232,14 +232,22 @@ finish: static void handle_discord_join(const char* secret) { - char url [2048] = "http://lobby.libretro.com/"; + settings_t *settings = config_get_ptr(); static struct string_list *list = NULL; + const char *base = settings->paths.netplay_lobby_url; + char url[PATH_MAX_LENGTH]; + + if (string_is_empty(base)) + { + RARCH_ERR("[discord] lobby URL is empty.\n"); + return; + } RARCH_LOG("[discord] join secret: (%s)\n", secret); list = string_split(secret, "|"); strlcpy(peer_party_id, list->elems[0].data, sizeof(peer_party_id)); - strlcat(url, peer_party_id, sizeof(url)); + fill_pathname_join(url, base, peer_party_id, sizeof(url)); strlcat(url, "/", sizeof(url)); RARCH_LOG("[discord] querying lobby id: %s at %s\n", peer_party_id, url); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 118f056a68..a77d0b3941 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -5222,7 +5222,17 @@ static void netplay_lan_scan_callback(retro_task_t *task, static int action_ok_push_netplay_refresh_rooms(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - char url [2048] = "http://lobby.libretro.com/list/"; + settings_t *settings = config_get_ptr(); + const char *base = settings->paths.netplay_lobby_url; + char url[PATH_MAX_LENGTH]; + + if (string_is_empty(base)) + { + RARCH_ERR("[lobby] lobby URL is empty.\n"); + return 0; + } + + fill_pathname_join(url, base, "list/", sizeof(url)); #ifndef RARCH_CONSOLE task_push_netplay_lan_scan(netplay_lan_scan_callback); #endif diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 90a609dcdd..10a2b82fed 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -857,18 +857,27 @@ static void netplay_announce(void) { char buf[4600]; char frontend_architecture[PATH_MAX_LENGTH]; - char url[2048] = "http://lobby.libretro.com/add/"; + char url[PATH_MAX_LENGTH]; + settings_t *settings = config_get_ptr(); + const char *base = settings->paths.netplay_lobby_url; char *username = NULL; char *corename = NULL; char *gamename = NULL; char *subsystemname = NULL; char *coreversion = NULL; char *frontend_ident = NULL; - settings_t *settings = config_get_ptr(); struct retro_system_info *system = runloop_get_libretro_system_info(); uint32_t content_crc = content_get_crc(); struct string_list *subsystem = path_get_subsystem_list(); + if (string_is_empty(base)) + { + RARCH_ERR("[lobby] lobby URL is empty.\n"); + return; + } + + fill_pathname_join(url, base, "add/", sizeof(url)); + buf[0] = '\0'; if (subsystem) diff --git a/retroarch.c b/retroarch.c index 7d9dce27d3..27238e7167 100644 --- a/retroarch.c +++ b/retroarch.c @@ -28366,7 +28366,9 @@ static void send_debug_info_cb(retro_task_t *task, static void rarch_send_debug_info(void) { char debug_filepath[PATH_MAX_LENGTH]; - const char *url = "http://lobby.libretro.com/debuginfo/add/"; + char url[PATH_MAX_LENGTH]; + settings_t *settings = configuration_settings; + const char *base = settings->paths.netplay_lobby_url; char *info_buf = NULL; const size_t param_buf_size = 65535; char *param_buf = (char*)malloc(param_buf_size); @@ -28376,6 +28378,14 @@ static void rarch_send_debug_info(void) const char *path_config = path_get(RARCH_PATH_CONFIG); bool info_written = rarch_write_debug_info(); + if (string_is_empty(base)) + { + RARCH_ERR("[discord] lobby URL is empty.\n"); + return; + } + + fill_pathname_join(url, base, "debuginfo/add/", sizeof(url)); + debug_filepath[0] = param_buf[0] = '\0';