mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-29 08:05:50 +03:00
Merge pull request #457 from s1lentq/hltv-patch1
HLTV: Fix crash and small refactoring.
This commit is contained in:
commit
f2b080ebba
@ -644,12 +644,6 @@ void System::Sleep(int msec)
|
|||||||
bool System::InitFileSystem()
|
bool System::InitFileSystem()
|
||||||
{
|
{
|
||||||
char *filesystemmodule = STDIO_FILESYSTEM_LIB;
|
char *filesystemmodule = STDIO_FILESYSTEM_LIB;
|
||||||
#ifdef _WIN32
|
|
||||||
if (CheckParam("-steam")) {
|
|
||||||
filesystemmodule = STEAM_FILESYSTEM_LIB;
|
|
||||||
}
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
m_FileSystemModule = Sys_LoadModule(filesystemmodule);
|
m_FileSystemModule = Sys_LoadModule(filesystemmodule);
|
||||||
if (!m_FileSystemModule)
|
if (!m_FileSystemModule)
|
||||||
{
|
{
|
||||||
|
@ -1508,7 +1508,7 @@ void Server::ParseDeltaPacketEntities()
|
|||||||
{
|
{
|
||||||
int entnum = m_Instream->ReadShort();
|
int entnum = m_Instream->ReadShort();
|
||||||
if (entnum > MAX_PACKET_ENTITIES) {
|
if (entnum > MAX_PACKET_ENTITIES) {
|
||||||
m_System->Errorf("Server::ParsePacketEntities: entnum > MAX_PACKET_ENTITIES.\n");
|
m_System->Errorf("Server::ParseDeltaPacketEntities: entnum > MAX_PACKET_ENTITIES.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Frame.delta = 0;
|
m_Frame.delta = 0;
|
||||||
|
@ -234,7 +234,7 @@ protected:
|
|||||||
char m_CDKey[32];
|
char m_CDKey[32];
|
||||||
int m_AuthProtocol;
|
int m_AuthProtocol;
|
||||||
frame_t m_Frame;
|
frame_t m_Frame;
|
||||||
unsigned char m_EntityBuffer[87040];
|
unsigned char m_EntityBuffer[MAX_PACKET_ENTITIES * sizeof(entity_state_t)];
|
||||||
int m_Rate;
|
int m_Rate;
|
||||||
int m_UpdateRate;
|
int m_UpdateRate;
|
||||||
float m_Time;
|
float m_Time;
|
||||||
|
@ -1060,65 +1060,65 @@ void World::ParseClientData(BitBuffer *stream, unsigned int deltaSeqNr, BitBuffe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::ParseDeltaHeader(BitBuffer *stream, bool *remove, bool *custom, int *numbase, bool *newbl, int *newblindex, bool full, int *offset)
|
int World::ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &numbase, bool &newbl, int &newblindex, bool full, int &offset)
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
|
bool isdelta, isnext;
|
||||||
|
|
||||||
*custom = false;
|
offset = 0;
|
||||||
*newbl = false;
|
custom = false;
|
||||||
|
newbl = false;
|
||||||
|
|
||||||
if (full)
|
if (full)
|
||||||
{
|
{
|
||||||
*remove = false;
|
isdelta = stream->ReadBit() ? true : false;
|
||||||
|
remove = false;
|
||||||
if (stream->ReadBit() != 0)
|
|
||||||
{
|
|
||||||
num = *numbase + 1;
|
|
||||||
}
|
|
||||||
else if (stream->ReadBit() == 0)
|
|
||||||
{
|
|
||||||
num = stream->ReadBits(6) + *numbase;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
num = stream->ReadBits(11);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*remove = stream->ReadBit() != 0;
|
isdelta = false;
|
||||||
|
remove = stream->ReadBit() ? true : false;
|
||||||
if (stream->ReadBit() == 0)
|
|
||||||
num = stream->ReadBits(6) + *numbase;
|
|
||||||
else
|
|
||||||
num = stream->ReadBits(11);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*numbase = num;
|
if (isdelta)
|
||||||
|
|
||||||
if (!*remove)
|
|
||||||
{
|
{
|
||||||
*custom = stream->ReadBit() != 0;
|
num = numbase + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stream->ReadBit())
|
||||||
|
{
|
||||||
|
num = stream->ReadBits(11);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int delta = stream->ReadBits(6);
|
||||||
|
num = delta + numbase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
numbase = num;
|
||||||
|
|
||||||
|
if (!remove)
|
||||||
|
{
|
||||||
|
custom = stream->ReadBit() ? true : false;
|
||||||
|
|
||||||
if (m_MaxInstanced_BaseLine)
|
if (m_MaxInstanced_BaseLine)
|
||||||
{
|
{
|
||||||
*newbl = stream->ReadBit() != 0;
|
isnext = stream->ReadBit() ? true : false;
|
||||||
if (*newbl)
|
if (isnext)
|
||||||
*newblindex = stream->ReadBits(6);
|
{
|
||||||
}
|
newbl = true;
|
||||||
else
|
newblindex = stream->ReadBits(6);
|
||||||
{
|
}
|
||||||
*newbl = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!full || *newbl)
|
if (full && !newbl)
|
||||||
{
|
{
|
||||||
*offset = 0;
|
isnext = stream->ReadBit() ? true : false;
|
||||||
}
|
if (isnext)
|
||||||
else
|
{
|
||||||
{
|
offset = stream->ReadBits(6);
|
||||||
*offset = stream->ReadBit();
|
|
||||||
if (*offset) {
|
|
||||||
*offset = stream->ReadBits(6);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1498,7 +1498,7 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsi
|
|||||||
|
|
||||||
while (stream->PeekBits(16))
|
while (stream->PeekBits(16))
|
||||||
{
|
{
|
||||||
newnum = ParseDeltaHeader(stream, &remove, &custom, &numbase, &newbl, &newblindex, false, &offset);
|
newnum = ParseDeltaHeader(stream, remove, custom, numbase, newbl, newblindex, false, offset);
|
||||||
|
|
||||||
if ((unsigned)oldindex < deltaFrame.entitynum)
|
if ((unsigned)oldindex < deltaFrame.entitynum)
|
||||||
oldnum = deltaEntity[oldindex].number;
|
oldnum = deltaEntity[oldindex].number;
|
||||||
@ -1634,7 +1634,7 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = ParseDeltaHeader(stream, &remove, &custom, &numbase, &newbl, &newblindex, true, &offset);
|
num = ParseDeltaHeader(stream, remove, custom, numbase, newbl, newblindex, true, offset);
|
||||||
if (num >= MAX_ENTITIES)
|
if (num >= MAX_ENTITIES)
|
||||||
{
|
{
|
||||||
m_System->Errorf("World::GetUncompressedFrame: entity number %i >= MAX_ENTITIES\n", num);
|
m_System->Errorf("World::GetUncompressedFrame: entity number %i >= MAX_ENTITIES\n", num);
|
||||||
@ -1662,7 +1662,7 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream)
|
|||||||
baseline = &m_BaseLines[num];
|
baseline = &m_BaseLines[num];
|
||||||
}
|
}
|
||||||
|
|
||||||
entities[num].entityType = custom ? ENTITY_BEAM : ENTITY_NORMAL;
|
entities[newindex].entityType = custom ? ENTITY_BEAM : ENTITY_NORMAL;
|
||||||
|
|
||||||
delta_t *delta = GetDeltaEncoder(num, custom);
|
delta_t *delta = GetDeltaEncoder(num, custom);
|
||||||
m_Delta.ParseDelta(stream, (byte *)baseline, (byte *)&entities[newindex], delta);
|
m_Delta.ParseDelta(stream, (byte *)baseline, (byte *)&entities[newindex], delta);
|
||||||
|
@ -139,7 +139,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int CompressFrame(frame_t *from, BitBuffer *stream);
|
int CompressFrame(frame_t *from, BitBuffer *stream);
|
||||||
int ParseDeltaHeader(BitBuffer *stream, bool *remove, bool *custom, int *numbase, bool *newbl, int *newblindex, bool full, int *offset);
|
int ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &numbase, bool &newbl, int &newblindex, bool full, int &offset);
|
||||||
void SetDirector(IDirector *director);
|
void SetDirector(IDirector *director);
|
||||||
void SetTimeScale(float scale);
|
void SetTimeScale(float scale);
|
||||||
void SetGameGroupAddress(NetAddress *addr);
|
void SetGameGroupAddress(NetAddress *addr);
|
||||||
@ -244,7 +244,7 @@ protected:
|
|||||||
} player_info_t;
|
} player_info_t;
|
||||||
|
|
||||||
player_info_t m_Players[MAX_CLIENTS];
|
player_info_t m_Players[MAX_CLIENTS];
|
||||||
unsigned char m_EntityBuffer[87040];
|
unsigned char m_EntityBuffer[MAX_PACKET_ENTITIES * sizeof(entity_state_t)];
|
||||||
|
|
||||||
entity_state_t m_BaseLines[MAX_ENTITIES];
|
entity_state_t m_BaseLines[MAX_ENTITIES];
|
||||||
int m_MaxBaseLines;
|
int m_MaxBaseLines;
|
||||||
|
@ -316,7 +316,6 @@ Some parameters can only be set in the command line:
|
|||||||
-maxfps <n> - sets maximum system cycles per seconds (default "100")
|
-maxfps <n> - sets maximum system cycles per seconds (default "100")
|
||||||
-highpriority - starts the HLTV proxy as high priority process
|
-highpriority - starts the HLTV proxy as high priority process
|
||||||
-multicastttl <n> - sets the Time-To-Live value for multicast packets
|
-multicastttl <n> - sets the Time-To-Live value for multicast packets
|
||||||
-steam - proxy enables special Steam support
|
|
||||||
-dev - developer mode
|
-dev - developer mode
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user