Added zstd training set

This commit is contained in:
Kamay Xutax 2024-07-18 21:12:36 +02:00
parent 1a3e348316
commit 4067d7cfe6
6 changed files with 51 additions and 58 deletions

1
.gitignore vendored
View file

@ -20,7 +20,6 @@ Release_*/
*.idb *.idb
*.pdb *.pdb
*.rc *.rc
*.bin
*.vcxproj* *.vcxproj*
*.sln *.sln
*.dll* *.dll*

Binary file not shown.

View file

@ -89,7 +89,7 @@ void WriteConfig_f( ConVar *var, const char *pOldString );
// If we get more than 250 messages in the incoming buffer queue, dump any above this # // If we get more than 250 messages in the incoming buffer queue, dump any above this #
#define MAX_INCOMING_MESSAGES 250 #define MAX_INCOMING_MESSAGES 250
// Size of command send buffer // Size of command send buffer
#define MAX_CMD_BUFFER 4000 #define MAX_CMD_BUFFER 0x10000
CGlobalVarsBase g_ClientGlobalVariables( true ); CGlobalVarsBase g_ClientGlobalVariables( true );
IVideoRecorder *g_pVideoRecorder = NULL; IVideoRecorder *g_pVideoRecorder = NULL;

View file

@ -1391,7 +1391,7 @@ bool COM_BufferToBufferCompress_ZSTD(void* dest,
Assert( destLen ); Assert( destLen );
Assert( source ); Assert( source );
//#define ZSTD_GENERATE_TRAINING_SET #define ZSTD_GENERATE_TRAINING_SET
#ifdef ZSTD_GENERATE_TRAINING_SET #ifdef ZSTD_GENERATE_TRAINING_SET
static int zstdTrainingSetCount = 0; static int zstdTrainingSetCount = 0;

View file

@ -10,7 +10,8 @@
#include "bitbuf.h" #include "bitbuf.h"
#include "checksum_md5.h" #include "checksum_md5.h"
#include "const.h" #include "const.h"
#include "platform.h" #include "utlvector.h"
#include "shareddefs.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
@ -176,56 +177,54 @@ void WriteUsercmd( bf_write *buf, const CUserCmd *to, const CUserCmd *from )
else else
{ {
buf->WriteOneBit( 0 ); buf->WriteOneBit( 0 );
} }
int entityCount = 0;
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
int highestEntityIndex = 0;
if (cl_entitylist) if (cl_entitylist)
entityCount = cl_entitylist->GetHighestEntityIndex(); highestEntityIndex = cl_entitylist->GetHighestEntityIndex();
#else #else
entityCount = MAX_EDICTS; static constexpr auto highestEntityIndex = MAX_EDICTS-1;
#endif #endif
buf->WriteSignedVarInt32(entityCount); // Write entity count
buf->WriteUBitLong(highestEntityIndex, 11);
if (entityCount > 0) // Write finally simulation data with entity index
for (unsigned int i = 0; i <= highestEntityIndex; i++)
{ {
for (int i = 0; i <= entityCount; i++) if (from->simulationdata[i].m_flInterpolatedSimulationTime
!= to->simulationdata[i].m_flInterpolatedSimulationTime)
{ {
if (to->simulationdata[i].m_flInterpolatedSimulationTime buf->WriteOneBit(1);
!= from->simulationdata[i].m_flInterpolatedSimulationTime) buf->WriteBitFloat(to->simulationdata[i].m_flInterpolatedSimulationTime);
{ }
buf->WriteOneBit(1); else
buf->WriteFloat( {
to->simulationdata[i].m_flInterpolatedSimulationTime); buf->WriteOneBit(0);
} }
else
{
buf->WriteOneBit(0);
}
if (to->simulationdata[i].m_flSimulationTime if (from->simulationdata[i].m_flSimulationTime != to->simulationdata[i].m_flSimulationTime)
!= from->simulationdata[i].m_flSimulationTime) {
{ buf->WriteOneBit(1);
buf->WriteOneBit(1); buf->WriteBitFloat(to->simulationdata[i].m_flSimulationTime);
buf->WriteFloat(to->simulationdata[i].m_flSimulationTime); }
} else
else {
{ buf->WriteOneBit(0);
buf->WriteOneBit(0);
}
} }
} }
if ( to->debug_hitboxes != from->debug_hitboxes ) if (to->debug_hitboxes != from->debug_hitboxes)
{ {
buf->WriteOneBit( 1 ); buf->WriteOneBit(1);
buf->WriteByte( to->debug_hitboxes ); buf->WriteUBitLong(to->debug_hitboxes, 2);
} }
else else
{ {
buf->WriteOneBit( 0 ); buf->WriteOneBit(0);
} }
#if defined( HL2_CLIENT_DLL ) #if defined( HL2_CLIENT_DLL )
if ( to->entitygroundcontact.Count() != 0 ) if ( to->entitygroundcontact.Count() != 0 )
@ -346,29 +345,24 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from )
move->mousedy = buf->ReadShort(); move->mousedy = buf->ReadShort();
} }
const auto entityCount = buf->ReadSignedVarInt32(); const auto highestEntityIndex = buf->ReadUBitLong(11);
if (entityCount > 0) for (unsigned int i = 0; i <= highestEntityIndex;i++)
{ {
for (int i = 0; i <= entityCount; i++) if (buf->ReadOneBit())
{ {
if (buf->ReadOneBit()) move->simulationdata[i].m_flInterpolatedSimulationTime = buf->ReadBitFloat();
{ }
move->simulationdata[i].m_flInterpolatedSimulationTime = buf
->ReadFloat();
}
if (buf->ReadOneBit()) if (buf->ReadOneBit())
{ {
move->simulationdata[i].m_flSimulationTime = buf move->simulationdata[i].m_flSimulationTime = buf->ReadBitFloat();
->ReadFloat(); }
} }
}
}
if ( buf->ReadOneBit() ) if ( buf->ReadOneBit() )
{ {
move->debug_hitboxes = (CUserCmd::debug_hitboxes_t)buf->ReadByte(); move->debug_hitboxes = (CUserCmd::debug_hitboxes_t)buf->ReadUBitLong(2);
} }
#if defined( HL2_DLL ) #if defined( HL2_DLL )