diff --git a/publish.gradle b/publish.gradle index 40763e0..7b6fbd3 100644 --- a/publish.gradle +++ b/publish.gradle @@ -49,7 +49,7 @@ task publishPrepareFiles << { copy { from 'rehlds/public' into 'publish/publishRoot/hlsdk/public' - include 'interface.h', 'interface.cpp' + include 'interface.h', 'interface.cpp', 'FileSystem.h' } copy { from 'rehlds/public/rehlds' diff --git a/rehlds/build.gradle b/rehlds/build.gradle index 87f998d..0e4cb2d 100644 --- a/rehlds/build.gradle +++ b/rehlds/build.gradle @@ -184,6 +184,7 @@ class RehldsSrc { include "**/*.cpp" exclude "precompiled.cpp" exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp" + exclude "interface.cpp", "rehlds/crc32.cpp", "rehlds/sys_shared.cpp" } source { diff --git a/rehlds/common/crc.h b/rehlds/common/crc.h index 913af67..69343aa 100644 --- a/rehlds/common/crc.h +++ b/rehlds/common/crc.h @@ -37,7 +37,7 @@ void CRC32_Init(CRC32_t *pulCRC); CRC32_t CRC32_Final(CRC32_t pulCRC); void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer); -NOXREF BOOL CRC_File(CRC32_t *crcvalue, char *pszFileName); +BOOL CRC_File(CRC32_t *crcvalue, char *pszFileName); #ifdef __cplusplus } diff --git a/rehlds/common/cvardef.h b/rehlds/common/cvardef.h index 23b442f..d1bf88b 100644 --- a/rehlds/common/cvardef.h +++ b/rehlds/common/cvardef.h @@ -29,7 +29,7 @@ typedef struct cvar_s { - char *name; + const char *name; char *string; int flags; float value; diff --git a/rehlds/common/mathlib.h b/rehlds/common/mathlib.h index 5e91d41..142c38c 100644 --- a/rehlds/common/mathlib.h +++ b/rehlds/common/mathlib.h @@ -20,7 +20,10 @@ typedef float vec_t; /* <42b91> ../common/mathlib.h:6 */ +#ifndef DID_VEC3_T_DEFINE +#define DID_VEC3_T_DEFINE typedef vec_t vec3_t[3]; +#endif /* <80013> ../common/mathlib.h:8 */ typedef vec_t vec4_t[4]; diff --git a/rehlds/dlls/extdll.h b/rehlds/dlls/extdll.h index 0129810..e264f87 100644 --- a/rehlds/dlls/extdll.h +++ b/rehlds/dlls/extdll.h @@ -80,6 +80,9 @@ typedef float vec_t; // needed before including progdefs.h // Vector class #include "vector.h" +// Defining it as a (bogus) struct helps enforce type-checking +#define vec3_t Vector + // Shared engine/DLL constants #include "const.h" #include "progdefs.h" diff --git a/rehlds/engine/APIProxy.h b/rehlds/engine/APIProxy.h index 4e42c05..0ac2dcb 100644 --- a/rehlds/engine/APIProxy.h +++ b/rehlds/engine/APIProxy.h @@ -289,7 +289,7 @@ typedef unsigned short (*pfnEngSrc_pfnPrecacheEvent_t ) ( int type, const ch typedef void (*pfnEngSrc_pfnPlaybackEvent_t ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); typedef void (*pfnEngSrc_pfnWeaponAnim_t ) ( int iAnim, int body ); typedef float (*pfnEngSrc_pfnRandomFloat_t ) ( float flLow, float flHigh ); -typedef int32_t (*pfnEngSrc_pfnRandomLong_t ) ( int32_t lLow, int32_t lHigh ); +typedef int32 (*pfnEngSrc_pfnRandomLong_t ) ( int32 lLow, int32 lHigh ); typedef void (*pfnEngSrc_pfnHookEvent_t ) ( char *name, void ( *pfnEvent )( struct event_args_s *args ) ); typedef int (*pfnEngSrc_Con_IsVisible_t) (); typedef const char * (*pfnEngSrc_pfnGetGameDirectory_t ) ( void ); @@ -565,7 +565,7 @@ typedef void(*pfnEngDst_pfnPrecacheEvent_t) (int *, const char* *); typedef void(*pfnEngDst_pfnPlaybackEvent_t) (int *, const struct edict_s **, unsigned short *, float *, float **, float **, float *, float *, int *, int *, int *, int *); typedef void(*pfnEngDst_pfnWeaponAnim_t) (int *, int *); typedef void(*pfnEngDst_pfnRandomFloat_t) (float *, float *); -typedef void(*pfnEngDst_pfnRandomLong_t) (int32_t *, int32_t *); +typedef void(*pfnEngDst_pfnRandomLong_t) (int32 *, int32 *); typedef void(*pfnEngDst_pfnHookEvent_t) (char **, void(**pfnEvent)(struct event_args_s *args)); typedef void(*pfnEngDst_Con_IsVisible_t) (); typedef void(*pfnEngDst_pfnGetGameDirectory_t) (void); diff --git a/rehlds/engine/cdll_int.h b/rehlds/engine/cdll_int.h index 914779c..ac37e79 100644 --- a/rehlds/engine/cdll_int.h +++ b/rehlds/engine/cdll_int.h @@ -82,7 +82,7 @@ typedef struct hud_player_info_s short topcolor; short bottomcolor; - uint64_t m_nSteamID; + uint64 m_nSteamID; } hud_player_info_t; diff --git a/rehlds/engine/client.h b/rehlds/engine/client.h index 8c01b2d..62a7aed 100644 --- a/rehlds/engine/client.h +++ b/rehlds/engine/client.h @@ -87,15 +87,15 @@ typedef struct frame_s clientdata_t clientdata; weapon_data_t weapondata[64]; packet_entities_t packet_entities; - uint16_t clientbytes; - uint16_t playerinfobytes; - uint16_t packetentitybytes; - uint16_t tentitybytes; - uint16_t soundbytes; - uint16_t eventbytes; - uint16_t usrbytes; - uint16_t voicebytes; - uint16_t msgbytes; + uint16 clientbytes; + uint16 playerinfobytes; + uint16 packetentitybytes; + uint16 tentitybytes; + uint16 soundbytes; + uint16 eventbytes; + uint16 usrbytes; + uint16 voicebytes; + uint16 msgbytes; } frame_t; /* <153e9> ../engine/client.h:127 */ @@ -117,7 +117,7 @@ typedef struct player_info_s vec3_t prevgaitorigin; customization_t customdata; char hashedcdkey[16]; - uint64_t m_nSteamID; + uint64 m_nSteamID; } player_info_t; /* <277f5> ../engine/client.h:208 */ @@ -183,7 +183,7 @@ typedef struct client_static_s qboolean director; qboolean fSecureClient; qboolean isVAC2Secure; - uint64_t GameServerSteamID; + uint64 GameServerSteamID; int build_num; } client_static_t; diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index 20f5f2b..7f2d956 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -864,7 +864,7 @@ void Cmd_RemoveWrapperCmds(void) } /* <5af2> ../engine/cmd.c:1035 */ -qboolean Cmd_Exists(char *cmd_name) +qboolean Cmd_Exists(const char *cmd_name) { cmd_function_t *cmd = cmd_functions; diff --git a/rehlds/engine/cmd.h b/rehlds/engine/cmd.h index f60800c..6fd947c 100644 --- a/rehlds/engine/cmd.h +++ b/rehlds/engine/cmd.h @@ -113,7 +113,7 @@ void Cmd_RemoveMallocedCmds(int flag); NOXREF void Cmd_RemoveHudCmds(void); void Cmd_RemoveGameCmds(void); void Cmd_RemoveWrapperCmds(void); -qboolean Cmd_Exists(char *cmd_name); +qboolean Cmd_Exists(const char *cmd_name); NOXREF char *Cmd_CompleteCommand(char *search, int forward); void Cmd_ExecuteString(char *text, cmd_source_t src); qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf); diff --git a/rehlds/engine/com_custom.cpp b/rehlds/engine/com_custom.cpp index 2c7510f..4173573 100644 --- a/rehlds/engine/com_custom.cpp +++ b/rehlds/engine/com_custom.cpp @@ -106,7 +106,7 @@ qboolean COM_CreateCustomization(customization_t *pListHead, resource_t *pResour if (flags & 1) { - if (!HPAK_GetDataPointer("custom.hpk", pResource, (uint8_t**)&pCust->pBuffer, 0)) + if (!HPAK_GetDataPointer("custom.hpk", pResource, (uint8**)&pCust->pBuffer, 0)) { bError = 1; goto CustomizationError; diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index 7931b66..6ab96b5 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -333,7 +333,7 @@ int msg_badread; int msg_readcount; // Some bit tables... -const uint32_t BITTABLE[] = +const uint32 BITTABLE[] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080, @@ -346,7 +346,7 @@ const uint32_t BITTABLE[] = 0x00000000, }; -const uint32_t ROWBITTABLE[] = +const uint32 ROWBITTABLE[] = { 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, @@ -359,7 +359,7 @@ const uint32_t ROWBITTABLE[] = 0xFFFFFFFF, }; -const uint32_t INVBITTABLE[] = +const uint32 INVBITTABLE[] = { 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFB, 0xFFFFFFF7, 0xFFFFFFEF, 0xFFFFFFDF, 0xFFFFFFBF, 0xFFFFFF7F, @@ -388,19 +388,19 @@ void MSG_WriteByte(sizebuf_t *sb, int c) void MSG_WriteShort(sizebuf_t *sb, int c) { unsigned char *buf = (unsigned char *)SZ_GetSpace(sb, 2); - *(int16_t *)buf = (int16_t)c; + *(int16 *)buf = (int16)c; } void MSG_WriteWord(sizebuf_t *sb, int c) { unsigned char *buf = (unsigned char *)SZ_GetSpace(sb, 2); - *(uint16_t *)buf = (uint16_t)c; + *(uint16 *)buf = (uint16)c; } void MSG_WriteLong(sizebuf_t *sb, int c) { unsigned char *buf = (unsigned char *)SZ_GetSpace(sb, 4); - *(uint32_t *)buf = (uint32_t)c; + *(uint32 *)buf = (uint32)c; } void MSG_WriteFloat(sizebuf_t *sb, float f) @@ -431,12 +431,12 @@ void MSG_WriteBuf(sizebuf_t *sb, int iSize, void *buf) void MSG_WriteAngle(sizebuf_t *sb, float f) { - MSG_WriteByte(sb, (int64_t)(fmod((double)f, 360.0) * 256.0 / 360.0) & 0xFF); + MSG_WriteByte(sb, (int64)(fmod((double)f, 360.0) * 256.0 / 360.0) & 0xFF); } void MSG_WriteHiresAngle(sizebuf_t *sb, float f) { - MSG_WriteShort(sb, (int64_t)(fmod((double)f, 360.0) * 65536.0 / 360.0) & 0xFFFF); + MSG_WriteShort(sb, (int64)(fmod((double)f, 360.0) * 65536.0 / 360.0) & 0xFFFF); } void MSG_WriteUsercmd(sizebuf_t *buf, usercmd_t *to, usercmd_t *from) @@ -528,16 +528,16 @@ void MSG_EndBitWriting(sizebuf_t *buf) } } -void MSG_WriteBits(uint32_t data, int numbits) +void MSG_WriteBits(uint32 data, int numbits) { if (numbits < 32) { - if (data >= (uint32_t)(1 << numbits)) + if (data >= (uint32)(1 << numbits)) data = ROWBITTABLE[numbits]; } int surplusBytes = 0; - if ((uint32_t)bfwrite.nCurOutputBit >= 8) + if ((uint32)bfwrite.nCurOutputBit >= 8) { surplusBytes = 1; bfwrite.nCurOutputBit = 0; @@ -554,7 +554,7 @@ void MSG_WriteBits(uint32_t data, int numbits) SZ_GetSpace(bfwrite.pbuf, surplusBytes + bytesToWrite); if (!(bfwrite.pbuf->flags & SIZEBUF_OVERFLOWED)) { - *(uint32_t *)bfwrite.pOutByte = (data << bfwrite.nCurOutputBit) | *(uint32_t *)bfwrite.pOutByte & ROWBITTABLE[bfwrite.nCurOutputBit]; + *(uint32 *)bfwrite.pOutByte = (data << bfwrite.nCurOutputBit) | *(uint32 *)bfwrite.pOutByte & ROWBITTABLE[bfwrite.nCurOutputBit]; bfwrite.nCurOutputBit = 8; if (bitsLeft) bfwrite.nCurOutputBit = bitsLeft; @@ -566,11 +566,11 @@ void MSG_WriteBits(uint32_t data, int numbits) SZ_GetSpace(bfwrite.pbuf, surplusBytes + 4); if (!(bfwrite.pbuf->flags & SIZEBUF_OVERFLOWED)) { - *(uint32_t *)bfwrite.pOutByte = (data << bfwrite.nCurOutputBit) | *(uint32_t *)bfwrite.pOutByte & ROWBITTABLE[bfwrite.nCurOutputBit]; + *(uint32 *)bfwrite.pOutByte = (data << bfwrite.nCurOutputBit) | *(uint32 *)bfwrite.pOutByte & ROWBITTABLE[bfwrite.nCurOutputBit]; int leftBits = 32 - bfwrite.nCurOutputBit; bfwrite.nCurOutputBit = bits & 7; bfwrite.pOutByte += 4; - *(uint32_t *)bfwrite.pOutByte = data >> leftBits; + *(uint32 *)bfwrite.pOutByte = data >> leftBits; } } } @@ -626,8 +626,8 @@ void MSG_WriteBitAngle(float fAngle, int numbits) Sys_Error(__FUNCTION__ ": Can't write bit angle with 32 bits precision\n"); } - uint32_t shift = (1 << numbits); - uint32_t mask = shift - 1; + uint32 shift = (1 << numbits); + uint32 mask = shift - 1; int d = (int)(shift * fmod((double)fAngle, 360.0)) / 360; d &= mask; @@ -725,9 +725,9 @@ int MSG_ReadOneBit(void) return nValue; } -uint32_t MSG_ReadBits(int numbits) +uint32 MSG_ReadBits(int numbits) { - uint32_t result; + uint32 result; if (msg_badread) { @@ -744,13 +744,13 @@ uint32_t MSG_ReadBits(int numbits) bfread.nCurInputBit = 0; } - uint32_t bits = (bfread.nCurInputBit + numbits) & 7; + uint32 bits = (bfread.nCurInputBit + numbits) & 7; if ((unsigned int)(bfread.nCurInputBit + numbits) <= 32) { result = (*(unsigned int *)bfread.pInByte >> bfread.nCurInputBit) & ROWBITTABLE[numbits]; - uint32_t bytes = (bfread.nCurInputBit + numbits) >> 3; + uint32 bytes = (bfread.nCurInputBit + numbits) >> 3; if (bits) { @@ -785,12 +785,12 @@ uint32_t MSG_ReadBits(int numbits) return result; } -NOXREF uint32_t MSG_PeekBits(int numbits) +NOXREF uint32 MSG_PeekBits(int numbits) { NOXREFCHECK; bf_read_t savebf = bfread; - uint32_t r = MSG_ReadBits(numbits); + uint32 r = MSG_ReadBits(numbits); bfread = savebf; return r; @@ -889,8 +889,8 @@ NOXREF float MSG_ReadBitCoord(void) void MSG_WriteBitCoord(const float f) { int signbit = f <= -0.125; - int intval = abs((int32_t)f); - int fractval = abs((int32_t)f * 8) & 7; + int intval = abs((int32)f); + int fractval = abs((int32)f * 8) & 7; MSG_WriteOneBit(intval); MSG_WriteOneBit(fractval); @@ -1024,7 +1024,7 @@ int MSG_ReadShort(void) if (msg_readcount + 2 <= net_message.cursize ) { - c = *(int16_t *)&net_message.data[msg_readcount]; + c = *(int16 *)&net_message.data[msg_readcount]; msg_readcount += 2; } else @@ -1044,7 +1044,7 @@ NOXREF int MSG_ReadWord(void) if (msg_readcount + 2 <= net_message.cursize) { - c = *(uint16_t *)&net_message.data[msg_readcount]; + c = *(uint16 *)&net_message.data[msg_readcount]; msg_readcount += 2; } else @@ -1062,7 +1062,7 @@ int MSG_ReadLong(void) if (msg_readcount + 4 <= net_message.cursize) { - c = *(uint32_t *)&net_message.data[msg_readcount]; + c = *(uint32 *)&net_message.data[msg_readcount]; msg_readcount += 4; } else diff --git a/rehlds/engine/common.h b/rehlds/engine/common.h index 3f0d1c8..48b0582 100644 --- a/rehlds/engine/common.h +++ b/rehlds/engine/common.h @@ -201,7 +201,7 @@ void MSG_WriteOneBit(int nValue); void MSG_StartBitWriting(sizebuf_t *buf); NOXREF qboolean MSG_IsBitWriting(void); void MSG_EndBitWriting(sizebuf_t *buf); -void MSG_WriteBits(uint32_t data, int numbits); +void MSG_WriteBits(uint32 data, int numbits); void MSG_WriteSBits(int data, int numbits); void MSG_WriteBitString(const char *p); void MSG_WriteBitData(void *src, int length); @@ -212,8 +212,8 @@ NOXREF qboolean MSG_IsBitReading(void); void MSG_StartBitReading(sizebuf_t *buf); void MSG_EndBitReading(sizebuf_t *buf); int MSG_ReadOneBit(void); -uint32_t MSG_ReadBits(int numbits); -NOXREF uint32_t MSG_PeekBits(int numbits); +uint32 MSG_ReadBits(int numbits); +NOXREF uint32 MSG_PeekBits(int numbits); int MSG_ReadSBits(int numbits); NOXREF char *MSG_ReadBitString(void); int MSG_ReadBitData(void *dest, int length); diff --git a/rehlds/engine/crc.cpp b/rehlds/engine/crc.cpp index 25207b6..1c133be 100644 --- a/rehlds/engine/crc.cpp +++ b/rehlds/engine/crc.cpp @@ -29,7 +29,7 @@ #include "precompiled.h" -static const uint32_t pulCRCTable[256] = +static const uint32 pulCRCTable[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, @@ -122,7 +122,7 @@ void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch) void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer) { CRC32_t ulCrc = *pulCRC; - uint8_t* pb = (uint8_t*)pBuffer; + uint8* pb = (uint8*)pBuffer; for (int i = 0; i < nBuffer; i++) { @@ -299,25 +299,25 @@ static unsigned char PADDING[64] = /* Rotation is separate from addition to prevent recomputation */ #define FF(a, b, c, d, x, s, ac) \ { \ - (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) += F ((b), (c), (d)) + (x) + (uint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) \ { \ - (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) += G ((b), (c), (d)) + (x) + (uint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) \ { \ - (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) += H ((b), (c), (d)) + (x) + (uint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) \ { \ - (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ + (a) += I ((b), (c), (d)) + (x) + (uint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } @@ -338,7 +338,7 @@ void MD5Init(MD5Context_t *ctx) /* <19841> ../engine/crc.c:473 */ void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len) { - uint32_t in[16]; + uint32 in[16]; int mdi; unsigned int i, ii; @@ -346,13 +346,13 @@ void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len) mdi = (int)((ctx->bits[0] >> 3) & 0x3F); // Update number of bits - if ((ctx->bits[0] + ((uint32_t)len << 3)) < ctx->bits[0]) + if ((ctx->bits[0] + ((uint32)len << 3)) < ctx->bits[0]) { ctx->bits[1]++; } - ctx->bits[0] += ((uint32_t)len << 3); - ctx->bits[1] += ((uint32_t)len >> 29); + ctx->bits[0] += ((uint32)len << 3); + ctx->bits[1] += ((uint32)len >> 29); while (len--) { @@ -363,10 +363,10 @@ void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len) if (mdi == 0x40) { for (i = 0, ii = 0; i < 16; i++, ii += 4) - in[i] = (((uint32_t)ctx->in[ii + 3]) << 24) | - (((uint32_t)ctx->in[ii + 2]) << 16) | - (((uint32_t)ctx->in[ii + 1]) << 8) | - ((uint32_t)ctx->in[ii]); + in[i] = (((uint32)ctx->in[ii + 3]) << 24) | + (((uint32)ctx->in[ii + 2]) << 16) | + (((uint32)ctx->in[ii + 1]) << 8) | + ((uint32)ctx->in[ii]); MD5Transform(ctx->buf, in); mdi = 0; } @@ -376,7 +376,7 @@ void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len) /* <197ea> ../engine/crc.c:528 */ void MD5Final(unsigned char digest[16], MD5Context_t *ctx) { - uint32_t in[16]; + uint32 in[16]; int mdi; unsigned int i, ii; unsigned int padLen; @@ -394,10 +394,10 @@ void MD5Final(unsigned char digest[16], MD5Context_t *ctx) // Append length in bits and transform for (i = 0, ii = 0; i < 14; i++, ii += 4) - in[i] = (((uint32_t)ctx->in[ii + 3]) << 24) | - (((uint32_t)ctx->in[ii + 2]) << 16) | - (((uint32_t)ctx->in[ii + 1]) << 8) | - ((uint32_t)ctx->in[ii]); + in[i] = (((uint32)ctx->in[ii + 3]) << 24) | + (((uint32)ctx->in[ii + 2]) << 16) | + (((uint32)ctx->in[ii + 1]) << 8) | + ((uint32)ctx->in[ii]); MD5Transform(ctx->buf, in); // Store buffer in digest @@ -413,7 +413,7 @@ void MD5Final(unsigned char digest[16], MD5Context_t *ctx) /* <19769> ../engine/crc.c:592 */ void MD5Transform(unsigned int buf[4], const unsigned int in[16]) { - uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3]; + uint32 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; // Round 1 #define S11 7 diff --git a/rehlds/engine/cvar.cpp b/rehlds/engine/cvar.cpp index 2efe02b..e6866e7 100644 --- a/rehlds/engine/cvar.cpp +++ b/rehlds/engine/cvar.cpp @@ -127,7 +127,7 @@ char *Cvar_VariableString(const char *var_name) } /* <1872a> ../engine/cvar.c:126 */ -NOXREF char *Cvar_CompleteVariable(const char *search, int forward) +NOXREF const char *Cvar_CompleteVariable(const char *search, int forward) { NOXREFCHECK; diff --git a/rehlds/engine/cvar.h b/rehlds/engine/cvar.h index 4ffbce5..3e97800 100644 --- a/rehlds/engine/cvar.h +++ b/rehlds/engine/cvar.h @@ -53,7 +53,7 @@ NOXREF cvar_t *Cvar_FindPrevVar(const char *var_name); float Cvar_VariableValue(const char *var_name); NOXREF int Cvar_VariableInt(const char *var_name); char *Cvar_VariableString(const char *var_name); -NOXREF char *Cvar_CompleteVariable(const char *search, int forward); +NOXREF const char *Cvar_CompleteVariable(const char *search, int forward); void Cvar_DirectSet(struct cvar_s *var, const char *value); void Cvar_Set(const char *var_name, const char *value); void Cvar_SetValue(const char *var_name, float value); diff --git a/rehlds/engine/delta.cpp b/rehlds/engine/delta.cpp index 6b29b65..6364618 100644 --- a/rehlds/engine/delta.cpp +++ b/rehlds/engine/delta.cpp @@ -434,18 +434,18 @@ int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) different = from[pTest->fieldOffset] != to[pTest->fieldOffset]; break; case DT_SHORT: - different = *(uint16_t *)&from[pTest->fieldOffset] != *(uint16_t *)&to[pTest->fieldOffset]; + different = *(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset]; break; case DT_FLOAT: case DT_INTEGER: case DT_ANGLE: - different = *(uint32_t *)&from[pTest->fieldOffset] != *(uint32_t *)&to[pTest->fieldOffset]; + different = *(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]; break; case DT_TIMEWINDOW_8: - different = (int32_t)(*(float *)&from[pTest->fieldOffset] * 100.0) != (int32_t)(*(float *)&to[pTest->fieldOffset] * 100.0); + different = (int32)(*(float *)&from[pTest->fieldOffset] * 100.0) != (int32)(*(float *)&to[pTest->fieldOffset] * 100.0); break; case DT_TIMEWINDOW_BIG: - different = (int32_t)(*(float *)&from[pTest->fieldOffset] * 1000.0) != (int32_t)(*(float *)&to[pTest->fieldOffset] * 1000.0); + different = (int32)(*(float *)&from[pTest->fieldOffset] * 1000.0) != (int32)(*(float *)&to[pTest->fieldOffset] * 1000.0); break; case DT_STRING: st1 = (char*)&from[pTest->fieldOffset]; @@ -511,21 +511,21 @@ void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFiel pTest->flags |= FDT_MARK; break; case DT_SHORT: - if (*(uint16_t *)&from[pTest->fieldOffset] != *(uint16_t *)&to[pTest->fieldOffset]) + if (*(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset]) pTest->flags |= FDT_MARK; break; case DT_FLOAT: case DT_INTEGER: case DT_ANGLE: - if (*(uint32_t *)&from[pTest->fieldOffset] != *(uint32_t *)&to[pTest->fieldOffset]) + if (*(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]) pTest->flags |= FDT_MARK; break; case DT_TIMEWINDOW_8: - if ((int32_t)(*(float *)&from[pTest->fieldOffset] * 100.0) != (int32_t)(*(float *)&to[pTest->fieldOffset] * 100.0)) + if ((int32)(*(float *)&from[pTest->fieldOffset] * 100.0) != (int32)(*(float *)&to[pTest->fieldOffset] * 100.0)) pTest->flags |= FDT_MARK; break; case DT_TIMEWINDOW_BIG: - if ((int32_t)(*(float *)&from[pTest->fieldOffset] * 1000.0) != (int32_t)(*(float *)&to[pTest->fieldOffset] * 1000.0)) + if ((int32)(*(float *)&from[pTest->fieldOffset] * 1000.0) != (int32)(*(float *)&to[pTest->fieldOffset] * 1000.0)) pTest->flags |= FDT_MARK; break; case DT_STRING: @@ -592,28 +592,28 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF case DT_BYTE: if (fieldSign) { - int8_t si8 = *(int8_t *)&to[pTest->fieldOffset]; - si8 = (int8_t)((double)si8 * pTest->premultiply); + int8 si8 = *(int8 *)&to[pTest->fieldOffset]; + si8 = (int8)((double)si8 * pTest->premultiply); MSG_WriteSBits(si8, pTest->significant_bits); } else { - uint8_t i8 = *(uint8_t *)&to[pTest->fieldOffset]; - i8 = (uint8_t)((double)i8 * pTest->premultiply); + uint8 i8 = *(uint8 *)&to[pTest->fieldOffset]; + i8 = (uint8)((double)i8 * pTest->premultiply); MSG_WriteBits(i8, pTest->significant_bits); } break; case DT_SHORT: if (fieldSign) { - int16_t si16 = *(int16_t *)&to[pTest->fieldOffset]; - si16 = (int16_t)((double)si16 * pTest->premultiply); + int16 si16 = *(int16 *)&to[pTest->fieldOffset]; + si16 = (int16)((double)si16 * pTest->premultiply); MSG_WriteSBits(si16, pTest->significant_bits); } else { - uint16_t i16 = *(uint16_t *)&to[pTest->fieldOffset]; - i16 = (uint16_t)((double)i16 * pTest->premultiply); + uint16 i16 = *(uint16 *)&to[pTest->fieldOffset]; + i16 = (uint16)((double)i16 * pTest->premultiply); MSG_WriteBits(i16, pTest->significant_bits); } break; @@ -622,11 +622,11 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF double val = (double)(*(float *)&to[pTest->fieldOffset]) * pTest->premultiply; if (fieldSign) { - MSG_WriteSBits((int32_t)val, pTest->significant_bits); + MSG_WriteSBits((int32)val, pTest->significant_bits); } else { - MSG_WriteBits((uint32_t)val, pTest->significant_bits); + MSG_WriteBits((uint32)val, pTest->significant_bits); } break; } @@ -634,19 +634,19 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF { if (fieldSign) { - int32_t signedInt = *(int32_t *)&to[pTest->fieldOffset]; + int32 signedInt = *(int32 *)&to[pTest->fieldOffset]; if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) { - signedInt = (int32_t)((double)signedInt * pTest->premultiply); + signedInt = (int32)((double)signedInt * pTest->premultiply); } MSG_WriteSBits(signedInt, pTest->significant_bits); } else { - uint32_t unsignedInt = *(uint32_t *)&to[pTest->fieldOffset]; + uint32 unsignedInt = *(uint32 *)&to[pTest->fieldOffset]; if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) { - unsignedInt = (uint32_t)((double)unsignedInt * pTest->premultiply); + unsignedInt = (uint32)((double)unsignedInt * pTest->premultiply); } MSG_WriteBits(unsignedInt, pTest->significant_bits); } @@ -659,15 +659,15 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF case DT_TIMEWINDOW_8: { f2 = *(float *)&to[pTest->fieldOffset]; - int32_t twVal = (int)(g_psv.time * 100.0) - (int)(f2 * 100.0); + int32 twVal = (int)(g_psv.time * 100.0) - (int)(f2 * 100.0); MSG_WriteSBits(twVal, 8); break; } case DT_TIMEWINDOW_BIG: { f2 = *(float *)&to[pTest->fieldOffset]; - int32_t twVal = (int)(g_psv.time * pTest->premultiply) - (int)(f2 * pTest->premultiply); - MSG_WriteSBits((int32_t)twVal, pTest->significant_bits); + int32 twVal = (int)(g_psv.time * pTest->premultiply) - (int)(f2 * pTest->premultiply); + MSG_WriteSBits((int32)twVal, pTest->significant_bits); break; } case DT_STRING: @@ -769,14 +769,14 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) to[pTest->fieldOffset] = from[pTest->fieldOffset]; break; case DT_SHORT: - *(uint16_t *)&to[pTest->fieldOffset] = *(uint16_t *)&from[pTest->fieldOffset]; + *(uint16 *)&to[pTest->fieldOffset] = *(uint16 *)&from[pTest->fieldOffset]; break; case DT_FLOAT: case DT_INTEGER: case DT_ANGLE: case DT_TIMEWINDOW_8: case DT_TIMEWINDOW_BIG: - *(uint32_t *)&to[pTest->fieldOffset] = *(uint32_t *)&from[pTest->fieldOffset]; + *(uint32 *)&to[pTest->fieldOffset] = *(uint32 *)&from[pTest->fieldOffset]; break; case DT_STRING: Q_strcpy((char *)&to[pTest->fieldOffset], (char *)&from[pTest->fieldOffset]); @@ -804,7 +804,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { d2 = d2 * pTest->postmultiply; } - *(int8_t *)&to[pTest->fieldOffset] = (int8_t)d2; + *(int8 *)&to[pTest->fieldOffset] = (int8)d2; } else { @@ -817,7 +817,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { d2 = d2 * pTest->postmultiply; } - *(uint8_t *)&to[pTest->fieldOffset] = (uint8_t)d2; + *(uint8 *)&to[pTest->fieldOffset] = (uint8)d2; } break; case DT_SHORT: @@ -832,7 +832,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { d2 = d2 * pTest->postmultiply; } - *(int16_t *)&to[pTest->fieldOffset] = (int16_t)d2; + *(int16 *)&to[pTest->fieldOffset] = (int16)d2; } else { @@ -845,7 +845,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { d2 = d2 * pTest->postmultiply; } - *(uint16_t *)&to[pTest->fieldOffset] = (uint16_t)d2; + *(uint16 *)&to[pTest->fieldOffset] = (uint16)d2; } break; case DT_FLOAT: @@ -879,7 +879,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { d2 = d2 * pTest->postmultiply; } - *(int32_t *)&to[pTest->fieldOffset] = (int32_t)d2; + *(int32 *)&to[pTest->fieldOffset] = (int32)d2; } else { @@ -892,7 +892,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { d2 = d2 * pTest->postmultiply; } - *(uint32_t *)&to[pTest->fieldOffset] = (uint32_t)d2; + *(uint32 *)&to[pTest->fieldOffset] = (uint32)d2; } break; case DT_ANGLE: diff --git a/rehlds/engine/ed_strpool.cpp b/rehlds/engine/ed_strpool.cpp index 4994ad3..bbed2e3 100644 --- a/rehlds/engine/ed_strpool.cpp +++ b/rehlds/engine/ed_strpool.cpp @@ -2,9 +2,9 @@ class CStringPoolMap : public CStaticMap { protected: - virtual uint32_t hash(const char* const &val) { + virtual uint32 hash(const char* const &val) { unsigned int len = strlen(val); - return crc32((const uint8_t*)val, len); + return crc32((const uint8*)val, len); } virtual bool equals(const char* const &val1, const char* const &val2) { diff --git a/rehlds/engine/filesystem_internal.cpp b/rehlds/engine/filesystem_internal.cpp index 68ccabf..36133d0 100644 --- a/rehlds/engine/filesystem_internal.cpp +++ b/rehlds/engine/filesystem_internal.cpp @@ -122,13 +122,13 @@ unsigned int FS_FileSize(const char *pFileName) } /* <262fe> ../engine/filesystem_internal.cpp:101 */ -int32_t FS_GetFileTime(const char *pFileName) +int32 FS_GetFileTime(const char *pFileName) { return g_pFileSystem->GetFileTime(pFileName); } /* <26329> ../engine/filesystem_internal.cpp:107 */ -NOXREF void FS_FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, int32_t fileTime) +NOXREF void FS_FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, int32 fileTime) { NOXREFCHECK; @@ -283,7 +283,7 @@ NOXREF unsigned char FS_GetCharacter(FileHandle_t f) { NOXREFCHECK; - uint8_t retval; + uint8 retval; g_pFileSystem->Read(&retval, 1, f); return retval; } diff --git a/rehlds/engine/filesystem_internal.h b/rehlds/engine/filesystem_internal.h index 8f5335c..684cda5 100644 --- a/rehlds/engine/filesystem_internal.h +++ b/rehlds/engine/filesystem_internal.h @@ -57,8 +57,8 @@ void FS_Seek(FileHandle_t file, int pos, FileSystemSeek_t seekType); unsigned int FS_Tell(FileHandle_t file); unsigned int FS_Size(FileHandle_t file); unsigned int FS_FileSize(const char *pFileName); -int32_t FS_GetFileTime(const char *pFileName); -NOXREF void FS_FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, int32_t fileTime); +int32 FS_GetFileTime(const char *pFileName); +NOXREF void FS_FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, int32 fileTime); int FS_IsOk(FileHandle_t file); void FS_Flush(FileHandle_t file); int FS_EndOfFile(FileHandle_t file); diff --git a/rehlds/engine/filter.h b/rehlds/engine/filter.h index 091ff2c..7da90fe 100644 --- a/rehlds/engine/filter.h +++ b/rehlds/engine/filter.h @@ -40,8 +40,8 @@ typedef struct ipfilter_s { unsigned int mask; union { - uint32_t u32; - uint8_t octets[4]; + uint32 u32; + uint8 octets[4]; } compare; float banEndTime; float banTime; diff --git a/rehlds/engine/hashpak.cpp b/rehlds/engine/hashpak.cpp index 8d13a2b..537e78a 100644 --- a/rehlds/engine/hashpak.cpp +++ b/rehlds/engine/hashpak.cpp @@ -765,7 +765,7 @@ void HPAK_List_f(void) void HPAK_CreatePak(char *pakname, struct resource_s *pResource, void *pData, FileHandle_t fpSource) { char name[MAX_PATH]; - int32_t curpos; + int32 curpos; FileHandle_t fp; hash_pack_entry_t *pCurrentEntry; diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index 769d13b..3058c8f 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -29,10 +29,10 @@ #include "precompiled.h" #define FILETIME_TO_QWORD(ft) \ - ((((uint64_t)ft.dwHighDateTime) << 32) + ft.dwLowDateTime) + ((((uint64)ft.dwHighDateTime) << 32) + ft.dwLowDateTime) #define FILETIME_TO_PAIR(f,h)\ - (((uint64_t)f << 32) | h) + (((uint64)f << 32) | h) /* <3d3ff> ../engine/host_cmd.c:4378 */ typedef int(*SV_BLENDING_INTERFACE_FUNC)(int, struct sv_blending_interface_s **, struct server_studio_api_s *, float *, float *); @@ -328,14 +328,14 @@ int Host_GetStartTime(void) /* <3e39a> ../engine/host_cmd.c:405 */ void Host_UpdateStats(void) { - uint32_t runticks = 0; - uint32_t cputicks = 0; + uint32 runticks = 0; + uint32 cputicks = 0; static float last = 0.0f; static float lastAvg = 0.0f; - static uint64_t lastcputicks = 0; - static uint64_t lastrunticks = 0; + static uint64 lastcputicks = 0; + static uint64 lastrunticks = 0; #ifdef _WIN32 @@ -365,8 +365,8 @@ void Host_UpdateStats(void) } else { - cputicks = (uint32_t)(lastcputicks & 0xFFFFFFFF); - runticks = (uint32_t)(lastcputicks >> 32); + cputicks = (uint32)(lastcputicks & 0xFFFFFFFF); + runticks = (uint32)(lastcputicks >> 32); } cpuPercent = diff --git a/rehlds/engine/l_studio.cpp b/rehlds/engine/l_studio.cpp index 29cf5e9..9f2ec76 100644 --- a/rehlds/engine/l_studio.cpp +++ b/rehlds/engine/l_studio.cpp @@ -34,12 +34,12 @@ /* <42900> ../engine/l_studio.c:31 */ void Mod_LoadStudioModel_internal(model_t * mod, void * buffer) { - uint8_t *poutdata; - uint8_t *pindata; + uint8 *poutdata; + uint8 *pindata; mstudiotexture_t *ptexture; int size; int i; - uint8_t *pout; + uint8 *pout; studiohdr_t * phdr = (studiohdr_t *)buffer; i = LittleLong(phdr->version); @@ -54,14 +54,14 @@ void Mod_LoadStudioModel_internal(model_t * mod, void * buffer) mod->type = mod_studio; mod->flags = phdr->flags; Cache_Alloc(&mod->cache, phdr->length + 1280 * phdr->numtextures, mod->name); - pout = (uint8_t *)mod->cache.data; + pout = (uint8 *)mod->cache.data; if (pout) { if (phdr->textureindex) { Q_memcpy(pout, buffer, phdr->texturedataindex); poutdata = pout + phdr->texturedataindex; - pindata = (uint8_t*)buffer + phdr->texturedataindex; + pindata = (uint8*)buffer + phdr->texturedataindex; ptexture = (mstudiotexture_t *)(pout + phdr->textureindex); for (i = 0; i < phdr->numtextures; i++, ptexture++) { @@ -73,10 +73,10 @@ void Mod_LoadStudioModel_internal(model_t * mod, void * buffer) for (int j = 0; j < 256; j++, pindata += 3, poutdata += 8) { - ((uint16_t*)poutdata)[0] = texgammatable[pindata[0]]; - ((uint16_t*)poutdata)[1] = texgammatable[pindata[1]]; - ((uint16_t*)poutdata)[2] = texgammatable[pindata[2]]; - ((uint16_t*)poutdata)[3] = 0; + ((uint16*)poutdata)[0] = texgammatable[pindata[0]]; + ((uint16*)poutdata)[1] = texgammatable[pindata[1]]; + ((uint16*)poutdata)[2] = texgammatable[pindata[2]]; + ((uint16*)poutdata)[3] = 0; } } } diff --git a/rehlds/engine/model.cpp b/rehlds/engine/model.cpp index e15d455..a6c27e5 100644 --- a/rehlds/engine/model.cpp +++ b/rehlds/engine/model.cpp @@ -336,7 +336,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC) loadmodel = mod; mod->needload = NL_PRESENT; - switch (LittleLong(*(uint32_t *)buf)) + switch (LittleLong(*(uint32 *)buf)) { case 'OPDI': Sys_Error(__FUNCTION__ "Alias models are not supported"); @@ -427,8 +427,8 @@ void Mod_LoadTextures(lump_t *l) miptex_t *mt; int palette; int pixels; - uint8_t *mippal; - uint16_t *texpal; + uint8 *mippal; + uint16 *texpal; int max; texture_t *tx2; int num; @@ -487,7 +487,7 @@ void Mod_LoadTextures(lump_t *l) Sys_Error("Texture %s is not 16 aligned", mt); pixels = 85 * mt->height * mt->width / 64; - palette = *(uint16_t*)((char*)mt + sizeof(miptex_t) + pixels); + palette = *(uint16*)((char*)mt + sizeof(miptex_t) + pixels); tx = (texture_t *)Hunk_AllocName(2 + 8 * palette + pixels + sizeof(texture_t), loadname); loadmodel->textures[i] = tx; @@ -510,8 +510,8 @@ void Mod_LoadTextures(lump_t *l) //R_InitSky(); } - mippal = (uint8_t *)&mt[1] + pixels + 2; - texpal = (uint16_t *)((char*)&tx[1] + pixels + 2); + mippal = (uint8 *)&mt[1] + pixels + 2; + texpal = (uint16 *)((char*)&tx[1] + pixels + 2); for (int j = 0; j < palette; j++, mippal += 3, texpal += 4) { texpal[0] = texgammatable[mippal[2]]; @@ -1772,7 +1772,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer) "(%i should be %i)", mod->name, version, SPRITE_VERSION); numframes = LittleLong(pin->numframes); - int palsize = *(uint16_t*)&pin[1]; + int palsize = *(uint16*)&pin[1]; size = sizeof(msprite_t) + (numframes - 1) * sizeof(psprite->frames) + 2 + 8 * palsize; psprite = (msprite_t*) Hunk_AllocName(size, loadname); @@ -1792,7 +1792,7 @@ void Mod_LoadSpriteModel(model_t *mod, void *buffer) mod->maxs[2] = float(psprite->maxheight / 2); unsigned char *palsrc = (unsigned char*)(&pin[1]) + 2; //header + palette size - uint16_t* paldest = (uint16_t*)((char*)(psprite + 1) + sizeof(psprite->frames) * (numframes - 1)); //sprite + [frames-1] + uint16* paldest = (uint16*)((char*)(psprite + 1) + sizeof(psprite->frames) * (numframes - 1)); //sprite + [frames-1] *(paldest++) = palsize; //write palette size for (i = 0; i < palsize; i++, paldest += 4, palsrc += 3) { diff --git a/rehlds/engine/net_ws.cpp b/rehlds/engine/net_ws.cpp index 07e4a78..5b86b98 100644 --- a/rehlds/engine/net_ws.cpp +++ b/rehlds/engine/net_ws.cpp @@ -457,7 +457,7 @@ qboolean NET_StringToSockaddr(const char *s, struct sockaddr *sadr) sadr->sa_data[9] = (char)val; sscanf(s + 22, "%u", &val); - *(uint16_t *)&sadr->sa_data[10] = htons(val); + *(uint16 *)&sadr->sa_data[10] = htons(val); return TRUE; } @@ -492,7 +492,7 @@ qboolean NET_StringToSockaddr(const char *s, struct sockaddr *sadr) { return FALSE; } - ((sockaddr_in *)sadr)->sin_addr.s_addr = *(uint32_t *)h->h_addr; + ((sockaddr_in *)sadr)->sin_addr.s_addr = *(uint32 *)h->h_addr; } return TRUE; } @@ -1020,7 +1020,7 @@ qboolean NET_QueuePacket(netsrc_t sock) } NET_TransferRawData(&in_message, buf, ret); - if (*(uint32_t *)in_message.data == 0xFFFFFFFE) + if (*(uint32 *)in_message.data == 0xFFFFFFFE) { if (in_message.cursize >= 9) { @@ -1284,7 +1284,7 @@ qboolean NET_GetPacket_internal(netsrc_t sock) return bret; } -bool NET_GetPacketPreprocessor(uint8_t* data, unsigned int len, const netadr_t& srcAddr) { +bool NET_GetPacketPreprocessor(uint8* data, unsigned int len, const netadr_t& srcAddr) { return true; } diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index 552beb6..5b80154 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -49,7 +49,7 @@ int gMsgDest; int gMsgType; qboolean gMsgStarted; vec3_t gMsgOrigin; -int32_t idum; +int32 idum; int g_groupop; int g_groupmask; unsigned char checkpvs[1024]; @@ -130,7 +130,7 @@ void PF_setsize_I(edict_t *e, const float *rgflMin, const float *rgflMax) /* <78451> ../engine/pr_cmds.c:184 */ void PF_setmodel_I(edict_t *e, const char *m) { - char** check = &g_psv.model_precache[0]; + const char** check = &g_psv.model_precache[0]; int i = 0; #ifdef REHLDS_CHECKS @@ -1043,7 +1043,7 @@ qboolean PR_IsEmptyString(const char *s) } /* <795b5> ../engine/pr_cmds.c:1397 */ -int PF_precache_sound_I(char *s) +int PF_precache_sound_I(const char *s) { int i; @@ -1379,7 +1379,7 @@ void EV_SV_Playback(int flags, int clientindex, short unsigned int eventindex, f } /* <799da> ../engine/pr_cmds.c:1849 */ -int PF_precache_model_I(char *s) +int PF_precache_model_I(const char *s) { int iOptional = 0; if (!s) @@ -1525,13 +1525,13 @@ char *PF_GetInfoKeyBuffer_I(edict_t *e) } /* <79b55> ../engine/pr_cmds.c:2012 */ -char *PF_InfoKeyValue_I(char *infobuffer, char *key) +char *PF_InfoKeyValue_I(char *infobuffer, const char *key) { return (char *)Info_ValueForKey(infobuffer, key); } /* <79b91> ../engine/pr_cmds.c:2022 */ -void PF_SetKeyValue_I(char *infobuffer, char *key, char *value) +void PF_SetKeyValue_I(char *infobuffer, const char *key, const char *value) { if (infobuffer == localinfo) { @@ -1558,7 +1558,7 @@ void PF_RemoveKey_I(char *s, const char *key) } /* <79c0f> ../engine/pr_cmds.c:2047 */ -void PF_SetClientKeyValue_I(int clientIndex, char *infobuffer, char *key, char *value) +void PF_SetClientKeyValue_I(int clientIndex, char *infobuffer, const char *key, const char *value) { client_t *pClient; @@ -2273,7 +2273,7 @@ void PF_setspawnparms_I(edict_t *ent) } /* <7a539> ../engine/pr_cmds.c:2956 */ -void PF_changelevel_I(char *s1, char *s2) +void PF_changelevel_I(const char *s1, const char *s2) { static int last_spawncount; @@ -2310,7 +2310,7 @@ void SeedRandomNumberGenerator(void) #define NDIV (1+(IM-1)/NTAB) /* <7a598> ../engine/pr_cmds.c:3003 */ -int32_t ran1(void) +int32 ran1(void) { int j; long k; @@ -2364,7 +2364,7 @@ float RandomFloat(float flLow, float flHigh) } /* <7a6b2> ../engine/pr_cmds.c:3056 */ -int32_t RandomLong(int32_t lLow, int32_t lHigh) +int32 RandomLong(int32 lLow, int32 lHigh) { #ifndef SWDS g_engdstAddrs.pfnRandomLong(&lLow, &lHigh); @@ -2410,10 +2410,10 @@ void PF_FadeVolume(const edict_t *clientent, int fadePercent, int fadeOutSeconds return; MSG_WriteChar(&client->netchan.message, svc_soundfade); - MSG_WriteByte(&client->netchan.message, (uint8_t)fadePercent); - MSG_WriteByte(&client->netchan.message, (uint8_t)holdTime); - MSG_WriteByte(&client->netchan.message, (uint8_t)fadeOutSeconds); - MSG_WriteByte(&client->netchan.message, (uint8_t)fadeInSeconds); + MSG_WriteByte(&client->netchan.message, (uint8)fadePercent); + MSG_WriteByte(&client->netchan.message, (uint8)holdTime); + MSG_WriteByte(&client->netchan.message, (uint8)fadeOutSeconds); + MSG_WriteByte(&client->netchan.message, (uint8)fadeInSeconds); } /* <7a7a1> ../engine/pr_cmds.c:3124 */ @@ -2589,7 +2589,7 @@ int PF_CreateInstancedBaseline(int classname, struct entity_state_s *baseline) } /* <7abdb> ../engine/pr_cmds.c:3332 */ -void PF_Cvar_DirectSet(struct cvar_s *var, char *value) +void PF_Cvar_DirectSet(struct cvar_s *var, const char *value) { Cvar_DirectSet(var, value); } diff --git a/rehlds/engine/pr_cmds.h b/rehlds/engine/pr_cmds.h index b277f90..9b7d8d5 100644 --- a/rehlds/engine/pr_cmds.h +++ b/rehlds/engine/pr_cmds.h @@ -81,7 +81,7 @@ extern int gMsgDest; extern int gMsgType; extern qboolean gMsgStarted; extern vec3_t gMsgOrigin; -extern int32_t idum; +extern int32 idum; extern int g_groupop; extern int g_groupmask; extern unsigned char checkpvs[1024]; @@ -141,20 +141,20 @@ int iGetIndex(const char *pszField); edict_t *FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue); int GetEntityIllum(edict_t *pEnt); qboolean PR_IsEmptyString(const char *s); -int PF_precache_sound_I(char *s); +int PF_precache_sound_I(const char *s); short unsigned int EV_Precache(int type, const char *psz); void EV_PlayReliableEvent(client_t *cl, int entindex, short unsigned int eventindex, float delay, event_args_t *pargs); void EV_Playback(int flags, const edict_t *pInvoker, short unsigned int eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); void EV_SV_Playback(int flags, int clientindex, short unsigned int eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2); -int PF_precache_model_I(char *s); +int PF_precache_model_I(const char *s); int PF_precache_generic_I(char *s); int PF_IsMapValid_I(char *mapname); int PF_NumberOfEntities_I(void); char *PF_GetInfoKeyBuffer_I(edict_t *e); -char *PF_InfoKeyValue_I(char *infobuffer, char *key); -void PF_SetKeyValue_I(char *infobuffer, char *key, char *value); +char *PF_InfoKeyValue_I(char *infobuffer, const char *key); +void PF_SetKeyValue_I(char *infobuffer, const char *key, const char *value); void PF_RemoveKey_I(char *s, const char *key); -void PF_SetClientKeyValue_I(int clientIndex, char *infobuffer, char *key, char *value); +void PF_SetClientKeyValue_I(int clientIndex, char *infobuffer, const char *key, const char *value); int PF_walkmove_I(edict_t *ent, float yaw, float dist, int iMode); int PF_droptofloor_I(edict_t *ent); int PF_DecalIndex(const char *name); @@ -182,12 +182,12 @@ void PF_WriteEntity_I(int iValue); void PF_makestatic_I(edict_t *ent); void PF_StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex); void PF_setspawnparms_I(edict_t *ent); -void PF_changelevel_I(char *s1, char *s2); +void PF_changelevel_I(const char *s1, const char *s2); void SeedRandomNumberGenerator(void); -int32_t ran1(void); +int32 ran1(void); float fran1(void); float RandomFloat(float flLow, float flHigh); -int32_t RandomLong(int32_t lLow, int32_t lHigh); +int32 RandomLong(int32 lLow, int32 lHigh); void PF_FadeVolume(const edict_t *clientent, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds); void PF_SetClientMaxspeed(edict_t *clientent, float fNewMaxspeed); int PF_GetPlayerUserId(edict_t *e); @@ -202,7 +202,7 @@ int PF_GetCurrentPlayer(void); int PF_CanSkipPlayer(const edict_t *pClient); void PF_SetGroupMask(int mask, int op); int PF_CreateInstancedBaseline(int classname, struct entity_state_s *baseline); -void PF_Cvar_DirectSet(struct cvar_s *var, char *value); +void PF_Cvar_DirectSet(struct cvar_s *var, const char *value); void PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, const char *filename); void PF_GetPlayerStats(const edict_t *pClient, int *ping, int *packet_loss); NOXREF void QueryClientCvarValueCmd(void); diff --git a/rehlds/engine/pr_dlls.h b/rehlds/engine/pr_dlls.h index 92227f1..a29bfac 100644 --- a/rehlds/engine/pr_dlls.h +++ b/rehlds/engine/pr_dlls.h @@ -39,7 +39,7 @@ /* <8a763> ../engine/pr_dlls.h:42 */ typedef struct functiontable_s { - uint32_t pFunction; + uint32 pFunction; char *pFunctionName; } functiontable_t; diff --git a/rehlds/engine/pr_edict.cpp b/rehlds/engine/pr_edict.cpp index d45e469..cef96af 100644 --- a/rehlds/engine/pr_edict.cpp +++ b/rehlds/engine/pr_edict.cpp @@ -441,7 +441,7 @@ void InitEntityDLLFields(edict_t *pEdict) } /* <7f8ee> ../engine/pr_edict.c:594 */ -void *PvAllocEntPrivateData(edict_t *pEdict, int32_t cb) +void *PvAllocEntPrivateData(edict_t *pEdict, int32 cb) { FreeEntPrivateData(pEdict); diff --git a/rehlds/engine/pr_edict.h b/rehlds/engine/pr_edict.h index d3703bb..e610394 100644 --- a/rehlds/engine/pr_edict.h +++ b/rehlds/engine/pr_edict.h @@ -51,7 +51,7 @@ int NUM_FOR_EDICT(const edict_t *e); bool SuckOutClassname(char *szInputStream, edict_t *pEdict); void ReleaseEntityDLLFields(edict_t *pEdict); void InitEntityDLLFields(edict_t *pEdict); -void *PvAllocEntPrivateData(edict_t *pEdict, int32_t cb); +void *PvAllocEntPrivateData(edict_t *pEdict, int32 cb); void *PvEntPrivateData(edict_t *pEdict); void FreeEntPrivateData(edict_t *pEdict); void FreeAllEntPrivateData(void); diff --git a/rehlds/engine/public_amalgamation.cpp b/rehlds/engine/public_amalgamation.cpp new file mode 100644 index 0000000..cebff6f --- /dev/null +++ b/rehlds/engine/public_amalgamation.cpp @@ -0,0 +1,5 @@ +#include "precompiled.h" + +#include "sys_shared.cpp" +#include "crc32.cpp" +#include "interface.cpp" diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index b0dd4b7..6d0bf1c 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -135,14 +135,14 @@ typedef struct server_s int num_resources; consistency_t consistency_list[512]; int num_consistency; - char *model_precache[HL_MODEL_MAX]; + const char *model_precache[HL_MODEL_MAX]; struct model_s *models[HL_MODEL_MAX]; unsigned char model_precache_flags[HL_MODEL_MAX]; struct event_s event_precache[HL_EVENT_MAX]; - char *sound_precache[HL_SOUND_MAX]; + const char *sound_precache[HL_SOUND_MAX]; short int sound_precache_hashedlookup[HL_SOUND_HASHLOOKUP_SIZE]; qboolean sound_precache_hashedlookup_built; - char *generic_precache[HL_GENERIC_MAX]; + const char *generic_precache[HL_GENERIC_MAX]; char generic_precache_names[HL_GENERIC_MAX][64]; int num_generic_names; char *lightstyles[MAX_LIGHTSTYLES]; @@ -229,7 +229,7 @@ typedef struct client_s int lc; char physinfo[MAX_INFO_STRING]; qboolean m_bLoopback; - uint32_t m_VoiceStreams[2]; + uint32 m_VoiceStreams[2]; double m_lastvoicetime; int m_sendrescount; } client_t; @@ -697,7 +697,7 @@ void SV_SkipUpdates(void); void SV_SendClientMessages(void); void SV_ExtractFromUserinfo(client_t *cl); int SV_ModelIndex(const char *name); -void SV_AddResource(resourcetype_t type, char *name, int size, unsigned char flags, int index); +void SV_AddResource(resourcetype_t type, const char *name, int size, unsigned char flags, int index); void SV_CreateGenericResources(void); void SV_CreateResourceList(void); void SV_ClearCaches(void); diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 3905746..7d5d9f0 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -826,7 +826,7 @@ qboolean SV_BuildSoundMsg(edict_t *entity, int channel, const char *sample, int if (field_mask & SND_FL_VOLUME) MSG_WriteBits(volume, 8); if (field_mask & SND_FL_ATTENUATION) - MSG_WriteBits((uint32_t)(attenuation * 64.0f), 8); + MSG_WriteBits((uint32)(attenuation * 64.0f), 8); MSG_WriteBits(channel, 3); MSG_WriteBits(ent, 11); MSG_WriteBits(sound_num, (field_mask & SND_FL_LARGE_INDEX) ? 16 : 8); @@ -2323,11 +2323,11 @@ void SV_ConnectClient_internal(void) return; } memcpy(szSteamAuthBuf, &net_message.data[msg_readcount], len); - client->network_userid.clientip = *(uint32_t *)&adr.ip[0]; + client->network_userid.clientip = *(uint32 *)&adr.ip[0]; if (adr.type == NA_LOOPBACK) { if (sv_lan.value <= 0.0f) - client->network_userid.clientip = *(uint32_t *)&adr.ip[0]; + client->network_userid.clientip = *(uint32 *)&adr.ip[0]; else client->network_userid.clientip = 0x7F000001; //127.0.0.1 } @@ -2365,7 +2365,7 @@ void SV_ConnectClient_internal(void) } host_client->network_userid.idtype = AUTH_IDTYPE_LOCAL; host_client->network_userid.m_SteamID = 0; - host_client->network_userid.clientip = *(uint32_t *)&adr.ip[0]; + host_client->network_userid.clientip = *(uint32 *)&adr.ip[0]; Steam_NotifyBotConnect(client); } @@ -3067,7 +3067,7 @@ int SVC_GameDllQuery(const char *s) valid = gEntityInterface.pfnConnectionlessPacket(&net_from, s, (char *) &data[4], &len); if (len && len <= 2044) { - *(uint32_t *)data = 0xFFFFFFFF; //connectionless packet + *(uint32 *)data = 0xFFFFFFFF; //connectionless packet NET_SendPacket(NS_SERVER, len + 4, data, net_from); } return valid; @@ -3508,7 +3508,7 @@ qboolean SV_FilterPacket(void) ipfilter_t* curFilter = &ipfilters[i]; if (curFilter->compare.u32 == 0xFFFFFFFF || curFilter->banEndTime == 0.0f || curFilter->banEndTime > realtime) { - if ((*(uint32_t*)net_from.ip & curFilter->mask) == curFilter->compare.u32) + if ((*(uint32*)net_from.ip & curFilter->mask) == curFilter->compare.u32) return (int)sv_filterban.value; } else @@ -3549,7 +3549,7 @@ void SV_ReadPackets(void) continue; } - if (*(uint32_t *)net_message.data == 0xFFFFFFFF) + if (*(uint32 *)net_message.data == 0xFFFFFFFF) { // Connectionless packet if (CheckIP(net_from)) @@ -4862,7 +4862,7 @@ int SV_ModelIndex(const char *name) } /* ../engine/sv_main.c:6529 */ -void SV_AddResource(resourcetype_t type, char *name, int size, unsigned char flags, int index) +void SV_AddResource(resourcetype_t type, const char *name, int size, unsigned char flags, int index) { resource_t *r; if (g_psv.num_resources >= 1280) @@ -4938,7 +4938,7 @@ void SV_CreateGenericResources(void) /* ../engine/sv_main.c:6675 */ void SV_CreateResourceList(void) { - char ** s; + char const ** s; int ffirstsent = 0; int i; int nSize; @@ -5690,8 +5690,8 @@ qboolean StringToFilter(const char *s, ipfilter_t *f) if (i < 4) continue; } - f->mask = *(uint32_t *)m; - f->compare.u32 = *(uint32_t *)b; + f->mask = *(uint32 *)m; + f->compare.u32 = *(uint32 *)b; return TRUE; } Con_Printf("Bad filter address: %s\n", cc); @@ -6266,7 +6266,7 @@ void SV_ListIP_f(void) Con_Printf("IP filter list:\n"); for (int i = 0; i < numipfilters; i++) { - uint8_t* b = ipfilters[i].compare.octets; + uint8* b = ipfilters[i].compare.octets; if (ipfilters[i].banTime == 0.0f) Con_Printf("%3i.%3i.%3i.%3i : permanent\n", b[0], b[1], b[2], b[3]); else @@ -6293,7 +6293,7 @@ void SV_WriteIP_f(void) if (ipfilters[i].banTime != 0.0f) continue; - uint8_t *b = ipfilters[i].compare.octets; + uint8 *b = ipfilters[i].compare.octets; FS_FPrintf(f, "addip 0.0 %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]); } FS_Close(f); @@ -6689,7 +6689,7 @@ void SV_CheckForRcon(void) } else { - if (*(uint32_t *)net_message.data == 0xFFFFFFFF) + if (*(uint32 *)net_message.data == 0xFFFFFFFF) SV_HandleRconPacket(); } } diff --git a/rehlds/engine/sv_steam3.cpp b/rehlds/engine/sv_steam3.cpp index 795307c..c4b4922 100644 --- a/rehlds/engine/sv_steam3.cpp +++ b/rehlds/engine/sv_steam3.cpp @@ -29,7 +29,7 @@ #include "precompiled.h" -bool (CSteam3Server::*pNotifyClientConnect)(client_t *client, const void *pvSteam2Key, uint32_t ucbSteam2Key) = &CSteam3Server::NotifyClientConnect; +bool (CSteam3Server::*pNotifyClientConnect)(client_t *client, const void *pvSteam2Key, uint32 ucbSteam2Key) = &CSteam3Server::NotifyClientConnect; /* ../engine/sv_steam3.cpp:81 */ @@ -61,7 +61,7 @@ void CSteam3Server::OnLogonSuccess(SteamServersConnected_t *pLogonSuccess) } /* ../engine/sv_steam3.cpp:128 */ -uint64_t CSteam3Server::GetSteamID() +uint64 CSteam3Server::GetSteamID() { if (m_bLanOnly) return CSteamID(0, k_EUniversePublic, k_EAccountTypeInvalid).ConvertToUint64(); @@ -252,7 +252,7 @@ void CSteam3Server::Activate() int gamePort; char gamedir[MAX_PATH]; int usSteamPort; - uint32_t unIP; + uint32 unIP; if (m_bLoggedOn) { @@ -349,7 +349,7 @@ void CSteam3Server::Shutdown(void) /* linkage=_ZN13CSteam3Server8ShutdownEv */ } /* ../engine/sv_steam3.cpp:537 */ -bool CSteam3Server::NotifyClientConnect(client_t *client, const void *pvSteam2Key, uint32_t ucbSteam2Key) /* linkage=_ZN13CSteam3Server19NotifyClientConnectEP8client_sPKvj */ +bool CSteam3Server::NotifyClientConnect(client_t *client, const void *pvSteam2Key, uint32 ucbSteam2Key) /* linkage=_ZN13CSteam3Server19NotifyClientConnectEP8client_sPKvj */ { class CSteamID steamIDClient; bool bRet = false; @@ -486,13 +486,13 @@ void CSteam3Server::RunFrame() { s_fLastRunSendPackets = fCurTime; - uint16_t port; - uint32_t ip; + uint16 port; + uint32 ip; int iLen = CRehldsPlatformHolder::get()->SteamGameServer()->GetNextOutgoingPacket(szOutBuf, sizeof(szOutBuf), &ip, &port); while (iLen > 0) { netadr_t netAdr; - *((uint32_t*)&netAdr.ip[0]) = htonl(ip); + *((uint32*)&netAdr.ip[0]) = htonl(ip); netAdr.port = htons(port); netAdr.type = NA_IP; @@ -540,13 +540,13 @@ void CSteam3Client::Shutdown(void) /* linkage=_ZN13CSteam3Client8ShutdownEv */ } /* ../engine/sv_steam3.cpp:816 */ -int CSteam3Client::InitiateGameConnection(void *pData, int cbMaxData, uint64_t steamID, uint32_t unIPServer, uint16_t usPortServer, bool bSecure) +int CSteam3Client::InitiateGameConnection(void *pData, int cbMaxData, uint64 steamID, uint32 unIPServer, uint16 usPortServer, bool bSecure) { return SteamUser()->InitiateGameConnection(pData, cbMaxData, CSteamID(steamID), ntohl(unIPServer), ntohs(usPortServer), bSecure); } /* ../engine/sv_steam3.cpp:822 */ -void CSteam3Client::TerminateConnection(uint32_t unIPServer, uint16_t usPortServer) +void CSteam3Client::TerminateConnection(uint32 unIPServer, uint16 usPortServer) { SteamUser()->TerminateGameConnection(ntohl(unIPServer), ntohs(usPortServer)); } @@ -628,7 +628,7 @@ void CSteam3Client::RunFrame(void) /* linkage=_ZN13CSteam3Client8RunFrameEv */ /* ../engine/sv_steam3.cpp:552 */ -uint64_t ISteamGameServer_CreateUnauthenticatedUserConnection(void) +uint64 ISteamGameServer_CreateUnauthenticatedUserConnection(void) { if (!CRehldsPlatformHolder::get()->SteamGameServer()) { @@ -639,7 +639,7 @@ uint64_t ISteamGameServer_CreateUnauthenticatedUserConnection(void) } /* ../engine/sv_steam3.cpp:559 */ -bool ISteamGameServer_BUpdateUserData(uint64_t steamid, const char *netname, uint32_t score) +bool ISteamGameServer_BUpdateUserData(uint64 steamid, const char *netname, uint32 score) { if (!CRehldsPlatformHolder::get()->SteamGameServer()) { @@ -650,7 +650,7 @@ bool ISteamGameServer_BUpdateUserData(uint64_t steamid, const char *netname, uin } /* ../engine/sv_steam3.cpp:566 */ -bool ISteamApps_BIsSubscribedApp(uint32_t appid) +bool ISteamApps_BIsSubscribedApp(uint32 appid) { if (CRehldsPlatformHolder::get()->SteamApps()) { @@ -795,13 +795,13 @@ void Steam_InitClient(void) } /* ../engine/sv_steam3.cpp:1007 */ -int Steam_GSInitiateGameConnection(void *pData, int cbMaxData, uint64_t steamID, uint32_t unIPServer, uint16_t usPortServer, qboolean bSecure) +int Steam_GSInitiateGameConnection(void *pData, int cbMaxData, uint64 steamID, uint32 unIPServer, uint16 usPortServer, qboolean bSecure) { return Steam3Client()->InitiateGameConnection(pData, cbMaxData, steamID, unIPServer, usPortServer, bSecure != 0); } /* ../engine/sv_steam3.cpp:1013 */ -void Steam_GSTerminateGameConnection(uint32_t unIPServer, uint16_t usPortServer) +void Steam_GSTerminateGameConnection(uint32 unIPServer, uint16 usPortServer) { Steam3Client()->TerminateConnection(unIPServer, usPortServer); } @@ -813,7 +813,7 @@ void Steam_ShutdownClient(void) } /* ../engine/sv_steam3.cpp:1026 */ -uint64_t Steam_GSGetSteamID() +uint64 Steam_GSGetSteamID() { return Steam3Server()->GetSteamID(); } @@ -838,7 +838,7 @@ qboolean Steam_GSBSecurePreference(void) } /* ../engine/sv_steam3.cpp:1046 */ -TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64_t unSteamID) +TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64 unSteamID) { class CSteamID steamID = unSteamID; TSteamGlobalUserID steam2ID; @@ -847,7 +847,7 @@ TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64_t unSteamID) } /* ../engine/sv_steam3.cpp:1054 */ -uint64_t Steam_StringToSteamID(const char *pStr) +uint64 Steam_StringToSteamID(const char *pStr) { CSteamID steamID; if (Steam3Server()) @@ -943,7 +943,7 @@ void Master_SetMaster_f(void) } /* ../engine/sv_steam3.cpp:1143 */ -void Steam_HandleIncomingPacket(byte *data, int len, int fromip, uint16_t port) +void Steam_HandleIncomingPacket(byte *data, int len, int fromip, uint16 port) { CRehldsPlatformHolder::get()->SteamGameServer()->HandleIncomingPacket(data, len, fromip, port); } diff --git a/rehlds/engine/sv_steam3.h b/rehlds/engine/sv_steam3.h index 78bf746..f1fa188 100644 --- a/rehlds/engine/sv_steam3.h +++ b/rehlds/engine/sv_steam3.h @@ -116,7 +116,7 @@ public: } /* ../engine/sv_steam3.cpp:128 */ - uint64_t GetSteamID(void); /* linkage=_ZN13CSteam3Server10GetSteamIDEv */ + uint64 GetSteamID(void); /* linkage=_ZN13CSteam3Server10GetSteamIDEv */ /* ../engine/sv_steam3.cpp:190 */ void OnGSClientDenyHelper(client_t *cl, EDenyReason eDenyReason, const char *pchOptionalText); /* linkage=_ZN13CSteam3Server20OnGSClientDenyHelperEP8client_s11EDenyReasonPKc */ @@ -134,7 +134,7 @@ public: virtual void Shutdown(void); /* linkage=_ZN13CSteam3Server8ShutdownEv */ /* ../engine/sv_steam3.cpp:537 */ - bool NotifyClientConnect(client_t *client, const void *pvSteam2Key, uint32_t ucbSteam2Key); /* linkage=_ZN13CSteam3Server19NotifyClientConnectEP8client_sPKvj */ + bool NotifyClientConnect(client_t *client, const void *pvSteam2Key, uint32 ucbSteam2Key); /* linkage=_ZN13CSteam3Server19NotifyClientConnectEP8client_sPKvj */ /* ../engine/sv_steam3.cpp:578 */ bool NotifyBotConnect(client_t *client); /* linkage=_ZN13CSteam3Server16NotifyBotConnectEP8client_s */ @@ -194,12 +194,12 @@ extern CSteam3Server *s_Steam3Server; extern CSteam3Client s_Steam3Client; -extern bool (CSteam3Server::*pNotifyClientConnect)(client_t *client, const void *pvSteam2Key, uint32_t ucbSteam2Key); +extern bool (CSteam3Server::*pNotifyClientConnect)(client_t *client, const void *pvSteam2Key, uint32 ucbSteam2Key); -uint64_t ISteamGameServer_CreateUnauthenticatedUserConnection(void); -bool ISteamGameServer_BUpdateUserData(uint64_t steamid, const char *netname, uint32_t score); -bool ISteamApps_BIsSubscribedApp(uint32_t appid); +uint64 ISteamGameServer_CreateUnauthenticatedUserConnection(void); +bool ISteamGameServer_BUpdateUserData(uint64 steamid, const char *netname, uint32 score); +bool ISteamApps_BIsSubscribedApp(uint32 appid); const char *Steam_GetCommunityName(void); qboolean Steam_NotifyClientConnect(client_t *cl, const void *pvSteam2Key, unsigned int ucbSteam2Key); qboolean Steam_NotifyClientConnect_internal(client_t *cl, const void *pvSteam2Key, unsigned int ucbSteam2Key); @@ -215,19 +215,19 @@ void Steam_RunFrame(void); void Steam_SetCVar(const char *pchKey, const char *pchValue); void Steam_ClientRunFrame(void); void Steam_InitClient(void); -int Steam_GSInitiateGameConnection(void *pData, int cbMaxData, uint64_t steamID, uint32_t unIPServer, uint16_t usPortServer, qboolean bSecure); -void Steam_GSTerminateGameConnection(uint32_t unIPServer, uint16_t usPortServer); +int Steam_GSInitiateGameConnection(void *pData, int cbMaxData, uint64 steamID, uint32 unIPServer, uint16 usPortServer, qboolean bSecure); +void Steam_GSTerminateGameConnection(uint32 unIPServer, uint16 usPortServer); void Steam_ShutdownClient(void); -uint64_t Steam_GSGetSteamID(void); +uint64 Steam_GSGetSteamID(void); qboolean Steam_GSBSecure(void); qboolean Steam_GSBLoggedOn(void); qboolean Steam_GSBSecurePreference(void); -TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64_t unSteamID); -uint64_t Steam_StringToSteamID(const char *pStr); +TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64 unSteamID); +uint64 Steam_StringToSteamID(const char *pStr); const char *Steam_GetGSUniverse(void); CSteam3Server *Steam3Server(void); CSteam3Client *Steam3Client(void); void Master_SetMaster_f(void); -void Steam_HandleIncomingPacket(byte *data, int len, int fromip, uint16_t port); +void Steam_HandleIncomingPacket(byte *data, int len, int fromip, uint16 port); #endif // SV_STEAM3_H diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 74f6ed7..2d7a2bd 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -142,7 +142,7 @@ void SV_ParseConsistencyResponse(client_t *pSenderClient) Q_memcpy(resbuffer, r->rguc_reserved, sizeof(resbuffer)); if (!Q_memcmp(resbuffer, nullbuffer, sizeof(resbuffer))) { - if (MSG_ReadBits(32) != *(uint32_t *)&r->rgucMD5_hash[0]) + if (MSG_ReadBits(32) != *(uint32 *)&r->rgucMD5_hash[0]) c = idx + 1; } else @@ -1660,7 +1660,7 @@ void SV_ParseCvarValue2(client_t *cl) Con_DPrintf("Cvar query response: name:%s, request ID %d, cvar:%s, value:%s\n", cl->name, requestID, cvarName, value); } -void SV_HandleClientMessage_api(IGameClient* client, int8_t opcode) { +void SV_HandleClientMessage_api(IGameClient* client, int8 opcode) { client_t* cl = client->GetClient(); if (opcode < clc_bad || opcode > clc_cvarvalue2) { diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index ccf78c5..9286884 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -215,7 +215,7 @@ enginefuncs_t g_engfuncsExportedToDlls; #ifdef _WIN32 void Sys_SetupFPUOptions() { - static uint8_t fpuOpts[32]; + static uint8 fpuOpts[32]; __asm { fnstenv byte ptr fpuOpts } fpuOpts[0] |= 0x3Fu; @@ -281,13 +281,13 @@ void __cdecl Sys_InitHardwareTimer() int g_SavedFPUCW1 = 0; __declspec(noinline) void Sys_FPUCW_Push_Prec64() { - uint16_t tmp = g_FPUCW_Mask_Prec_64Bit; + uint16 tmp = g_FPUCW_Mask_Prec_64Bit; __asm { fnstcw g_SavedFPUCW1 } __asm { fldcw tmp } } __declspec(noinline) void Sys_FPUCW_Pop_Prec64() { - uint16_t tmp = g_SavedFPUCW1; + uint16 tmp = g_SavedFPUCW1; __asm { fldcw tmp } } diff --git a/rehlds/engine/unicode_strtools.cpp b/rehlds/engine/unicode_strtools.cpp index 2ef3ca2..c049df8 100644 --- a/rehlds/engine/unicode_strtools.cpp +++ b/rehlds/engine/unicode_strtools.cpp @@ -45,11 +45,11 @@ qboolean Q_IsValidUChar32(uchar32 uVal) // as a single character, as if they were a correctly-encoded 4-byte UTF-8 sequence. int Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut) { - const uint8_t *pUTF8 = (const uint8_t *)pUTF8_; + const uint8 *pUTF8 = (const uint8 *)pUTF8_; int nBytes = 1; - uint32_t uValue = pUTF8[0]; - uint32_t uMinValue = 0; + uint32 uValue = pUTF8[0]; + uint32 uMinValue = 0; // 0....... single byte if (uValue < 0x80) @@ -105,9 +105,9 @@ decodeError: decodeFinishedMaybeCESU8: // Do we have a full UTF-16 surrogate pair that's been UTF-8 encoded afterwards? // That is, do we have 0xD800-0xDBFF followed by 0xDC00-0xDFFF? If so, decode it all. - if ((uValue - 0xD800u) < 0x400u && pUTF8[3] == 0xED && (uint8_t)(pUTF8[4] - 0xB0) < 0x10 && (pUTF8[5] & 0xC0) == 0x80) + if ((uValue - 0xD800u) < 0x400u && pUTF8[3] == 0xED && (uint8)(pUTF8[4] - 0xB0) < 0x10 && (pUTF8[5] & 0xC0) == 0x80) { - uValue = 0x10000 + ((uValue - 0xD800u) << 10) + ((uint8_t)(pUTF8[4] - 0xB0) << 6) + pUTF8[5] - 0x80; + uValue = 0x10000 + ((uValue - 0xD800u) << 10) + ((uint8)(pUTF8[4] - 0xB0) << 6) + pUTF8[5] - 0x80; nBytes = 6; uMinValue = 0x10000; } diff --git a/rehlds/hookers/memory.cpp b/rehlds/hookers/memory.cpp index 80824d1..ce48769 100644 --- a/rehlds/hookers/memory.cpp +++ b/rehlds/hookers/memory.cpp @@ -289,8 +289,8 @@ size_t HIDDEN FindSymbol(Module *module, const char* symbolName, int index) Elf32_Shdr *sections, *shstrtab_hdr, *symtab_hdr, *strtab_hdr; Elf32_Sym *symtab; const char *shstrtab, *strtab; - uint16_t section_count; - uint32_t symbol_count; + uint16 section_count; + uint32 symbol_count; size_t address; // If index > 0 then we shouldn't use dlsym, cos it will give wrong result @@ -334,7 +334,7 @@ size_t HIDDEN FindSymbol(Module *module, const char* symbolName, int index) shstrtab = (const char *)(map_base + shstrtab_hdr->sh_offset); // Iterate sections while looking for ELF symbol table and string table - for (uint16_t i = 0; i < section_count; i++) + for (uint16 i = 0; i < section_count; i++) { Elf32_Shdr &hdr = sections[i]; const char *section_name = shstrtab + hdr.sh_name; @@ -368,7 +368,7 @@ size_t HIDDEN FindSymbol(Module *module, const char* symbolName, int index) // Iterate symbol table int match = 1; - for (uint32_t i = 0; i < symbol_count; i++) + for (uint32 i = 0; i < symbol_count; i++) { Elf32_Sym &sym = symtab[i]; unsigned char sym_type = ELF32_ST_TYPE(sym.st_info); @@ -444,7 +444,7 @@ void ProcessModuleData(Module *module) return; } - module->codeSection.start = (uint32_t)module->base + CodeSection->VirtualAddress; + module->codeSection.start = (uint32)module->base + CodeSection->VirtualAddress; module->codeSection.size = CodeSection->Misc.VirtualSize; module->codeSection.end = module->codeSection.start + module->codeSection.size; module->codeSection.next = NULL; @@ -499,7 +499,7 @@ size_t HIDDEN ConvertHexString(const char *srcHexString, unsigned char *outBuffe unsigned char *out = outBuffer; unsigned char *end = outBuffer + bufferSize; bool low = false; - uint8_t byte = 0; + uint8 byte = 0; while (*in && out < end) { if (*in >= '0' && *in <= '9') { byte |= *in - '0'; } @@ -628,7 +628,7 @@ size_t HIDDEN MemoryFindBackward(size_t start, size_t end, const unsigned char * return NULL; } -size_t HIDDEN MemoryFindRefForwardPrefix8(size_t start, size_t end, size_t refAddress, uint8_t prefixValue, bool relative) +size_t HIDDEN MemoryFindRefForwardPrefix8(size_t start, size_t end, size_t refAddress, uint8 prefixValue, bool relative) { // Ensure start is lower than the end if (start > end) @@ -664,20 +664,20 @@ size_t HIDDEN MemoryFindRefForwardPrefix8(size_t start, size_t end, size_t refAd } // Replaces double word on specified address with a new dword, returns old dword -uint32_t HIDDEN HookDWord(size_t addr, uint32_t newDWord) +uint32 HIDDEN HookDWord(size_t addr, uint32 newDWord) { - uint32_t origDWord = *(size_t *)addr; - EnablePageWrite(addr, sizeof(uint32_t)); + uint32 origDWord = *(size_t *)addr; + EnablePageWrite(addr, sizeof(uint32)); *(size_t *)addr = newDWord; - RestorePageProtection(addr, sizeof(uint32_t)); + RestorePageProtection(addr, sizeof(uint32)); return origDWord; } // Exchanges bytes between memory address and bytes array -void HIDDEN ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32_t size) +void HIDDEN ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32 size) { EnablePageWrite(origAddr, size); unsigned char data[MAX_PATTERN]; - int32_t iSize = size; + int32 iSize = size; while (iSize > 0) { size_t s = iSize <= MAX_PATTERN ? iSize : MAX_PATTERN; @@ -753,9 +753,9 @@ bool HIDDEN FindDataRef(Module *module, AddressRef *ref) } #ifdef _WIN32 -void FindAllCalls(Section* section, CFuncAddr** calls, uint32_t findRefsTo) +void FindAllCalls(Section* section, CFuncAddr** calls, uint32 findRefsTo) { - uint32_t coderef_addr = section->start; + uint32 coderef_addr = section->start; coderef_addr = MemoryFindRefForwardPrefix8(coderef_addr, section->end, findRefsTo, 0xE8, true); while (coderef_addr) { CFuncAddr* cfa = new CFuncAddr(coderef_addr); diff --git a/rehlds/hookers/memory.h b/rehlds/hookers/memory.h index 5401b95..56b88e1 100644 --- a/rehlds/hookers/memory.h +++ b/rehlds/hookers/memory.h @@ -90,7 +90,7 @@ struct AddressRef class CFuncAddr { public: - uint32_t Addr; + uint32 Addr; CFuncAddr *Next; void *operator new(size_t size){ @@ -101,7 +101,7 @@ public: free(cPoint); } - CFuncAddr(uint32_t addr) { + CFuncAddr(uint32 addr) { Addr = addr; Next = NULL; } @@ -122,10 +122,10 @@ void ProcessModuleData(Module *module); size_t ConvertHexString(const char *srcHexString, unsigned char *outBuffer, size_t bufferSize); size_t MemoryFindForward(size_t start, size_t end, const unsigned char *pattern, const unsigned char *mask, size_t len); size_t MemoryFindBackward(size_t start, size_t end, const unsigned char *pattern, const unsigned char *mask, size_t len); -size_t MemoryFindRefForwardPrefix8(size_t start, size_t end, size_t refAddress, uint8_t prefixValue, bool relative); +size_t MemoryFindRefForwardPrefix8(size_t start, size_t end, size_t refAddress, uint8 prefixValue, bool relative); -uint32_t HookDWord(size_t addr, uint32_t newDWord); -void ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32_t size); +uint32 HookDWord(size_t addr, uint32 newDWord); +void ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32 size); bool GetAddress(Module *module, Address *addr, size_t baseOffset); bool HookFunction(Module *module, FunctionHook *hook); @@ -133,7 +133,7 @@ void HookFunctionCall(void* hookWhat, void* hookAddr); bool HIDDEN FindDataRef(Module *module, AddressRef *ref); #ifdef _WIN32 -void FindAllCalls(Section* section, CFuncAddr** calls, uint32_t findRefsTo); +void FindAllCalls(Section* section, CFuncAddr** calls, uint32 findRefsTo); #endif // _WIN32 #endif // _MEMORY_H diff --git a/rehlds/hookers/rehlds_debug.cpp b/rehlds/hookers/rehlds_debug.cpp index c302772..0b8b8b8 100644 --- a/rehlds/hookers/rehlds_debug.cpp +++ b/rehlds/hookers/rehlds_debug.cpp @@ -2,12 +2,12 @@ #define REHLDS_DEBUG_MAX_EDICTS 2048 -uint32_t calcFloatChecksum(uint32_t crc, const float* pFloat) { - uint32_t sVal = *reinterpret_cast(pFloat); +uint32 calcFloatChecksum(uint32 crc, const float* pFloat) { + uint32 sVal = *reinterpret_cast(pFloat); return _mm_crc32_u32(crc, sVal); } -uint32_t calcVec3Checksum(uint32_t crc, const vec_t* v) +uint32 calcVec3Checksum(uint32 crc, const vec_t* v) { crc = calcFloatChecksum(crc, v); crc = calcFloatChecksum(crc, v + 1); @@ -15,7 +15,7 @@ uint32_t calcVec3Checksum(uint32_t crc, const vec_t* v) return crc; } -uint32_t calcEdictRefChecksum(uint32_t crc, edict_t* ed) { +uint32 calcEdictRefChecksum(uint32 crc, edict_t* ed) { if (ed == NULL) { return _mm_crc32_u32(crc, -1); } @@ -23,7 +23,7 @@ uint32_t calcEdictRefChecksum(uint32_t crc, edict_t* ed) { return _mm_crc32_u32(crc, ed - g_psv.edicts); } -uint32_t calcEngStringChecksum(uint32_t crc, int str) { +uint32 calcEngStringChecksum(uint32 crc, int str) { if (str == 0) { return _mm_crc32_u8(crc, 0); } @@ -39,7 +39,7 @@ uint32_t calcEngStringChecksum(uint32_t crc, int str) { return crc; } -uint32_t calcEntvarsChecksum(uint32_t crc, const entvars_t* ev) { +uint32 calcEntvarsChecksum(uint32 crc, const entvars_t* ev) { crc = calcEngStringChecksum(crc, ev->classname); crc = calcEngStringChecksum(crc, ev->globalname); @@ -98,8 +98,8 @@ uint32_t calcEntvarsChecksum(uint32_t crc, const entvars_t* ev) { crc = calcFloatChecksum(crc, &ev->frame); crc = calcFloatChecksum(crc, &ev->animtime); crc = calcFloatChecksum(crc, &ev->framerate); - crc = _mm_crc32_u32(crc, *(uint32_t*)&ev->controller[0]); - crc = _mm_crc32_u16(crc, *(uint16_t*)&ev->blending[0]); + crc = _mm_crc32_u32(crc, *(uint32*)&ev->controller[0]); + crc = _mm_crc32_u16(crc, *(uint16*)&ev->blending[0]); crc = calcFloatChecksum(crc, &ev->scale); @@ -175,7 +175,7 @@ uint32_t calcEntvarsChecksum(uint32_t crc, const entvars_t* ev) { return crc; } -uint32_t calcEdictChecksum(uint32_t crc, const edict_t* ed) { +uint32 calcEdictChecksum(uint32 crc, const edict_t* ed) { crc = _mm_crc32_u32(crc, ed->free); if (ed->free) return crc; @@ -192,7 +192,7 @@ uint32_t calcEdictChecksum(uint32_t crc, const edict_t* ed) { } void PrintFloat(const float* pVal, std::stringstream &ss) { - uint32_t sVal = *reinterpret_cast(pVal); + uint32 sVal = *reinterpret_cast(pVal); ss << "{ float: " << *pVal << "; raw: " << std::hex << sVal << " }"; } @@ -237,7 +237,7 @@ void PrintTrace(trace_t* trace, std::stringstream &ss) if (trace->ent == NULL) ss << "NULL"; else - ss << (uint32_t)(trace->ent - g_psv.edicts); + ss << (uint32)(trace->ent - g_psv.edicts); ss << "; fraction: "; PrintFloat(&trace->fraction, ss); ss << "; endpos: "; PrintVec3(trace->endpos, ss); @@ -260,7 +260,7 @@ void PrintEdict(edict_t* ent, std::stringstream &ss, int flags) } ss << "{" - << " id: " << (uint32_t)(ent - g_psv.edicts); + << " id: " << (uint32)(ent - g_psv.edicts); if (flags & ED_PRINT_POSITION) { ss << "; origin: "; PrintVec3(ent->v.origin, ss); @@ -297,7 +297,7 @@ int __cdecl SV_PushRotate_hooked(edict_t *pusher, float movetime) ss << "; movetime: "; PrintFloat(&movetime, ss); ss << " )"; - uint32_t entCheckSums[REHLDS_DEBUG_MAX_EDICTS]; + uint32 entCheckSums[REHLDS_DEBUG_MAX_EDICTS]; for (int i = 0; i < g_psv.num_edicts; i++) entCheckSums[i] = calcEdictChecksum(0, &g_psv.edicts[i]); @@ -314,7 +314,7 @@ int __cdecl SV_PushRotate_hooked(edict_t *pusher, float movetime) ess << " chanedEdicts: [ "; for (int i = 0; i < g_psv.num_edicts; i++) { - uint32_t newCrc = calcEdictChecksum(0, &g_psv.edicts[i]); + uint32 newCrc = calcEdictChecksum(0, &g_psv.edicts[i]); if (newCrc != entCheckSums[i]) { ess << " { " << i << ": " << entCheckSums[i] << " -> " << newCrc; if (65097 == currentCallID) { @@ -387,7 +387,7 @@ void __cdecl SV_SingleClipMoveToEntity_hooked(edict_t *ent, const vec_t *start, if (ent == NULL) ss << "NULL"; else - ss << (uint32_t)(ent - g_psv.edicts); + ss << (uint32)(ent - g_psv.edicts); ss << "; start: "; PrintVec3(start, ss); ss << "; mins: "; PrintVec3(mins, ss); diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index 5855d57..9addf4f 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -65,6 +65,7 @@ + @@ -115,10 +116,37 @@ false - + + true + true + true + true + true + true + true + true + - - + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + @@ -349,7 +377,6 @@ - diff --git a/rehlds/msvc/ReHLDS.vcxproj.filters b/rehlds/msvc/ReHLDS.vcxproj.filters index f527489..b5eb9bd 100644 --- a/rehlds/msvc/ReHLDS.vcxproj.filters +++ b/rehlds/msvc/ReHLDS.vcxproj.filters @@ -319,6 +319,9 @@ rehlds + + engine + @@ -522,9 +525,6 @@ engine\common - - public - public diff --git a/rehlds/public/archtypes.h b/rehlds/public/archtypes.h deleted file mode 100644 index deb438f..0000000 --- a/rehlds/public/archtypes.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Word size dependent definitions -// DAL 1/03 -// -#ifndef ARCHTYPES_H -#define ARCHTYPES_H - -#include "steam/steamtypes.h" - -#ifndef _WIN32 -#define MAX_PATH PATH_MAX -#include -#include -#include -#include -#define _S_IREAD S_IREAD -#define _S_IWRITE S_IWRITE -typedef long unsigned int ulong; -#endif - -#endif // ARCHTYPES_H diff --git a/rehlds/public/interface.cpp b/rehlds/public/interface.cpp index bb7a19e..440e719 100644 --- a/rehlds/public/interface.cpp +++ b/rehlds/public/interface.cpp @@ -1,4 +1,4 @@ -#include "precompiled.h" +#include "interface.h" #if !defined ( _WIN32 ) diff --git a/rehlds/public/rehlds/FlightRecorder.h b/rehlds/public/rehlds/FlightRecorder.h index a5852e7..19f5c65 100644 --- a/rehlds/public/rehlds/FlightRecorder.h +++ b/rehlds/public/rehlds/FlightRecorder.h @@ -27,29 +27,29 @@ */ #pragma once -#include "osconfig.h" +#include "archtypes.h" class IRehldsFlightRecorder { public: virtual ~IRehldsFlightRecorder() { } - virtual uint16_t RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) = 0; + virtual uint16 RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) = 0; - virtual void StartMessage(uint16_t msg, bool entrance) = 0; - virtual void EndMessage(uint16_t msg, bool entrance) = 0; + virtual void StartMessage(uint16 msg, bool entrance) = 0; + virtual void EndMessage(uint16 msg, bool entrance) = 0; - virtual void WriteInt8(int8_t v) = 0; - virtual void WriteUInt8(uint8_t v) = 0; + virtual void WriteInt8(int8 v) = 0; + virtual void WriteUInt8(uint8 v) = 0; - virtual void WriteInt16(int16_t v) = 0; - virtual void WriteUInt16(uint16_t v) = 0; + virtual void WriteInt16(int16 v) = 0; + virtual void WriteUInt16(uint16 v) = 0; - virtual void WriteInt32(int32_t v) = 0; - virtual void WriteUInt32(uint32_t v) = 0; + virtual void WriteInt32(int32 v) = 0; + virtual void WriteUInt32(uint32 v) = 0; - virtual void WriteInt64(int64_t v) = 0; - virtual void WriteUInt64(uint64_t v) = 0; + virtual void WriteInt64(int64 v) = 0; + virtual void WriteUInt64(uint64 v) = 0; virtual void WriteFloat(float v) = 0; virtual void WriteDouble(double v) = 0; diff --git a/rehlds/public/rehlds/archtypes.h b/rehlds/public/rehlds/archtypes.h index 7e6210b..f3f6a71 100644 --- a/rehlds/public/rehlds/archtypes.h +++ b/rehlds/public/rehlds/archtypes.h @@ -33,6 +33,8 @@ #if defined( _WIN32 ) && (! defined( __MINGW32__ )) +typedef __int8 int8; +typedef unsigned __int8 uint8; typedef __int16 int16; typedef unsigned __int16 uint16; typedef __int32 int32; @@ -43,7 +45,8 @@ typedef __int32 intp; // intp is an integer that can accomodate a pointer typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) #else /* _WIN32 */ - +typedef char int8; +typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; typedef int int32; diff --git a/rehlds/public/rehlds/cmd_rehlds.h b/rehlds/public/rehlds/cmd_rehlds.h index abab94a..33d167a 100644 --- a/rehlds/public/rehlds/cmd_rehlds.h +++ b/rehlds/public/rehlds/cmd_rehlds.h @@ -27,7 +27,7 @@ */ #pragma once -#include "maintypes.h" +#include "archtypes.h" /* <8f1> ../engine/cmd.h:65 */ typedef void(*xcommand_t)(void); diff --git a/rehlds/public/rehlds/common_rehlds.h b/rehlds/public/rehlds/common_rehlds.h index 52dce23..b2cf597 100644 --- a/rehlds/public/rehlds/common_rehlds.h +++ b/rehlds/public/rehlds/common_rehlds.h @@ -27,7 +27,7 @@ */ #pragma once -#include "maintypes.h" +#include "const.h" #define COM_TOKEN_LEN 1024 @@ -46,7 +46,7 @@ typedef struct sizebuf_s { const char *buffername; - uint16_t flags; + uint16 flags; byte *data; int maxsize; int cursize; diff --git a/rehlds/public/rehlds/crc32.cpp b/rehlds/public/rehlds/crc32.cpp index d3840d3..4c6e12e 100644 --- a/rehlds/public/rehlds/crc32.cpp +++ b/rehlds/public/rehlds/crc32.cpp @@ -41,9 +41,10 @@ /* polynomial $edb88320 */ /* */ /* -------------------------------------------------------------------- */ -#include "precompiled.h" +#include "crc32.h" +#include "sys_shared.h" -static uint32_t crc32_tab[] = { +static uint32 crc32_tab[] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, @@ -100,24 +101,24 @@ static uint32_t crc32_tab[] = { }; -uint32_t NOINLINE crc32_t_nosse(uint32_t iCRC, const uint8_t *s, unsigned int len) { - uint32_t crc32val = iCRC; +uint32 crc32_t_nosse(uint32 iCRC, const uint8 *s, unsigned int len) { + uint32 crc32val = iCRC; for (unsigned int i = 0; i < len; i++) { crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8); } return crc32val; } -uint32_t crc32_t(uint32_t iCRC, const uint8_t *s, unsigned int len) { +uint32 crc32_t(uint32 iCRC, const uint8 *s, unsigned int len) { if (!g_HasSSE42) { return crc32_t_nosse(iCRC, s, len); } - uint32_t crc32val = iCRC; + uint32 crc32val = iCRC; unsigned int i = 0; for (; i < (len >> 2); i += 4) { - crc32val = _mm_crc32_u32(crc32val, *(uint32_t*)&s[i]); + crc32val = _mm_crc32_u32(crc32val, *(uint32*)&s[i]); } for (; i < len; i++) { @@ -127,6 +128,6 @@ uint32_t crc32_t(uint32_t iCRC, const uint8_t *s, unsigned int len) { return crc32val; } -uint32_t crc32(const uint8_t *buf, unsigned int len) { +uint32 crc32(const uint8 *buf, unsigned int len) { return crc32_t(0, buf, len); } diff --git a/rehlds/public/rehlds/crc32.h b/rehlds/public/rehlds/crc32.h index 58abf4d..58e9030 100644 --- a/rehlds/public/rehlds/crc32.h +++ b/rehlds/public/rehlds/crc32.h @@ -12,10 +12,10 @@ */ #pragma once -#include "osconfig.h" +#include "archtypes.h" /* This computes a 32 bit CRC of the data in the buffer, and returns the CRC. The polynomial used is 0xedb88320. */ -uint32_t crc32(const uint8_t *buf, unsigned int len); -uint32_t crc32_t(uint32_t iCRC, const uint8_t *s, unsigned int len); +uint32 crc32(const uint8 *buf, unsigned int len); +uint32 crc32_t(uint32 iCRC, const uint8 *s, unsigned int len); diff --git a/rehlds/public/rehlds/eiface.h b/rehlds/public/rehlds/eiface.h index f34cd95..60266ec 100644 --- a/rehlds/public/rehlds/eiface.h +++ b/rehlds/public/rehlds/eiface.h @@ -105,13 +105,13 @@ typedef struct // Engine hands this to DLLs for functionality callbacks typedef struct enginefuncs_s { - int (*pfnPrecacheModel) (char* s); - int (*pfnPrecacheSound) (char* s); + int (*pfnPrecacheModel) (const char* s); + int (*pfnPrecacheSound) (const char* s); void (*pfnSetModel) (edict_t *e, const char *m); int (*pfnModelIndex) (const char *m); int (*pfnModelFrames) (int modelIndex); void (*pfnSetSize) (edict_t *e, const float *rgflMin, const float *rgflMax); - void (*pfnChangeLevel) (char* s1, char* s2); + void (*pfnChangeLevel) (const char* s1, const char* s2); void (*pfnGetSpawnParms) (edict_t *ent); void (*pfnSaveSpawnParms) (edict_t *ent); float (*pfnVecToYaw) (const float *rgflVector); @@ -212,9 +212,9 @@ typedef struct enginefuncs_s void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); int (*pfnNumberOfEntities) (void); char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo - char* (*pfnInfoKeyValue) (char *infobuffer, char *key); - void (*pfnSetKeyValue) (char *infobuffer, char *key, char *value); - void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char *key, char *value); + char* (*pfnInfoKeyValue) (char *infobuffer, const char *key); + void (*pfnSetKeyValue) (char *infobuffer, const char *key, const char *value); + void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, const char *key, const char *value); int (*pfnIsMapValid) (char *filename); void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); int (*pfnPrecacheGeneric) (char* s); @@ -249,7 +249,7 @@ typedef struct enginefuncs_s void (*pfnSetGroupMask) ( int mask, int op ); int (*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline ); - void (*pfnCvar_DirectSet) ( struct cvar_s *var, char *value ); + void (*pfnCvar_DirectSet) ( struct cvar_s *var, const char *value ); // Forces the client and server to be running with the same version of the specified file // ( e.g., a player model ). diff --git a/rehlds/public/rehlds/maintypes.h b/rehlds/public/rehlds/maintypes.h index 6a7fa96..131a18c 100644 --- a/rehlds/public/rehlds/maintypes.h +++ b/rehlds/public/rehlds/maintypes.h @@ -49,10 +49,4 @@ typedef unsigned int string_t; // from engine's pr_comp.h; -#ifndef __cplusplus - typedef enum { false, true } qboolean; -#else - typedef int qboolean; -#endif - #endif // MAINTYPES_H diff --git a/rehlds/public/rehlds/osconfig.h b/rehlds/public/rehlds/osconfig.h index 91c69e2..08a2273 100644 --- a/rehlds/public/rehlds/osconfig.h +++ b/rehlds/public/rehlds/osconfig.h @@ -85,34 +85,6 @@ #include #include -#ifdef _WIN32 // WINDOWS -#ifndef _STDINT - typedef unsigned __int64 uint64_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int8 uint8_t; - - typedef __int64 int64_t; - typedef __int32 int32_t; - typedef __int16 int16_t; - typedef __int8 int8_t; -#endif -#else // _WIN32 - typedef unsigned long long uint64_t; - typedef unsigned int uint32_t; - typedef unsigned short uint16_t; - typedef unsigned char uint8_t; - - #ifndef __int8_t_defined - typedef long long int64_t; - typedef int int32_t; - typedef short int16_t; - typedef char int8_t; - #endif - - typedef unsigned char byte; -#endif // _WIN32 - #ifdef _WIN32 // WINDOWS #define _CRT_SECURE_NO_WARNINGS #define WIN32_LEAN_AND_MEAN diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 729e772..8930a8c 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -26,7 +26,7 @@ * */ #pragma once -#include "maintypes.h" +#include "archtypes.h" #include "cmd_rehlds.h" #include "rehlds_interfaces.h" #include "hookchains.h" @@ -62,8 +62,8 @@ typedef IVoidHookChain IRehldsHook_SVC_GetChallenge_mod; typedef IVoidHookChainRegistry IRehldsHookRegistry_SVC_GetChallenge_mod; //SV_CheckKeyInfo hook -typedef IHookChain IRehldsHook_SV_CheckKeyInfo; -typedef IHookChainRegistry IRehldsHookRegistry_SV_CheckKeyInfo; +typedef IHookChain IRehldsHook_SV_CheckKeyInfo; +typedef IHookChainRegistry IRehldsHookRegistry_SV_CheckKeyInfo; //SV_CheckIPRestrictions hook typedef IHookChain IRehldsHook_SV_CheckIPRestrictions; @@ -90,8 +90,8 @@ typedef IVoidHookChain IRehldsHook_Steam_NotifyClientDisconnect; typedef IVoidHookChainRegistry IRehldsHookRegistry_Steam_NotifyClientDisconnect; //PreProcessPacket -typedef IHookChain IRehldsHook_PreprocessPacket; -typedef IHookChainRegistry IRehldsHookRegistry_PreprocessPacket; +typedef IHookChain IRehldsHook_PreprocessPacket; +typedef IHookChainRegistry IRehldsHookRegistry_PreprocessPacket; //ValidateCommand typedef IHookChain IRehldsHook_ValidateCommand; @@ -102,8 +102,8 @@ typedef IVoidHookChain IRehldsHook_ClientConnected; typedef IVoidHookChainRegistry IRehldsHookRegistry_ClientConnected; //HandleNetCommand -typedef IVoidHookChain IRehldsHook_HandleNetCommand; -typedef IVoidHookChainRegistry IRehldsHookRegistry_HandleNetCommand; +typedef IVoidHookChain IRehldsHook_HandleNetCommand; +typedef IVoidHookChainRegistry IRehldsHookRegistry_HandleNetCommand; //Mod_LoadBrushModel typedef IVoidHookChain IRehldsHook_Mod_LoadBrushModel; diff --git a/rehlds/public/rehlds/rehlds_interfaces.h b/rehlds/public/rehlds/rehlds_interfaces.h index 063e8c2..f5bbfa5 100644 --- a/rehlds/public/rehlds/rehlds_interfaces.h +++ b/rehlds/public/rehlds/rehlds_interfaces.h @@ -30,7 +30,7 @@ class INetChan; class IGameClient; -#include "maintypes.h" +#include "archtypes.h" #include "const.h" #include "netadr.h" @@ -100,6 +100,6 @@ public: virtual const char* GetModelName() = 0; virtual const char* GetName() = 0; - virtual uint32_t GetWorldmapCrc() = 0; - virtual uint8_t* GetClientDllMd5() = 0; + virtual uint32 GetWorldmapCrc() = 0; + virtual uint8* GetClientDllMd5() = 0; }; diff --git a/rehlds/public/rehlds/static_map.h b/rehlds/public/rehlds/static_map.h index 9d57196..bc6662a 100644 --- a/rehlds/public/rehlds/static_map.h +++ b/rehlds/public/rehlds/static_map.h @@ -1,12 +1,12 @@ #pragma once -#include "osconfig.h" +#include "archtypes.h" #include "crc32.h" template class CStaticMap { protected: - virtual uint32_t hash(const T_KEY& val) { + virtual uint32 hash(const T_KEY& val) { return crc32((const unsigned char*)&val, sizeof(T_KEY)); } diff --git a/rehlds/public/rehlds/studio.h b/rehlds/public/rehlds/studio.h index efecde2..5c0ec15 100644 --- a/rehlds/public/rehlds/studio.h +++ b/rehlds/public/rehlds/studio.h @@ -141,7 +141,7 @@ typedef struct { char label[32]; // textual name char name[64]; // file name - int32_t unused1; // was "cache" - index pointer + int32 unused1; // was "cache" - index pointer int unused2; // was "data" - hack for group 0 } mstudioseqgroup_t; diff --git a/rehlds/public/rehlds/sys_shared.cpp b/rehlds/public/rehlds/sys_shared.cpp index 95d80d6..aad58e8 100644 --- a/rehlds/public/rehlds/sys_shared.cpp +++ b/rehlds/public/rehlds/sys_shared.cpp @@ -25,7 +25,7 @@ * version. * */ -#include "precompiled.h" +#include "sys_shared.h" bool Sys_ChechSSE42Support(); diff --git a/rehlds/public/rehlds/sys_shared.h b/rehlds/public/rehlds/sys_shared.h index a5574d4..8187370 100644 --- a/rehlds/public/rehlds/sys_shared.h +++ b/rehlds/public/rehlds/sys_shared.h @@ -26,6 +26,5 @@ * */ #pragma once -#include "maintypes.h" extern bool g_HasSSE42; diff --git a/rehlds/public/rehlds/userid_rehlds.h b/rehlds/public/rehlds/userid_rehlds.h index 63161b9..cd3ddc4 100644 --- a/rehlds/public/rehlds/userid_rehlds.h +++ b/rehlds/public/rehlds/userid_rehlds.h @@ -27,13 +27,13 @@ */ #pragma once -#include "maintypes.h" +#include "archtypes.h" /* <2e915> ../engine/userid.h:22 */ typedef struct USERID_s { int idtype; - uint64_t m_SteamID; + uint64 m_SteamID; unsigned int clientip; } USERID_t; diff --git a/rehlds/public/steam/isteamutils.h b/rehlds/public/steam/isteamutils.h index d0bf2c6..a2616e7 100644 --- a/rehlds/public/steam/isteamutils.h +++ b/rehlds/public/steam/isteamutils.h @@ -139,7 +139,7 @@ public: #endif #ifdef _PS3 - virtual void PostPS3SysutilCallback( uint64_t status, uint64_t param, void* userdata ) = 0; + virtual void PostPS3SysutilCallback( uint64 status, uint64 param, void* userdata ) = 0; virtual bool BIsReadyToShutdown() = 0; virtual bool BIsPSNOnline() = 0; diff --git a/rehlds/public/steam/steamtypes.h b/rehlds/public/steam/steamtypes.h index 6b6bc26..519c7d3 100644 --- a/rehlds/public/steam/steamtypes.h +++ b/rehlds/public/steam/steamtypes.h @@ -31,18 +31,8 @@ typedef unsigned char uint8; #define VALVE_BIG_ENDIAN #endif -typedef unsigned char uint8; -typedef signed char int8; - #if defined( _WIN32 ) -typedef __int16 int16; -typedef unsigned __int16 uint16; -typedef __int32 int32; -typedef unsigned __int32 uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; - #ifdef X64BITS typedef __int64 intp; // intp is an integer that can accomodate a pointer typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) @@ -53,12 +43,6 @@ typedef unsigned __int32 uintp; #else // _WIN32 -typedef short int16; -typedef unsigned short uint16; -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; #ifdef X64BITS typedef long long intp; typedef unsigned long long uintp; diff --git a/rehlds/public/tier0/platform.h b/rehlds/public/tier0/platform.h index 0f1910b..dbf6c10 100644 --- a/rehlds/public/tier0/platform.h +++ b/rehlds/public/tier0/platform.h @@ -27,28 +27,7 @@ // need this for memset #include -// for when we care about how many bits we use -typedef signed char int8; -typedef signed short int16; - -#ifdef _WIN32 -#ifdef _MSC_VER -typedef signed __int64 int64; -#endif -#elif defined __linux__ -typedef long long int64; -#endif - -typedef unsigned char uint8; -typedef unsigned short uint16; -#ifdef _WIN32 -#ifdef _MSC_VER -typedef unsigned __int64 uint64; -#endif -#elif defined __linux__ -typedef unsigned long long uint64; -#endif - +#include "archtypes.h" typedef float float32; typedef double float64; diff --git a/rehlds/rehlds/FlightRecorderImpl.cpp b/rehlds/rehlds/FlightRecorderImpl.cpp index e1af095..d8bdc3f 100644 --- a/rehlds/rehlds/FlightRecorderImpl.cpp +++ b/rehlds/rehlds/FlightRecorderImpl.cpp @@ -18,8 +18,8 @@ #include "precompiled.h" CRehldsFlightRecorder::CRehldsFlightRecorder() { - m_MetaRegionPtr = (uint8_t*) sys_allocmem(META_REGION_SIZE); - m_DataRegionPtr = (uint8_t*) sys_allocmem(DATA_REGION_SIZE); + m_MetaRegionPtr = (uint8*) sys_allocmem(META_REGION_SIZE); + m_DataRegionPtr = (uint8*) sys_allocmem(DATA_REGION_SIZE); if (!m_MetaRegionPtr || !m_DataRegionPtr) { rehlds_syserror("%s: direct allocation failed", __FUNCTION__); @@ -82,7 +82,7 @@ void CRehldsFlightRecorder::MoveToStart() { } } -void CRehldsFlightRecorder::StartMessage(uint16_t msg, bool entrance) { +void CRehldsFlightRecorder::StartMessage(uint16 msg, bool entrance) { if (msg == 0 || msg > m_pMetaHeader->numMessages) { rehlds_syserror("%s: Invalid message id %u", __FUNCTION__, msg); } @@ -104,11 +104,11 @@ void CRehldsFlightRecorder::StartMessage(uint16_t msg, bool entrance) { m_pRecorderState->curMessage = msg; m_pRecorderState->lastMsgBeginPos = m_pRecorderState->wpos; - *(uint16_t*)(m_DataRegionPtr + m_pRecorderState->wpos) = msg; + *(uint16*)(m_DataRegionPtr + m_pRecorderState->wpos) = msg; m_pRecorderState->wpos += 2; } -void CRehldsFlightRecorder::EndMessage(uint16_t msg, bool entrance) { +void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) { if (entrance) { msg = msg | 0x8000; } @@ -126,7 +126,7 @@ void CRehldsFlightRecorder::EndMessage(uint16_t msg, bool entrance) { if (msgSize > MSG_MAX_SIZE) { rehlds_syserror("%s: too big message %u; size%u", __FUNCTION__, msg, msgSize); } - *(uint16_t*)(m_DataRegionPtr + m_pRecorderState->wpos) = msgSize; + *(uint16*)(m_DataRegionPtr + m_pRecorderState->wpos) = msgSize; m_pRecorderState->wpos += 2; m_pRecorderState->curMessage = 0; @@ -158,36 +158,36 @@ void CRehldsFlightRecorder::WriteString(const char* s) { WriteBuffer(s, strlen(s) + 1); } -void CRehldsFlightRecorder::WriteInt8(int8_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteInt8(int8 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteUInt8(uint8_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteUInt8(uint8 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteInt16(int16_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteInt16(int16 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteUInt16(uint16_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteUInt16(uint16 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteInt32(int32_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteInt32(int32 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteUInt32(uint32_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteUInt32(uint32 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteInt64(int64_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteInt64(int64 v) { + WritePrimitive(v); } -void CRehldsFlightRecorder::WriteUInt64(uint64_t v) { - WritePrimitive(v); +void CRehldsFlightRecorder::WriteUInt64(uint64 v) { + WritePrimitive(v); } void CRehldsFlightRecorder::WriteFloat(float v) { @@ -198,12 +198,12 @@ void CRehldsFlightRecorder::WriteDouble(double v) { WritePrimitive(v); } -uint16_t CRehldsFlightRecorder::RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) { +uint16 CRehldsFlightRecorder::RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut) { if (m_pMetaHeader->numMessages >= MSG_MAX_ID) { rehlds_syserror("%s: can't register message; limit exceeded", __FUNCTION__); } - uint16_t msgId = ++m_pMetaHeader->numMessages; + uint16 msgId = ++m_pMetaHeader->numMessages; sizebuf_t sb; sb.buffername = "FlightRecorded Meta"; diff --git a/rehlds/rehlds/FlightRecorderImpl.h b/rehlds/rehlds/FlightRecorderImpl.h index 514d7c3..ec9aea4 100644 --- a/rehlds/rehlds/FlightRecorderImpl.h +++ b/rehlds/rehlds/FlightRecorderImpl.h @@ -40,7 +40,7 @@ private: struct recorder_state { unsigned int wpos; unsigned int lastMsgBeginPos; - uint16_t curMessage; + uint16 curMessage; }; struct meta_header { @@ -55,8 +55,8 @@ private: }; #pragma pack(pop) - uint8_t* m_MetaRegionPtr; - uint8_t* m_DataRegionPtr; + uint8* m_MetaRegionPtr; + uint8* m_DataRegionPtr; meta_header* m_pMetaHeader; recorder_state* m_pRecorderState; data_header* m_pDataHeader; @@ -85,20 +85,20 @@ private: public: CRehldsFlightRecorder(); - virtual void StartMessage(uint16_t msg, bool entrance); - virtual void EndMessage(uint16_t msg, bool entrance); + virtual void StartMessage(uint16 msg, bool entrance); + virtual void EndMessage(uint16 msg, bool entrance); - virtual void WriteInt8(int8_t v); - virtual void WriteUInt8(uint8_t v); + virtual void WriteInt8(int8 v); + virtual void WriteUInt8(uint8 v); - virtual void WriteInt16(int16_t v); - virtual void WriteUInt16(uint16_t v); + virtual void WriteInt16(int16 v); + virtual void WriteUInt16(uint16 v); - virtual void WriteInt32(int32_t v); - virtual void WriteUInt32(uint32_t v); + virtual void WriteInt32(int32 v); + virtual void WriteUInt32(uint32 v); - virtual void WriteInt64(int64_t v); - virtual void WriteUInt64(uint64_t v); + virtual void WriteInt64(int64 v); + virtual void WriteUInt64(uint64 v); virtual void WriteFloat(float v); virtual void WriteDouble(double v); @@ -106,5 +106,5 @@ public: virtual void WriteBuffer(const void* data, unsigned int len); virtual void WriteString(const char* s); - virtual uint16_t RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut); + virtual uint16 RegisterMessage(const char* module, const char *message, unsigned int version, bool inOut); }; diff --git a/rehlds/rehlds/flight_recorder.cpp b/rehlds/rehlds/flight_recorder.cpp index d86ffbe..ac7ee71 100644 --- a/rehlds/rehlds/flight_recorder.cpp +++ b/rehlds/rehlds/flight_recorder.cpp @@ -19,9 +19,9 @@ CRehldsFlightRecorder* g_FlightRecorder; -uint16_t g_FRMsg_Frame; -uint16_t g_FRMsg_FreeEntPrivateData; -uint16_t g_FRMsg_AllocEntPrivateData; +uint16 g_FRMsg_Frame; +uint16 g_FRMsg_FreeEntPrivateData; +uint16 g_FRMsg_AllocEntPrivateData; void FR_Init() { diff --git a/rehlds/rehlds/flight_recorder.h b/rehlds/rehlds/flight_recorder.h index 87c9423..5ee2c12 100644 --- a/rehlds/rehlds/flight_recorder.h +++ b/rehlds/rehlds/flight_recorder.h @@ -21,9 +21,9 @@ extern CRehldsFlightRecorder* g_FlightRecorder; -extern uint16_t g_FRMsg_Frame; -extern uint16_t g_FRMsg_FreeEntPrivateData; -extern uint16_t g_FRMsg_AllocEntPrivateData; +extern uint16 g_FRMsg_Frame; +extern uint16 g_FRMsg_FreeEntPrivateData; +extern uint16 g_FRMsg_AllocEntPrivateData; extern void FR_Init(); diff --git a/rehlds/rehlds/platform.cpp b/rehlds/rehlds/platform.cpp index 0d9d24f..9420ae2 100644 --- a/rehlds/rehlds/platform.cpp +++ b/rehlds/rehlds/platform.cpp @@ -23,21 +23,21 @@ CSimplePlatform::CSimplePlatform() { #endif } -uint32_t CSimplePlatform::time(uint32_t* pTime) +uint32 CSimplePlatform::time(uint32* pTime) { time_t res = ::time((time_t*)NULL); - if (pTime != NULL) *pTime = (uint32_t)res; + if (pTime != NULL) *pTime = (uint32)res; - return (uint32_t) res; + return (uint32) res; } -struct tm* CSimplePlatform::localtime(uint32_t time) +struct tm* CSimplePlatform::localtime(uint32 time) { time_t theTime = (time_t)time; return ::localtime(&theTime); } -void CSimplePlatform::srand(uint32_t seed) +void CSimplePlatform::srand(uint32 seed) { return ::srand(seed); } diff --git a/rehlds/rehlds/platform.h b/rehlds/rehlds/platform.h index fd53707..d9543dc 100644 --- a/rehlds/rehlds/platform.h +++ b/rehlds/rehlds/platform.h @@ -10,9 +10,9 @@ typedef int(__stdcall *setsockopt_proto)(SOCKET s, int level, int optname, const class IReHLDSPlatform { public: - virtual uint32_t time(uint32_t* pTime) = 0; - virtual struct tm* localtime(uint32_t time) = 0; - virtual void srand(uint32_t seed) = 0; + virtual uint32 time(uint32* pTime) = 0; + virtual struct tm* localtime(uint32 time) = 0; + virtual void srand(uint32 seed) = 0; virtual int rand() = 0; #ifdef _WIN32 @@ -65,9 +65,9 @@ private: public: CSimplePlatform(); - virtual uint32_t time(uint32_t* pTime); - virtual struct tm* localtime(uint32_t time); - virtual void srand(uint32_t seed); + virtual uint32 time(uint32* pTime); + virtual struct tm* localtime(uint32 time); + virtual void srand(uint32 seed); virtual int rand(); #ifdef _WIN32 diff --git a/rehlds/rehlds/precompiled.h b/rehlds/rehlds/precompiled.h index 870a216..0ac70bb 100644 --- a/rehlds/rehlds/precompiled.h +++ b/rehlds/rehlds/precompiled.h @@ -4,6 +4,9 @@ #include "osconfig.h" +#include "archtypes.h" +#include "mathlib.h" + #include "sys_shared.h" #include "crc32.h" #include "static_map.h" diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index eb2fb0c..7e3e34a 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -27,7 +27,7 @@ */ #pragma once -#include "maintypes.h" +#include "archtypes.h" #include "rehlds_api.h" #include "rehlds_interfaces_impl.h" @@ -56,8 +56,8 @@ typedef IVoidHookChainImpl CRehldsHook_SVC_GetChallenge_mod; typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_SVC_GetChallenge_mod; //SV_CheckKeyInfo hook -typedef IHookChainImpl CRehldsHook_SV_CheckKeyInfo; -typedef IHookChainRegistryImpl CRehldsHookRegistry_SV_CheckKeyInfo; +typedef IHookChainImpl CRehldsHook_SV_CheckKeyInfo; +typedef IHookChainRegistryImpl CRehldsHookRegistry_SV_CheckKeyInfo; //SV_CheckIPRestrictions hook typedef IHookChainImpl CRehldsHook_SV_CheckIPRestrictions; @@ -84,8 +84,8 @@ typedef IVoidHookChainImpl CRehldsHook_Steam_NotifyClientDisconnec typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_Steam_NotifyClientDisconnect; //PreProcessPacket -typedef IHookChainImpl CRehldsHook_PreprocessPacket; -typedef IHookChainRegistryImpl CRehldsHookRegistry_PreprocessPacket; +typedef IHookChainImpl CRehldsHook_PreprocessPacket; +typedef IHookChainRegistryImpl CRehldsHookRegistry_PreprocessPacket; //ValidateCommand typedef IHookChainImpl CRehldsHook_ValidateCommand; @@ -96,8 +96,8 @@ typedef IVoidHookChainImpl CRehldsHook_ClientConnected; typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_ClientConnected; //HandleNetCommand -typedef IVoidHookChainImpl CRehldsHook_HandleNetCommand; -typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_HandleNetCommand; +typedef IVoidHookChainImpl CRehldsHook_HandleNetCommand; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_HandleNetCommand; //Mod_LoadBrushModel typedef IVoidHookChainImpl CRehldsHook_Mod_LoadBrushModel; diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index 5fb4c74..d6b2bf0 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -146,11 +146,11 @@ const char* CRehldsServerData::GetName() { return g_psv.name; } -uint32_t CRehldsServerData::GetWorldmapCrc() { +uint32 CRehldsServerData::GetWorldmapCrc() { return g_psv.worldmapCRC; } -uint8_t* CRehldsServerData::GetClientDllMd5() { +uint8* CRehldsServerData::GetClientDllMd5() { return g_psv.clientdllmd5; } diff --git a/rehlds/rehlds/rehlds_interfaces_impl.h b/rehlds/rehlds/rehlds_interfaces_impl.h index 613d7aa..6023e9b 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.h +++ b/rehlds/rehlds/rehlds_interfaces_impl.h @@ -92,8 +92,8 @@ class CRehldsServerData : public IRehldsServerData { public: virtual const char* GetModelName(); virtual const char* GetName(); - virtual uint32_t GetWorldmapCrc(); - virtual uint8_t* GetClientDllMd5(); + virtual uint32 GetWorldmapCrc(); + virtual uint8* GetClientDllMd5(); }; extern CGameClient** g_GameClients; diff --git a/rehlds/testsuite/anonymizer.cpp b/rehlds/testsuite/anonymizer.cpp index c23f261..5e0b67a 100644 --- a/rehlds/testsuite/anonymizer.cpp +++ b/rehlds/testsuite/anonymizer.cpp @@ -1,10 +1,10 @@ #include "precompiled.h" -uint64_t NET_AdrToLong(const netadr_t &a) { +uint64 NET_AdrToLong(const netadr_t &a) { if (a.type != NA_IP) return -1; - return a.ip[0] | (a.ip[1] << 8) | (a.ip[2] << 16) | (a.ip[3] << 24) | (uint64_t)a.port << 32; + return a.ip[0] | (a.ip[1] << 8) | (a.ip[2] << 16) | (a.ip[3] << 24) | (uint64)a.port << 32; } CSteamCallbackAnonymizingWrapper::CSteamCallbackAnonymizingWrapper(CAnonymizingEngExtInterceptor* anonymizer, CCallbackBase* cb, int id) @@ -345,7 +345,7 @@ void CSteamGameServerAnonymizingWrapper::SetRegion(const char *pszRegion) bool CSteamGameServerAnonymizingWrapper::SendUserConnectAndAuthenticate(uint32 unIPClient, const void *pvAuthBlob, uint32 cubAuthBlobSize, CSteamID *pSteamIDUser) { - uint32_t realIp = m_Anonymizer->Fake2RealIp(ntohl(unIPClient), __FUNCTION__); + uint32 realIp = m_Anonymizer->Fake2RealIp(ntohl(unIPClient), __FUNCTION__); bool res = m_Wrapped->SendUserConnectAndAuthenticate(htonl(realIp), pvAuthBlob, cubAuthBlobSize, pSteamIDUser); if (res) { *pSteamIDUser = m_Anonymizer->Real2FakeSteamId(*pSteamIDUser, __FUNCTION__); @@ -427,7 +427,7 @@ uint32 CSteamGameServerAnonymizingWrapper::GetPublicIP() bool CSteamGameServerAnonymizingWrapper::HandleIncomingPacket(const void *pData, int cbData, uint32 srcIP, uint16 srcPort) { - uint32_t realIp = m_Anonymizer->Fake2RealIp(htonl(srcIP), __FUNCTION__); + uint32 realIp = m_Anonymizer->Fake2RealIp(htonl(srcIP), __FUNCTION__); bool res; if (m_Anonymizer->m_OriginalConnectPacketLen) { @@ -445,17 +445,17 @@ int CSteamGameServerAnonymizingWrapper::GetNextOutgoingPacket(void *pOut, int cb { int res = m_Wrapped->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort); if (res > 0) { - uint32_t fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __FUNCTION__); + uint32 fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __FUNCTION__); *pNetAdr = htonl(fakeIp); //Clear players list - if (res > 6 && *(uint32_t*)pOut == 0xFFFFFFFF && ((uint8_t*)pOut)[4] == 0x44) { - memset((uint8_t*)pOut + 6, 0, res - 6); + if (res > 6 && *(uint32*)pOut == 0xFFFFFFFF && ((uint8*)pOut)[4] == 0x44) { + memset((uint8*)pOut + 6, 0, res - 6); } //Clear serverinfo - if (res > 6 && *(uint32_t*)pOut == 0xFFFFFFFF && ((uint8_t*)pOut)[4] == 0x49) { - memset((uint8_t*)pOut + 6, 0, res - 6); + if (res > 6 && *(uint32*)pOut == 0xFFFFFFFF && ((uint8*)pOut)[4] == 0x49) { + memset((uint8*)pOut + 6, 0, res - 6); } } return res; @@ -505,19 +505,19 @@ CAnonymizingEngExtInterceptor::CAnonymizingEngExtInterceptor(IReHLDSPlatform* ba m_OriginalConnectPacketLen = 0; } -uint32_t CAnonymizingEngExtInterceptor::time(uint32_t* pTime) +uint32 CAnonymizingEngExtInterceptor::time(uint32* pTime) { - uint32_t res = m_BasePlatform->time(pTime); + uint32 res = m_BasePlatform->time(pTime); return res; } -struct tm* CAnonymizingEngExtInterceptor::localtime(uint32_t time) +struct tm* CAnonymizingEngExtInterceptor::localtime(uint32 time) { struct tm* res = m_BasePlatform->localtime(time); return res; } -void CAnonymizingEngExtInterceptor::srand(uint32_t seed) +void CAnonymizingEngExtInterceptor::srand(uint32 seed) { m_BasePlatform->srand(seed); } @@ -606,9 +606,9 @@ int CAnonymizingEngExtInterceptor::recvfrom(SOCKET s, char* buf, int len, int fl int res = m_BasePlatform->recvfrom(s, buf, len, flags, from, fromlen); if (res > 0) { Real2FakeSockaddr(from, __FUNCTION__); - if (res > 4 && (*(uint32_t*)buf) == 0xFFFFFFFF) { + if (res > 4 && (*(uint32*)buf) == 0xFFFFFFFF) { unsigned int localLen = res; - ProcessConnectionlessPacket((uint8_t*)buf, &localLen); + ProcessConnectionlessPacket((uint8*)buf, &localLen); res = localLen; } } @@ -800,14 +800,14 @@ void CAnonymizingEngExtInterceptor::AnonymizeAddr(const char* real, const char* } void CAnonymizingEngExtInterceptor::AnonymizeAddr(const netadr_t& real, const netadr_t& fake) { - uint32_t realIp = *(uint32_t*)(&real.ip[0]); - uint32_t fakeIp = *(uint32_t*)(&fake.ip[0]); + uint32 realIp = *(uint32*)(&real.ip[0]); + uint32 fakeIp = *(uint32*)(&fake.ip[0]); m_Fake2RealIpMap[fakeIp] = realIp; m_Real2FakeIpMap[realIp] = fakeIp; } -uint32_t CAnonymizingEngExtInterceptor::Fake2RealIp(uint32_t fakeIp, const char* callsite) { +uint32 CAnonymizingEngExtInterceptor::Fake2RealIp(uint32 fakeIp, const char* callsite) { auto itr = m_Fake2RealIpMap.find(fakeIp); if (itr == m_Fake2RealIpMap.end()) { rehlds_syserror("%s: Unmapped fake addr %s", callsite, IpToString(fakeIp)); @@ -816,7 +816,7 @@ uint32_t CAnonymizingEngExtInterceptor::Fake2RealIp(uint32_t fakeIp, const char* return itr->second; } -uint32_t CAnonymizingEngExtInterceptor::Real2FakeIp(uint32_t realIp, const char* callsite) { +uint32 CAnonymizingEngExtInterceptor::Real2FakeIp(uint32 realIp, const char* callsite) { auto itr = m_Real2FakeIpMap.find(realIp); if (itr == m_Real2FakeIpMap.end()) { Con_Printf("%s: Unmapped real addr %s\n", callsite, IpToString(realIp)); @@ -830,21 +830,21 @@ uint32_t CAnonymizingEngExtInterceptor::Real2FakeIp(uint32_t realIp, const char* void CAnonymizingEngExtInterceptor::Real2FakeSockaddr(sockaddr* saddr, const char* callsite) { sockaddr_in* inaddr = (sockaddr_in*)saddr; - uint32_t realIp = *(uint32_t*)(&inaddr->sin_addr); - uint32_t fakeIp = Real2FakeIp(realIp, callsite); + uint32 realIp = *(uint32*)(&inaddr->sin_addr); + uint32 fakeIp = Real2FakeIp(realIp, callsite); - *(uint32_t*)(&inaddr->sin_addr) = fakeIp; + *(uint32*)(&inaddr->sin_addr) = fakeIp; } void CAnonymizingEngExtInterceptor::Fake2RealSockaddr(sockaddr* saddr, const char* callsite) { sockaddr_in* inaddr = (sockaddr_in*)saddr; - uint32_t fakeIp = *(uint32_t*)(&inaddr->sin_addr); - uint32_t realIp = Fake2RealIp(fakeIp, callsite); + uint32 fakeIp = *(uint32*)(&inaddr->sin_addr); + uint32 realIp = Fake2RealIp(fakeIp, callsite); - *(uint32_t*)(&inaddr->sin_addr) = realIp; + *(uint32*)(&inaddr->sin_addr) = realIp; } -char* CAnonymizingEngExtInterceptor::IpToString(uint32_t ip) { +char* CAnonymizingEngExtInterceptor::IpToString(uint32 ip) { static char buf[64]; sprintf(buf, "%u.%u.%u.%u", ip & 0xFF, (ip >> 8) & 0xFF, (ip >> 16) & 0xFF, (ip >> 24) & 0xFF); return buf; @@ -891,7 +891,7 @@ void CAnonymizingEngExtInterceptor::AnonymizeSteamId(const char* real, const cha AnonymizeSteamId(realId, fakeId); } -void CAnonymizingEngExtInterceptor::ProcessConnectionlessPacket(uint8_t* data, unsigned int *len) { +void CAnonymizingEngExtInterceptor::ProcessConnectionlessPacket(uint8* data, unsigned int *len) { memcpy(net_message.data, data, *len); net_message.cursize = *len; MSG_BeginReading(); @@ -933,7 +933,7 @@ void CopyInfoKey(char* from, char* to, const char* key) { } } -void CAnonymizingEngExtInterceptor::ProcessConnectPacket(uint8_t* data, unsigned int *len) { +void CAnonymizingEngExtInterceptor::ProcessConnectPacket(uint8* data, unsigned int *len) { char origuserinfo[1024]; char userinfo[1024]; char protinfo[1024]; @@ -987,7 +987,7 @@ void CAnonymizingEngExtInterceptor::ProcessConnectPacket(uint8_t* data, unsigned } - uint8_t ticket[1024]; + uint8 ticket[1024]; unsigned int ticketLen = *len - msg_readcount; if (ticketLen > 0) { diff --git a/rehlds/testsuite/anonymizer.h b/rehlds/testsuite/anonymizer.h index dd6f96e..c32f0cf 100644 --- a/rehlds/testsuite/anonymizer.h +++ b/rehlds/testsuite/anonymizer.h @@ -138,33 +138,33 @@ private: IReHLDSPlatform* m_BasePlatform; - std::unordered_map m_Fake2RealIpMap; - std::unordered_map m_Real2FakeIpMap; + std::unordered_map m_Fake2RealIpMap; + std::unordered_map m_Real2FakeIpMap; - uint32_t Fake2RealIp(uint32_t fakeIp, const char* callsite); - uint32_t Real2FakeIp(uint32_t realIp, const char* callsite); + uint32 Fake2RealIp(uint32 fakeIp, const char* callsite); + uint32 Real2FakeIp(uint32 realIp, const char* callsite); void Real2FakeSockaddr(sockaddr* saddr, const char* callsite); void Fake2RealSockaddr(sockaddr* saddr, const char* callsite); - char* IpToString(uint32_t ip); + char* IpToString(uint32 ip); - std::unordered_map m_Fake2RealSteamId; - std::unordered_map m_Real2FakeSteamId; + std::unordered_map m_Fake2RealSteamId; + std::unordered_map m_Real2FakeSteamId; CSteamID Real2FakeSteamId(CSteamID realId, const char* callsite); CSteamID Fake2RealSteamId(CSteamID fakeId, const char* callsite); char* SteamIdToString(const CSteamID& steamid); - void ProcessConnectionlessPacket(uint8_t* data, unsigned int *len); - void ProcessConnectPacket(uint8_t* data, unsigned int *len); + void ProcessConnectionlessPacket(uint8* data, unsigned int *len); + void ProcessConnectPacket(uint8* data, unsigned int *len); std::unordered_map m_Real2FakeName; std::unordered_map m_Fake2RealName; std::string Real2FakeName(const char* realName, const char* callsite); std::string Fake2RealName(const char* fakeName, const char* callsite); - uint8_t m_OriginalConnectPacketData[4096]; + uint8 m_OriginalConnectPacketData[4096]; unsigned int m_OriginalConnectPacketLen; std::unordered_map m_Real2FakeHost; @@ -176,9 +176,9 @@ private: public: CAnonymizingEngExtInterceptor(IReHLDSPlatform* basePlatform); - virtual uint32_t time(uint32_t* pTime); - virtual struct tm* localtime(uint32_t time); - virtual void srand(uint32_t seed); + virtual uint32 time(uint32* pTime); + virtual struct tm* localtime(uint32 time); + virtual void srand(uint32 seed); virtual int rand(); virtual void Sleep(DWORD msec); diff --git a/rehlds/testsuite/funccalls.cpp b/rehlds/testsuite/funccalls.cpp index 1e15bf6..c557781 100644 --- a/rehlds/testsuite/funccalls.cpp +++ b/rehlds/testsuite/funccalls.cpp @@ -2046,7 +2046,7 @@ void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) { /* ============================================================================ CSteamApiSetBreakpadAppIdCall ============================================================================ */ -CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32_t appId) +CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32 appId) { m_AppId = appId; } @@ -2879,7 +2879,7 @@ void CGetSystemTimeAsFileTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ CStdTimeCall ============================================================================ */ -CStdTimeCall::CStdTimeCall(uint32_t* inTime) +CStdTimeCall::CStdTimeCall(uint32* inTime) { m_InTimeNull = (inTime == NULL); } @@ -2904,7 +2904,7 @@ bool CStdTimeCall::compareInputArgs(IEngExtCall* other, bool strict) return true; } -void CStdTimeCall::setResult(uint32_t res) +void CStdTimeCall::setResult(uint32 res) { m_Res = res; } @@ -2933,7 +2933,7 @@ void CStdTimeCall::readEpilogue(std::istream &stream) { /* ============================================================================ CStdLocalTimeCall ============================================================================ */ -CStdLocalTimeCall::CStdLocalTimeCall(uint32_t inTime) +CStdLocalTimeCall::CStdLocalTimeCall(uint32 inTime) { m_Time = inTime; } diff --git a/rehlds/testsuite/funccalls.h b/rehlds/testsuite/funccalls.h index 42b3444..41c4597 100644 --- a/rehlds/testsuite/funccalls.h +++ b/rehlds/testsuite/funccalls.h @@ -186,7 +186,7 @@ public: class CQueryPerfFreqCall : public IEngExtCall { public: - int64_t m_Freq; + int64 m_Freq; BOOL m_Res; public: @@ -202,7 +202,7 @@ public: class CQueryPerfCounterCall : public IEngExtCall { public: - int64_t m_Counter; + int64 m_Counter; BOOL m_Res; public: @@ -860,11 +860,11 @@ public: class CSteamApiSetBreakpadAppIdCall : public IEngExtCall { public: - uint32_t m_AppId; + uint32 m_AppId; public: CSteamApiSetBreakpadAppIdCall() { m_AppId = 0; } - CSteamApiSetBreakpadAppIdCall(uint32_t appId); + CSteamApiSetBreakpadAppIdCall(uint32 appId); virtual bool compareInputArgs(IEngExtCall* other, bool strict); virtual std::string toString(); @@ -933,7 +933,7 @@ public: class CGameServerGetSteamIdCall : public IEngExtCall { public: - uint64_t m_SteamId; + uint64 m_SteamId; public: CGameServerGetSteamIdCall() { m_SteamId = 0; } @@ -965,8 +965,8 @@ class CGameServerHandleIncomingPacketCall : public IEngExtCall { public: char m_Data[8192]; int m_Len; - uint32_t m_Ip; - uint16_t m_Port; + uint32 m_Ip; + uint16 m_Port; bool m_Res; public: @@ -987,9 +987,9 @@ class CGameServerSendUserConnectAndAuthenticateCall : public IEngExtCall { public: char m_AuthBlob[4096]; int m_AuthBlobLen; - uint32_t m_IP; + uint32 m_IP; - uint64_t m_OutSteamId; + uint64 m_OutSteamId; bool m_Res; public: @@ -1008,7 +1008,7 @@ public: class CGameServerSendUserDisconnectCall : public IEngExtCall { public: - uint64_t m_SteamId; + uint64 m_SteamId; public: CGameServerSendUserDisconnectCall() { m_SteamId = 0; } @@ -1023,10 +1023,10 @@ public: class CGameServerBUpdateUserDataCall : public IEngExtCall { public: - uint64_t m_SteamId; + uint64 m_SteamId; char m_PlayerName[64]; int m_PlayerNameLen; - uint32_t m_Score; + uint32 m_Score; bool m_Res; @@ -1046,7 +1046,7 @@ public: class CGameServerCreateUnauthUserConnectionCall : public IEngExtCall { public: - uint64_t m_SteamId; + uint64 m_SteamId; public: CGameServerCreateUnauthUserConnectionCall() { m_SteamId = 0; } @@ -1146,13 +1146,13 @@ class CStdTimeCall : public IEngExtCall { public: bool m_InTimeNull; - uint32_t m_Res; + uint32 m_Res; public: - CStdTimeCall(uint32_t* inTime); + CStdTimeCall(uint32* inTime); CStdTimeCall() { m_InTimeNull = false; m_Res = 0; } - void setResult(uint32_t res); + void setResult(uint32 res); virtual bool compareInputArgs(IEngExtCall* other, bool strict); virtual std::string toString(); virtual ExtCallFuncs getOpcode() { return ECF_CSTD_TIME; } @@ -1164,12 +1164,12 @@ public: class CStdLocalTimeCall : public IEngExtCall { public: - uint32_t m_Time; + uint32 m_Time; struct tm m_Res; public: - CStdLocalTimeCall(uint32_t inTime); + CStdLocalTimeCall(uint32 inTime); CStdLocalTimeCall() { m_Time = 0; memset(&m_Res, 0, sizeof(m_Res)); } void setResult(struct tm *res); @@ -1184,11 +1184,11 @@ public: class CStdSrandCall : public IEngExtCall { public: - uint32_t m_Seed; + uint32 m_Seed; public: CStdSrandCall() { m_Seed = 0; } - CStdSrandCall(uint32_t seed) { m_Seed = seed; } + CStdSrandCall(uint32 seed) { m_Seed = seed; } virtual bool compareInputArgs(IEngExtCall* other, bool strict); virtual std::string toString(); diff --git a/rehlds/testsuite/player.cpp b/rehlds/testsuite/player.cpp index 52defaf..58a36a9 100644 --- a/rehlds/testsuite/player.cpp +++ b/rehlds/testsuite/player.cpp @@ -24,11 +24,11 @@ CPlayingEngExtInterceptor::CPlayingEngExtInterceptor(const char* fname, bool str m_GameServerWrapper = NULL; m_SteamBreakpadContext = NULL; - uint32_t cmdlineLen = 0; + uint32 cmdlineLen = 0; char cmdLine[2048]; - uint16_t versionMajor = 0; - uint16_t versionMinor = 0; + uint16 versionMajor = 0; + uint16 versionMinor = 0; m_InStream.read((char*)&versionMinor, 2).read((char*)&versionMajor, 2); @@ -235,13 +235,13 @@ int CPlayingEngExtInterceptor::getOrRegisterSteamCallback(CCallbackBase* cb) { return id; } -uint32_t CPlayingEngExtInterceptor::time(uint32_t* pTime) +uint32 CPlayingEngExtInterceptor::time(uint32* pTime) { CStdTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_TIME, true, __FUNCTION__)); CStdTimeCall(pTime).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); CStdTimeCall* playEndCall = dynamic_cast(getNextCall(false, true, ECF_CSTD_TIME, false, __FUNCTION__)); - uint32_t res = playEndCall->m_Res; + uint32 res = playEndCall->m_Res; if (pTime != NULL) *pTime = res; freeFuncCall(playCall); freeFuncCall(playEndCall); @@ -249,7 +249,7 @@ uint32_t CPlayingEngExtInterceptor::time(uint32_t* pTime) return res; } -struct tm* CPlayingEngExtInterceptor::localtime(uint32_t time) +struct tm* CPlayingEngExtInterceptor::localtime(uint32 time) { CStdLocalTimeCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_LOCALTIME, true, __FUNCTION__)); CStdLocalTimeCall(time).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); @@ -262,7 +262,7 @@ struct tm* CPlayingEngExtInterceptor::localtime(uint32_t time) return &m_CurrentTm; } -void CPlayingEngExtInterceptor::srand(uint32_t seed) +void CPlayingEngExtInterceptor::srand(uint32 seed) { CStdSrandCall* playCall = dynamic_cast(getNextCall(false, false, ECF_CSTD_SRAND_CALL, true, __FUNCTION__)); CStdSrandCall(seed).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); diff --git a/rehlds/testsuite/player.h b/rehlds/testsuite/player.h index 619fe6a..f99cbe9 100644 --- a/rehlds/testsuite/player.h +++ b/rehlds/testsuite/player.h @@ -116,7 +116,7 @@ private: bool m_FuncCallsFree[TESTPLAYER_FUNCTREE_DEPTH]; std::ifstream m_InStream; - int64_t m_inStreamSize; + int64 m_inStreamSize; bool m_bLastRead; std::queue m_CommandsQueue; @@ -157,9 +157,9 @@ public: IEngExtCall* getNextCall(bool peek, bool processCallbacks, ExtCallFuncs expectedOpcode, bool needStart, const char* callSource); - virtual uint32_t time(uint32_t* pTime); - virtual struct tm* localtime(uint32_t time); - virtual void srand(uint32_t seed); + virtual uint32 time(uint32* pTime); + virtual struct tm* localtime(uint32 time); + virtual void srand(uint32 seed); virtual int rand(); virtual void Sleep(DWORD msec); diff --git a/rehlds/testsuite/recorder.cpp b/rehlds/testsuite/recorder.cpp index 0c915ad..c0eb676 100644 --- a/rehlds/testsuite/recorder.cpp +++ b/rehlds/testsuite/recorder.cpp @@ -516,8 +516,8 @@ CRecordingEngExtInterceptor::CRecordingEngExtInterceptor(const char* fname, IReH m_RootFunc = m_LastFunc = NULL; m_BasePlatform = basePlatform; - uint16_t versionMajor = TESTSUITE_PROTOCOL_VERSION_MAJOR; - uint16_t versionMinor = TESTSUITE_PROTOCOL_VERSION_MINOR; + uint16 versionMajor = TESTSUITE_PROTOCOL_VERSION_MAJOR; + uint16 versionMinor = TESTSUITE_PROTOCOL_VERSION_MINOR; m_OutStream.write((char*)&versionMinor, 2).write((char*)&versionMajor, 2); const char* cmdLine = GetCommandLineA(); @@ -529,7 +529,7 @@ CRecordingEngExtInterceptor::CRecordingEngExtInterceptor(const char* fname, IReH void CRecordingEngExtInterceptor::writeCall(bool start, bool end, IEngExtCall* fcall) { - uint16_t opc = fcall->getOpcode(); + uint16 opc = fcall->getOpcode(); if (start) opc |= (1 << 15); @@ -587,18 +587,18 @@ void CRecordingEngExtInterceptor::PopFunc(CRecorderFuncCall* func) } } -uint32_t CRecordingEngExtInterceptor::time(uint32_t* pTime) +uint32 CRecordingEngExtInterceptor::time(uint32* pTime) { CStdTimeCall fcall(pTime); CRecorderFuncCall frec(&fcall); PushFunc(&frec); - uint32_t res = m_BasePlatform->time(pTime); + uint32 res = m_BasePlatform->time(pTime); fcall.setResult(res); PopFunc(&frec); return res; } -struct tm* CRecordingEngExtInterceptor::localtime(uint32_t time) +struct tm* CRecordingEngExtInterceptor::localtime(uint32 time) { CStdLocalTimeCall fcall; CRecorderFuncCall frec(&fcall); PushFunc(&frec); @@ -609,7 +609,7 @@ struct tm* CRecordingEngExtInterceptor::localtime(uint32_t time) return res; } -void CRecordingEngExtInterceptor::srand(uint32_t seed) +void CRecordingEngExtInterceptor::srand(uint32 seed) { CStdSrandCall fcall(seed); CRecorderFuncCall frec(&fcall); PushFunc(&frec); diff --git a/rehlds/testsuite/recorder.h b/rehlds/testsuite/recorder.h index bb354ac..35ea40b 100644 --- a/rehlds/testsuite/recorder.h +++ b/rehlds/testsuite/recorder.h @@ -158,9 +158,9 @@ public: void PushFunc(CRecorderFuncCall* func); void PopFunc(CRecorderFuncCall* func); - virtual uint32_t time(uint32_t* pTime); - virtual struct tm* localtime(uint32_t time); - virtual void srand(uint32_t seed); + virtual uint32 time(uint32* pTime); + virtual struct tm* localtime(uint32 time); + virtual void srand(uint32 seed); virtual int rand(); virtual void Sleep(DWORD msec); diff --git a/rehlds/testsuite/testsuite.cpp b/rehlds/testsuite/testsuite.cpp index 23fe254..284618a 100644 --- a/rehlds/testsuite/testsuite.cpp +++ b/rehlds/testsuite/testsuite.cpp @@ -4,12 +4,12 @@ /* ============================================================================ external function hooks ============================================================================*/ -uint32_t __cdecl time_hooked(uint32_t* pTime) +uint32 __cdecl time_hooked(uint32* pTime) { return CRehldsPlatformHolder::get()->time(pTime); } -struct tm* __cdecl localtime_hooked(uint32_t* pTime) +struct tm* __cdecl localtime_hooked(uint32* pTime) { if (pTime == NULL) rehlds_syserror("%s: pTime is NULL", __FUNCTION__); @@ -17,7 +17,7 @@ struct tm* __cdecl localtime_hooked(uint32_t* pTime) return CRehldsPlatformHolder::get()->localtime(*pTime); } -void __cdecl srand_hooked(uint32_t seed) +void __cdecl srand_hooked(uint32 seed) { CRehldsPlatformHolder::get()->srand(seed); } diff --git a/rehlds/unittests/common_tests.cpp b/rehlds/unittests/common_tests.cpp index 94db0d7..9a998b6 100644 --- a/rehlds/unittests/common_tests.cpp +++ b/rehlds/unittests/common_tests.cpp @@ -10,8 +10,8 @@ TEST(BitsWritingReading, MSG, 5000) sizebuf_t *buf = &net_message; - uint32_t ff1 = ((uint32_t)1 << 31) - 1; - uint32_t ff2 = ((uint32_t)1 << 9) - 1; + uint32 ff1 = ((uint32)1 << 31) - 1; + uint32 ff2 = ((uint32)1 << 9) - 1; SZ_Clear(buf); @@ -23,8 +23,8 @@ TEST(BitsWritingReading, MSG, 5000) MSG_BeginReading(); MSG_StartBitReading(buf); - uint32_t t1 = MSG_ReadBits(31); - uint32_t t2 = MSG_ReadBits(9); + uint32 t1 = MSG_ReadBits(31); + uint32 t2 = MSG_ReadBits(9); MSG_EndBitReading(buf); UINT32_EQUALS("31/9 Read failed (31)", ff1, t1); @@ -49,9 +49,9 @@ TEST(BitsWritingReading, MSG, 5000) UINT32_EQUALS("9/31 Read failed (31)", ff2, t2); - uint32_t a2, a1 = 5; - uint32_t b2, b1 = 0xEFEF; - uint32_t c2, c1 = 0x7AAEAEAE; + uint32 a2, a1 = 5; + uint32 b2, b1 = 0xEFEF; + uint32 c2, c1 = 0x7AAEAEAE; SZ_Clear(buf);