mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Fix CXX_BUILD
This commit is contained in:
parent
3ff158b907
commit
36b2c48cb5
@ -3121,20 +3121,30 @@ static int action_ok_netplay_connect_room(const char *path,
|
|||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
|
char tmp_hostname[512];
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
tmp_hostname[0] = '\0';
|
||||||
|
|
||||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
|
||||||
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);
|
||||||
|
|
||||||
char tmp_hostname[512];
|
|
||||||
|
|
||||||
/* For testing purposes
|
/* For testing purposes
|
||||||
strlcpy(tmp_hostname, "192.168.1.241", sizeof(tmp_hostname));*/
|
strlcpy(tmp_hostname, "192.168.1.241", sizeof(tmp_hostname));*/
|
||||||
strlcpy(tmp_hostname, netplay_room_list[idx - 1].address, sizeof(tmp_hostname));
|
strlcpy(tmp_hostname,
|
||||||
snprintf(tmp_hostname, sizeof(tmp_hostname), "%s:%d",
|
netplay_room_list[idx - 1].address,
|
||||||
netplay_room_list[idx - 1].address, netplay_room_list[idx - 1].port);
|
sizeof(tmp_hostname));
|
||||||
RARCH_LOG("%s %s %08x", netplay_room_list[idx - 1].address, netplay_room_list[idx - 1].gamename, netplay_room_list[idx - 1].gamecrc);
|
snprintf(tmp_hostname,
|
||||||
|
sizeof(tmp_hostname),
|
||||||
|
"%s:%d",
|
||||||
|
netplay_room_list[idx - 1].address,
|
||||||
|
netplay_room_list[idx - 1].port);
|
||||||
|
|
||||||
|
RARCH_LOG("%s %s %08x", netplay_room_list[idx - 1].address,
|
||||||
|
netplay_room_list[idx - 1].gamename,
|
||||||
|
netplay_room_list[idx - 1].gamecrc);
|
||||||
|
|
||||||
/* If we haven't yet started, this will load on its own */
|
/* If we haven't yet started, this will load on its own */
|
||||||
if (!content_is_inited())
|
if (!content_is_inited())
|
||||||
{
|
{
|
||||||
@ -3211,8 +3221,8 @@ static int action_ok_netplay_lan_scan(const char *path,
|
|||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
struct netplay_host_list *hosts;
|
struct netplay_host_list *hosts = NULL;
|
||||||
struct netplay_host *host;
|
struct netplay_host *host = NULL;
|
||||||
|
|
||||||
/* Figure out what host we're connecting to */
|
/* Figure out what host we're connecting to */
|
||||||
if (!netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &hosts))
|
if (!netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, &hosts))
|
||||||
@ -3311,6 +3321,7 @@ static int action_ok_push_scan_file(const char *path,
|
|||||||
return action_ok_push_content_list(path, label, type, idx, entry_idx);
|
return action_ok_push_content_list(path, label, type, idx, entry_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err)
|
static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const char *err)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX_LENGTH];
|
char buf[PATH_MAX_LENGTH];
|
||||||
@ -3340,8 +3351,8 @@ finish:
|
|||||||
int i, j = 0;
|
int i, j = 0;
|
||||||
char tmp[PATH_MAX_LENGTH];
|
char tmp[PATH_MAX_LENGTH];
|
||||||
static struct string_list *room_data = NULL;
|
static struct string_list *room_data = NULL;
|
||||||
file_list_t *file_list = NULL;
|
file_list_t *file_list = menu_entries_get_selection_buf_ptr(0);
|
||||||
file_list = menu_entries_get_selection_buf_ptr(0);
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list);
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list);
|
||||||
|
|
||||||
room_data = string_split(buf, "\n");
|
room_data = string_split(buf, "\n");
|
||||||
@ -3350,15 +3361,18 @@ finish:
|
|||||||
free(netplay_room_list);
|
free(netplay_room_list);
|
||||||
|
|
||||||
netplay_room_count = room_data->size / 8;
|
netplay_room_count = room_data->size / 8;
|
||||||
netplay_room_list = (struct netplay_room*)malloc(sizeof(struct netplay_room) * netplay_room_count);
|
netplay_room_list = (struct netplay_room*)
|
||||||
|
malloc(sizeof(struct netplay_room) * netplay_room_count);
|
||||||
|
|
||||||
/*for (int i = 0; i < room_data->size; i++)
|
#if 0
|
||||||
|
for (int i = 0; i < room_data->size; i++)
|
||||||
{
|
{
|
||||||
strlcpy(tmp,
|
strlcpy(tmp,
|
||||||
room_data->elems[i].data, sizeof(tmp));
|
room_data->elems[i].data, sizeof(tmp));
|
||||||
RARCH_LOG("tmp %s\n", tmp);
|
RARCH_LOG("tmp %s\n", tmp);
|
||||||
|
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
menu_entries_append_enum(file_list,
|
menu_entries_append_enum(file_list,
|
||||||
"Refresh Room List",
|
"Refresh Room List",
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS),
|
msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY_REFRESH_ROOMS),
|
||||||
@ -3368,11 +3382,22 @@ finish:
|
|||||||
RARCH_LOG ("Found %d rooms\n", netplay_room_count);
|
RARCH_LOG ("Found %d rooms\n", netplay_room_count);
|
||||||
for (i = 0; i < netplay_room_count; i++)
|
for (i = 0; i < netplay_room_count; i++)
|
||||||
{
|
{
|
||||||
strlcpy(netplay_room_list[i].nickname, room_data->elems[j + 0].data, sizeof(netplay_room_list[i].nickname));
|
strlcpy(netplay_room_list[i].nickname,
|
||||||
strlcpy(netplay_room_list[i].address, room_data->elems[j + 1].data, sizeof(netplay_room_list[i].address));
|
room_data->elems[j + 0].data,
|
||||||
strlcpy(netplay_room_list[i].corename, room_data->elems[j + 3].data, sizeof(netplay_room_list[i].corename));
|
sizeof(netplay_room_list[i].nickname));
|
||||||
strlcpy(netplay_room_list[i].coreversion, room_data->elems[j + 4].data, sizeof(netplay_room_list[i].coreversion));
|
strlcpy(netplay_room_list[i].address,
|
||||||
strlcpy(netplay_room_list[i].gamename, room_data->elems[j + 5].data, sizeof(netplay_room_list[i].coreversion));
|
room_data->elems[j + 1].data,
|
||||||
|
sizeof(netplay_room_list[i].address));
|
||||||
|
strlcpy(netplay_room_list[i].corename,
|
||||||
|
room_data->elems[j + 3].data,
|
||||||
|
sizeof(netplay_room_list[i].corename));
|
||||||
|
strlcpy(netplay_room_list[i].coreversion,
|
||||||
|
room_data->elems[j + 4].data,
|
||||||
|
sizeof(netplay_room_list[i].coreversion));
|
||||||
|
strlcpy(netplay_room_list[i].gamename,
|
||||||
|
room_data->elems[j + 5].data,
|
||||||
|
sizeof(netplay_room_list[i].coreversion));
|
||||||
|
|
||||||
netplay_room_list[i].port = atoi(room_data->elems[j + 2].data);
|
netplay_room_list[i].port = atoi(room_data->elems[j + 2].data);
|
||||||
netplay_room_list[i].gamecrc = atoi(room_data->elems[j + 6].data);
|
netplay_room_list[i].gamecrc = atoi(room_data->elems[j + 6].data);
|
||||||
netplay_room_list[i].timestamp = atoi(room_data->elems[j + 7].data);
|
netplay_room_list[i].timestamp = atoi(room_data->elems[j + 7].data);
|
||||||
@ -3396,7 +3421,8 @@ finish:
|
|||||||
netplay_room_list[i].timestamp);
|
netplay_room_list[i].timestamp);
|
||||||
j+=8;
|
j+=8;
|
||||||
char s[PATH_MAX_LENGTH];
|
char s[PATH_MAX_LENGTH];
|
||||||
snprintf(s, sizeof(s), "Nickname: %s", netplay_room_list[i].nickname);
|
snprintf(s, sizeof(s), "Nickname: %s",
|
||||||
|
netplay_room_list[i].nickname);
|
||||||
menu_entries_append_enum(file_list,
|
menu_entries_append_enum(file_list,
|
||||||
s,
|
s,
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM),
|
msg_hash_to_str(MENU_ENUM_LABEL_CONNECT_NETPLAY_ROOM),
|
||||||
@ -3429,6 +3455,7 @@ static int action_ok_push_netplay_refresh_rooms(const char *path,
|
|||||||
task_push_http_transfer(url, true, NULL, netplay_refresh_rooms_cb, NULL);
|
task_push_http_transfer(url, true, NULL, netplay_refresh_rooms_cb, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int action_ok_scan_directory_list(const char *path,
|
static int action_ok_scan_directory_list(const char *path,
|
||||||
|
@ -63,8 +63,12 @@ struct ad_packet
|
|||||||
bool netplay_lan_ad_client(void);
|
bool netplay_lan_ad_client(void);
|
||||||
|
|
||||||
/* LAN discovery sockets */
|
/* LAN discovery sockets */
|
||||||
static int lan_ad_server_fd = -1;
|
static int lan_ad_server_fd = -1;
|
||||||
static int lan_ad_client_fd = -1;
|
static int lan_ad_client_fd = -1;
|
||||||
|
|
||||||
|
int netplay_room_count = 0;
|
||||||
|
|
||||||
|
struct netplay_room *netplay_room_list = NULL;
|
||||||
|
|
||||||
/* Packet buffer for advertisement and responses */
|
/* Packet buffer for advertisement and responses */
|
||||||
static struct ad_packet ad_packet_buffer;
|
static struct ad_packet ad_packet_buffer;
|
||||||
|
@ -30,19 +30,21 @@ enum rarch_netplay_discovery_ctl_state
|
|||||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES
|
RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES
|
||||||
};
|
};
|
||||||
|
|
||||||
struct netplay_host {
|
struct netplay_host
|
||||||
struct sockaddr addr;
|
{
|
||||||
socklen_t addrlen;
|
struct sockaddr addr;
|
||||||
|
socklen_t addrlen;
|
||||||
|
|
||||||
char nick[NETPLAY_HOST_STR_LEN];
|
char nick[NETPLAY_HOST_STR_LEN];
|
||||||
char core[NETPLAY_HOST_STR_LEN];
|
char core[NETPLAY_HOST_STR_LEN];
|
||||||
char core_version[NETPLAY_HOST_STR_LEN];
|
char core_version[NETPLAY_HOST_STR_LEN];
|
||||||
char content[NETPLAY_HOST_STR_LEN];
|
char content[NETPLAY_HOST_STR_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct netplay_host_list {
|
struct netplay_host_list
|
||||||
struct netplay_host *hosts;
|
{
|
||||||
size_t size;
|
struct netplay_host *hosts;
|
||||||
|
size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 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
|
||||||
@ -59,9 +61,9 @@ struct netplay_room
|
|||||||
int timestamp;
|
int timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct netplay_room *netplay_room_list;
|
extern struct netplay_room *netplay_room_list;
|
||||||
|
|
||||||
int netplay_room_count;
|
extern int netplay_room_count;
|
||||||
|
|
||||||
/** Initialize Netplay discovery */
|
/** Initialize Netplay discovery */
|
||||||
bool init_netplay_discovery(void);
|
bool init_netplay_discovery(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user