(Netplay hosting)

- Remove clear
- Use index offset variable
This commit is contained in:
twinaphex 2019-12-30 05:49:45 +01:00
parent 3fe8806018
commit 106c912eb5
4 changed files with 27 additions and 20 deletions

View File

@ -4949,6 +4949,7 @@ static int action_ok_netplay_connect_room(const char *path,
{
#ifdef HAVE_NETWORKING
char tmp_hostname[4115];
unsigned offset = idx - 4;
tmp_hostname[0] = '\0';
@ -4956,33 +4957,36 @@ static int action_ok_netplay_connect_room(const char *path,
generic_action_ok_command(CMD_EVENT_NETPLAY_DEINIT);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
if (netplay_room_list[idx - 3].host_method == NETPLAY_HOST_METHOD_MITM)
if (netplay_room_list[offset].host_method == NETPLAY_HOST_METHOD_MITM)
{
snprintf(tmp_hostname,
sizeof(tmp_hostname),
"%s|%d",
netplay_room_list[idx - 3].mitm_address,
netplay_room_list[idx - 3].mitm_port);
netplay_room_list[offset].mitm_address,
netplay_room_list[offset].mitm_port);
}
else
{
snprintf(tmp_hostname,
sizeof(tmp_hostname),
"%s|%d",
netplay_room_list[idx - 3].address,
netplay_room_list[idx - 3].port);
netplay_room_list[offset].address,
netplay_room_list[offset].port);
}
#if 0
RARCH_LOG("[lobby] connecting to: %s with game: %s/%08x\n",
tmp_hostname,
netplay_room_list[idx - 3].gamename,
netplay_room_list[idx - 3].gamecrc);
netplay_room_list[offset].gamename,
netplay_room_list[offset].gamecrc);
#endif
task_push_netplay_crc_scan(netplay_room_list[idx - 3].gamecrc,
netplay_room_list[idx - 3].gamename,
tmp_hostname, netplay_room_list[idx - 3].corename, netplay_room_list[idx - 3].subsystem_name);
task_push_netplay_crc_scan(
netplay_room_list[offset].gamecrc,
netplay_room_list[offset].gamename,
tmp_hostname,
netplay_room_list[offset].corename,
netplay_room_list[offset].subsystem_name);
#else
return -1;

View File

@ -141,6 +141,7 @@ static int action_select_netplay_connect_room(const char *path,
size_t idx, size_t entry_idx)
{
char tmp_hostname[4115];
unsigned offset = idx - 4;
tmp_hostname[0] = '\0';
@ -148,22 +149,25 @@ static int action_select_netplay_connect_room(const char *path,
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_CLIENT, NULL);
if (netplay_room_list[idx - 3].host_method == NETPLAY_HOST_METHOD_MITM)
if (netplay_room_list[offset].host_method == NETPLAY_HOST_METHOD_MITM)
snprintf(tmp_hostname,
sizeof(tmp_hostname),
"%s|%d",
netplay_room_list[idx - 3].mitm_address,
netplay_room_list[idx - 3].mitm_port);
netplay_room_list[offset].mitm_address,
netplay_room_list[offset].mitm_port);
else
snprintf(tmp_hostname,
sizeof(tmp_hostname),
"%s|%d",
netplay_room_list[idx - 3].address,
netplay_room_list[idx - 3].port);
netplay_room_list[offset].address,
netplay_room_list[offset].port);
task_push_netplay_crc_scan(netplay_room_list[idx - 3].gamecrc,
netplay_room_list[idx - 3].gamename,
tmp_hostname, netplay_room_list[idx - 3].corename, netplay_room_list[idx - 3].subsystem_name);
task_push_netplay_crc_scan(
netplay_room_list[offset].gamecrc,
netplay_room_list[offset].gamename,
tmp_hostname,
netplay_room_list[offset].corename,
netplay_room_list[offset].subsystem_name);
return 0;
}

View File

@ -969,7 +969,7 @@ static int action_bind_sublabel_netplay_room(
const char *subsystem = NULL;
/* This offset may cause issues if any entries are added to this menu */
unsigned offset = i - 3;
unsigned offset = i - 4;
if (i < 1 || offset > (unsigned)netplay_room_count)
return -1;

View File

@ -7098,7 +7098,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
#endif
info->need_push = true;
info->need_refresh = true;
info->need_clear = true;
break;
case DISPLAYLIST_OPTIONS_REMAPPINGS_PORT:
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);