Example #1
0
/*
====================
NET_Config

A single player game will only use the loopback code
====================
*/
void	NET_Config (qboolean multiplayer)
{
	int		i;

	if (!multiplayer)
	{	// shut down any existing sockets
		for (i=0 ; i<2 ; i++)
		{
			if (ip_sockets[i])
			{
				close (ip_sockets[i]);
				ip_sockets[i] = 0;
			}
			if (ipx_sockets[i])
			{
				close (ipx_sockets[i]);
				ipx_sockets[i] = 0;
			}
		}
	}
	else
	{	// open sockets
		NET_OpenIP ();
		NET_OpenIPX ();
	}
}
Example #2
0
/*
====================
NET_Config

A single player game will only use the loopback code
====================
*/
void	NET_Config (qboolean multiplayer)
{
	int		i;
	static	qboolean	old_config;

	if (old_config == multiplayer)
		return;

	old_config = multiplayer;

	if (!multiplayer)
	{	// shut down any existing sockets
		for (i=0 ; i<2 ; i++)
		{
			if (ip_sockets[i])
			{
				closesocket (ip_sockets[i]);
				ip_sockets[i] = 0;
			}
			if (ipx_sockets[i])
			{
				closesocket (ipx_sockets[i]);
				ipx_sockets[i] = 0;
			}
		}
	}
	else
	{	// open sockets
		if (! noudp->value)
			NET_OpenIP ();
		if (! noipx->value)
			NET_OpenIPX ();
	}
}
Example #3
0
/*
====================
NET_Config

A single player game will only use the loopback code
====================
*/
void	NET_Config (qboolean multiplayer)
{
	int		i;

	if (!multiplayer)
	{	// shut down any existing sockets
		for (i=0 ; i<2 ; i++)
		{
			if (ip_sockets[i])
			{
// >>> FIX: For Nintendo Wii using devkitPPC / libogc
// Switching to the equivalent function in the library:
				//close (ip_sockets[i]);
				net_close (ip_sockets[i]);
// <<< FIX
				ip_sockets[i] = 0;
			}
			if (ipx_sockets[i])
			{
// >>> FIX: For Nintendo Wii using devkitPPC / libogc
// Switching to the equivalent function in the library:
				//close (ipx_sockets[i]);
				net_close (ipx_sockets[i]);
// <<< FIX
				ipx_sockets[i] = 0;
			}
		}
	}
	else
	{	// open sockets
		NET_OpenIP ();
		NET_OpenIPX ();
	}
}
Example #4
0
/* <d4991> ../engine/net_ws.c:2182 */
void NET_Config(qboolean multiplayer)
{
	int i;
	static qboolean old_config;
	static qboolean bFirst = TRUE;

	if (old_config == multiplayer)
	{
		return;
	}

	old_config = multiplayer;

	if (multiplayer)
	{
		if (!noip)
			NET_OpenIP();
#ifdef _WIN32
		if (!noipx)
			NET_OpenIPX();
#endif //_WIN32
		if (bFirst)
		{
			bFirst = FALSE;
			NET_GetLocalAddress();
		}
	}
	else
	{

		NET_ThreadLock();
		for (i = 0; i < 3; i++)
		{
			if (ip_sockets[i])
			{
#ifdef _WIN32
				CRehldsPlatformHolder::get()->closesocket(ip_sockets[i]);
#else
				SOCKET_CLOSE(ip_sockets[i]);
#endif //_WIN32
				ip_sockets[i] = 0;
			}
#ifdef _WIN32
			if (ipx_sockets[i])
			{
				CRehldsPlatformHolder::get()->closesocket(ipx_sockets[i]);
				ipx_sockets[i] = 0;
			}
#endif //_WIN32
		}
		NET_ThreadUnlock();
	}
	net_configured = multiplayer ? 1 : 0;
}
Example #5
0
/*
====================
NET_Config
====================
*/
void NET_Config( qboolean enableNetworking ) {
	qboolean	modified;
	qboolean	stop;
	qboolean	start;

	// get any latched changes to cvars
	modified = NET_GetCvars();

	if( net_noudp->integer && net_noipx->integer ) {
		enableNetworking = qfalse;
	}

	// if enable state is the same and no cvars were modified, we have nothing to do
	if( enableNetworking == networkingEnabled && !modified ) {
		return;
	}

	if( enableNetworking == networkingEnabled ) {
		if( enableNetworking ) {
			stop = qtrue;
			start = qtrue;
		}
		else {
			stop = qfalse;
			start = qfalse;
		}
	}
	else {
		if( enableNetworking ) {
			stop = qfalse;
			start = qtrue;
		}
		else {
			stop = qtrue;
			start = qfalse;
		}
		networkingEnabled = enableNetworking;
	}

	if( stop ) {
		if ( ip_socket && ip_socket != INVALID_SOCKET ) {
			closesocket( ip_socket );
			ip_socket = 0;
		}

		if ( socks_socket && socks_socket != INVALID_SOCKET ) {
			closesocket( socks_socket );
			socks_socket = 0;
		}

		if ( ipx_socket && ipx_socket != INVALID_SOCKET ) {
			closesocket( ipx_socket );
			ipx_socket = 0;
		}
	}

	if( start ) {
		if (! net_noudp->integer ) {
			NET_OpenIP();
		}
		if (! net_noipx->integer ) {
			NET_OpenIPX();
		}
	}
}