diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 1b5899a6..e1c4565b 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1021,6 +1021,24 @@ void CL_SendConnectPacket( void ) 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 ) { // set related userinfo keys @@ -1032,13 +1050,7 @@ void CL_SendConnectPacket( void ) if( !*Info_ValueForKey( cls.userinfo,"cl_maxpayload") ) Info_SetValueForKey( cls.userinfo, "cl_maxpayload", "1000", sizeof( cls.userinfo ) ); - /// TODO: add input devices list - //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 ) ); + Info_SetValueForKey( protinfo, "i", key, sizeof( protinfo ) ); 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 ); @@ -1051,7 +1063,7 @@ void CL_SendConnectPacket( void ) if( cl_dlmax->value > FRAGMENT_MAX_SIZE || cl_dlmax->value < FRAGMENT_MIN_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_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo )); @@ -1062,7 +1074,6 @@ void CL_SendConnectPacket( void ) Con_Printf( "Trying to connect by modern protocol\n" ); } - cls.timestart = Sys_DoubleTime(); } @@ -1487,6 +1498,8 @@ void CL_Disconnect( void ) // clear the network channel, too. Netchan_Clear( &cls.netchan ); + IN_LockInputDevices( false ); // unlock input devices + cls.state = ca_disconnected; cls.set_lastdemo = false; cls.connect_retry = 0; diff --git a/engine/client/in_joy.c b/engine/client/in_joy.c index d2b7297f..9f7d6bf6 100644 --- a/engine/client/in_joy.c +++ b/engine/client/in_joy.c @@ -57,7 +57,7 @@ static struct joy_axis_s short prevval; } joyaxis[MAX_AXES] = { 0 }; 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_yaw; static convar_t *joy_forward; diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index e4606f4b..89755715 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -287,12 +287,6 @@ void SV_ConnectClient( netadr_t from ) return; } - if( !SV_ProcessUserAgent( from, Cmd_Argv( 6 ) ) ) - { - Netchan_OutOfBandPrint( NS_SERVER, from, "disconnect\n" ); - return; - } - challenge = Q_atoi( Cmd_Argv( 2 )); // get 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 )); + if( !SV_ProcessUserAgent( from, protinfo ) ) + { + Netchan_OutOfBandPrint( NS_SERVER, from, "disconnect\n" ); + return; + } + // extract qport from protocol info qport = Q_atoi( Info_ValueForKey( protinfo, "qport" )); @@ -321,7 +321,6 @@ void SV_ConnectClient( netadr_t from ) extensions = Q_atoi( Info_ValueForKey( protinfo, "ext" ) ); - // LAN servers restrict to class b IP addresses if( !SV_CheckIPRestrictions( from )) {