Configurable lobby URL

This commit is contained in:
twinaphex 2020-01-02 10:15:21 +01:00
parent 4ec9fe5a57
commit cc0b7c42d1
7 changed files with 50 additions and 6 deletions

View File

@ -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";

View File

@ -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';

View File

@ -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];

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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';