mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-04 02:55:50 +03:00
Extended server reliable and signon buffers
Extended client netchan message buffer
This commit is contained in:
parent
57bcc12469
commit
940cf0e2ec
@ -214,8 +214,18 @@ void Netchan_Setup(netsrc_t socketnumber, netchan_t *chan, netadr_t adr, int pla
|
|||||||
chan->connect_time = (float)realtime;
|
chan->connect_time = (float)realtime;
|
||||||
|
|
||||||
chan->message.buffername = "netchan->message";
|
chan->message.buffername = "netchan->message";
|
||||||
chan->message.data = chan->message_buf;
|
#ifdef REHLDS_FIXES
|
||||||
chan->message.maxsize = sizeof(chan->message_buf);
|
if (player_slot != -1)
|
||||||
|
{
|
||||||
|
chan->message.data = g_GameClients[player_slot]->GetExtendedMessageBuffer();
|
||||||
|
chan->message.maxsize = NET_MAX_PAYLOAD;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
chan->message.data = chan->message_buf;
|
||||||
|
chan->message.maxsize = sizeof(chan->message_buf);
|
||||||
|
}
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
chan->message.cursize = 0;
|
chan->message.cursize = 0;
|
||||||
#endif // REHLDS_FIXES
|
#endif // REHLDS_FIXES
|
||||||
@ -326,6 +336,14 @@ void Netchan_Transmit(netchan_t *chan, int length, byte *data)
|
|||||||
int send_from_frag[MAX_STREAMS] = { 0, 0 };
|
int send_from_frag[MAX_STREAMS] = { 0, 0 };
|
||||||
int send_from_regular = 0;
|
int send_from_regular = 0;
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
if (chan->message.cursize > MAX_MSGLEN)
|
||||||
|
{
|
||||||
|
Netchan_CreateFragments_(chan == &g_pcls.netchan ? 1 : 0, chan, &chan->message);
|
||||||
|
SZ_Clear(&chan->message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// If we have data in the waiting list(s) and we have cleared the current queue(s), then
|
// If we have data in the waiting list(s) and we have cleared the current queue(s), then
|
||||||
// push the waitlist(s) into the current queue(s)
|
// push the waitlist(s) into the current queue(s)
|
||||||
Netchan_FragSend(chan);
|
Netchan_FragSend(chan);
|
||||||
@ -380,7 +398,11 @@ void Netchan_Transmit(netchan_t *chan, int length, byte *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (send_from_regular) {
|
if (send_from_regular) {
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
Q_memcpy(chan->reliable_buf, chan->message.data, chan->message.cursize);
|
||||||
|
#else
|
||||||
Q_memcpy(chan->reliable_buf, chan->message_buf, chan->message.cursize);
|
Q_memcpy(chan->reliable_buf, chan->message_buf, chan->message.cursize);
|
||||||
|
#endif
|
||||||
chan->reliable_length = chan->message.cursize;
|
chan->reliable_length = chan->message.cursize;
|
||||||
SZ_Clear(&chan->message);
|
SZ_Clear(&chan->message);
|
||||||
|
|
||||||
|
@ -157,7 +157,6 @@ typedef struct server_s
|
|||||||
|
|
||||||
|
|
||||||
struct rehlds_server_t {
|
struct rehlds_server_t {
|
||||||
|
|
||||||
//map for sv.model_precache (for faster resolving of model index by its name)
|
//map for sv.model_precache (for faster resolving of model index by its name)
|
||||||
#if defined(REHLDS_FIXES)
|
#if defined(REHLDS_FIXES)
|
||||||
CStringKeyStaticMap<int, 7, HL_MODEL_MAX * 2> modelsMap; //case-sensitive keys for better performance
|
CStringKeyStaticMap<int, 7, HL_MODEL_MAX * 2> modelsMap; //case-sensitive keys for better performance
|
||||||
@ -165,6 +164,11 @@ struct rehlds_server_t {
|
|||||||
CICaseStringKeyStaticMap<int, 7, HL_MODEL_MAX * 2> modelsMap; //use case-insensitive keys to conform original engine's behavior
|
CICaseStringKeyStaticMap<int, 7, HL_MODEL_MAX * 2> modelsMap; //use case-insensitive keys to conform original engine's behavior
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
// Extended net buffers
|
||||||
|
uint8_t reliableDatagramBuffer[NET_MAX_PAYLOAD];
|
||||||
|
uint8_t signonData[NET_MAX_PAYLOAD];
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -5583,8 +5583,13 @@ int SV_SpawnServer(qboolean bIsDemo, char *server, char *startspot)
|
|||||||
g_psv.datagram.cursize = 0;
|
g_psv.datagram.cursize = 0;
|
||||||
|
|
||||||
g_psv.reliable_datagram.buffername = "Server Reliable Datagram";
|
g_psv.reliable_datagram.buffername = "Server Reliable Datagram";
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
g_psv.reliable_datagram.data = g_rehlds_sv.reliableDatagramBuffer;
|
||||||
|
g_psv.reliable_datagram.maxsize = sizeof(g_rehlds_sv.reliableDatagramBuffer);
|
||||||
|
#else
|
||||||
g_psv.reliable_datagram.data = g_psv.reliable_datagram_buf;
|
g_psv.reliable_datagram.data = g_psv.reliable_datagram_buf;
|
||||||
g_psv.reliable_datagram.maxsize = sizeof(g_psv.reliable_datagram_buf);
|
g_psv.reliable_datagram.maxsize = sizeof(g_psv.reliable_datagram_buf);
|
||||||
|
#endif
|
||||||
g_psv.reliable_datagram.cursize = 0;
|
g_psv.reliable_datagram.cursize = 0;
|
||||||
|
|
||||||
g_psv.spectator.buffername = "Server Spectator Buffer";
|
g_psv.spectator.buffername = "Server Spectator Buffer";
|
||||||
@ -5596,8 +5601,13 @@ int SV_SpawnServer(qboolean bIsDemo, char *server, char *startspot)
|
|||||||
g_psv.multicast.maxsize = sizeof(g_psv.multicast_buf);
|
g_psv.multicast.maxsize = sizeof(g_psv.multicast_buf);
|
||||||
|
|
||||||
g_psv.signon.buffername = "Server Signon Buffer";
|
g_psv.signon.buffername = "Server Signon Buffer";
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
g_psv.signon.data = g_rehlds_sv.signonData;
|
||||||
|
g_psv.signon.maxsize = sizeof(g_rehlds_sv.signonData);
|
||||||
|
#else
|
||||||
g_psv.signon.data = g_psv.signon_data;
|
g_psv.signon.data = g_psv.signon_data;
|
||||||
g_psv.signon.maxsize = sizeof(g_psv.signon_data);
|
g_psv.signon.maxsize = sizeof(g_psv.signon_data);
|
||||||
|
#endif
|
||||||
g_psv.signon.cursize = 0;
|
g_psv.signon.cursize = 0;
|
||||||
|
|
||||||
g_psv.num_edicts = g_psvs.maxclients + 1;
|
g_psv.num_edicts = g_psvs.maxclients + 1;
|
||||||
|
@ -35,6 +35,9 @@ class CNetChan : public INetChan
|
|||||||
private:
|
private:
|
||||||
netchan_t* m_pNetChan;
|
netchan_t* m_pNetChan;
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
uint8_t m_messageBuffer[NET_MAX_PAYLOAD];
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
CNetChan(netchan_t* chan);
|
CNetChan(netchan_t* chan);
|
||||||
|
|
||||||
@ -42,6 +45,11 @@ public:
|
|||||||
virtual sizebuf_t* GetMessageBuf();
|
virtual sizebuf_t* GetMessageBuf();
|
||||||
|
|
||||||
virtual netchan_t* GetChan();
|
virtual netchan_t* GetChan();
|
||||||
|
|
||||||
|
public:
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
uint8_t* GetExtendedMessageBuffer() { return m_messageBuffer; };
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -90,6 +98,9 @@ public:
|
|||||||
public:
|
public:
|
||||||
bool GetSpawnedOnce() const { return m_bSpawnedOnce; }
|
bool GetSpawnedOnce() const { return m_bSpawnedOnce; }
|
||||||
void SetSpawnedOnce(bool spawned) { m_bSpawnedOnce = spawned; }
|
void SetSpawnedOnce(bool spawned) { m_bSpawnedOnce = spawned; }
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
uint8_t* GetExtendedMessageBuffer() { return m_NetChan.GetExtendedMessageBuffer(); };
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class CRehldsServerStatic : public IRehldsServerStatic {
|
class CRehldsServerStatic : public IRehldsServerStatic {
|
||||||
|
Loading…
Reference in New Issue
Block a user