Skip to content

Commit

Permalink
SSR: Fix message buffer sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chomenor committed May 6, 2024
1 parent 1ddc203 commit d416d8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion code/server/sv_record_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ Returns first baseline index to drop due to msg overflow
*/
static int Record_CalculateBaselineCutoff( record_entityset_t *baselines, msg_t msg ) {
int i;
byte buffer[MAX_MSGLEN];
byte buffer[MAX_MSGLEN_BUF];
entityState_t nullstate;

msg.data = buffer;
Expand Down
8 changes: 4 additions & 4 deletions code/server/sv_record_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ Based on cl_main.c->CL_Record_f
*/
static void Record_WriteDemoGamestate( record_entityset_t *baselines, char **configstrings,
int clientNum, record_demo_writer_t *rdw ) {
byte buffer[MAX_MSGLEN];
byte buffer[MAX_MSGLEN_BUF];
msg_t msg;

// Delta from baselines for next snapshot
rdw->haveDelta = qfalse;
rdw->baselines = *baselines;

MSG_Init( &msg, buffer, sizeof( buffer ) );
MSG_Init( &msg, buffer, MAX_MSGLEN );

MSG_WriteLong( &msg, 0 );

Expand Down Expand Up @@ -143,10 +143,10 @@ Based on sv.snapshot.c->SV_SendClientSnapshot
static void Record_WriteDemoSnapshot( record_entityset_t *entities, record_visibility_state_t *visibility,
playerState_t *ps, int svTime, record_demo_writer_t *rdw ) {
int i;
byte buffer[MAX_MSGLEN];
byte buffer[MAX_MSGLEN_BUF];
msg_t msg;

MSG_Init( &msg, buffer, sizeof( buffer ) );
MSG_Init( &msg, buffer, MAX_MSGLEN );

MSG_WriteLong( &msg, 0 );

Expand Down
8 changes: 4 additions & 4 deletions code/server/sv_record_spectator.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Based on sv_client.c->SV_SendClientGameState
static void Record_SendSpectatorGamestate( spectator_t *spectator ) {
client_t *cl = &spectator->cl;
msg_t msg;
byte msgBuf[MAX_MSGLEN];
byte msgBuf[MAX_MSGLEN_BUF];

if ( SVC_RateLimit( &cl->gamestate_rate, 4, 1000 ) ) {
return;
Expand All @@ -273,7 +273,7 @@ static void Record_SendSpectatorGamestate( spectator_t *spectator ) {
cl->gamestateMessageNum = cl->netchan.outgoingSequence;

// Initialize message
Record_InitSpectatorMessage( cl, &msg, msgBuf, sizeof( msgBuf ) );
Record_InitSpectatorMessage( cl, &msg, msgBuf, MAX_MSGLEN );

// Write gamestate message
Record_WriteGamestateMessage( &sps->currentBaselines, sv.configstrings, 0, cl->reliableSequence, &msg,
Expand All @@ -293,7 +293,7 @@ Based on sv_snapshot.c->SV_SendClientSnapshot
static void Record_SendSpectatorSnapshot( spectator_t *spectator ) {
client_t *cl = &spectator->cl;
msg_t msg;
byte msg_buf[MAX_MSGLEN];
byte msg_buf[MAX_MSGLEN_BUF];
spectator_frame_t *current_frame = &spectator->frames[cl->netchan.outgoingSequence % PACKET_BACKUP];
spectator_frame_t *delta_frame = 0;
int delta_frame_offset = 0;
Expand Down Expand Up @@ -335,7 +335,7 @@ static void Record_SendSpectatorSnapshot( spectator_t *spectator ) {
}

// Initialize message
Record_InitSpectatorMessage( cl, &msg, msg_buf, sizeof( msg_buf ) );
Record_InitSpectatorMessage( cl, &msg, msg_buf, MAX_MSGLEN );

// Write snapshot message
Record_WriteSnapshotMessage( &sps->frameEntities[current_frame->frameEntitiesPosition % FRAME_ENTITY_COUNT],
Expand Down

0 comments on commit d416d8e

Please sign in to comment.