mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 13:50:53 +00:00
Fixed some NQ protocol related endian problems.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1176 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
fdec86754c
commit
3113fcad9e
4 changed files with 11 additions and 8 deletions
|
@ -579,7 +579,7 @@ void CL_CheckForResend (void)
|
||||||
|
|
||||||
Con_TPrintf (TLC_CONNECTINGTO, cls.servername);
|
Con_TPrintf (TLC_CONNECTINGTO, cls.servername);
|
||||||
|
|
||||||
MSG_WriteLong(&sb, BigLong(NETFLAG_CTL | (strlen(NET_GAMENAME_NQ)+7)));
|
MSG_WriteLong(&sb, LongSwap(NETFLAG_CTL | (strlen(NET_GAMENAME_NQ)+7)));
|
||||||
MSG_WriteByte(&sb, CCREQ_CONNECT);
|
MSG_WriteByte(&sb, CCREQ_CONNECT);
|
||||||
MSG_WriteString(&sb, NET_GAMENAME_NQ);
|
MSG_WriteString(&sb, NET_GAMENAME_NQ);
|
||||||
MSG_WriteByte(&sb, NET_PROTOCOL_VERSION);
|
MSG_WriteByte(&sb, NET_PROTOCOL_VERSION);
|
||||||
|
@ -1970,7 +1970,7 @@ void CLNQ_ConnectionlessPacket(void)
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
MSG_BeginReading ();
|
MSG_BeginReading ();
|
||||||
length = BigLong(MSG_ReadLong ());
|
length = LongSwap(MSG_ReadLong ());
|
||||||
if (!(length & NETFLAG_CTL))
|
if (!(length & NETFLAG_CTL))
|
||||||
return; //not an nq control packet.
|
return; //not an nq control packet.
|
||||||
length &= NETFLAG_LENGTH_MASK;
|
length &= NETFLAG_LENGTH_MASK;
|
||||||
|
|
|
@ -109,6 +109,9 @@ extern int (*LittleLong) (int l);
|
||||||
extern float (*BigFloat) (float l);
|
extern float (*BigFloat) (float l);
|
||||||
extern float (*LittleFloat) (float l);
|
extern float (*LittleFloat) (float l);
|
||||||
|
|
||||||
|
short ShortSwap (short l);
|
||||||
|
int LongSwap (int l);
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
struct usercmd_s;
|
struct usercmd_s;
|
||||||
|
|
|
@ -238,14 +238,14 @@ qboolean NQNetChan_Process(netchan_t *chan)
|
||||||
|
|
||||||
MSG_BeginReading ();
|
MSG_BeginReading ();
|
||||||
|
|
||||||
header = BigLong(MSG_ReadLong());
|
header = LongSwap(MSG_ReadLong());
|
||||||
if (net_message.cursize != (header & NETFLAG_LENGTH_MASK))
|
if (net_message.cursize != (header & NETFLAG_LENGTH_MASK))
|
||||||
return false; //size was wrong, couldn't have been ours.
|
return false; //size was wrong, couldn't have been ours.
|
||||||
|
|
||||||
if (header & NETFLAG_CTL)
|
if (header & NETFLAG_CTL)
|
||||||
return false; //huh?
|
return false; //huh?
|
||||||
|
|
||||||
sequence = BigLong(MSG_ReadLong());
|
sequence = LongSwap(MSG_ReadLong());
|
||||||
|
|
||||||
if (header & NETFLAG_ACK)
|
if (header & NETFLAG_ACK)
|
||||||
{
|
{
|
||||||
|
@ -364,7 +364,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
|
||||||
if (i>0)
|
if (i>0)
|
||||||
{
|
{
|
||||||
MSG_WriteLong(&send, 0);
|
MSG_WriteLong(&send, 0);
|
||||||
MSG_WriteLong(&send, BigLong(chan->reliable_sequence));
|
MSG_WriteLong(&send, LongSwap(chan->reliable_sequence));
|
||||||
if (i > MAX_NQDATAGRAM)
|
if (i > MAX_NQDATAGRAM)
|
||||||
i = MAX_NQDATAGRAM;
|
i = MAX_NQDATAGRAM;
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
MSG_WriteLong(&send, 0);
|
MSG_WriteLong(&send, 0);
|
||||||
MSG_WriteLong(&send, BigLong(chan->outgoing_unreliable));
|
MSG_WriteLong(&send, LongSwap(chan->outgoing_unreliable));
|
||||||
chan->outgoing_unreliable++;
|
chan->outgoing_unreliable++;
|
||||||
|
|
||||||
SZ_Write (&send, data, length);
|
SZ_Write (&send, data, length);
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ void SV_AcceptMessage(int protocol)
|
||||||
SZ_Clear(&sb);
|
SZ_Clear(&sb);
|
||||||
MSG_WriteLong(&sb, 0);
|
MSG_WriteLong(&sb, 0);
|
||||||
MSG_WriteByte(&sb, CCREP_ACCEPT);
|
MSG_WriteByte(&sb, CCREP_ACCEPT);
|
||||||
MSG_WriteLong(&sb, BigShort(net_local_sv_ipadr.port));
|
MSG_WriteLong(&sb, ShortSwap(net_local_sv_ipadr.port));
|
||||||
*(int*)sb.data = BigLong(NETFLAG_CTL|sb.cursize);
|
*(int*)sb.data = BigLong(NETFLAG_CTL|sb.cursize);
|
||||||
NET_SendPacket(NS_SERVER, sb.cursize, sb.data, net_from);
|
NET_SendPacket(NS_SERVER, sb.cursize, sb.data, net_from);
|
||||||
return;
|
return;
|
||||||
|
@ -2081,7 +2081,7 @@ void SVNQ_ConnectionlessPacket(void)
|
||||||
return; //no, start using dp7 instead.
|
return; //no, start using dp7 instead.
|
||||||
|
|
||||||
MSG_BeginReading();
|
MSG_BeginReading();
|
||||||
header = BigLong(MSG_ReadLong());
|
header = LongSwap(MSG_ReadLong());
|
||||||
if (!(header & NETFLAG_CTL))
|
if (!(header & NETFLAG_CTL))
|
||||||
return; //no idea what it is.
|
return; //no idea what it is.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue