mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 06:18:34 +00:00
Add Network Information now
This commit is contained in:
parent
e99a97d9b7
commit
5b4ba2a449
@ -24,7 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <net_ifinfo.h>
|
||||
#include <net/net_ifinfo.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
|
@ -63,6 +63,11 @@ static int deferred_push_system_information(menu_displaylist_info_t *info)
|
||||
return deferred_push_dlist(info, DISPLAYLIST_SYSTEM_INFO);
|
||||
}
|
||||
|
||||
static int deferred_push_network_information(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_NETWORK_INFO);
|
||||
}
|
||||
|
||||
static int deferred_push_debug_information(menu_displaylist_info_t *info)
|
||||
{
|
||||
return deferred_push_dlist(info, DISPLAYLIST_DEBUG_INFO);
|
||||
@ -694,6 +699,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
|
||||
case MENU_LABEL_SYSTEM_INFORMATION:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_system_information);
|
||||
break;
|
||||
case MENU_LABEL_NETWORK_INFORMATION:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_network_information);
|
||||
break;
|
||||
case MENU_LABEL_DEBUG_INFORMATION:
|
||||
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_debug_information);
|
||||
break;
|
||||
|
@ -2346,6 +2346,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS:
|
||||
case MENU_LABEL_CORE_INFORMATION:
|
||||
case MENU_LABEL_SYSTEM_INFORMATION:
|
||||
case MENU_LABEL_NETWORK_INFORMATION:
|
||||
case MENU_LABEL_DEBUG_INFORMATION:
|
||||
case MENU_LABEL_ACHIEVEMENT_LIST:
|
||||
case MENU_LABEL_DISK_OPTIONS:
|
||||
|
@ -620,6 +620,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
|
||||
return "achievement_list";
|
||||
case MENU_LABEL_SYSTEM_INFORMATION:
|
||||
return "system_information";
|
||||
case MENU_LABEL_NETWORK_INFORMATION:
|
||||
return "network_information";
|
||||
case MENU_LABEL_ONLINE_UPDATER:
|
||||
return "online_updater";
|
||||
case MENU_LABEL_CORE_INFORMATION:
|
||||
@ -1304,6 +1306,8 @@ const char *menu_hash_to_str_us(uint32_t hash)
|
||||
return "Automatically extract downloaded archive";
|
||||
case MENU_LABEL_VALUE_SYSTEM_INFORMATION:
|
||||
return "System Information";
|
||||
case MENU_LABEL_VALUE_NETWORK_INFORMATION:
|
||||
return "Network Information";
|
||||
case MENU_LABEL_VALUE_DEBUG_INFORMATION:
|
||||
return "Debug Information";
|
||||
case MENU_LABEL_VALUE_ACHIEVEMENT_LIST:
|
||||
|
@ -442,6 +442,37 @@ static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
#include <net/net_ifinfo.h>
|
||||
|
||||
static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info)
|
||||
{
|
||||
unsigned k = 0;
|
||||
net_ifinfo_t *list =
|
||||
(net_ifinfo_t*)calloc(1, sizeof(*list));
|
||||
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
if (!net_ifinfo_new(list))
|
||||
return -1;
|
||||
|
||||
for (k = 0; k < list->size; k++)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
snprintf(tmp, sizeof(tmp), "Interface (%s) : %s\n",
|
||||
list->entries[k].name, list->entries[k].host);
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
}
|
||||
|
||||
net_ifinfo_free(list);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
{
|
||||
int controller;
|
||||
@ -2142,6 +2173,15 @@ static int menu_displaylist_parse_information_list(
|
||||
menu_hash_to_str(MENU_LABEL_CORE_INFORMATION),
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
menu_entries_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_NETWORK_INFORMATION),
|
||||
menu_hash_to_str(MENU_LABEL_NETWORK_INFORMATION),
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
menu_entries_push(info->list,
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFORMATION),
|
||||
menu_hash_to_str(MENU_LABEL_SYSTEM_INFORMATION),
|
||||
@ -2954,6 +2994,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
case DISPLAYLIST_PLAYLIST_COLLECTION:
|
||||
case DISPLAYLIST_HISTORY:
|
||||
case DISPLAYLIST_OPTIONS_DISK:
|
||||
case DISPLAYLIST_NETWORK_INFO:
|
||||
case DISPLAYLIST_SYSTEM_INFO:
|
||||
case DISPLAYLIST_DEBUG_INFO:
|
||||
case DISPLAYLIST_ACHIEVEMENT_LIST:
|
||||
@ -3553,6 +3594,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_NETWORK_INFO:
|
||||
#ifdef HAVE_NETPLAY
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
menu_displaylist_parse_network_info(info);
|
||||
#endif
|
||||
#endif
|
||||
info->need_push = true;
|
||||
info->need_refresh = true;
|
||||
break;
|
||||
case DISPLAYLIST_SYSTEM_INFO:
|
||||
menu_displaylist_parse_system_info(info);
|
||||
info->need_push = true;
|
||||
|
@ -89,6 +89,7 @@ enum menu_displaylist_ctl_state
|
||||
DISPLAYLIST_OVERLAYS,
|
||||
DISPLAYLIST_SHADER_PARAMETERS,
|
||||
DISPLAYLIST_SHADER_PARAMETERS_PRESET,
|
||||
DISPLAYLIST_NETWORK_INFO,
|
||||
DISPLAYLIST_SYSTEM_INFO,
|
||||
DISPLAYLIST_DEBUG_INFO,
|
||||
DISPLAYLIST_ACHIEVEMENT_LIST,
|
||||
|
@ -759,6 +759,8 @@ extern "C" {
|
||||
#define MENU_LABEL_CORE_COUNTERS 0x64cc83e0U
|
||||
#define MENU_LABEL_LOAD_CONTENT_HISTORY 0xfe1d79e5U
|
||||
#define MENU_LABEL_VALUE_LOAD_CONTENT_HISTORY 0x5b362286U
|
||||
#define MENU_LABEL_NETWORK_INFORMATION 0x73ae3cb4U
|
||||
#define MENU_LABEL_VALUE_NETWORK_INFORMATION 0xa0e6d195U
|
||||
#define MENU_LABEL_SYSTEM_INFORMATION 0x206ebf0fU
|
||||
#define MENU_LABEL_DEBUG_INFORMATION 0xeb0d82b1U
|
||||
#define MENU_LABEL_ACHIEVEMENT_LIST 0x7b90fc49U
|
||||
|
Loading…
Reference in New Issue
Block a user