mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
netplay: connect to MITM server instead of host IP if one is specified in lobby listing
This commit is contained in:
parent
8a01dda5d6
commit
bf553fe65c
@ -3207,11 +3207,22 @@ static int action_ok_netplay_connect_room(const char *path,
|
|||||||
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
|
||||||
|
|
||||||
snprintf(tmp_hostname,
|
if (netplay_room_list[idx - 2].host_method == NETPLAY_HOST_METHOD_MITM)
|
||||||
sizeof(tmp_hostname),
|
{
|
||||||
"%s:%d",
|
snprintf(tmp_hostname,
|
||||||
netplay_room_list[idx - 2].address,
|
sizeof(tmp_hostname),
|
||||||
netplay_room_list[idx - 2].port);
|
"%s:%d",
|
||||||
|
netplay_room_list[idx - 2].mitm_address,
|
||||||
|
netplay_room_list[idx - 2].mitm_port);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(tmp_hostname,
|
||||||
|
sizeof(tmp_hostname),
|
||||||
|
"%s:%d",
|
||||||
|
netplay_room_list[idx - 2].address,
|
||||||
|
netplay_room_list[idx - 2].port);
|
||||||
|
}
|
||||||
|
|
||||||
RARCH_LOG("Connecting to: %s with game: %s/%08x\n",
|
RARCH_LOG("Connecting to: %s with game: %s/%08x\n",
|
||||||
tmp_hostname,
|
tmp_hostname,
|
||||||
|
@ -48,18 +48,29 @@ struct netplay_host_list
|
|||||||
size_t size;
|
size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum netplay_host_method
|
||||||
|
{
|
||||||
|
NETPLAY_HOST_METHOD_UNKNOWN = 0,
|
||||||
|
NETPLAY_HOST_METHOD_MANUAL,
|
||||||
|
NETPLAY_HOST_METHOD_UPNP,
|
||||||
|
NETPLAY_HOST_METHOD_MITM
|
||||||
|
};
|
||||||
|
|
||||||
/* data is ordered like this on the server, I left it in this ordered
|
/* data is ordered like this on the server, I left it in this ordered
|
||||||
for reference */
|
for reference */
|
||||||
struct netplay_room
|
struct netplay_room
|
||||||
{
|
{
|
||||||
char nickname [PATH_MAX_LENGTH];
|
char nickname [PATH_MAX_LENGTH];
|
||||||
char address [PATH_MAX_LENGTH];
|
char address [PATH_MAX_LENGTH];
|
||||||
|
char mitm_address[PATH_MAX_LENGTH];
|
||||||
int port;
|
int port;
|
||||||
|
int mitm_port;
|
||||||
char corename [PATH_MAX_LENGTH];
|
char corename [PATH_MAX_LENGTH];
|
||||||
char coreversion [PATH_MAX_LENGTH];
|
char coreversion [PATH_MAX_LENGTH];
|
||||||
char gamename [PATH_MAX_LENGTH];
|
char gamename [PATH_MAX_LENGTH];
|
||||||
int gamecrc;
|
int gamecrc;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
|
int host_method;
|
||||||
bool has_password;
|
bool has_password;
|
||||||
bool has_spectate_password;
|
bool has_spectate_password;
|
||||||
bool fixed;
|
bool fixed;
|
||||||
|
@ -228,6 +228,12 @@ static JSON_Parser_HandlerResult JSON_CALL ObjectMemberHandler(JSON_Parser parse
|
|||||||
pCtx->cur_member = &rooms->cur->has_spectate_password;
|
pCtx->cur_member = &rooms->cur->has_spectate_password;
|
||||||
else if (string_is_equal(pValue, "fixed"))
|
else if (string_is_equal(pValue, "fixed"))
|
||||||
pCtx->cur_member = &rooms->cur->fixed;
|
pCtx->cur_member = &rooms->cur->fixed;
|
||||||
|
else if (string_is_equal(pValue, "mitm_ip"))
|
||||||
|
pCtx->cur_member = &rooms->cur->mitm_address;
|
||||||
|
else if (string_is_equal(pValue, "mitm_port"))
|
||||||
|
pCtx->cur_member = &rooms->cur->mitm_port;
|
||||||
|
else if (string_is_equal(pValue, "host_method"))
|
||||||
|
pCtx->cur_member = &rooms->cur->host_method;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* unknown field, ignore it */
|
/* unknown field, ignore it */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user