Move more global state to rarch_state

This commit is contained in:
twinaphex 2020-07-09 02:41:13 +02:00
parent 638d692d2e
commit 68aa5dc0db
2 changed files with 12 additions and 8 deletions

View File

@ -71,9 +71,11 @@ struct ad_packet
char subsystem_name[NETPLAY_HOST_STR_LEN];
};
/* TODO/FIXME - global referenced outside */
struct netplay_room *netplay_room_list = NULL;
/* TODO/FIXME - globals - remove to make code thread-safe */
int netplay_room_count = 0;
struct netplay_room *netplay_room_list = NULL;
/* LAN discovery sockets */
static int lan_ad_server_fd = -1;
@ -86,16 +88,9 @@ static struct ad_packet ad_packet_buffer;
static struct netplay_host_list discovered_hosts;
static size_t discovered_hosts_allocated;
static struct netplay_room netplay_host_room = {0};
/* Forward declarations */
static bool netplay_lan_ad_client(void);
struct netplay_room* netplay_get_host_room(void)
{
return &netplay_host_room;
}
/** Initialize Netplay discovery (client) */
bool init_netplay_discovery(void)
{

View File

@ -2308,6 +2308,9 @@ struct rarch_state
#ifdef HAVE_DYNAMIC
dylib_t lib_handle;
#endif
#ifdef HAVE_NETWORKING
struct netplay_room netplay_host_room;
#endif
#if defined(HAVE_RUNAHEAD)
retro_ctx_load_content_info_t *load_content_info;
@ -2899,6 +2902,12 @@ static void menu_input_post_iterate(
static void menu_input_reset(struct rarch_state *p_rarch);
#endif
struct netplay_room* netplay_get_host_room(void)
{
struct rarch_state *p_rarch = &rarch_st;
return &p_rarch->netplay_host_room;
}
content_state_t *content_state_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;