mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 21:35:25 +00:00
Improve HAVE_NETWORKING and HAVE_NETPLAYDISCOVERY ifdefs; remove
unused netplay lan scan rooms function
This commit is contained in:
parent
43b72ea23c
commit
d07e0da412
@ -5686,12 +5686,10 @@ static int action_ok_wifi_disconnect(const char *path,
|
||||
task_push_wifi_disconnect(wifi_menu_refresh_callback);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int action_ok_netplay_connect_room(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef HAVE_NETWORKING
|
||||
char tmp_hostname[4115];
|
||||
unsigned room_index = type - MENU_SETTINGS_NETPLAY_ROOMS_START;
|
||||
|
||||
@ -5731,17 +5729,12 @@ static int action_ok_netplay_connect_room(const char *path,
|
||||
netplay_room_list[room_index].corename,
|
||||
netplay_room_list[room_index].subsystem_name);
|
||||
|
||||
#else
|
||||
return -1;
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_netplay_lan_scan(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
#ifdef HAVE_NETWORKING
|
||||
struct netplay_host_list *hosts = NULL;
|
||||
struct netplay_host *host = NULL;
|
||||
|
||||
@ -5760,15 +5753,9 @@ static int action_ok_netplay_lan_scan(const char *path,
|
||||
/* Enable Netplay */
|
||||
if (command_event(CMD_EVENT_NETPLAY_INIT_DIRECT, (void *) host))
|
||||
return generic_action_ok_command(CMD_EVENT_RESUME);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
DEFAULT_ACTION_OK_DL_PUSH(action_ok_content_collection_list, FILEBROWSER_SELECT_COLLECTION, ACTION_OK_DL_CONTENT_COLLECTION_LIST, NULL)
|
||||
DEFAULT_ACTION_OK_DL_PUSH(action_ok_push_content_list, FILEBROWSER_SELECT_FILE, ACTION_OK_DL_CONTENT_LIST, settings->paths.directory_menu_content)
|
||||
DEFAULT_ACTION_OK_DL_PUSH(action_ok_push_scan_file, FILEBROWSER_SCAN_FILE, ACTION_OK_DL_CONTENT_LIST, settings->paths.directory_menu_content)
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
static void netplay_refresh_rooms_cb(retro_task_t *task,
|
||||
void *task_data, void *user_data, const char *err)
|
||||
{
|
||||
@ -5894,7 +5881,7 @@ finish:
|
||||
free(user_data);
|
||||
}
|
||||
|
||||
#ifndef RARCH_CONSOLE
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
static void netplay_lan_scan_callback(retro_task_t *task,
|
||||
void *task_data,
|
||||
void *user_data, const char *error)
|
||||
@ -5956,7 +5943,7 @@ 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/";
|
||||
#ifndef RARCH_CONSOLE
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
task_push_netplay_lan_scan(netplay_lan_scan_callback);
|
||||
#endif
|
||||
task_push_http_transfer(url, true, NULL, netplay_refresh_rooms_cb, NULL);
|
||||
@ -5964,6 +5951,11 @@ static int action_ok_push_netplay_refresh_rooms(const char *path,
|
||||
}
|
||||
#endif
|
||||
|
||||
DEFAULT_ACTION_OK_DL_PUSH(action_ok_content_collection_list, FILEBROWSER_SELECT_COLLECTION, ACTION_OK_DL_CONTENT_COLLECTION_LIST, NULL)
|
||||
DEFAULT_ACTION_OK_DL_PUSH(action_ok_push_content_list, FILEBROWSER_SELECT_FILE, ACTION_OK_DL_CONTENT_LIST, settings->paths.directory_menu_content)
|
||||
DEFAULT_ACTION_OK_DL_PUSH(action_ok_push_scan_file, FILEBROWSER_SCAN_FILE, ACTION_OK_DL_CONTENT_LIST, settings->paths.directory_menu_content)
|
||||
|
||||
|
||||
static int action_ok_scan_directory_list(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -7811,11 +7803,11 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
{MENU_ENUM_LABEL_WIFI_SETTINGS, action_ok_wifi_list},
|
||||
{MENU_ENUM_LABEL_WIFI_NETWORK_SCAN, action_ok_wifi_networks_list},
|
||||
{MENU_ENUM_LABEL_WIFI_DISCONNECT, action_ok_wifi_disconnect},
|
||||
{MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, action_ok_netplay_connect_room},
|
||||
#endif
|
||||
{MENU_ENUM_LABEL_NETWORK_HOSTING_SETTINGS, action_ok_network_hosting_list},
|
||||
{MENU_ENUM_LABEL_SUBSYSTEM_SETTINGS, action_ok_subsystem_list},
|
||||
{MENU_ENUM_LABEL_NETWORK_SETTINGS, action_ok_network_list},
|
||||
{MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM, action_ok_netplay_connect_room},
|
||||
{MENU_ENUM_LABEL_LAKKA_SERVICES, action_ok_lakka_services},
|
||||
{MENU_ENUM_LABEL_NETPLAY_SETTINGS, action_ok_netplay_sublist},
|
||||
{MENU_ENUM_LABEL_USER_SETTINGS, action_ok_user_list},
|
||||
@ -8269,7 +8261,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
#endif
|
||||
break;
|
||||
case MENU_NETPLAY_LAN_SCAN:
|
||||
#ifdef HAVE_NETWORKING
|
||||
BIND_ACTION_OK(cbs, action_ok_netplay_lan_scan);
|
||||
#endif
|
||||
break;
|
||||
case FILE_TYPE_CURSOR:
|
||||
if (string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST)))
|
||||
|
@ -55,6 +55,11 @@
|
||||
#define HAVE_INET6 1
|
||||
#endif
|
||||
|
||||
/* TODO/FIXME - globals referenced outside */
|
||||
struct netplay_room *netplay_room_list = NULL;
|
||||
int netplay_room_count = 0;
|
||||
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
struct ad_packet
|
||||
{
|
||||
uint32_t header;
|
||||
@ -71,11 +76,6 @@ struct ad_packet
|
||||
char subsystem_name[NETPLAY_HOST_STR_LEN];
|
||||
};
|
||||
|
||||
/* TODO/FIXME - globals referenced outside */
|
||||
struct netplay_room *netplay_room_list = NULL;
|
||||
int netplay_room_count = 0;
|
||||
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
/* TODO/FIXME - static globals */
|
||||
|
||||
/* LAN discovery sockets */
|
||||
@ -89,7 +89,6 @@ static struct ad_packet ad_packet_buffer;
|
||||
static struct netplay_host_list discovered_hosts;
|
||||
|
||||
static size_t discovered_hosts_allocated;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOCKET_LEGACY
|
||||
|
||||
@ -109,7 +108,6 @@ static int16_t htons_for_morons(int16_t value)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
static bool netplay_lan_ad_client(void)
|
||||
{
|
||||
unsigned i;
|
||||
@ -241,7 +239,6 @@ static bool netplay_lan_ad_client(void)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Initialize Netplay discovery (client) */
|
||||
bool init_netplay_discovery(void)
|
||||
@ -285,7 +282,6 @@ void deinit_netplay_discovery(void)
|
||||
bool netplay_discovery_driver_ctl(
|
||||
enum rarch_netplay_discovery_ctl_state state, void *data)
|
||||
{
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
int ret;
|
||||
char port_str[6];
|
||||
unsigned k = 0;
|
||||
@ -351,11 +347,9 @@ bool netplay_discovery_driver_ctl(
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
static bool init_lan_ad_server_socket(netplay_t *netplay, uint16_t port)
|
||||
{
|
||||
struct addrinfo *addr = NULL;
|
||||
@ -380,7 +374,6 @@ error:
|
||||
freeaddrinfo_retro(addr);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* netplay_lan_ad_server
|
||||
@ -389,8 +382,7 @@ error:
|
||||
*/
|
||||
bool netplay_lan_ad_server(netplay_t *netplay)
|
||||
{
|
||||
/* Todo: implement net_ifinfo and ntohs for consoles */
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
/* TODO/FIXME: implement net_ifinfo and ntohs for consoles */
|
||||
fd_set fds;
|
||||
int ret;
|
||||
unsigned i;
|
||||
@ -557,6 +549,6 @@ bool netplay_lan_ad_server(netplay_t *netplay)
|
||||
}
|
||||
}
|
||||
net_ifinfo_free(&interfaces);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -23,14 +23,6 @@
|
||||
#define NETPLAY_HOST_STR_LEN 32
|
||||
#define NETPLAY_HOST_LONGSTR_LEN 256
|
||||
|
||||
enum rarch_netplay_discovery_ctl_state
|
||||
{
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_NONE = 0,
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_SEND_QUERY,
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES,
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES
|
||||
};
|
||||
|
||||
struct netplay_host
|
||||
{
|
||||
struct sockaddr addr;
|
||||
@ -87,9 +79,14 @@ struct netplay_room
|
||||
bool fixed;
|
||||
};
|
||||
|
||||
extern struct netplay_room *netplay_room_list;
|
||||
|
||||
extern int netplay_room_count;
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
enum rarch_netplay_discovery_ctl_state
|
||||
{
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_NONE = 0,
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_SEND_QUERY,
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES,
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES
|
||||
};
|
||||
|
||||
/** Initialize Netplay discovery */
|
||||
bool init_netplay_discovery(void);
|
||||
@ -99,6 +96,11 @@ void deinit_netplay_discovery(void);
|
||||
|
||||
/** Discovery control */
|
||||
bool netplay_discovery_driver_ctl(enum rarch_netplay_discovery_ctl_state state, void *data);
|
||||
#endif
|
||||
|
||||
/* TODO/FIXME - globals */
|
||||
extern struct netplay_room *netplay_room_list;
|
||||
extern int netplay_room_count;
|
||||
|
||||
struct netplay_room* netplay_get_host_room(void);
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "../verbosity.h"
|
||||
#include "../network/netplay/netplay_discovery.h"
|
||||
|
||||
#ifdef HAVE_NETPLAYDISCOVERY
|
||||
static void task_netplay_lan_scan_handler(retro_task_t *task)
|
||||
{
|
||||
if (init_netplay_discovery())
|
||||
@ -40,8 +41,6 @@ static void task_netplay_lan_scan_handler(retro_task_t *task)
|
||||
|
||||
task_set_progress(task, 100);
|
||||
task_set_finished(task, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool task_push_netplay_lan_scan(retro_task_callback_t cb)
|
||||
@ -60,20 +59,4 @@ bool task_push_netplay_lan_scan(retro_task_callback_t cb)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool task_push_netplay_lan_scan_rooms(retro_task_callback_t cb)
|
||||
{
|
||||
retro_task_t *task = task_init();
|
||||
|
||||
if (!task)
|
||||
return false;
|
||||
|
||||
task->type = TASK_TYPE_BLOCKING;
|
||||
task->handler = task_netplay_lan_scan_handler;
|
||||
task->callback = cb;
|
||||
task->title = strdup(msg_hash_to_str(MSG_NETPLAY_LAN_SCANNING));
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -85,8 +85,6 @@ bool task_push_netplay_lan_scan(retro_task_callback_t cb);
|
||||
bool task_push_netplay_crc_scan(uint32_t crc, char* name,
|
||||
const char *hostname, const char *corename, const char* subsystem);
|
||||
|
||||
bool task_push_netplay_lan_scan_rooms(retro_task_callback_t cb);
|
||||
|
||||
bool task_push_netplay_nat_traversal(void *nat_traversal_state, uint16_t port);
|
||||
|
||||
/* Core updater tasks */
|
||||
|
Loading…
x
Reference in New Issue
Block a user