Added ability to enforce dm68-compatible stream along with new challenge format, can be enabled on both client and server-side by adding -compat suffix to protocol cvar in command line, for example:
+set protocol "71-compat"
This commit is contained in:
parent
5924248d79
commit
34f0392d7b
|
@ -2700,27 +2700,27 @@ static qboolean CL_ConnectionlessPacket( const netadr_t *from, msg_t *msg ) {
|
|||
return qfalse;
|
||||
}
|
||||
|
||||
if ( !clc.compat )
|
||||
{
|
||||
c = Cmd_Argv(1);
|
||||
|
||||
if(*c)
|
||||
challenge = atoi(c);
|
||||
else
|
||||
{
|
||||
Com_Printf("Bad connectResponse received. Ignored.\n");
|
||||
if ( !clc.compat ) {
|
||||
c = Cmd_Argv( 1 );
|
||||
if ( *c != '\0' ) {
|
||||
challenge = atoi( c );
|
||||
} else {
|
||||
Com_Printf( "Bad connectResponse received. Ignored.\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if(challenge != clc.challenge)
|
||||
{
|
||||
Com_Printf("ConnectResponse with bad challenge received. Ignored.\n");
|
||||
if ( challenge != clc.challenge ) {
|
||||
Com_Printf( "ConnectResponse with bad challenge received. Ignored.\n" );
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ( com_protocolCompat ) {
|
||||
// enforce dm68-compatible stream
|
||||
clc.compat = qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
Netchan_Setup( NS_CLIENT, &clc.netchan, from, Cvar_VariableIntegerValue("net_qport"),
|
||||
clc.challenge, clc.compat );
|
||||
Netchan_Setup( NS_CLIENT, &clc.netchan, from, Cvar_VariableIntegerValue( "net_qport" ), clc.challenge, clc.compat );
|
||||
|
||||
cls.state = CA_CONNECTED;
|
||||
clc.lastPacketSentTime = -9999; // send first packet immediately
|
||||
|
|
|
@ -68,6 +68,7 @@ cvar_t *com_timescale;
|
|||
static cvar_t *com_fixedtime;
|
||||
cvar_t *com_journal;
|
||||
cvar_t *com_protocol;
|
||||
qboolean com_protocolCompat;
|
||||
#ifndef DEDICATED
|
||||
cvar_t *com_maxfps;
|
||||
cvar_t *com_maxfpsUnfocused;
|
||||
|
@ -3611,6 +3612,15 @@ void Com_Init( char *commandLine ) {
|
|||
Cvar_Get( "sv_master3", "master.maverickservers.com", CVAR_INIT );
|
||||
|
||||
com_protocol = Cvar_Get( "protocol", XSTRING( PROTOCOL_VERSION ), 0 );
|
||||
if ( Q_stristr( com_protocol->string, "-compat" ) > com_protocol->string ) {
|
||||
// strip -compat suffix
|
||||
Cvar_Set2( "protocol", va( "%i", com_protocol->integer ), qtrue );
|
||||
// enforce legacy stream encoding but with new challenge format
|
||||
com_protocolCompat = qtrue;
|
||||
} else {
|
||||
com_protocolCompat = qfalse;
|
||||
}
|
||||
|
||||
Cvar_CheckRange( com_protocol, "0", NULL, CV_INTEGER );
|
||||
com_protocol->flags &= ~CVAR_USER_CREATED;
|
||||
com_protocol->flags |= CVAR_SERVERINFO | CVAR_ROM;
|
||||
|
|
|
@ -1004,6 +1004,7 @@ extern cvar_t *com_buildScript; // for building release pak files
|
|||
extern cvar_t *com_journal;
|
||||
extern cvar_t *com_cameraMode;
|
||||
extern cvar_t *com_protocol;
|
||||
extern qboolean com_protocolCompat;
|
||||
|
||||
// both client and server must agree to pause
|
||||
extern cvar_t *sv_paused;
|
||||
|
|
|
@ -4871,7 +4871,7 @@ int32_t VM_CallCompiled( vm_t *vm, int nargs, int32_t *args )
|
|||
Com_Error( ERR_DROP, "%s(%s): opStack corrupted in compiled code", __func__, vm->name );
|
||||
}
|
||||
|
||||
if ( vm->programStack != stackOnEntry - ( MAX_VMMAIN_CALL_ARGS + 2 ) * sizeof( int32_t ) ) {
|
||||
if ( vm->programStack != (int32_t)( stackOnEntry - ( MAX_VMMAIN_CALL_ARGS + 2 ) * sizeof( int32_t ) ) ) {
|
||||
Com_Error( ERR_DROP, "%s(%s): programStack corrupted in compiled code", __func__, vm->name );
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -536,6 +536,12 @@ void SV_DirectConnect( const netadr_t *from ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( com_protocolCompat )
|
||||
{
|
||||
// enforce dm68-compatible stream
|
||||
compat = qtrue;
|
||||
}
|
||||
|
||||
v = Info_ValueForKey( userinfo, "qport" );
|
||||
if ( *v == '\0' )
|
||||
{
|
||||
|
|
|
@ -778,7 +778,7 @@ static void SVC_Info( const netadr_t *from ) {
|
|||
// to prevent timed spoofed reply packets that add ghost servers
|
||||
Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) );
|
||||
|
||||
Info_SetValueForKey( infostring, "protocol", com_protocol->string );
|
||||
Info_SetValueForKey( infostring, "protocol", va( "%i", com_protocol->integer ) );
|
||||
Info_SetValueForKey( infostring, "hostname", sv_hostname->string );
|
||||
Info_SetValueForKey( infostring, "mapname", sv_mapname->string );
|
||||
Info_SetValueForKey( infostring, "clients", va("%i", count) );
|
||||
|
|
Loading…
Reference in New Issue