allow connecting to lobby port instead of the port in settings

This commit is contained in:
radius 2017-01-22 12:29:29 -05:00
parent a782ecbe1b
commit 33cc168eb9
3 changed files with 9 additions and 3 deletions

View File

@ -2443,12 +2443,16 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED:
{
char *hostname = (char *) data;
/* buf is expected to be address:port, there must be a better way
to do this but for now I'll just use a string list */
char *buf = (char *) data;
static struct string_list *hostname = NULL;
hostname = string_split(buf, ":");
settings_t *settings = config_get_ptr();
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
if (!init_netplay_deferred(
hostname, settings->netplay.port))
hostname->elems[0].data, atoi(hostname->elems[1].data)))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
return false;

View File

@ -3130,6 +3130,8 @@ static int action_ok_netplay_connect_room(const char *path,
/* For testing purposes
strlcpy(tmp_hostname, "192.168.1.241", sizeof(tmp_hostname));*/
strlcpy(tmp_hostname, netplay_room_list[idx - 1].address, sizeof(tmp_hostname));
snprintf(tmp_hostname, sizeof(tmp_hostname), "%s:%d",
netplay_room_list[idx - 1].address, netplay_room_list[idx - 1].port);
/* If we haven't yet started, this will load on its own */
if (!content_is_inited())

View File

@ -947,7 +947,7 @@ bool init_netplay(void *direct_host, const char *server, unsigned port)
netplay_data = (netplay_t*)netplay_new(
netplay_is_client ? direct_host : NULL,
netplay_is_client ? (!netplay_client_deferred ? server : server_address_deferred) : NULL,
port ? port : RARCH_DEFAULT_PORT,
port ? ( !netplay_client_deferred ? port : server_port_deferred) : RARCH_DEFAULT_PORT,
settings->netplay.stateless_mode, settings->netplay.check_frames, &cbs,
settings->netplay.nat_traversal, settings->username,
quirks);