mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Buildfixes as suggested by forum member - should hopefully fix
console builds as well as other issues
This commit is contained in:
parent
3bc6dd97d9
commit
aadedf39f2
@ -34,6 +34,9 @@
|
||||
|
||||
#include "../../core.h"
|
||||
|
||||
#define NETPLAY_HOST_STR_LEN 32
|
||||
#define NETPLAY_HOST_LONGSTR_LEN 256
|
||||
|
||||
enum rarch_netplay_ctl_state
|
||||
{
|
||||
RARCH_NETPLAY_CTL_NONE = 0,
|
||||
@ -137,6 +140,29 @@ struct netplay_room
|
||||
bool fixed;
|
||||
};
|
||||
|
||||
struct netplay_host
|
||||
{
|
||||
struct sockaddr addr;
|
||||
socklen_t addrlen;
|
||||
int content_crc;
|
||||
int port;
|
||||
char address[NETPLAY_HOST_STR_LEN];
|
||||
char nick[NETPLAY_HOST_STR_LEN];
|
||||
char frontend[NETPLAY_HOST_STR_LEN];
|
||||
char core[NETPLAY_HOST_STR_LEN];
|
||||
char core_version[NETPLAY_HOST_STR_LEN];
|
||||
char retroarch_version[NETPLAY_HOST_STR_LEN];
|
||||
char content[NETPLAY_HOST_LONGSTR_LEN];
|
||||
char subsystem_name[NETPLAY_HOST_LONGSTR_LEN];
|
||||
};
|
||||
|
||||
struct netplay_host_list
|
||||
{
|
||||
struct netplay_host *hosts;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
netplay_t *data; /* Used while Netplay is running */
|
||||
|
@ -20,31 +20,6 @@
|
||||
#include <net/net_ifinfo.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define NETPLAY_HOST_STR_LEN 32
|
||||
#define NETPLAY_HOST_LONGSTR_LEN 256
|
||||
|
||||
struct netplay_host
|
||||
{
|
||||
struct sockaddr addr;
|
||||
socklen_t addrlen;
|
||||
int content_crc;
|
||||
int port;
|
||||
char address[NETPLAY_HOST_STR_LEN];
|
||||
char nick[NETPLAY_HOST_STR_LEN];
|
||||
char frontend[NETPLAY_HOST_STR_LEN];
|
||||
char core[NETPLAY_HOST_STR_LEN];
|
||||
char core_version[NETPLAY_HOST_STR_LEN];
|
||||
char retroarch_version[NETPLAY_HOST_STR_LEN];
|
||||
char content[NETPLAY_HOST_LONGSTR_LEN];
|
||||
char subsystem_name[NETPLAY_HOST_LONGSTR_LEN];
|
||||
};
|
||||
|
||||
struct netplay_host_list
|
||||
{
|
||||
struct netplay_host *hosts;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
/* Keep these in order, they coincide with a server-side enum and must match. */
|
||||
enum netplay_host_method
|
||||
{
|
||||
|
@ -4096,14 +4096,18 @@ static void announce_play_spectate(netplay_t *netplay,
|
||||
pdevice_str = device_str;
|
||||
|
||||
for (device = 0; device < MAX_INPUT_DEVICES; device++)
|
||||
{
|
||||
if (devices & (1<<device))
|
||||
pdevice_str += snprintf(pdevice_str,
|
||||
sizeof(device_str) - (size_t)
|
||||
(pdevice_str - device_str),
|
||||
"%u, ",
|
||||
(unsigned) (device+1));
|
||||
}
|
||||
|
||||
if (pdevice_str > device_str)
|
||||
pdevice_str -= 2;
|
||||
*pdevice_str = '\0';
|
||||
|
||||
/* Then we make the final string */
|
||||
if (nick)
|
||||
@ -5489,7 +5493,7 @@ void netplay_announce_nat_traversal(netplay_t *netplay)
|
||||
&netplay->nat_traversal_state.ext_inet4_addr,
|
||||
sizeof(netplay->nat_traversal_state.ext_inet4_addr),
|
||||
host, sizeof(host), port, sizeof(port),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV))
|
||||
NI_NUMERICHOST | NI_NUMERICSERV))
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "%s: %s:%s",
|
||||
msg_hash_to_str(MSG_PUBLIC_ADDRESS),
|
||||
@ -5507,7 +5511,7 @@ void netplay_announce_nat_traversal(netplay_t *netplay)
|
||||
&netplay->nat_traversal_state.ext_inet6_addr,
|
||||
sizeof(netplay->nat_traversal_state.ext_inet6_addr),
|
||||
host, sizeof(host), port, sizeof(port),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV))
|
||||
NI_NUMERICHOST | NI_NUMERICSERV))
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "%s: %s|%s",
|
||||
msg_hash_to_str(MSG_PUBLIC_ADDRESS),
|
||||
@ -5572,15 +5576,19 @@ static int init_tcp_connection(const struct addrinfo *res,
|
||||
if (!socket_connect(fd, (void*)res, false))
|
||||
return fd;
|
||||
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
if (!getnameinfo(res->ai_addr, res->ai_addrlen,
|
||||
host, sizeof(host), port, sizeof(port),
|
||||
NI_NUMERICHOST|NI_NUMERICSERV))
|
||||
NI_NUMERICHOST | NI_NUMERICSERV))
|
||||
{
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Failed to connect to host %s on port %s.",
|
||||
host, port);
|
||||
dmsg = msg;
|
||||
}
|
||||
#else
|
||||
dmsg = "Failed to connect to host.";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5601,12 +5609,16 @@ static int init_tcp_connection(const struct addrinfo *res,
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
if (!getnameinfo(res->ai_addr, res->ai_addrlen,
|
||||
NULL, 0, port, sizeof(port), NI_NUMERICSERV))
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "Failed to bind port %s.", port);
|
||||
dmsg = msg;
|
||||
}
|
||||
#else
|
||||
dmsg = "Failed to bind port.";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -5629,10 +5641,9 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
|
||||
|
||||
if (!direct_host)
|
||||
{
|
||||
#ifdef HAVE_INET6
|
||||
char port_buf[6];
|
||||
snprintf(port_buf, sizeof(port_buf), "%hu", port);
|
||||
|
||||
#ifdef HAVE_INET6
|
||||
if (!server)
|
||||
{
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user