engine: client: add command replaybufferdat to aid in debugging protocol errors by parsing buffer.dat
This commit is contained in:
parent
1abec80191
commit
95af635ab4
3 changed files with 44 additions and 0 deletions
|
@ -198,3 +198,44 @@ void CL_WriteMessageHistory( void )
|
||||||
CL_WriteErrorMessage( old->starting_offset, msg );
|
CL_WriteErrorMessage( old->starting_offset, msg );
|
||||||
cls_message_debug.parsing = false;
|
cls_message_debug.parsing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CL_ReplayBufferDat_f( void )
|
||||||
|
{
|
||||||
|
file_t *f = FS_Open( Cmd_Argv( 1 ), "rb", true );
|
||||||
|
sizebuf_t msg;
|
||||||
|
char buffer[NET_MAX_MESSAGE];
|
||||||
|
int starting_count, current_count, protocol;
|
||||||
|
fs_offset_t len;
|
||||||
|
|
||||||
|
if( !f )
|
||||||
|
return;
|
||||||
|
|
||||||
|
FS_Read( f, &starting_count, sizeof( starting_count ));
|
||||||
|
FS_Read( f, ¤t_count, sizeof( current_count ));
|
||||||
|
FS_Read( f, &protocol, sizeof( protocol ));
|
||||||
|
|
||||||
|
cls.legacymode = protocol;
|
||||||
|
|
||||||
|
len = FS_Read( f, buffer, sizeof( buffer ));
|
||||||
|
FS_Close( f );
|
||||||
|
|
||||||
|
MSG_Init( &msg, __func__, buffer, len );
|
||||||
|
|
||||||
|
Delta_Shutdown();
|
||||||
|
Delta_Init();
|
||||||
|
|
||||||
|
clgame.maxEntities = MAX_EDICTS;
|
||||||
|
clgame.entities = Mem_Calloc( clgame.mempool, sizeof( *clgame.entities ) * clgame.maxEntities );
|
||||||
|
|
||||||
|
// ad-hoc implement
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
const int message_pos = 12; // put real number here
|
||||||
|
MSG_SeekToBit( &msg, ( message_pos - 12 + 1 ) << 3, SEEK_SET );
|
||||||
|
|
||||||
|
CL_ParseYourMom( &msg, protocol );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Sys_Quit( __func__ );
|
||||||
|
}
|
||||||
|
|
|
@ -3489,6 +3489,8 @@ static void CL_InitLocal( void )
|
||||||
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "sent by server when serverinfo changes" );
|
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "sent by server when serverinfo changes" );
|
||||||
Cmd_AddCommand ("upload", CL_BeginUpload_f, "uploading file to the server" );
|
Cmd_AddCommand ("upload", CL_BeginUpload_f, "uploading file to the server" );
|
||||||
|
|
||||||
|
Cmd_AddRestrictedCommand( "replaybufferdat", CL_ReplayBufferDat_f, "development and debugging tool" );
|
||||||
|
|
||||||
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
||||||
Cmd_AddRestrictedCommand ("exit", CL_Quit_f, "quit from game" );
|
Cmd_AddRestrictedCommand ("exit", CL_Quit_f, "quit from game" );
|
||||||
|
|
||||||
|
|
|
@ -737,6 +737,7 @@ void CL_ClearResourceLists( void );
|
||||||
//
|
//
|
||||||
// cl_debug.c
|
// cl_debug.c
|
||||||
//
|
//
|
||||||
|
void CL_ReplayBufferDat_f( void );
|
||||||
void CL_Parse_Debug( qboolean enable );
|
void CL_Parse_Debug( qboolean enable );
|
||||||
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
||||||
void CL_ResetFrame( frame_t *frame );
|
void CL_ResetFrame( frame_t *frame );
|
||||||
|
|
Loading…
Add table
Reference in a new issue