diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 55c8b0dde..56b65994a 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -34,6 +34,7 @@ static qboolean lastdemowassystempath; extern cvar_t qtvcl_forceversion1; extern cvar_t qtvcl_eztvextensions; +extern cvar_t record_flush; static unsigned char demobuffer[1024*66]; //input buffer static int demooffset; //start offset of demo buffer @@ -133,7 +134,8 @@ void CL_WriteDemoCmd (usercmd_t *pcmd) VFS_WRITE (cls.demooutfile, &fl, 4); } - VFS_FLUSH (cls.demooutfile); + if (record_flush.ival) + VFS_FLUSH (cls.demooutfile); } /* @@ -196,7 +198,8 @@ void CL_WriteDemoMessage (sizebuf_t *msg, int payloadoffset) VFS_WRITE(cls.demooutfile, net_message.data + payloadoffset, net_message.cursize - payloadoffset); break; } - VFS_FLUSH (cls.demooutfile); + if (record_flush.ival) + VFS_FLUSH (cls.demooutfile); } int demo_preparsedemo(unsigned char *buffer, int bytes) @@ -948,7 +951,8 @@ void CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq) VFS_WRITE (cls.demooutfile, msg->data, msg->cursize); - VFS_FLUSH (cls.demooutfile); + if (record_flush.ival) + VFS_FLUSH (cls.demooutfile); } @@ -974,7 +978,8 @@ void CL_WriteSetDemoMessage (void) len = LittleLong(cls.netchan.incoming_sequence); VFS_WRITE (cls.demooutfile, &len, 4); - VFS_FLUSH (cls.demooutfile); + if (record_flush.ival) + VFS_FLUSH (cls.demooutfile); } diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 40a05a511..3a38ce81c 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -89,6 +89,7 @@ cvar_t cl_serveraddress = CVARD("cl_serveraddress", "none", "The address of the cvar_t qtvcl_forceversion1 = CVAR("qtvcl_forceversion1", "0"); cvar_t qtvcl_eztvextensions = CVAR("qtvcl_eztvextensions", "0"); +cvar_t record_flush = CVARD("record_flush", "0", "If set, explicitly flushes demo data to disk while recording. This may be inefficient, depending on how your operating system is configured."); cvar_t cl_demospeed = CVARF("cl_demospeed", "1", 0); cvar_t cl_demoreel = CVARFD("cl_demoreel", "0", CVAR_SAVE, "When enabled, the engine will begin playing a demo loop on startup."); @@ -3760,6 +3761,7 @@ void CL_Init (void) Cvar_Register (&w_switch, cl_controlgroup); Cvar_Register (&cl_demoreel, cl_controlgroup); + Cvar_Register (&record_flush, cl_controlgroup); Cvar_Register (&cl_nofake, cl_controlgroup); Cvar_Register (&cl_chatsound, cl_controlgroup);