Add RARCH_CMD_NETWORK_INIT and RARCH_CMD_NETWORK_DEINIT.

Run RARCH_CMD_NETWORK_INIT before entering Core Manager option.
Needed on Windows where we need to call WSAStartup to initialize Winsocks
first before we can do any network stuff
This commit is contained in:
twinaphex 2015-01-21 20:44:40 +01:00
parent de0b087666
commit f790216a41
3 changed files with 17 additions and 0 deletions

View File

@ -2188,6 +2188,7 @@ static int deferred_push_core_manager_list(void *data, void *userdata,
(void)buf;
menu_list_clear(list);
if (g_settings.network.buildbot_url[0] == '\0')
@ -2205,6 +2206,8 @@ static int deferred_push_core_manager_list(void *data, void *userdata,
}
#ifdef HAVE_NETPLAY
rarch_main_command(RARCH_CMD_NETWORK_INIT);
fill_pathname_join(url, g_settings.network.buildbot_url,
".index", sizeof(url));

View File

@ -2928,6 +2928,16 @@ bool rarch_main_command(unsigned cmd)
netplay_free(netplay);
driver.netplay_data = NULL;
}
#endif
break;
case RARCH_CMD_NETWORK_DEINIT:
#ifdef HAVE_NETPLAY
network_deinit();
#endif
break;
case RARCH_CMD_NETWORK_INIT:
#ifdef HAVE_NETPLAY
network_init();
#endif
break;
case RARCH_CMD_NETPLAY_INIT:

View File

@ -143,6 +143,10 @@ enum basic_event
RARCH_CMD_CHEATS_INIT,
/* Deinitializes cheats. */
RARCH_CMD_CHEATS_DEINIT,
/* Deinitializes network system. */
RARCH_CMD_NETWORK_DEINIT,
/* Initializes network system. */
RARCH_CMD_NETWORK_INIT,
/* Initializes netplay system. */
RARCH_CMD_NETPLAY_INIT,
/* Deinitializes netplay system. */