mirror of
https://github.com/rehlds/rehlds.git
synced 2025-03-31 22:59:06 +03:00
Experimental fixes for incomplete record/broadcast when delay set.
This commit is contained in:
parent
2f2be916c2
commit
a07e88b147
@ -1727,6 +1727,12 @@ char *Server::GetType()
|
|||||||
{
|
{
|
||||||
return SERVER_INTERFACE_VERSION;
|
return SERVER_INTERFACE_VERSION;
|
||||||
}
|
}
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
void Server::SetWorld(IWorld* world)
|
||||||
|
{
|
||||||
|
m_World = world;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
IWorld *Server::GetWorld()
|
IWorld *Server::GetWorld()
|
||||||
{
|
{
|
||||||
|
@ -123,6 +123,9 @@ public:
|
|||||||
EXT_FUNC char *GetHostName();
|
EXT_FUNC char *GetHostName();
|
||||||
EXT_FUNC float GetPacketLoss();
|
EXT_FUNC float GetPacketLoss();
|
||||||
EXT_FUNC int GetProtocol();
|
EXT_FUNC int GetProtocol();
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
EXT_FUNC void SetWorld(IWorld* world);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
|
@ -86,7 +86,28 @@ Proxy::LocalCommandID_s Proxy::m_LocalCmdReg[] = {
|
|||||||
#ifndef HOOK_HLTV
|
#ifndef HOOK_HLTV
|
||||||
EXPOSE_SINGLE_INTERFACE(Proxy, IProxy, PROXY_INTERFACE_VERSION);
|
EXPOSE_SINGLE_INTERFACE(Proxy, IProxy, PROXY_INTERFACE_VERSION);
|
||||||
#endif // HOOK_HLTV
|
#endif // HOOK_HLTV
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
void Proxy::AddNextWorld()
|
||||||
|
{
|
||||||
|
static int num_alloc = 0;
|
||||||
|
static char instance[64];
|
||||||
|
snprintf(instance, sizeof(instance), "AddNextWorld_%d", num_alloc++);
|
||||||
|
IWorld* nextWorld = (IWorld*)m_System->GetModule(WORLD_INTERFACE_VERSION, "core", instance);
|
||||||
|
if (!nextWorld)
|
||||||
|
{
|
||||||
|
m_System->Errorf("Proxy::AddNextWorld: couldn't load world module.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nextWorld->RegisterListener(this);
|
||||||
|
|
||||||
|
m_Worlds.AddTail(nextWorld);
|
||||||
|
m_Server->SetWorld(nextWorld);
|
||||||
|
if (m_Server->IsConnected()) {
|
||||||
|
m_Server->Reconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
bool Proxy::Init(IBaseSystem *system, int serial, char *name)
|
bool Proxy::Init(IBaseSystem *system, int serial, char *name)
|
||||||
{
|
{
|
||||||
BaseSystemModule::Init(system, serial, name);
|
BaseSystemModule::Init(system, serial, name);
|
||||||
@ -315,9 +336,42 @@ void Proxy::RunFrame(double time)
|
|||||||
RunClocks();
|
RunClocks();
|
||||||
if (m_IsFinishingBroadcast && m_ClientWorldTime > m_World->GetTime() && !m_IsReconnectRequested)
|
if (m_IsFinishingBroadcast && m_ClientWorldTime > m_World->GetTime() && !m_IsReconnectRequested)
|
||||||
{
|
{
|
||||||
if (m_Server->IsConnected()) {
|
#ifdef HLTV_FIXES
|
||||||
m_Server->Reconnect();
|
IWorld* head = (IWorld*)m_Worlds.GetFirst();
|
||||||
|
|
||||||
|
// If we just finished playback previous world record
|
||||||
|
if(head)
|
||||||
|
{
|
||||||
|
// We can't RemoveModule m_World right now because it will fire events to unload us.
|
||||||
|
// Store it in temp var to unload it after set new world
|
||||||
|
IWorld* oldWorld = m_World;
|
||||||
|
m_World = head;
|
||||||
|
if (m_DemoClient.IsActive())
|
||||||
|
{
|
||||||
|
m_DemoClient.Disconnect("End of Record");
|
||||||
|
m_DemoClient.SetProxy(this);
|
||||||
|
m_DemoClient.SetWorld(m_World);
|
||||||
|
if (m_DemoClient.Connect())
|
||||||
|
{
|
||||||
|
m_DemoClient.SetUpdateRate(m_MaxUpdateRate);
|
||||||
|
m_DemoClient.SetRate(m_MaxRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_Worlds.RemoveHead();
|
||||||
|
NewGameStarted();
|
||||||
|
ReconnectClients();
|
||||||
|
m_System->RemoveModule((ISystemModule*)oldWorld);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
if (m_Server->IsConnected()) {
|
||||||
|
m_Server->Reconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
}
|
||||||
|
#endif
|
||||||
m_IsReconnectRequested = true;
|
m_IsReconnectRequested = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1423,8 +1477,17 @@ void Proxy::ReceiveSignal(ISystemModule *module, unsigned int signal, void *data
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
|
{
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
if (!m_IsFinishingBroadcast && m_ClientDelay > 0.0)
|
||||||
|
{
|
||||||
|
//If we finished broadcast we need to get frames from next "World" (Next server map)
|
||||||
|
AddNextWorld();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
m_IsFinishingBroadcast = true;
|
m_IsFinishingBroadcast = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 7:
|
case 7:
|
||||||
BroadcastRetryMessage();
|
BroadcastRetryMessage();
|
||||||
break;
|
break;
|
||||||
@ -1441,15 +1504,26 @@ void Proxy::ReceiveSignal(ISystemModule *module, unsigned int signal, void *data
|
|||||||
switch (signal)
|
switch (signal)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
NewGameStarted();
|
|
||||||
ReconnectClients();
|
#ifdef HLTV_FIXES
|
||||||
|
if(m_ClientDelay <= 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
NewGameStarted();
|
||||||
|
ReconnectClients();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
BroadcastPaused(signal == 5 ? true : false);
|
BroadcastPaused(signal == 5 ? true : false);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
StopBroadcast("HLTV shutddown.");
|
#ifdef HLTV_FIXES
|
||||||
|
if (m_ClientDelay <= 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
StopBroadcast("HLTV shutdown.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1841,6 +1915,9 @@ void Proxy::ReconnectClients()
|
|||||||
IClient *client = (IClient *)m_Clients.GetFirst();
|
IClient *client = (IClient *)m_Clients.GetFirst();
|
||||||
while (client)
|
while (client)
|
||||||
{
|
{
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
client->SetWorld(m_World);
|
||||||
|
#endif
|
||||||
client->Reconnect();
|
client->Reconnect();
|
||||||
client = (IClient *)m_Clients.GetNext();
|
client = (IClient *)m_Clients.GetNext();
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,9 @@ private:
|
|||||||
void CMD_Protocol(char *cmdLine);
|
void CMD_Protocol(char *cmdLine);
|
||||||
void CMD_Region(char *cmdLine);
|
void CMD_Region(char *cmdLine);
|
||||||
void CMD_ChatDelay(char *cmdLine);
|
void CMD_ChatDelay(char *cmdLine);
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
void AddNextWorld();
|
||||||
|
#endif
|
||||||
struct LocalCommandID_s {
|
struct LocalCommandID_s {
|
||||||
char *name;
|
char *name;
|
||||||
LocalCommandIDs id;
|
LocalCommandIDs id;
|
||||||
@ -388,4 +390,7 @@ protected:
|
|||||||
BitBuffer m_InfoDetails;
|
BitBuffer m_InfoDetails;
|
||||||
BitBuffer m_InfoInfo;
|
BitBuffer m_InfoInfo;
|
||||||
BitBuffer m_InfoString;
|
BitBuffer m_InfoString;
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
ObjectList m_Worlds;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -96,6 +96,9 @@ public:
|
|||||||
virtual bool GetAutoRetry() = 0;
|
virtual bool GetAutoRetry() = 0;
|
||||||
virtual float GetPacketLoss() = 0;
|
virtual float GetPacketLoss() = 0;
|
||||||
virtual int GetProtocol() = 0;
|
virtual int GetProtocol() = 0;
|
||||||
|
#ifdef HLTV_FIXES
|
||||||
|
virtual void SetWorld(IWorld* world) = 0;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_INTERFACE_VERSION "server001"
|
#define SERVER_INTERFACE_VERSION "server001"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user