mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-15 05:29:51 +01:00
engine: client: implement sending input devices list to server, using protinfo
This commit is contained in:
parent
7d10660b87
commit
3e4bd20919
engine
@ -1021,6 +1021,24 @@ void CL_SendConnectPacket( void )
|
|||||||
|
|
||||||
memset( protinfo, 0, sizeof( protinfo ));
|
memset( protinfo, 0, sizeof( protinfo ));
|
||||||
|
|
||||||
|
if( adr.type == NA_LOOPBACK )
|
||||||
|
{
|
||||||
|
IN_LockInputDevices( false );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int input_devices;
|
||||||
|
|
||||||
|
input_devices = IN_CollectInputDevices();
|
||||||
|
IN_LockInputDevices( true );
|
||||||
|
|
||||||
|
Info_SetValueForKey( protinfo, "d", va( "%d", input_devices ), sizeof( protinfo ) );
|
||||||
|
Info_SetValueForKey( protinfo, "v", XASH_VERSION, sizeof( protinfo ) );
|
||||||
|
Info_SetValueForKey( protinfo, "b", va( "%d", Q_buildnum() ), sizeof( protinfo ) );
|
||||||
|
Info_SetValueForKey( protinfo, "o", Q_buildos(), sizeof( protinfo ) );
|
||||||
|
Info_SetValueForKey( protinfo, "a", Q_buildarch(), sizeof( protinfo ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( cls.legacymode )
|
if( cls.legacymode )
|
||||||
{
|
{
|
||||||
// set related userinfo keys
|
// set related userinfo keys
|
||||||
@ -1032,13 +1050,7 @@ void CL_SendConnectPacket( void )
|
|||||||
if( !*Info_ValueForKey( cls.userinfo,"cl_maxpayload") )
|
if( !*Info_ValueForKey( cls.userinfo,"cl_maxpayload") )
|
||||||
Info_SetValueForKey( cls.userinfo, "cl_maxpayload", "1000", sizeof( cls.userinfo ) );
|
Info_SetValueForKey( cls.userinfo, "cl_maxpayload", "1000", sizeof( cls.userinfo ) );
|
||||||
|
|
||||||
/// TODO: add input devices list
|
Info_SetValueForKey( protinfo, "i", key, sizeof( protinfo ) );
|
||||||
//Info_SetValueForKey( protinfo, "d", va( "%d", input_devices ), sizeof( protinfo ) );
|
|
||||||
Info_SetValueForKey( protinfo, "v", XASH_VERSION, sizeof( protinfo ) );
|
|
||||||
Info_SetValueForKey( protinfo, "b", va( "%d", Q_buildnum() ), sizeof( protinfo ) );
|
|
||||||
Info_SetValueForKey( protinfo, "o", Q_buildos(), sizeof( protinfo ) );
|
|
||||||
Info_SetValueForKey( protinfo, "a", Q_buildarch(), sizeof( protinfo ) );
|
|
||||||
Info_SetValueForKey( protinfo, "i", ID_GetMD5(), sizeof( protinfo ) );
|
|
||||||
|
|
||||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i %i \"%s\" %d \"%s\"\n",
|
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i %i \"%s\" %d \"%s\"\n",
|
||||||
PROTOCOL_LEGACY_VERSION, Q_atoi( qport ), cls.challenge, cls.userinfo, NET_LEGACY_EXT_SPLIT, protinfo );
|
PROTOCOL_LEGACY_VERSION, Q_atoi( qport ), cls.challenge, cls.userinfo, NET_LEGACY_EXT_SPLIT, protinfo );
|
||||||
@ -1051,7 +1063,7 @@ void CL_SendConnectPacket( void )
|
|||||||
if( cl_dlmax->value > FRAGMENT_MAX_SIZE || cl_dlmax->value < FRAGMENT_MIN_SIZE )
|
if( cl_dlmax->value > FRAGMENT_MAX_SIZE || cl_dlmax->value < FRAGMENT_MIN_SIZE )
|
||||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
|
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
|
||||||
|
|
||||||
Info_RemoveKey( cls.userinfo,"cl_maxpacket" );
|
Info_RemoveKey( cls.userinfo, "cl_maxpacket" );
|
||||||
Info_RemoveKey( cls.userinfo, "cl_maxpayload" );
|
Info_RemoveKey( cls.userinfo, "cl_maxpayload" );
|
||||||
|
|
||||||
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
|
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
|
||||||
@ -1062,7 +1074,6 @@ void CL_SendConnectPacket( void )
|
|||||||
Con_Printf( "Trying to connect by modern protocol\n" );
|
Con_Printf( "Trying to connect by modern protocol\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cls.timestart = Sys_DoubleTime();
|
cls.timestart = Sys_DoubleTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1487,6 +1498,8 @@ void CL_Disconnect( void )
|
|||||||
// clear the network channel, too.
|
// clear the network channel, too.
|
||||||
Netchan_Clear( &cls.netchan );
|
Netchan_Clear( &cls.netchan );
|
||||||
|
|
||||||
|
IN_LockInputDevices( false ); // unlock input devices
|
||||||
|
|
||||||
cls.state = ca_disconnected;
|
cls.state = ca_disconnected;
|
||||||
cls.set_lastdemo = false;
|
cls.set_lastdemo = false;
|
||||||
cls.connect_retry = 0;
|
cls.connect_retry = 0;
|
||||||
|
@ -57,7 +57,7 @@ static struct joy_axis_s
|
|||||||
short prevval;
|
short prevval;
|
||||||
} joyaxis[MAX_AXES] = { 0 };
|
} joyaxis[MAX_AXES] = { 0 };
|
||||||
static byte currentbinding; // add posibility to remap keys, to place it in joykeys[]
|
static byte currentbinding; // add posibility to remap keys, to place it in joykeys[]
|
||||||
static convar_t *joy_enable;
|
convar_t *joy_enable;
|
||||||
static convar_t *joy_pitch;
|
static convar_t *joy_pitch;
|
||||||
static convar_t *joy_yaw;
|
static convar_t *joy_yaw;
|
||||||
static convar_t *joy_forward;
|
static convar_t *joy_forward;
|
||||||
|
@ -287,12 +287,6 @@ void SV_ConnectClient( netadr_t from )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !SV_ProcessUserAgent( from, Cmd_Argv( 6 ) ) )
|
|
||||||
{
|
|
||||||
Netchan_OutOfBandPrint( NS_SERVER, from, "disconnect\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
challenge = Q_atoi( Cmd_Argv( 2 )); // get challenge
|
challenge = Q_atoi( Cmd_Argv( 2 )); // get challenge
|
||||||
|
|
||||||
// see if the challenge is valid (local clients don't need to challenge)
|
// see if the challenge is valid (local clients don't need to challenge)
|
||||||
@ -309,6 +303,12 @@ void SV_ConnectClient( netadr_t from )
|
|||||||
|
|
||||||
Q_strncpy( protinfo, s, sizeof( protinfo ));
|
Q_strncpy( protinfo, s, sizeof( protinfo ));
|
||||||
|
|
||||||
|
if( !SV_ProcessUserAgent( from, protinfo ) )
|
||||||
|
{
|
||||||
|
Netchan_OutOfBandPrint( NS_SERVER, from, "disconnect\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// extract qport from protocol info
|
// extract qport from protocol info
|
||||||
qport = Q_atoi( Info_ValueForKey( protinfo, "qport" ));
|
qport = Q_atoi( Info_ValueForKey( protinfo, "qport" ));
|
||||||
|
|
||||||
@ -321,7 +321,6 @@ void SV_ConnectClient( netadr_t from )
|
|||||||
|
|
||||||
extensions = Q_atoi( Info_ValueForKey( protinfo, "ext" ) );
|
extensions = Q_atoi( Info_ValueForKey( protinfo, "ext" ) );
|
||||||
|
|
||||||
|
|
||||||
// LAN servers restrict to class b IP addresses
|
// LAN servers restrict to class b IP addresses
|
||||||
if( !SV_CheckIPRestrictions( from ))
|
if( !SV_CheckIPRestrictions( from ))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user