2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-28 03:35:19 +01:00

engine: client: skip voice data for GoldSrc protocol to avoid svc_bad

This commit is contained in:
Alibek Omarov 2024-10-11 19:22:49 +03:00
parent 0c54895877
commit f90c658567
3 changed files with 19 additions and 5 deletions

View File

@ -1940,15 +1940,29 @@ CL_ParseVoiceData
================== ==================
*/ */
void CL_ParseVoiceData( sizebuf_t *msg ) void CL_ParseVoiceData( sizebuf_t *msg, connprotocol_t proto )
{ {
int size, idx, frames; int size, idx, frames;
byte received[8192]; byte received[8192];
idx = MSG_ReadByte( msg ) + 1; idx = MSG_ReadByte( msg ) + 1;
frames = MSG_ReadByte( msg ); if( proto == PROTO_GOLDSRC )
{
size = MSG_ReadShort( msg );
MSG_SeekToBit( msg, size << 3, SEEK_CUR ); // skip the entire buf, not supported yet
#if 0 // shall we notify client.dll if nothing can be heard?
// must notify through as both local player and normal client
if( idx == cl.playernum + 1 )
Voice_StatusAck( &voice.local, VOICE_LOOPBACK_INDEX );
Voice_StatusAck( &voice.players_status[idx], idx );
#endif
return;
}
frames = MSG_ReadByte( msg );
size = MSG_ReadShort( msg ); size = MSG_ReadShort( msg );
size = Q_min( size, sizeof( received )); size = Q_min( size, sizeof( received ));
@ -2632,7 +2646,7 @@ void CL_ParseServerMessage( sizebuf_t *msg )
CL_ParseVoiceInit( msg ); CL_ParseVoiceInit( msg );
break; break;
case svc_voicedata: case svc_voicedata:
CL_ParseVoiceData( msg ); CL_ParseVoiceData( msg, PROTO_CURRENT );
cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart; cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart;
break; break;
case svc_resourcelocation: case svc_resourcelocation:

View File

@ -730,7 +730,7 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
CL_ParseVoiceInit( msg ); CL_ParseVoiceInit( msg );
break; break;
case svc_voicedata: case svc_voicedata:
CL_ParseVoiceData( msg ); CL_ParseVoiceData( msg, PROTO_GOLDSRC );
cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart; cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart;
break; break;
case svc_resourcelocation: case svc_resourcelocation:

View File

@ -886,7 +886,7 @@ void CL_ParseFileTransferFailed( sizebuf_t *msg );
void CL_ParseHLTV( sizebuf_t *msg ); void CL_ParseHLTV( sizebuf_t *msg );
void CL_ParseDirector( sizebuf_t *msg ); void CL_ParseDirector( sizebuf_t *msg );
void CL_ParseVoiceInit( sizebuf_t *msg ); void CL_ParseVoiceInit( sizebuf_t *msg );
void CL_ParseVoiceData( sizebuf_t *msg ); void CL_ParseVoiceData( sizebuf_t *msg, connprotocol_t proto );
void CL_ParseResLocation( sizebuf_t *msg ); void CL_ParseResLocation( sizebuf_t *msg );
void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext, const connprotocol_t proto ); void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext, const connprotocol_t proto );
void CL_ParseServerMessage( sizebuf_t *msg ); void CL_ParseServerMessage( sizebuf_t *msg );