From 106c912eb5ea4f2d67036e69d98c108ddcdaf5d0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 30 Dec 2019 05:49:45 +0100 Subject: [PATCH] (Netplay hosting) - Remove clear - Use index offset variable --- menu/cbs/menu_cbs_ok.c | 24 ++++++++++++++---------- menu/cbs/menu_cbs_select.c | 20 ++++++++++++-------- menu/cbs/menu_cbs_sublabel.c | 2 +- menu/menu_displaylist.c | 1 - 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 4566446ff7..742b90ccfa 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -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; diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 162bbdcc8f..97b5bb8a42 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -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; } diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index b75dff87c6..b2b961d66e 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -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; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 854c95c0a6..7fe83ae9e0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -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);