mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 06:18:34 +00:00
show the frontend name and CPU architecture on netplay rooms
This commit is contained in:
parent
4758d3e22b
commit
7bdd8e945a
@ -3431,6 +3431,9 @@ static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const cha
|
||||
strlcpy(netplay_room_list[i].gamename,
|
||||
host->content,
|
||||
sizeof(netplay_room_list[i].gamename));
|
||||
strlcpy(netplay_room_list[i].frontend,
|
||||
host->frontend,
|
||||
sizeof(netplay_room_list[i].frontend));
|
||||
|
||||
netplay_room_list[i].port = host->port;
|
||||
netplay_room_list[i].gamecrc = host->content_crc;
|
||||
|
@ -405,6 +405,8 @@ static int action_bind_sublabel_netplay_room(
|
||||
const char *corename = NULL;
|
||||
const char *gamename = NULL;
|
||||
const char *core_ver = NULL;
|
||||
const char *frontend = NULL;
|
||||
|
||||
/* This offset may cause issues if any entries are added to this menu */
|
||||
unsigned offset = i - 3;
|
||||
|
||||
@ -415,11 +417,13 @@ static int action_bind_sublabel_netplay_room(
|
||||
corename = netplay_room_list[offset].corename;
|
||||
gamename = netplay_room_list[offset].gamename;
|
||||
core_ver = netplay_room_list[offset].coreversion;
|
||||
gamecrc = netplay_room_list[offset].gamecrc;
|
||||
gamecrc = netplay_room_list[offset].gamecrc;
|
||||
frontend = netplay_room_list[offset].frontend;
|
||||
|
||||
snprintf(s, len,
|
||||
"RetroArch: %s\nCore: %s (%s)\nGame: %s (%08x)",
|
||||
"RetroArch: %s (%s)\nCore: %s (%s)\nGame: %s (%08x)",
|
||||
string_is_empty(ra_version) ? "n/a" : ra_version,
|
||||
string_is_empty(frontend) ? "n/a" : frontend,
|
||||
corename, core_ver,
|
||||
!string_is_equal(gamename, "N/A") ? gamename : "n/a",
|
||||
gamecrc);
|
||||
|
@ -91,4 +91,6 @@ int netplay_rooms_get_count();
|
||||
|
||||
void netplay_rooms_free();
|
||||
|
||||
void netplay_get_architecture(char *frontend_architecture, size_t size);
|
||||
|
||||
#endif
|
||||
|
@ -63,6 +63,7 @@ struct ad_packet
|
||||
char address[NETPLAY_HOST_STR_LEN];
|
||||
char retroarch_version[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 content[NETPLAY_HOST_LONGSTR_LEN];
|
||||
@ -290,6 +291,8 @@ bool netplay_lan_ad_server(netplay_t *netplay)
|
||||
{
|
||||
char *p;
|
||||
char sub[NETPLAY_HOST_STR_LEN];
|
||||
char frontend[NETPLAY_HOST_STR_LEN];
|
||||
netplay_get_architecture(frontend, sizeof(frontend));
|
||||
|
||||
p=strrchr(reply_addr,'.');
|
||||
if (p)
|
||||
@ -321,6 +324,7 @@ bool netplay_lan_ad_server(netplay_t *netplay)
|
||||
? path_basename(path_get(RARCH_PATH_BASENAME)) : "N/A",
|
||||
NETPLAY_HOST_LONGSTR_LEN);
|
||||
strlcpy(ad_packet_buffer.nick, netplay->nick, NETPLAY_HOST_STR_LEN);
|
||||
strlcpy(ad_packet_buffer.frontend, frontend, NETPLAY_HOST_STR_LEN);
|
||||
|
||||
if (info)
|
||||
{
|
||||
@ -482,6 +486,8 @@ static bool netplay_lan_ad_client(void)
|
||||
NETPLAY_HOST_STR_LEN);
|
||||
strlcpy(host->content, ad_packet_buffer.content,
|
||||
NETPLAY_HOST_LONGSTR_LEN);
|
||||
strlcpy(host->frontend, ad_packet_buffer.frontend,
|
||||
NETPLAY_HOST_LONGSTR_LEN);
|
||||
|
||||
host->content_crc =
|
||||
atoi(ad_packet_buffer.content_crc);
|
||||
|
@ -39,6 +39,7 @@ struct netplay_host
|
||||
|
||||
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];
|
||||
@ -69,6 +70,7 @@ struct netplay_room
|
||||
int port;
|
||||
int mitm_port;
|
||||
char corename [PATH_MAX_LENGTH];
|
||||
char frontend [PATH_MAX_LENGTH];
|
||||
char coreversion [PATH_MAX_LENGTH];
|
||||
char gamename [PATH_MAX_LENGTH];
|
||||
int gamecrc;
|
||||
|
@ -605,6 +605,49 @@ static void netplay_announce_cb(void *task_data, void *user_data, const char *er
|
||||
return;
|
||||
}
|
||||
|
||||
void netplay_get_architecture(char *frontend_architecture, size_t size)
|
||||
{
|
||||
const frontend_ctx_driver_t
|
||||
*frontend = frontend_get_ptr();
|
||||
enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
|
||||
char architecture[PATH_MAX_LENGTH];
|
||||
|
||||
switch (arch)
|
||||
{
|
||||
case FRONTEND_ARCH_X86:
|
||||
strlcpy(architecture, "x86", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_X86_64:
|
||||
strlcpy(architecture, "x64", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_PPC:
|
||||
strlcpy(architecture, "PPC", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_ARM:
|
||||
strlcpy(architecture, "ARM", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_ARMV7:
|
||||
strlcpy(architecture, "ARMv7", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_ARMV8:
|
||||
strlcpy(architecture, "ARMv8", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_MIPS:
|
||||
strlcpy(architecture, "MIPS", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_TILE:
|
||||
strlcpy(architecture, "Tilera", sizeof(architecture));
|
||||
break;
|
||||
case FRONTEND_ARCH_NONE:
|
||||
default:
|
||||
strlcpy(architecture,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
sizeof(architecture));
|
||||
break;
|
||||
}
|
||||
snprintf(frontend_architecture, size, "%s %s", frontend->ident, architecture);
|
||||
}
|
||||
|
||||
static void netplay_announce(void)
|
||||
{
|
||||
char buf [2048];
|
||||
@ -617,8 +660,9 @@ static void netplay_announce(void)
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
uint32_t content_crc = content_get_crc();
|
||||
const frontend_ctx_driver_t
|
||||
*frontend = frontend_get_ptr();
|
||||
char frontend_architecture[PATH_MAX_LENGTH];
|
||||
|
||||
netplay_get_architecture(frontend_architecture, sizeof(frontend_architecture));
|
||||
|
||||
net_http_urlencode_full(&username, settings->paths.username);
|
||||
net_http_urlencode_full(&corename, system->info.library_name);
|
||||
@ -626,7 +670,7 @@ static void netplay_announce(void)
|
||||
!string_is_empty(path_basename(path_get(RARCH_PATH_BASENAME))) ?
|
||||
path_basename(path_get(RARCH_PATH_BASENAME)) : "N/A");
|
||||
net_http_urlencode_full(&coreversion, system->info.library_version);
|
||||
net_http_urlencode_full(&frontend_ident, frontend->ident);
|
||||
net_http_urlencode_full(&frontend_ident, frontend_architecture);
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
@ -638,7 +682,7 @@ static void netplay_announce(void)
|
||||
*settings->paths.netplay_password ? 1 : 0,
|
||||
*settings->paths.netplay_spectate_password ? 1 : 0,
|
||||
settings->bools.netplay_use_mitm_server,
|
||||
PACKAGE_VERSION, frontend_ident);
|
||||
PACKAGE_VERSION, frontend_architecture);
|
||||
#if 0
|
||||
RARCH_LOG("[netplay] announcement URL: %s\n", buf);
|
||||
#endif
|
||||
|
@ -283,6 +283,11 @@ static JSON_Parser_HandlerResult JSON_CALL ObjectMemberHandler(JSON_Parser parse
|
||||
pCtx->cur_field = strdup(pValue);
|
||||
pCtx->cur_member = &rooms->cur->country;
|
||||
}
|
||||
else if (string_is_equal_fast(pValue, "frontend", 7))
|
||||
{
|
||||
pCtx->cur_field = strdup(pValue);
|
||||
pCtx->cur_member = &rooms->cur->frontend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user