2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

HLTV: Increased rates threshold for recording demofile, rate 100k and updaterate up to 100

This commit is contained in:
s1lent 2019-08-11 03:26:52 +07:00
parent 361185ffbc
commit 7c5dc890df
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
8 changed files with 62 additions and 12 deletions

View File

@ -90,6 +90,24 @@ void DemoClient::Reconnect()
FinishDemo(); FinishDemo();
} }
void DemoClient::SetUpdateRate(int updaterate)
{
m_DemoChannel.SetUpdateRate(
clamp(updaterate,
MIN_PROXY_UPDATERATE,
MAX_PROXY_UPDATERATE)
);
}
void DemoClient::SetRate(int rate)
{
m_DemoChannel.SetRate(
clamp(rate,
MIN_PROXY_RATE,
MAX_PROXY_RATE)
);
}
bool DemoClient::Connect(INetSocket *socket, NetAddress *adr, char *userinfo) bool DemoClient::Connect(INetSocket *socket, NetAddress *adr, char *userinfo)
{ {
if (IsActive()) if (IsActive())

View File

@ -60,6 +60,8 @@ public:
void FinishDemo(); void FinishDemo();
void SendDatagram(); void SendDatagram();
void WriteDatagram(double time, frame_t *frame); void WriteDatagram(double time, frame_t *frame);
void SetUpdateRate(int updaterate);
void SetRate(int rate);
protected: protected:
IProxy *m_Proxy; IProxy *m_Proxy;

View File

@ -904,7 +904,7 @@ bool Proxy::SetMaxClients(int number)
void Proxy::SetMaxLoss(float maxloss) void Proxy::SetMaxLoss(float maxloss)
{ {
m_MaxLoss = Q_clamp(maxloss, 0.0f, 1.0f); m_MaxLoss = clamp(maxloss, 0.0f, 1.0f);
} }
int Proxy::GetMaxClients() int Proxy::GetMaxClients()
@ -1162,8 +1162,15 @@ void Proxy::CMD_Record(char *cmdLine)
return; return;
} }
if (m_DemoClient.Connect()) { if (m_DemoClient.Connect())
{
m_DemoClient.SetFileName(params.GetToken(1)); m_DemoClient.SetFileName(params.GetToken(1));
#ifdef HLTV_FIXES
// Increased rate for recording demofile
m_DemoClient.SetUpdateRate(m_MaxUpdateRate);
m_DemoClient.SetRate(m_MaxRate);
#endif
} }
} }
@ -1680,7 +1687,7 @@ void Proxy::CMD_ChatMode(char *cmdLine)
return; return;
} }
m_ChatMode = Q_clamp((ChatMode_e)Q_atoi(params.GetToken(1)), CHAT_OFF, CHAT_GLOBAL); m_ChatMode = clamp((ChatMode_e)Q_atoi(params.GetToken(1)), CHAT_OFF, CHAT_GLOBAL);
} }
void Proxy::CMD_MaxQueries(char *cmdLine) void Proxy::CMD_MaxQueries(char *cmdLine)
@ -1946,7 +1953,7 @@ void Proxy::CMD_DispatchMode(char *cmdLine)
return; return;
} }
m_DispatchMode = Q_clamp((DispatchMode_e)Q_atoi(params.GetToken(1)), DISPATCH_OFF, DISPATCH_ALL); m_DispatchMode = clamp((DispatchMode_e)Q_atoi(params.GetToken(1)), DISPATCH_OFF, DISPATCH_ALL);
} }
bool Proxy::IsValidPassword(int type, char *pw) bool Proxy::IsValidPassword(int type, char *pw)
@ -2454,14 +2461,12 @@ void Proxy::CreateServerInfoString(InfoString *info)
void Proxy::SetMaxRate(int rate) void Proxy::SetMaxRate(int rate)
{ {
// maxrate: 1.000 - 20.000 m_MaxRate = clamp(rate, MIN_PROXY_RATE, MAX_PROXY_RATE);
m_MaxRate = Q_clamp(rate, 1000, MAX_PROXY_RATE);
} }
void Proxy::SetMaxUpdateRate(int updaterate) void Proxy::SetMaxUpdateRate(int updaterate)
{ {
// maxupdaterate: 1.0 - 40.0 m_MaxUpdateRate = clamp(updaterate, MIN_PROXY_UPDATERATE, MAX_PROXY_UPDATERATE);
m_MaxUpdateRate = Q_clamp(updaterate, 1, MAX_PROXY_UPDATERATE);
} }
void Proxy::SetDelay(float seconds) void Proxy::SetDelay(float seconds)
@ -2495,7 +2500,7 @@ void Proxy::SetClientTime(double time, bool relative)
void Proxy::SetClientTimeScale(float scale) void Proxy::SetClientTimeScale(float scale)
{ {
BitBuffer buf(32); BitBuffer buf(32);
m_ClientTimeScale = Q_clamp(scale, 0.5f, 4.0f); m_ClientTimeScale = clamp(scale, 0.5f, 4.0f);
buf.WriteByte(svc_timescale); buf.WriteByte(svc_timescale);
buf.WriteFloat(m_ClientTimeScale); buf.WriteFloat(m_ClientTimeScale);

View File

@ -45,8 +45,17 @@ class IDirector;
class IBaseSystem; class IBaseSystem;
#define MAX_NAME 32 #define MAX_NAME 32
#define MAX_PROXY_RATE 20000
#define MAX_PROXY_UPDATERATE 40 #ifdef HLTV_FIXES
const int MAX_PROXY_RATE = 100000;
const int MAX_PROXY_UPDATERATE = 100;
#else
const int MAX_PROXY_RATE = 20000;
const int MAX_PROXY_UPDATERATE = 40;
#endif
const int MIN_PROXY_RATE = 1000;
const int MIN_PROXY_UPDATERATE = 1;
#define PROXY_CHALLENGE_LIFE 40.0f #define PROXY_CHALLENGE_LIFE 40.0f
#define PROXY_PRIVATE 0x8000 #define PROXY_PRIVATE 0x8000

View File

@ -49,6 +49,8 @@ public:
void DownloadFile(char *fileName); void DownloadFile(char *fileName);
void SendDatagram(); void SendDatagram();
void ParseHLTV(NetPacket *packet); void ParseHLTV(NetPacket *packet);
void SetUpdateRate(int updaterate) {}
void SetRate(int rate) {}
private: private:
enum LocalCommandIDs { enum LocalCommandIDs {

View File

@ -1201,7 +1201,7 @@ void NetChannel::SetConnected(bool flag)
void NetChannel::SetRate(int newRate) void NetChannel::SetRate(int newRate)
{ {
m_max_bandwidth_rate = Q_clamp(newRate, 1000, 20000); m_max_bandwidth_rate = Q_clamp(newRate, MIN_NETCHAN_RATE, MAX_NETCHAN_RATE);
} }
void NetChannel::GetFlowStats(float *avgInKBSec, float *avgOutKBSec) void NetChannel::GetFlowStats(float *avgInKBSec, float *avgOutKBSec)

View File

@ -51,6 +51,15 @@ enum
MAX_FLOWS MAX_FLOWS
}; };
// Flow control bytes per second limits
#ifdef HLTV_FIXES
const int MAX_NETCHAN_RATE = 100000.0f;
#else
const int MAX_NETCHAN_RATE = 20000.0f;
#endif
const int MIN_NETCHAN_RATE = 1000.0f;
#define MAX_LATENT 32 #define MAX_LATENT 32
#define FRAGMENT_MAX_SIZE 1400 // Size of fragmentation buffer internal buffers #define FRAGMENT_MAX_SIZE 1400 // Size of fragmentation buffer internal buffers
#define CLIENT_FRAGMENT_SIZE_ONCONNECT 128 #define CLIENT_FRAGMENT_SIZE_ONCONNECT 128

View File

@ -46,6 +46,11 @@ public:
virtual bool IsActive() = 0; virtual bool IsActive() = 0;
virtual bool IsHearingVoices() = 0; virtual bool IsHearingVoices() = 0;
virtual bool HasChatEnabled() = 0; virtual bool HasChatEnabled() = 0;
#ifdef HLTV_FIXES
virtual void SetUpdateRate(int updaterate) = 0;
virtual void SetRate(int rate) = 0;
#endif // HLTV_FIXES
}; };
#define CLIENT_INTERFACE_VERSION "client001" #define CLIENT_INTERFACE_VERSION "client001"