2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-04 02:55:50 +03:00

#8 Refactoring SDK

Get rid of (u)int[nn]_t types from osconfig.h, use (u)int[nn] from archtypes.h instead
This commit is contained in:
dreamstalker 2015-05-09 20:31:05 +04:00
parent 78b1785e7d
commit 2a0fff4074
86 changed files with 536 additions and 583 deletions

View File

@ -49,7 +49,7 @@ task publishPrepareFiles << {
copy { copy {
from 'rehlds/public' from 'rehlds/public'
into 'publish/publishRoot/hlsdk/public' into 'publish/publishRoot/hlsdk/public'
include 'interface.h', 'interface.cpp' include 'interface.h', 'interface.cpp', 'FileSystem.h'
} }
copy { copy {
from 'rehlds/public/rehlds' from 'rehlds/public/rehlds'

View File

@ -184,6 +184,7 @@ class RehldsSrc {
include "**/*.cpp" include "**/*.cpp"
exclude "precompiled.cpp" exclude "precompiled.cpp"
exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp" exclude GradleCppUtils.windows ? "tier0/platform_linux.cpp" : "tier0/platform_win32.cpp"
exclude "interface.cpp", "rehlds/crc32.cpp", "rehlds/sys_shared.cpp"
} }
source { source {

View File

@ -37,7 +37,7 @@ void CRC32_Init(CRC32_t *pulCRC);
CRC32_t CRC32_Final(CRC32_t pulCRC); CRC32_t CRC32_Final(CRC32_t pulCRC);
void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer); 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 #ifdef __cplusplus
} }

View File

@ -29,7 +29,7 @@
typedef struct cvar_s typedef struct cvar_s
{ {
char *name; const char *name;
char *string; char *string;
int flags; int flags;
float value; float value;

View File

@ -20,7 +20,10 @@
typedef float vec_t; typedef float vec_t;
/* <42b91> ../common/mathlib.h:6 */ /* <42b91> ../common/mathlib.h:6 */
#ifndef DID_VEC3_T_DEFINE
#define DID_VEC3_T_DEFINE
typedef vec_t vec3_t[3]; typedef vec_t vec3_t[3];
#endif
/* <80013> ../common/mathlib.h:8 */ /* <80013> ../common/mathlib.h:8 */
typedef vec_t vec4_t[4]; typedef vec_t vec4_t[4];

View File

@ -80,6 +80,9 @@ typedef float vec_t; // needed before including progdefs.h
// Vector class // Vector class
#include "vector.h" #include "vector.h"
// Defining it as a (bogus) struct helps enforce type-checking
#define vec3_t Vector
// Shared engine/DLL constants // Shared engine/DLL constants
#include "const.h" #include "const.h"
#include "progdefs.h" #include "progdefs.h"

View File

@ -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_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 void (*pfnEngSrc_pfnWeaponAnim_t ) ( int iAnim, int body );
typedef float (*pfnEngSrc_pfnRandomFloat_t ) ( float flLow, float flHigh ); 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 void (*pfnEngSrc_pfnHookEvent_t ) ( char *name, void ( *pfnEvent )( struct event_args_s *args ) );
typedef int (*pfnEngSrc_Con_IsVisible_t) (); typedef int (*pfnEngSrc_Con_IsVisible_t) ();
typedef const char * (*pfnEngSrc_pfnGetGameDirectory_t ) ( void ); 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_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_pfnWeaponAnim_t) (int *, int *);
typedef void(*pfnEngDst_pfnRandomFloat_t) (float *, float *); 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_pfnHookEvent_t) (char **, void(**pfnEvent)(struct event_args_s *args));
typedef void(*pfnEngDst_Con_IsVisible_t) (); typedef void(*pfnEngDst_Con_IsVisible_t) ();
typedef void(*pfnEngDst_pfnGetGameDirectory_t) (void); typedef void(*pfnEngDst_pfnGetGameDirectory_t) (void);

View File

@ -82,7 +82,7 @@ typedef struct hud_player_info_s
short topcolor; short topcolor;
short bottomcolor; short bottomcolor;
uint64_t m_nSteamID; uint64 m_nSteamID;
} hud_player_info_t; } hud_player_info_t;

View File

@ -87,15 +87,15 @@ typedef struct frame_s
clientdata_t clientdata; clientdata_t clientdata;
weapon_data_t weapondata[64]; weapon_data_t weapondata[64];
packet_entities_t packet_entities; packet_entities_t packet_entities;
uint16_t clientbytes; uint16 clientbytes;
uint16_t playerinfobytes; uint16 playerinfobytes;
uint16_t packetentitybytes; uint16 packetentitybytes;
uint16_t tentitybytes; uint16 tentitybytes;
uint16_t soundbytes; uint16 soundbytes;
uint16_t eventbytes; uint16 eventbytes;
uint16_t usrbytes; uint16 usrbytes;
uint16_t voicebytes; uint16 voicebytes;
uint16_t msgbytes; uint16 msgbytes;
} frame_t; } frame_t;
/* <153e9> ../engine/client.h:127 */ /* <153e9> ../engine/client.h:127 */
@ -117,7 +117,7 @@ typedef struct player_info_s
vec3_t prevgaitorigin; vec3_t prevgaitorigin;
customization_t customdata; customization_t customdata;
char hashedcdkey[16]; char hashedcdkey[16];
uint64_t m_nSteamID; uint64 m_nSteamID;
} player_info_t; } player_info_t;
/* <277f5> ../engine/client.h:208 */ /* <277f5> ../engine/client.h:208 */
@ -183,7 +183,7 @@ typedef struct client_static_s
qboolean director; qboolean director;
qboolean fSecureClient; qboolean fSecureClient;
qboolean isVAC2Secure; qboolean isVAC2Secure;
uint64_t GameServerSteamID; uint64 GameServerSteamID;
int build_num; int build_num;
} client_static_t; } client_static_t;

View File

@ -864,7 +864,7 @@ void Cmd_RemoveWrapperCmds(void)
} }
/* <5af2> ../engine/cmd.c:1035 */ /* <5af2> ../engine/cmd.c:1035 */
qboolean Cmd_Exists(char *cmd_name) qboolean Cmd_Exists(const char *cmd_name)
{ {
cmd_function_t *cmd = cmd_functions; cmd_function_t *cmd = cmd_functions;

View File

@ -113,7 +113,7 @@ void Cmd_RemoveMallocedCmds(int flag);
NOXREF void Cmd_RemoveHudCmds(void); NOXREF void Cmd_RemoveHudCmds(void);
void Cmd_RemoveGameCmds(void); void Cmd_RemoveGameCmds(void);
void Cmd_RemoveWrapperCmds(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); NOXREF char *Cmd_CompleteCommand(char *search, int forward);
void Cmd_ExecuteString(char *text, cmd_source_t src); void Cmd_ExecuteString(char *text, cmd_source_t src);
qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf); qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf);

View File

@ -106,7 +106,7 @@ qboolean COM_CreateCustomization(customization_t *pListHead, resource_t *pResour
if (flags & 1) 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; bError = 1;
goto CustomizationError; goto CustomizationError;

View File

@ -333,7 +333,7 @@ int msg_badread;
int msg_readcount; int msg_readcount;
// Some bit tables... // Some bit tables...
const uint32_t BITTABLE[] = const uint32 BITTABLE[] =
{ {
0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000010, 0x00000020, 0x00000040, 0x00000080,
@ -346,7 +346,7 @@ const uint32_t BITTABLE[] =
0x00000000, 0x00000000,
}; };
const uint32_t ROWBITTABLE[] = const uint32 ROWBITTABLE[] =
{ {
0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x00000000, 0x00000001, 0x00000003, 0x00000007,
0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
@ -359,7 +359,7 @@ const uint32_t ROWBITTABLE[] =
0xFFFFFFFF, 0xFFFFFFFF,
}; };
const uint32_t INVBITTABLE[] = const uint32 INVBITTABLE[] =
{ {
0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFB, 0xFFFFFFF7, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFB, 0xFFFFFFF7,
0xFFFFFFEF, 0xFFFFFFDF, 0xFFFFFFBF, 0xFFFFFF7F, 0xFFFFFFEF, 0xFFFFFFDF, 0xFFFFFFBF, 0xFFFFFF7F,
@ -388,19 +388,19 @@ void MSG_WriteByte(sizebuf_t *sb, int c)
void MSG_WriteShort(sizebuf_t *sb, int c) void MSG_WriteShort(sizebuf_t *sb, int c)
{ {
unsigned char *buf = (unsigned char *)SZ_GetSpace(sb, 2); 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) void MSG_WriteWord(sizebuf_t *sb, int c)
{ {
unsigned char *buf = (unsigned char *)SZ_GetSpace(sb, 2); 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) void MSG_WriteLong(sizebuf_t *sb, int c)
{ {
unsigned char *buf = (unsigned char *)SZ_GetSpace(sb, 4); 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) 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) 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) 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) 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 (numbits < 32)
{ {
if (data >= (uint32_t)(1 << numbits)) if (data >= (uint32)(1 << numbits))
data = ROWBITTABLE[numbits]; data = ROWBITTABLE[numbits];
} }
int surplusBytes = 0; int surplusBytes = 0;
if ((uint32_t)bfwrite.nCurOutputBit >= 8) if ((uint32)bfwrite.nCurOutputBit >= 8)
{ {
surplusBytes = 1; surplusBytes = 1;
bfwrite.nCurOutputBit = 0; bfwrite.nCurOutputBit = 0;
@ -554,7 +554,7 @@ void MSG_WriteBits(uint32_t data, int numbits)
SZ_GetSpace(bfwrite.pbuf, surplusBytes + bytesToWrite); SZ_GetSpace(bfwrite.pbuf, surplusBytes + bytesToWrite);
if (!(bfwrite.pbuf->flags & SIZEBUF_OVERFLOWED)) 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; bfwrite.nCurOutputBit = 8;
if (bitsLeft) if (bitsLeft)
bfwrite.nCurOutputBit = bitsLeft; bfwrite.nCurOutputBit = bitsLeft;
@ -566,11 +566,11 @@ void MSG_WriteBits(uint32_t data, int numbits)
SZ_GetSpace(bfwrite.pbuf, surplusBytes + 4); SZ_GetSpace(bfwrite.pbuf, surplusBytes + 4);
if (!(bfwrite.pbuf->flags & SIZEBUF_OVERFLOWED)) 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; int leftBits = 32 - bfwrite.nCurOutputBit;
bfwrite.nCurOutputBit = bits & 7; bfwrite.nCurOutputBit = bits & 7;
bfwrite.pOutByte += 4; 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"); Sys_Error(__FUNCTION__ ": Can't write bit angle with 32 bits precision\n");
} }
uint32_t shift = (1 << numbits); uint32 shift = (1 << numbits);
uint32_t mask = shift - 1; uint32 mask = shift - 1;
int d = (int)(shift * fmod((double)fAngle, 360.0)) / 360; int d = (int)(shift * fmod((double)fAngle, 360.0)) / 360;
d &= mask; d &= mask;
@ -725,9 +725,9 @@ int MSG_ReadOneBit(void)
return nValue; return nValue;
} }
uint32_t MSG_ReadBits(int numbits) uint32 MSG_ReadBits(int numbits)
{ {
uint32_t result; uint32 result;
if (msg_badread) if (msg_badread)
{ {
@ -744,13 +744,13 @@ uint32_t MSG_ReadBits(int numbits)
bfread.nCurInputBit = 0; bfread.nCurInputBit = 0;
} }
uint32_t bits = (bfread.nCurInputBit + numbits) & 7; uint32 bits = (bfread.nCurInputBit + numbits) & 7;
if ((unsigned int)(bfread.nCurInputBit + numbits) <= 32) if ((unsigned int)(bfread.nCurInputBit + numbits) <= 32)
{ {
result = (*(unsigned int *)bfread.pInByte >> bfread.nCurInputBit) & ROWBITTABLE[numbits]; result = (*(unsigned int *)bfread.pInByte >> bfread.nCurInputBit) & ROWBITTABLE[numbits];
uint32_t bytes = (bfread.nCurInputBit + numbits) >> 3; uint32 bytes = (bfread.nCurInputBit + numbits) >> 3;
if (bits) if (bits)
{ {
@ -785,12 +785,12 @@ uint32_t MSG_ReadBits(int numbits)
return result; return result;
} }
NOXREF uint32_t MSG_PeekBits(int numbits) NOXREF uint32 MSG_PeekBits(int numbits)
{ {
NOXREFCHECK; NOXREFCHECK;
bf_read_t savebf = bfread; bf_read_t savebf = bfread;
uint32_t r = MSG_ReadBits(numbits); uint32 r = MSG_ReadBits(numbits);
bfread = savebf; bfread = savebf;
return r; return r;
@ -889,8 +889,8 @@ NOXREF float MSG_ReadBitCoord(void)
void MSG_WriteBitCoord(const float f) void MSG_WriteBitCoord(const float f)
{ {
int signbit = f <= -0.125; int signbit = f <= -0.125;
int intval = abs((int32_t)f); int intval = abs((int32)f);
int fractval = abs((int32_t)f * 8) & 7; int fractval = abs((int32)f * 8) & 7;
MSG_WriteOneBit(intval); MSG_WriteOneBit(intval);
MSG_WriteOneBit(fractval); MSG_WriteOneBit(fractval);
@ -1024,7 +1024,7 @@ int MSG_ReadShort(void)
if (msg_readcount + 2 <= net_message.cursize ) 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; msg_readcount += 2;
} }
else else
@ -1044,7 +1044,7 @@ NOXREF int MSG_ReadWord(void)
if (msg_readcount + 2 <= net_message.cursize) 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; msg_readcount += 2;
} }
else else
@ -1062,7 +1062,7 @@ int MSG_ReadLong(void)
if (msg_readcount + 4 <= net_message.cursize) 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; msg_readcount += 4;
} }
else else

View File

@ -201,7 +201,7 @@ void MSG_WriteOneBit(int nValue);
void MSG_StartBitWriting(sizebuf_t *buf); void MSG_StartBitWriting(sizebuf_t *buf);
NOXREF qboolean MSG_IsBitWriting(void); NOXREF qboolean MSG_IsBitWriting(void);
void MSG_EndBitWriting(sizebuf_t *buf); 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_WriteSBits(int data, int numbits);
void MSG_WriteBitString(const char *p); void MSG_WriteBitString(const char *p);
void MSG_WriteBitData(void *src, int length); void MSG_WriteBitData(void *src, int length);
@ -212,8 +212,8 @@ NOXREF qboolean MSG_IsBitReading(void);
void MSG_StartBitReading(sizebuf_t *buf); void MSG_StartBitReading(sizebuf_t *buf);
void MSG_EndBitReading(sizebuf_t *buf); void MSG_EndBitReading(sizebuf_t *buf);
int MSG_ReadOneBit(void); int MSG_ReadOneBit(void);
uint32_t MSG_ReadBits(int numbits); uint32 MSG_ReadBits(int numbits);
NOXREF uint32_t MSG_PeekBits(int numbits); NOXREF uint32 MSG_PeekBits(int numbits);
int MSG_ReadSBits(int numbits); int MSG_ReadSBits(int numbits);
NOXREF char *MSG_ReadBitString(void); NOXREF char *MSG_ReadBitString(void);
int MSG_ReadBitData(void *dest, int length); int MSG_ReadBitData(void *dest, int length);

View File

@ -29,7 +29,7 @@
#include "precompiled.h" #include "precompiled.h"
static const uint32_t pulCRCTable[256] = static const uint32 pulCRCTable[256] =
{ {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 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) void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *pBuffer, int nBuffer)
{ {
CRC32_t ulCrc = *pulCRC; CRC32_t ulCrc = *pulCRC;
uint8_t* pb = (uint8_t*)pBuffer; uint8* pb = (uint8*)pBuffer;
for (int i = 0; i < nBuffer; i++) for (int i = 0; i < nBuffer; i++)
{ {
@ -299,25 +299,25 @@ static unsigned char PADDING[64] =
/* Rotation is separate from addition to prevent recomputation */ /* Rotation is separate from addition to prevent recomputation */
#define FF(a, b, c, d, x, s, ac) \ #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) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \ (a) += (b); \
} }
#define GG(a, b, c, d, x, s, ac) \ #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) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \ (a) += (b); \
} }
#define HH(a, b, c, d, x, s, ac) \ #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) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \ (a) += (b); \
} }
#define II(a, b, c, d, x, s, ac) \ #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) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \ (a) += (b); \
} }
@ -338,7 +338,7 @@ void MD5Init(MD5Context_t *ctx)
/* <19841> ../engine/crc.c:473 */ /* <19841> ../engine/crc.c:473 */
void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len) void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len)
{ {
uint32_t in[16]; uint32 in[16];
int mdi; int mdi;
unsigned int i, ii; 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); mdi = (int)((ctx->bits[0] >> 3) & 0x3F);
// Update number of bits // 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[1]++;
} }
ctx->bits[0] += ((uint32_t)len << 3); ctx->bits[0] += ((uint32)len << 3);
ctx->bits[1] += ((uint32_t)len >> 29); ctx->bits[1] += ((uint32)len >> 29);
while (len--) while (len--)
{ {
@ -363,10 +363,10 @@ void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len)
if (mdi == 0x40) if (mdi == 0x40)
{ {
for (i = 0, ii = 0; i < 16; i++, ii += 4) for (i = 0, ii = 0; i < 16; i++, ii += 4)
in[i] = (((uint32_t)ctx->in[ii + 3]) << 24) | in[i] = (((uint32)ctx->in[ii + 3]) << 24) |
(((uint32_t)ctx->in[ii + 2]) << 16) | (((uint32)ctx->in[ii + 2]) << 16) |
(((uint32_t)ctx->in[ii + 1]) << 8) | (((uint32)ctx->in[ii + 1]) << 8) |
((uint32_t)ctx->in[ii]); ((uint32)ctx->in[ii]);
MD5Transform(ctx->buf, in); MD5Transform(ctx->buf, in);
mdi = 0; mdi = 0;
} }
@ -376,7 +376,7 @@ void MD5Update(MD5Context_t *ctx, const unsigned char *buf, unsigned int len)
/* <197ea> ../engine/crc.c:528 */ /* <197ea> ../engine/crc.c:528 */
void MD5Final(unsigned char digest[16], MD5Context_t *ctx) void MD5Final(unsigned char digest[16], MD5Context_t *ctx)
{ {
uint32_t in[16]; uint32 in[16];
int mdi; int mdi;
unsigned int i, ii; unsigned int i, ii;
unsigned int padLen; unsigned int padLen;
@ -394,10 +394,10 @@ void MD5Final(unsigned char digest[16], MD5Context_t *ctx)
// Append length in bits and transform // Append length in bits and transform
for (i = 0, ii = 0; i < 14; i++, ii += 4) for (i = 0, ii = 0; i < 14; i++, ii += 4)
in[i] = (((uint32_t)ctx->in[ii + 3]) << 24) | in[i] = (((uint32)ctx->in[ii + 3]) << 24) |
(((uint32_t)ctx->in[ii + 2]) << 16) | (((uint32)ctx->in[ii + 2]) << 16) |
(((uint32_t)ctx->in[ii + 1]) << 8) | (((uint32)ctx->in[ii + 1]) << 8) |
((uint32_t)ctx->in[ii]); ((uint32)ctx->in[ii]);
MD5Transform(ctx->buf, in); MD5Transform(ctx->buf, in);
// Store buffer in digest // Store buffer in digest
@ -413,7 +413,7 @@ void MD5Final(unsigned char digest[16], MD5Context_t *ctx)
/* <19769> ../engine/crc.c:592 */ /* <19769> ../engine/crc.c:592 */
void MD5Transform(unsigned int buf[4], const unsigned int in[16]) 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 // Round 1
#define S11 7 #define S11 7

View File

@ -127,7 +127,7 @@ char *Cvar_VariableString(const char *var_name)
} }
/* <1872a> ../engine/cvar.c:126 */ /* <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; NOXREFCHECK;

View File

@ -53,7 +53,7 @@ NOXREF cvar_t *Cvar_FindPrevVar(const char *var_name);
float Cvar_VariableValue(const char *var_name); float Cvar_VariableValue(const char *var_name);
NOXREF int Cvar_VariableInt(const char *var_name); NOXREF int Cvar_VariableInt(const char *var_name);
char *Cvar_VariableString(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_DirectSet(struct cvar_s *var, const char *value);
void Cvar_Set(const char *var_name, const char *value); void Cvar_Set(const char *var_name, const char *value);
void Cvar_SetValue(const char *var_name, float value); void Cvar_SetValue(const char *var_name, float value);

View File

@ -434,18 +434,18 @@ int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
different = from[pTest->fieldOffset] != to[pTest->fieldOffset]; different = from[pTest->fieldOffset] != to[pTest->fieldOffset];
break; break;
case DT_SHORT: case DT_SHORT:
different = *(uint16_t *)&from[pTest->fieldOffset] != *(uint16_t *)&to[pTest->fieldOffset]; different = *(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset];
break; break;
case DT_FLOAT: case DT_FLOAT:
case DT_INTEGER: case DT_INTEGER:
case DT_ANGLE: case DT_ANGLE:
different = *(uint32_t *)&from[pTest->fieldOffset] != *(uint32_t *)&to[pTest->fieldOffset]; different = *(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset];
break; break;
case DT_TIMEWINDOW_8: 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; break;
case DT_TIMEWINDOW_BIG: 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; break;
case DT_STRING: case DT_STRING:
st1 = (char*)&from[pTest->fieldOffset]; 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; pTest->flags |= FDT_MARK;
break; break;
case DT_SHORT: 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; pTest->flags |= FDT_MARK;
break; break;
case DT_FLOAT: case DT_FLOAT:
case DT_INTEGER: case DT_INTEGER:
case DT_ANGLE: 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; pTest->flags |= FDT_MARK;
break; break;
case DT_TIMEWINDOW_8: 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; pTest->flags |= FDT_MARK;
break; break;
case DT_TIMEWINDOW_BIG: 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; pTest->flags |= FDT_MARK;
break; break;
case DT_STRING: case DT_STRING:
@ -592,28 +592,28 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF
case DT_BYTE: case DT_BYTE:
if (fieldSign) if (fieldSign)
{ {
int8_t si8 = *(int8_t *)&to[pTest->fieldOffset]; int8 si8 = *(int8 *)&to[pTest->fieldOffset];
si8 = (int8_t)((double)si8 * pTest->premultiply); si8 = (int8)((double)si8 * pTest->premultiply);
MSG_WriteSBits(si8, pTest->significant_bits); MSG_WriteSBits(si8, pTest->significant_bits);
} }
else else
{ {
uint8_t i8 = *(uint8_t *)&to[pTest->fieldOffset]; uint8 i8 = *(uint8 *)&to[pTest->fieldOffset];
i8 = (uint8_t)((double)i8 * pTest->premultiply); i8 = (uint8)((double)i8 * pTest->premultiply);
MSG_WriteBits(i8, pTest->significant_bits); MSG_WriteBits(i8, pTest->significant_bits);
} }
break; break;
case DT_SHORT: case DT_SHORT:
if (fieldSign) if (fieldSign)
{ {
int16_t si16 = *(int16_t *)&to[pTest->fieldOffset]; int16 si16 = *(int16 *)&to[pTest->fieldOffset];
si16 = (int16_t)((double)si16 * pTest->premultiply); si16 = (int16)((double)si16 * pTest->premultiply);
MSG_WriteSBits(si16, pTest->significant_bits); MSG_WriteSBits(si16, pTest->significant_bits);
} }
else else
{ {
uint16_t i16 = *(uint16_t *)&to[pTest->fieldOffset]; uint16 i16 = *(uint16 *)&to[pTest->fieldOffset];
i16 = (uint16_t)((double)i16 * pTest->premultiply); i16 = (uint16)((double)i16 * pTest->premultiply);
MSG_WriteBits(i16, pTest->significant_bits); MSG_WriteBits(i16, pTest->significant_bits);
} }
break; 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; double val = (double)(*(float *)&to[pTest->fieldOffset]) * pTest->premultiply;
if (fieldSign) if (fieldSign)
{ {
MSG_WriteSBits((int32_t)val, pTest->significant_bits); MSG_WriteSBits((int32)val, pTest->significant_bits);
} }
else else
{ {
MSG_WriteBits((uint32_t)val, pTest->significant_bits); MSG_WriteBits((uint32)val, pTest->significant_bits);
} }
break; break;
} }
@ -634,19 +634,19 @@ void DELTA_WriteMarkedFields(unsigned char *from, unsigned char *to, delta_t *pF
{ {
if (fieldSign) 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) 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); MSG_WriteSBits(signedInt, pTest->significant_bits);
} }
else else
{ {
uint32_t unsignedInt = *(uint32_t *)&to[pTest->fieldOffset]; uint32 unsignedInt = *(uint32 *)&to[pTest->fieldOffset];
if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) 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); 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: case DT_TIMEWINDOW_8:
{ {
f2 = *(float *)&to[pTest->fieldOffset]; 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); MSG_WriteSBits(twVal, 8);
break; break;
} }
case DT_TIMEWINDOW_BIG: case DT_TIMEWINDOW_BIG:
{ {
f2 = *(float *)&to[pTest->fieldOffset]; f2 = *(float *)&to[pTest->fieldOffset];
int32_t twVal = (int)(g_psv.time * pTest->premultiply) - (int)(f2 * pTest->premultiply); int32 twVal = (int)(g_psv.time * pTest->premultiply) - (int)(f2 * pTest->premultiply);
MSG_WriteSBits((int32_t)twVal, pTest->significant_bits); MSG_WriteSBits((int32)twVal, pTest->significant_bits);
break; break;
} }
case DT_STRING: 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]; to[pTest->fieldOffset] = from[pTest->fieldOffset];
break; break;
case DT_SHORT: case DT_SHORT:
*(uint16_t *)&to[pTest->fieldOffset] = *(uint16_t *)&from[pTest->fieldOffset]; *(uint16 *)&to[pTest->fieldOffset] = *(uint16 *)&from[pTest->fieldOffset];
break; break;
case DT_FLOAT: case DT_FLOAT:
case DT_INTEGER: case DT_INTEGER:
case DT_ANGLE: case DT_ANGLE:
case DT_TIMEWINDOW_8: case DT_TIMEWINDOW_8:
case DT_TIMEWINDOW_BIG: case DT_TIMEWINDOW_BIG:
*(uint32_t *)&to[pTest->fieldOffset] = *(uint32_t *)&from[pTest->fieldOffset]; *(uint32 *)&to[pTest->fieldOffset] = *(uint32 *)&from[pTest->fieldOffset];
break; break;
case DT_STRING: case DT_STRING:
Q_strcpy((char *)&to[pTest->fieldOffset], (char *)&from[pTest->fieldOffset]); 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; d2 = d2 * pTest->postmultiply;
} }
*(int8_t *)&to[pTest->fieldOffset] = (int8_t)d2; *(int8 *)&to[pTest->fieldOffset] = (int8)d2;
} }
else else
{ {
@ -817,7 +817,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
{ {
d2 = d2 * pTest->postmultiply; d2 = d2 * pTest->postmultiply;
} }
*(uint8_t *)&to[pTest->fieldOffset] = (uint8_t)d2; *(uint8 *)&to[pTest->fieldOffset] = (uint8)d2;
} }
break; break;
case DT_SHORT: case DT_SHORT:
@ -832,7 +832,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
{ {
d2 = d2 * pTest->postmultiply; d2 = d2 * pTest->postmultiply;
} }
*(int16_t *)&to[pTest->fieldOffset] = (int16_t)d2; *(int16 *)&to[pTest->fieldOffset] = (int16)d2;
} }
else else
{ {
@ -845,7 +845,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
{ {
d2 = d2 * pTest->postmultiply; d2 = d2 * pTest->postmultiply;
} }
*(uint16_t *)&to[pTest->fieldOffset] = (uint16_t)d2; *(uint16 *)&to[pTest->fieldOffset] = (uint16)d2;
} }
break; break;
case DT_FLOAT: case DT_FLOAT:
@ -879,7 +879,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
{ {
d2 = d2 * pTest->postmultiply; d2 = d2 * pTest->postmultiply;
} }
*(int32_t *)&to[pTest->fieldOffset] = (int32_t)d2; *(int32 *)&to[pTest->fieldOffset] = (int32)d2;
} }
else else
{ {
@ -892,7 +892,7 @@ int DELTA_ParseDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
{ {
d2 = d2 * pTest->postmultiply; d2 = d2 * pTest->postmultiply;
} }
*(uint32_t *)&to[pTest->fieldOffset] = (uint32_t)d2; *(uint32 *)&to[pTest->fieldOffset] = (uint32)d2;
} }
break; break;
case DT_ANGLE: case DT_ANGLE:

View File

@ -2,9 +2,9 @@
class CStringPoolMap : public CStaticMap<const char*, char*, 8, 2048> { class CStringPoolMap : public CStaticMap<const char*, char*, 8, 2048> {
protected: protected:
virtual uint32_t hash(const char* const &val) { virtual uint32 hash(const char* const &val) {
unsigned int len = strlen(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) { virtual bool equals(const char* const &val1, const char* const &val2) {

View File

@ -122,13 +122,13 @@ unsigned int FS_FileSize(const char *pFileName)
} }
/* <262fe> ../engine/filesystem_internal.cpp:101 */ /* <262fe> ../engine/filesystem_internal.cpp:101 */
int32_t FS_GetFileTime(const char *pFileName) int32 FS_GetFileTime(const char *pFileName)
{ {
return g_pFileSystem->GetFileTime(pFileName); return g_pFileSystem->GetFileTime(pFileName);
} }
/* <26329> ../engine/filesystem_internal.cpp:107 */ /* <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; NOXREFCHECK;
@ -283,7 +283,7 @@ NOXREF unsigned char FS_GetCharacter(FileHandle_t f)
{ {
NOXREFCHECK; NOXREFCHECK;
uint8_t retval; uint8 retval;
g_pFileSystem->Read(&retval, 1, f); g_pFileSystem->Read(&retval, 1, f);
return retval; return retval;
} }

View File

@ -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_Tell(FileHandle_t file);
unsigned int FS_Size(FileHandle_t file); unsigned int FS_Size(FileHandle_t file);
unsigned int FS_FileSize(const char *pFileName); unsigned int FS_FileSize(const char *pFileName);
int32_t FS_GetFileTime(const char *pFileName); int32 FS_GetFileTime(const char *pFileName);
NOXREF void FS_FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, int32_t fileTime); NOXREF void FS_FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, int32 fileTime);
int FS_IsOk(FileHandle_t file); int FS_IsOk(FileHandle_t file);
void FS_Flush(FileHandle_t file); void FS_Flush(FileHandle_t file);
int FS_EndOfFile(FileHandle_t file); int FS_EndOfFile(FileHandle_t file);

View File

@ -40,8 +40,8 @@ typedef struct ipfilter_s
{ {
unsigned int mask; unsigned int mask;
union { union {
uint32_t u32; uint32 u32;
uint8_t octets[4]; uint8 octets[4];
} compare; } compare;
float banEndTime; float banEndTime;
float banTime; float banTime;

View File

@ -765,7 +765,7 @@ void HPAK_List_f(void)
void HPAK_CreatePak(char *pakname, struct resource_s *pResource, void *pData, FileHandle_t fpSource) void HPAK_CreatePak(char *pakname, struct resource_s *pResource, void *pData, FileHandle_t fpSource)
{ {
char name[MAX_PATH]; char name[MAX_PATH];
int32_t curpos; int32 curpos;
FileHandle_t fp; FileHandle_t fp;
hash_pack_entry_t *pCurrentEntry; hash_pack_entry_t *pCurrentEntry;

View File

@ -29,10 +29,10 @@
#include "precompiled.h" #include "precompiled.h"
#define FILETIME_TO_QWORD(ft) \ #define FILETIME_TO_QWORD(ft) \
((((uint64_t)ft.dwHighDateTime) << 32) + ft.dwLowDateTime) ((((uint64)ft.dwHighDateTime) << 32) + ft.dwLowDateTime)
#define FILETIME_TO_PAIR(f,h)\ #define FILETIME_TO_PAIR(f,h)\
(((uint64_t)f << 32) | h) (((uint64)f << 32) | h)
/* <3d3ff> ../engine/host_cmd.c:4378 */ /* <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 *); 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 */ /* <3e39a> ../engine/host_cmd.c:405 */
void Host_UpdateStats(void) void Host_UpdateStats(void)
{ {
uint32_t runticks = 0; uint32 runticks = 0;
uint32_t cputicks = 0; uint32 cputicks = 0;
static float last = 0.0f; static float last = 0.0f;
static float lastAvg = 0.0f; static float lastAvg = 0.0f;
static uint64_t lastcputicks = 0; static uint64 lastcputicks = 0;
static uint64_t lastrunticks = 0; static uint64 lastrunticks = 0;
#ifdef _WIN32 #ifdef _WIN32
@ -365,8 +365,8 @@ void Host_UpdateStats(void)
} }
else else
{ {
cputicks = (uint32_t)(lastcputicks & 0xFFFFFFFF); cputicks = (uint32)(lastcputicks & 0xFFFFFFFF);
runticks = (uint32_t)(lastcputicks >> 32); runticks = (uint32)(lastcputicks >> 32);
} }
cpuPercent = cpuPercent =

View File

@ -34,12 +34,12 @@
/* <42900> ../engine/l_studio.c:31 */ /* <42900> ../engine/l_studio.c:31 */
void Mod_LoadStudioModel_internal(model_t * mod, void * buffer) void Mod_LoadStudioModel_internal(model_t * mod, void * buffer)
{ {
uint8_t *poutdata; uint8 *poutdata;
uint8_t *pindata; uint8 *pindata;
mstudiotexture_t *ptexture; mstudiotexture_t *ptexture;
int size; int size;
int i; int i;
uint8_t *pout; uint8 *pout;
studiohdr_t * phdr = (studiohdr_t *)buffer; studiohdr_t * phdr = (studiohdr_t *)buffer;
i = LittleLong(phdr->version); i = LittleLong(phdr->version);
@ -54,14 +54,14 @@ void Mod_LoadStudioModel_internal(model_t * mod, void * buffer)
mod->type = mod_studio; mod->type = mod_studio;
mod->flags = phdr->flags; mod->flags = phdr->flags;
Cache_Alloc(&mod->cache, phdr->length + 1280 * phdr->numtextures, mod->name); 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 (pout)
{ {
if (phdr->textureindex) if (phdr->textureindex)
{ {
Q_memcpy(pout, buffer, phdr->texturedataindex); Q_memcpy(pout, buffer, phdr->texturedataindex);
poutdata = pout + phdr->texturedataindex; poutdata = pout + phdr->texturedataindex;
pindata = (uint8_t*)buffer + phdr->texturedataindex; pindata = (uint8*)buffer + phdr->texturedataindex;
ptexture = (mstudiotexture_t *)(pout + phdr->textureindex); ptexture = (mstudiotexture_t *)(pout + phdr->textureindex);
for (i = 0; i < phdr->numtextures; i++, ptexture++) 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) for (int j = 0; j < 256; j++, pindata += 3, poutdata += 8)
{ {
((uint16_t*)poutdata)[0] = texgammatable[pindata[0]]; ((uint16*)poutdata)[0] = texgammatable[pindata[0]];
((uint16_t*)poutdata)[1] = texgammatable[pindata[1]]; ((uint16*)poutdata)[1] = texgammatable[pindata[1]];
((uint16_t*)poutdata)[2] = texgammatable[pindata[2]]; ((uint16*)poutdata)[2] = texgammatable[pindata[2]];
((uint16_t*)poutdata)[3] = 0; ((uint16*)poutdata)[3] = 0;
} }
} }
} }

View File

@ -336,7 +336,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
loadmodel = mod; loadmodel = mod;
mod->needload = NL_PRESENT; mod->needload = NL_PRESENT;
switch (LittleLong(*(uint32_t *)buf)) switch (LittleLong(*(uint32 *)buf))
{ {
case 'OPDI': case 'OPDI':
Sys_Error(__FUNCTION__ "Alias models are not supported"); Sys_Error(__FUNCTION__ "Alias models are not supported");
@ -427,8 +427,8 @@ void Mod_LoadTextures(lump_t *l)
miptex_t *mt; miptex_t *mt;
int palette; int palette;
int pixels; int pixels;
uint8_t *mippal; uint8 *mippal;
uint16_t *texpal; uint16 *texpal;
int max; int max;
texture_t *tx2; texture_t *tx2;
int num; int num;
@ -487,7 +487,7 @@ void Mod_LoadTextures(lump_t *l)
Sys_Error("Texture %s is not 16 aligned", mt); Sys_Error("Texture %s is not 16 aligned", mt);
pixels = 85 * mt->height * mt->width / 64; 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); tx = (texture_t *)Hunk_AllocName(2 + 8 * palette + pixels + sizeof(texture_t), loadname);
loadmodel->textures[i] = tx; loadmodel->textures[i] = tx;
@ -510,8 +510,8 @@ void Mod_LoadTextures(lump_t *l)
//R_InitSky(); //R_InitSky();
} }
mippal = (uint8_t *)&mt[1] + pixels + 2; mippal = (uint8 *)&mt[1] + pixels + 2;
texpal = (uint16_t *)((char*)&tx[1] + pixels + 2); texpal = (uint16 *)((char*)&tx[1] + pixels + 2);
for (int j = 0; j < palette; j++, mippal += 3, texpal += 4) for (int j = 0; j < palette; j++, mippal += 3, texpal += 4)
{ {
texpal[0] = texgammatable[mippal[2]]; 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); "(%i should be %i)", mod->name, version, SPRITE_VERSION);
numframes = LittleLong(pin->numframes); 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; size = sizeof(msprite_t) + (numframes - 1) * sizeof(psprite->frames) + 2 + 8 * palsize;
psprite = (msprite_t*) Hunk_AllocName(size, loadname); 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); mod->maxs[2] = float(psprite->maxheight / 2);
unsigned char *palsrc = (unsigned char*)(&pin[1]) + 2; //header + palette size 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 *(paldest++) = palsize; //write palette size
for (i = 0; i < palsize; i++, paldest += 4, palsrc += 3) for (i = 0; i < palsize; i++, paldest += 4, palsrc += 3)
{ {

View File

@ -457,7 +457,7 @@ qboolean NET_StringToSockaddr(const char *s, struct sockaddr *sadr)
sadr->sa_data[9] = (char)val; sadr->sa_data[9] = (char)val;
sscanf(s + 22, "%u", &val); sscanf(s + 22, "%u", &val);
*(uint16_t *)&sadr->sa_data[10] = htons(val); *(uint16 *)&sadr->sa_data[10] = htons(val);
return TRUE; return TRUE;
} }
@ -492,7 +492,7 @@ qboolean NET_StringToSockaddr(const char *s, struct sockaddr *sadr)
{ {
return FALSE; 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; return TRUE;
} }
@ -1020,7 +1020,7 @@ qboolean NET_QueuePacket(netsrc_t sock)
} }
NET_TransferRawData(&in_message, buf, ret); NET_TransferRawData(&in_message, buf, ret);
if (*(uint32_t *)in_message.data == 0xFFFFFFFE) if (*(uint32 *)in_message.data == 0xFFFFFFFE)
{ {
if (in_message.cursize >= 9) if (in_message.cursize >= 9)
{ {
@ -1284,7 +1284,7 @@ qboolean NET_GetPacket_internal(netsrc_t sock)
return bret; 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; return true;
} }

View File

@ -49,7 +49,7 @@ int gMsgDest;
int gMsgType; int gMsgType;
qboolean gMsgStarted; qboolean gMsgStarted;
vec3_t gMsgOrigin; vec3_t gMsgOrigin;
int32_t idum; int32 idum;
int g_groupop; int g_groupop;
int g_groupmask; int g_groupmask;
unsigned char checkpvs[1024]; 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 */ /* <78451> ../engine/pr_cmds.c:184 */
void PF_setmodel_I(edict_t *e, const char *m) 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; int i = 0;
#ifdef REHLDS_CHECKS #ifdef REHLDS_CHECKS
@ -1043,7 +1043,7 @@ qboolean PR_IsEmptyString(const char *s)
} }
/* <795b5> ../engine/pr_cmds.c:1397 */ /* <795b5> ../engine/pr_cmds.c:1397 */
int PF_precache_sound_I(char *s) int PF_precache_sound_I(const char *s)
{ {
int i; 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 */ /* <799da> ../engine/pr_cmds.c:1849 */
int PF_precache_model_I(char *s) int PF_precache_model_I(const char *s)
{ {
int iOptional = 0; int iOptional = 0;
if (!s) if (!s)
@ -1525,13 +1525,13 @@ char *PF_GetInfoKeyBuffer_I(edict_t *e)
} }
/* <79b55> ../engine/pr_cmds.c:2012 */ /* <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); return (char *)Info_ValueForKey(infobuffer, key);
} }
/* <79b91> ../engine/pr_cmds.c:2022 */ /* <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) if (infobuffer == localinfo)
{ {
@ -1558,7 +1558,7 @@ void PF_RemoveKey_I(char *s, const char *key)
} }
/* <79c0f> ../engine/pr_cmds.c:2047 */ /* <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; client_t *pClient;
@ -2273,7 +2273,7 @@ void PF_setspawnparms_I(edict_t *ent)
} }
/* <7a539> ../engine/pr_cmds.c:2956 */ /* <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; static int last_spawncount;
@ -2310,7 +2310,7 @@ void SeedRandomNumberGenerator(void)
#define NDIV (1+(IM-1)/NTAB) #define NDIV (1+(IM-1)/NTAB)
/* <7a598> ../engine/pr_cmds.c:3003 */ /* <7a598> ../engine/pr_cmds.c:3003 */
int32_t ran1(void) int32 ran1(void)
{ {
int j; int j;
long k; long k;
@ -2364,7 +2364,7 @@ float RandomFloat(float flLow, float flHigh)
} }
/* <7a6b2> ../engine/pr_cmds.c:3056 */ /* <7a6b2> ../engine/pr_cmds.c:3056 */
int32_t RandomLong(int32_t lLow, int32_t lHigh) int32 RandomLong(int32 lLow, int32 lHigh)
{ {
#ifndef SWDS #ifndef SWDS
g_engdstAddrs.pfnRandomLong(&lLow, &lHigh); g_engdstAddrs.pfnRandomLong(&lLow, &lHigh);
@ -2410,10 +2410,10 @@ void PF_FadeVolume(const edict_t *clientent, int fadePercent, int fadeOutSeconds
return; return;
MSG_WriteChar(&client->netchan.message, svc_soundfade); MSG_WriteChar(&client->netchan.message, svc_soundfade);
MSG_WriteByte(&client->netchan.message, (uint8_t)fadePercent); MSG_WriteByte(&client->netchan.message, (uint8)fadePercent);
MSG_WriteByte(&client->netchan.message, (uint8_t)holdTime); MSG_WriteByte(&client->netchan.message, (uint8)holdTime);
MSG_WriteByte(&client->netchan.message, (uint8_t)fadeOutSeconds); MSG_WriteByte(&client->netchan.message, (uint8)fadeOutSeconds);
MSG_WriteByte(&client->netchan.message, (uint8_t)fadeInSeconds); MSG_WriteByte(&client->netchan.message, (uint8)fadeInSeconds);
} }
/* <7a7a1> ../engine/pr_cmds.c:3124 */ /* <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 */ /* <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); Cvar_DirectSet(var, value);
} }

View File

@ -81,7 +81,7 @@ extern int gMsgDest;
extern int gMsgType; extern int gMsgType;
extern qboolean gMsgStarted; extern qboolean gMsgStarted;
extern vec3_t gMsgOrigin; extern vec3_t gMsgOrigin;
extern int32_t idum; extern int32 idum;
extern int g_groupop; extern int g_groupop;
extern int g_groupmask; extern int g_groupmask;
extern unsigned char checkpvs[1024]; 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); edict_t *FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
int GetEntityIllum(edict_t *pEnt); int GetEntityIllum(edict_t *pEnt);
qboolean PR_IsEmptyString(const char *s); 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); 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_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_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); 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_precache_generic_I(char *s);
int PF_IsMapValid_I(char *mapname); int PF_IsMapValid_I(char *mapname);
int PF_NumberOfEntities_I(void); int PF_NumberOfEntities_I(void);
char *PF_GetInfoKeyBuffer_I(edict_t *e); char *PF_GetInfoKeyBuffer_I(edict_t *e);
char *PF_InfoKeyValue_I(char *infobuffer, char *key); char *PF_InfoKeyValue_I(char *infobuffer, const char *key);
void PF_SetKeyValue_I(char *infobuffer, char *key, char *value); void PF_SetKeyValue_I(char *infobuffer, const char *key, const char *value);
void PF_RemoveKey_I(char *s, const char *key); 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_walkmove_I(edict_t *ent, float yaw, float dist, int iMode);
int PF_droptofloor_I(edict_t *ent); int PF_droptofloor_I(edict_t *ent);
int PF_DecalIndex(const char *name); 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_makestatic_I(edict_t *ent);
void PF_StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex); void PF_StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex);
void PF_setspawnparms_I(edict_t *ent); 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); void SeedRandomNumberGenerator(void);
int32_t ran1(void); int32 ran1(void);
float fran1(void); float fran1(void);
float RandomFloat(float flLow, float flHigh); 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_FadeVolume(const edict_t *clientent, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
void PF_SetClientMaxspeed(edict_t *clientent, float fNewMaxspeed); void PF_SetClientMaxspeed(edict_t *clientent, float fNewMaxspeed);
int PF_GetPlayerUserId(edict_t *e); int PF_GetPlayerUserId(edict_t *e);
@ -202,7 +202,7 @@ int PF_GetCurrentPlayer(void);
int PF_CanSkipPlayer(const edict_t *pClient); int PF_CanSkipPlayer(const edict_t *pClient);
void PF_SetGroupMask(int mask, int op); void PF_SetGroupMask(int mask, int op);
int PF_CreateInstancedBaseline(int classname, struct entity_state_s *baseline); 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_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, const char *filename);
void PF_GetPlayerStats(const edict_t *pClient, int *ping, int *packet_loss); void PF_GetPlayerStats(const edict_t *pClient, int *ping, int *packet_loss);
NOXREF void QueryClientCvarValueCmd(void); NOXREF void QueryClientCvarValueCmd(void);

View File

@ -39,7 +39,7 @@
/* <8a763> ../engine/pr_dlls.h:42 */ /* <8a763> ../engine/pr_dlls.h:42 */
typedef struct functiontable_s typedef struct functiontable_s
{ {
uint32_t pFunction; uint32 pFunction;
char *pFunctionName; char *pFunctionName;
} functiontable_t; } functiontable_t;

View File

@ -441,7 +441,7 @@ void InitEntityDLLFields(edict_t *pEdict)
} }
/* <7f8ee> ../engine/pr_edict.c:594 */ /* <7f8ee> ../engine/pr_edict.c:594 */
void *PvAllocEntPrivateData(edict_t *pEdict, int32_t cb) void *PvAllocEntPrivateData(edict_t *pEdict, int32 cb)
{ {
FreeEntPrivateData(pEdict); FreeEntPrivateData(pEdict);

View File

@ -51,7 +51,7 @@ int NUM_FOR_EDICT(const edict_t *e);
bool SuckOutClassname(char *szInputStream, edict_t *pEdict); bool SuckOutClassname(char *szInputStream, edict_t *pEdict);
void ReleaseEntityDLLFields(edict_t *pEdict); void ReleaseEntityDLLFields(edict_t *pEdict);
void InitEntityDLLFields(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 *PvEntPrivateData(edict_t *pEdict);
void FreeEntPrivateData(edict_t *pEdict); void FreeEntPrivateData(edict_t *pEdict);
void FreeAllEntPrivateData(void); void FreeAllEntPrivateData(void);

View File

@ -0,0 +1,5 @@
#include "precompiled.h"
#include "sys_shared.cpp"
#include "crc32.cpp"
#include "interface.cpp"

View File

@ -135,14 +135,14 @@ typedef struct server_s
int num_resources; int num_resources;
consistency_t consistency_list[512]; consistency_t consistency_list[512];
int num_consistency; int num_consistency;
char *model_precache[HL_MODEL_MAX]; const char *model_precache[HL_MODEL_MAX];
struct model_s *models[HL_MODEL_MAX]; struct model_s *models[HL_MODEL_MAX];
unsigned char model_precache_flags[HL_MODEL_MAX]; unsigned char model_precache_flags[HL_MODEL_MAX];
struct event_s event_precache[HL_EVENT_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]; short int sound_precache_hashedlookup[HL_SOUND_HASHLOOKUP_SIZE];
qboolean sound_precache_hashedlookup_built; 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]; char generic_precache_names[HL_GENERIC_MAX][64];
int num_generic_names; int num_generic_names;
char *lightstyles[MAX_LIGHTSTYLES]; char *lightstyles[MAX_LIGHTSTYLES];
@ -229,7 +229,7 @@ typedef struct client_s
int lc; int lc;
char physinfo[MAX_INFO_STRING]; char physinfo[MAX_INFO_STRING];
qboolean m_bLoopback; qboolean m_bLoopback;
uint32_t m_VoiceStreams[2]; uint32 m_VoiceStreams[2];
double m_lastvoicetime; double m_lastvoicetime;
int m_sendrescount; int m_sendrescount;
} client_t; } client_t;
@ -697,7 +697,7 @@ void SV_SkipUpdates(void);
void SV_SendClientMessages(void); void SV_SendClientMessages(void);
void SV_ExtractFromUserinfo(client_t *cl); void SV_ExtractFromUserinfo(client_t *cl);
int SV_ModelIndex(const char *name); 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_CreateGenericResources(void);
void SV_CreateResourceList(void); void SV_CreateResourceList(void);
void SV_ClearCaches(void); void SV_ClearCaches(void);

View File

@ -826,7 +826,7 @@ qboolean SV_BuildSoundMsg(edict_t *entity, int channel, const char *sample, int
if (field_mask & SND_FL_VOLUME) if (field_mask & SND_FL_VOLUME)
MSG_WriteBits(volume, 8); MSG_WriteBits(volume, 8);
if (field_mask & SND_FL_ATTENUATION) 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(channel, 3);
MSG_WriteBits(ent, 11); MSG_WriteBits(ent, 11);
MSG_WriteBits(sound_num, (field_mask & SND_FL_LARGE_INDEX) ? 16 : 8); MSG_WriteBits(sound_num, (field_mask & SND_FL_LARGE_INDEX) ? 16 : 8);
@ -2323,11 +2323,11 @@ void SV_ConnectClient_internal(void)
return; return;
} }
memcpy(szSteamAuthBuf, &net_message.data[msg_readcount], len); 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 (adr.type == NA_LOOPBACK)
{ {
if (sv_lan.value <= 0.0f) if (sv_lan.value <= 0.0f)
client->network_userid.clientip = *(uint32_t *)&adr.ip[0]; client->network_userid.clientip = *(uint32 *)&adr.ip[0];
else else
client->network_userid.clientip = 0x7F000001; //127.0.0.1 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.idtype = AUTH_IDTYPE_LOCAL;
host_client->network_userid.m_SteamID = 0; 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); Steam_NotifyBotConnect(client);
} }
@ -3067,7 +3067,7 @@ int SVC_GameDllQuery(const char *s)
valid = gEntityInterface.pfnConnectionlessPacket(&net_from, s, (char *) &data[4], &len); valid = gEntityInterface.pfnConnectionlessPacket(&net_from, s, (char *) &data[4], &len);
if (len && len <= 2044) if (len && len <= 2044)
{ {
*(uint32_t *)data = 0xFFFFFFFF; //connectionless packet *(uint32 *)data = 0xFFFFFFFF; //connectionless packet
NET_SendPacket(NS_SERVER, len + 4, data, net_from); NET_SendPacket(NS_SERVER, len + 4, data, net_from);
} }
return valid; return valid;
@ -3508,7 +3508,7 @@ qboolean SV_FilterPacket(void)
ipfilter_t* curFilter = &ipfilters[i]; ipfilter_t* curFilter = &ipfilters[i];
if (curFilter->compare.u32 == 0xFFFFFFFF || curFilter->banEndTime == 0.0f || curFilter->banEndTime > realtime) 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; return (int)sv_filterban.value;
} }
else else
@ -3549,7 +3549,7 @@ void SV_ReadPackets(void)
continue; continue;
} }
if (*(uint32_t *)net_message.data == 0xFFFFFFFF) if (*(uint32 *)net_message.data == 0xFFFFFFFF)
{ {
// Connectionless packet // Connectionless packet
if (CheckIP(net_from)) if (CheckIP(net_from))
@ -4862,7 +4862,7 @@ int SV_ModelIndex(const char *name)
} }
/* <a9992> ../engine/sv_main.c:6529 */ /* <a9992> ../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; resource_t *r;
if (g_psv.num_resources >= 1280) if (g_psv.num_resources >= 1280)
@ -4938,7 +4938,7 @@ void SV_CreateGenericResources(void)
/* <a9a24> ../engine/sv_main.c:6675 */ /* <a9a24> ../engine/sv_main.c:6675 */
void SV_CreateResourceList(void) void SV_CreateResourceList(void)
{ {
char ** s; char const ** s;
int ffirstsent = 0; int ffirstsent = 0;
int i; int i;
int nSize; int nSize;
@ -5690,8 +5690,8 @@ qboolean StringToFilter(const char *s, ipfilter_t *f)
if (i < 4) if (i < 4)
continue; continue;
} }
f->mask = *(uint32_t *)m; f->mask = *(uint32 *)m;
f->compare.u32 = *(uint32_t *)b; f->compare.u32 = *(uint32 *)b;
return TRUE; return TRUE;
} }
Con_Printf("Bad filter address: %s\n", cc); Con_Printf("Bad filter address: %s\n", cc);
@ -6266,7 +6266,7 @@ void SV_ListIP_f(void)
Con_Printf("IP filter list:\n"); Con_Printf("IP filter list:\n");
for (int i = 0; i < numipfilters; i++) 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) if (ipfilters[i].banTime == 0.0f)
Con_Printf("%3i.%3i.%3i.%3i : permanent\n", b[0], b[1], b[2], b[3]); Con_Printf("%3i.%3i.%3i.%3i : permanent\n", b[0], b[1], b[2], b[3]);
else else
@ -6293,7 +6293,7 @@ void SV_WriteIP_f(void)
if (ipfilters[i].banTime != 0.0f) if (ipfilters[i].banTime != 0.0f)
continue; 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_FPrintf(f, "addip 0.0 %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
} }
FS_Close(f); FS_Close(f);
@ -6689,7 +6689,7 @@ void SV_CheckForRcon(void)
} }
else else
{ {
if (*(uint32_t *)net_message.data == 0xFFFFFFFF) if (*(uint32 *)net_message.data == 0xFFFFFFFF)
SV_HandleRconPacket(); SV_HandleRconPacket();
} }
} }

View File

@ -29,7 +29,7 @@
#include "precompiled.h" #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;
/* <ee495> ../engine/sv_steam3.cpp:81 */ /* <ee495> ../engine/sv_steam3.cpp:81 */
@ -61,7 +61,7 @@ void CSteam3Server::OnLogonSuccess(SteamServersConnected_t *pLogonSuccess)
} }
/* <ee390> ../engine/sv_steam3.cpp:128 */ /* <ee390> ../engine/sv_steam3.cpp:128 */
uint64_t CSteam3Server::GetSteamID() uint64 CSteam3Server::GetSteamID()
{ {
if (m_bLanOnly) if (m_bLanOnly)
return CSteamID(0, k_EUniversePublic, k_EAccountTypeInvalid).ConvertToUint64(); return CSteamID(0, k_EUniversePublic, k_EAccountTypeInvalid).ConvertToUint64();
@ -252,7 +252,7 @@ void CSteam3Server::Activate()
int gamePort; int gamePort;
char gamedir[MAX_PATH]; char gamedir[MAX_PATH];
int usSteamPort; int usSteamPort;
uint32_t unIP; uint32 unIP;
if (m_bLoggedOn) if (m_bLoggedOn)
{ {
@ -349,7 +349,7 @@ void CSteam3Server::Shutdown(void) /* linkage=_ZN13CSteam3Server8ShutdownEv */
} }
/* <ee2d5> ../engine/sv_steam3.cpp:537 */ /* <ee2d5> ../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; class CSteamID steamIDClient;
bool bRet = false; bool bRet = false;
@ -486,13 +486,13 @@ void CSteam3Server::RunFrame()
{ {
s_fLastRunSendPackets = fCurTime; s_fLastRunSendPackets = fCurTime;
uint16_t port; uint16 port;
uint32_t ip; uint32 ip;
int iLen = CRehldsPlatformHolder::get()->SteamGameServer()->GetNextOutgoingPacket(szOutBuf, sizeof(szOutBuf), &ip, &port); int iLen = CRehldsPlatformHolder::get()->SteamGameServer()->GetNextOutgoingPacket(szOutBuf, sizeof(szOutBuf), &ip, &port);
while (iLen > 0) while (iLen > 0)
{ {
netadr_t netAdr; netadr_t netAdr;
*((uint32_t*)&netAdr.ip[0]) = htonl(ip); *((uint32*)&netAdr.ip[0]) = htonl(ip);
netAdr.port = htons(port); netAdr.port = htons(port);
netAdr.type = NA_IP; netAdr.type = NA_IP;
@ -540,13 +540,13 @@ void CSteam3Client::Shutdown(void) /* linkage=_ZN13CSteam3Client8ShutdownEv */
} }
/* <ed9fb> ../engine/sv_steam3.cpp:816 */ /* <ed9fb> ../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); return SteamUser()->InitiateGameConnection(pData, cbMaxData, CSteamID(steamID), ntohl(unIPServer), ntohs(usPortServer), bSecure);
} }
/* <eda3a> ../engine/sv_steam3.cpp:822 */ /* <eda3a> ../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)); SteamUser()->TerminateGameConnection(ntohl(unIPServer), ntohs(usPortServer));
} }
@ -628,7 +628,7 @@ void CSteam3Client::RunFrame(void) /* linkage=_ZN13CSteam3Client8RunFrameEv */
/* <f108b> ../engine/sv_steam3.cpp:552 */ /* <f108b> ../engine/sv_steam3.cpp:552 */
uint64_t ISteamGameServer_CreateUnauthenticatedUserConnection(void) uint64 ISteamGameServer_CreateUnauthenticatedUserConnection(void)
{ {
if (!CRehldsPlatformHolder::get()->SteamGameServer()) if (!CRehldsPlatformHolder::get()->SteamGameServer())
{ {
@ -639,7 +639,7 @@ uint64_t ISteamGameServer_CreateUnauthenticatedUserConnection(void)
} }
/* <f10a4> ../engine/sv_steam3.cpp:559 */ /* <f10a4> ../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()) if (!CRehldsPlatformHolder::get()->SteamGameServer())
{ {
@ -650,7 +650,7 @@ bool ISteamGameServer_BUpdateUserData(uint64_t steamid, const char *netname, uin
} }
/* <f10ef> ../engine/sv_steam3.cpp:566 */ /* <f10ef> ../engine/sv_steam3.cpp:566 */
bool ISteamApps_BIsSubscribedApp(uint32_t appid) bool ISteamApps_BIsSubscribedApp(uint32 appid)
{ {
if (CRehldsPlatformHolder::get()->SteamApps()) if (CRehldsPlatformHolder::get()->SteamApps())
{ {
@ -795,13 +795,13 @@ void Steam_InitClient(void)
} }
/* <f1ace> ../engine/sv_steam3.cpp:1007 */ /* <f1ace> ../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); return Steam3Client()->InitiateGameConnection(pData, cbMaxData, steamID, unIPServer, usPortServer, bSecure != 0);
} }
/* <f1bd1> ../engine/sv_steam3.cpp:1013 */ /* <f1bd1> ../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); Steam3Client()->TerminateConnection(unIPServer, usPortServer);
} }
@ -813,7 +813,7 @@ void Steam_ShutdownClient(void)
} }
/* <f1c86> ../engine/sv_steam3.cpp:1026 */ /* <f1c86> ../engine/sv_steam3.cpp:1026 */
uint64_t Steam_GSGetSteamID() uint64 Steam_GSGetSteamID()
{ {
return Steam3Server()->GetSteamID(); return Steam3Server()->GetSteamID();
} }
@ -838,7 +838,7 @@ qboolean Steam_GSBSecurePreference(void)
} }
/* <f1da1> ../engine/sv_steam3.cpp:1046 */ /* <f1da1> ../engine/sv_steam3.cpp:1046 */
TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64_t unSteamID) TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64 unSteamID)
{ {
class CSteamID steamID = unSteamID; class CSteamID steamID = unSteamID;
TSteamGlobalUserID steam2ID; TSteamGlobalUserID steam2ID;
@ -847,7 +847,7 @@ TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64_t unSteamID)
} }
/* <f1e63> ../engine/sv_steam3.cpp:1054 */ /* <f1e63> ../engine/sv_steam3.cpp:1054 */
uint64_t Steam_StringToSteamID(const char *pStr) uint64 Steam_StringToSteamID(const char *pStr)
{ {
CSteamID steamID; CSteamID steamID;
if (Steam3Server()) if (Steam3Server())
@ -943,7 +943,7 @@ void Master_SetMaster_f(void)
} }
/* <f20d0> ../engine/sv_steam3.cpp:1143 */ /* <f20d0> ../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); CRehldsPlatformHolder::get()->SteamGameServer()->HandleIncomingPacket(data, len, fromip, port);
} }

View File

@ -116,7 +116,7 @@ public:
} }
/* <ee390> ../engine/sv_steam3.cpp:128 */ /* <ee390> ../engine/sv_steam3.cpp:128 */
uint64_t GetSteamID(void); /* linkage=_ZN13CSteam3Server10GetSteamIDEv */ uint64 GetSteamID(void); /* linkage=_ZN13CSteam3Server10GetSteamIDEv */
/* <ee4f8> ../engine/sv_steam3.cpp:190 */ /* <ee4f8> ../engine/sv_steam3.cpp:190 */
void OnGSClientDenyHelper(client_t *cl, EDenyReason eDenyReason, const char *pchOptionalText); /* linkage=_ZN13CSteam3Server20OnGSClientDenyHelperEP8client_s11EDenyReasonPKc */ void OnGSClientDenyHelper(client_t *cl, EDenyReason eDenyReason, const char *pchOptionalText); /* linkage=_ZN13CSteam3Server20OnGSClientDenyHelperEP8client_s11EDenyReasonPKc */
@ -134,7 +134,7 @@ public:
virtual void Shutdown(void); /* linkage=_ZN13CSteam3Server8ShutdownEv */ virtual void Shutdown(void); /* linkage=_ZN13CSteam3Server8ShutdownEv */
/* <ee2d5> ../engine/sv_steam3.cpp:537 */ /* <ee2d5> ../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 */
/* <ee327> ../engine/sv_steam3.cpp:578 */ /* <ee327> ../engine/sv_steam3.cpp:578 */
bool NotifyBotConnect(client_t *client); /* linkage=_ZN13CSteam3Server16NotifyBotConnectEP8client_s */ bool NotifyBotConnect(client_t *client); /* linkage=_ZN13CSteam3Server16NotifyBotConnectEP8client_s */
@ -194,12 +194,12 @@ extern CSteam3Server *s_Steam3Server;
extern CSteam3Client s_Steam3Client; 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); uint64 ISteamGameServer_CreateUnauthenticatedUserConnection(void);
bool ISteamGameServer_BUpdateUserData(uint64_t steamid, const char *netname, uint32_t score); bool ISteamGameServer_BUpdateUserData(uint64 steamid, const char *netname, uint32 score);
bool ISteamApps_BIsSubscribedApp(uint32_t appid); bool ISteamApps_BIsSubscribedApp(uint32 appid);
const char *Steam_GetCommunityName(void); const char *Steam_GetCommunityName(void);
qboolean Steam_NotifyClientConnect(client_t *cl, const void *pvSteam2Key, unsigned int ucbSteam2Key); 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); 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_SetCVar(const char *pchKey, const char *pchValue);
void Steam_ClientRunFrame(void); void Steam_ClientRunFrame(void);
void Steam_InitClient(void); void Steam_InitClient(void);
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);
void Steam_GSTerminateGameConnection(uint32_t unIPServer, uint16_t usPortServer); void Steam_GSTerminateGameConnection(uint32 unIPServer, uint16 usPortServer);
void Steam_ShutdownClient(void); void Steam_ShutdownClient(void);
uint64_t Steam_GSGetSteamID(void); uint64 Steam_GSGetSteamID(void);
qboolean Steam_GSBSecure(void); qboolean Steam_GSBSecure(void);
qboolean Steam_GSBLoggedOn(void); qboolean Steam_GSBLoggedOn(void);
qboolean Steam_GSBSecurePreference(void); qboolean Steam_GSBSecurePreference(void);
TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64_t unSteamID); TSteamGlobalUserID Steam_Steam3IDtoSteam2(uint64 unSteamID);
uint64_t Steam_StringToSteamID(const char *pStr); uint64 Steam_StringToSteamID(const char *pStr);
const char *Steam_GetGSUniverse(void); const char *Steam_GetGSUniverse(void);
CSteam3Server *Steam3Server(void); CSteam3Server *Steam3Server(void);
CSteam3Client *Steam3Client(void); CSteam3Client *Steam3Client(void);
void Master_SetMaster_f(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 #endif // SV_STEAM3_H

View File

@ -142,7 +142,7 @@ void SV_ParseConsistencyResponse(client_t *pSenderClient)
Q_memcpy(resbuffer, r->rguc_reserved, sizeof(resbuffer)); Q_memcpy(resbuffer, r->rguc_reserved, sizeof(resbuffer));
if (!Q_memcmp(resbuffer, nullbuffer, 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; c = idx + 1;
} }
else 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); 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(); client_t* cl = client->GetClient();
if (opcode < clc_bad || opcode > clc_cvarvalue2) if (opcode < clc_bad || opcode > clc_cvarvalue2)
{ {

View File

@ -215,7 +215,7 @@ enginefuncs_t g_engfuncsExportedToDlls;
#ifdef _WIN32 #ifdef _WIN32
void Sys_SetupFPUOptions() void Sys_SetupFPUOptions()
{ {
static uint8_t fpuOpts[32]; static uint8 fpuOpts[32];
__asm { fnstenv byte ptr fpuOpts } __asm { fnstenv byte ptr fpuOpts }
fpuOpts[0] |= 0x3Fu; fpuOpts[0] |= 0x3Fu;
@ -281,13 +281,13 @@ void __cdecl Sys_InitHardwareTimer()
int g_SavedFPUCW1 = 0; int g_SavedFPUCW1 = 0;
__declspec(noinline) void Sys_FPUCW_Push_Prec64() { __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 { fnstcw g_SavedFPUCW1 }
__asm { fldcw tmp } __asm { fldcw tmp }
} }
__declspec(noinline) void Sys_FPUCW_Pop_Prec64() { __declspec(noinline) void Sys_FPUCW_Pop_Prec64() {
uint16_t tmp = g_SavedFPUCW1; uint16 tmp = g_SavedFPUCW1;
__asm { fldcw tmp } __asm { fldcw tmp }
} }

View File

@ -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. // 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) 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; int nBytes = 1;
uint32_t uValue = pUTF8[0]; uint32 uValue = pUTF8[0];
uint32_t uMinValue = 0; uint32 uMinValue = 0;
// 0....... single byte // 0....... single byte
if (uValue < 0x80) if (uValue < 0x80)
@ -105,9 +105,9 @@ decodeError:
decodeFinishedMaybeCESU8: decodeFinishedMaybeCESU8:
// Do we have a full UTF-16 surrogate pair that's been UTF-8 encoded afterwards? // 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. // 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; nBytes = 6;
uMinValue = 0x10000; uMinValue = 0x10000;
} }

View File

@ -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_Shdr *sections, *shstrtab_hdr, *symtab_hdr, *strtab_hdr;
Elf32_Sym *symtab; Elf32_Sym *symtab;
const char *shstrtab, *strtab; const char *shstrtab, *strtab;
uint16_t section_count; uint16 section_count;
uint32_t symbol_count; uint32 symbol_count;
size_t address; size_t address;
// If index > 0 then we shouldn't use dlsym, cos it will give wrong result // 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); shstrtab = (const char *)(map_base + shstrtab_hdr->sh_offset);
// Iterate sections while looking for ELF symbol table and string table // 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]; Elf32_Shdr &hdr = sections[i];
const char *section_name = shstrtab + hdr.sh_name; 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 // Iterate symbol table
int match = 1; 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]; Elf32_Sym &sym = symtab[i];
unsigned char sym_type = ELF32_ST_TYPE(sym.st_info); unsigned char sym_type = ELF32_ST_TYPE(sym.st_info);
@ -444,7 +444,7 @@ void ProcessModuleData(Module *module)
return; 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.size = CodeSection->Misc.VirtualSize;
module->codeSection.end = module->codeSection.start + module->codeSection.size; module->codeSection.end = module->codeSection.start + module->codeSection.size;
module->codeSection.next = NULL; module->codeSection.next = NULL;
@ -499,7 +499,7 @@ size_t HIDDEN ConvertHexString(const char *srcHexString, unsigned char *outBuffe
unsigned char *out = outBuffer; unsigned char *out = outBuffer;
unsigned char *end = outBuffer + bufferSize; unsigned char *end = outBuffer + bufferSize;
bool low = false; bool low = false;
uint8_t byte = 0; uint8 byte = 0;
while (*in && out < end) while (*in && out < end)
{ {
if (*in >= '0' && *in <= '9') { byte |= *in - '0'; } 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; 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 // Ensure start is lower than the end
if (start > 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 // 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; uint32 origDWord = *(size_t *)addr;
EnablePageWrite(addr, sizeof(uint32_t)); EnablePageWrite(addr, sizeof(uint32));
*(size_t *)addr = newDWord; *(size_t *)addr = newDWord;
RestorePageProtection(addr, sizeof(uint32_t)); RestorePageProtection(addr, sizeof(uint32));
return origDWord; return origDWord;
} }
// Exchanges bytes between memory address and bytes array // 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); EnablePageWrite(origAddr, size);
unsigned char data[MAX_PATTERN]; unsigned char data[MAX_PATTERN];
int32_t iSize = size; int32 iSize = size;
while (iSize > 0) while (iSize > 0)
{ {
size_t s = iSize <= MAX_PATTERN ? iSize : MAX_PATTERN; size_t s = iSize <= MAX_PATTERN ? iSize : MAX_PATTERN;
@ -753,9 +753,9 @@ bool HIDDEN FindDataRef(Module *module, AddressRef *ref)
} }
#ifdef _WIN32 #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); coderef_addr = MemoryFindRefForwardPrefix8(coderef_addr, section->end, findRefsTo, 0xE8, true);
while (coderef_addr) { while (coderef_addr) {
CFuncAddr* cfa = new CFuncAddr(coderef_addr); CFuncAddr* cfa = new CFuncAddr(coderef_addr);

View File

@ -90,7 +90,7 @@ struct AddressRef
class CFuncAddr { class CFuncAddr {
public: public:
uint32_t Addr; uint32 Addr;
CFuncAddr *Next; CFuncAddr *Next;
void *operator new(size_t size){ void *operator new(size_t size){
@ -101,7 +101,7 @@ public:
free(cPoint); free(cPoint);
} }
CFuncAddr(uint32_t addr) { CFuncAddr(uint32 addr) {
Addr = addr; Addr = addr;
Next = NULL; Next = NULL;
} }
@ -122,10 +122,10 @@ void ProcessModuleData(Module *module);
size_t ConvertHexString(const char *srcHexString, unsigned char *outBuffer, size_t bufferSize); 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 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 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); uint32 HookDWord(size_t addr, uint32 newDWord);
void ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32_t size); void ExchangeMemoryBytes(size_t origAddr, size_t dataAddr, uint32 size);
bool GetAddress(Module *module, Address *addr, size_t baseOffset); bool GetAddress(Module *module, Address *addr, size_t baseOffset);
bool HookFunction(Module *module, FunctionHook *hook); bool HookFunction(Module *module, FunctionHook *hook);
@ -133,7 +133,7 @@ void HookFunctionCall(void* hookWhat, void* hookAddr);
bool HIDDEN FindDataRef(Module *module, AddressRef *ref); bool HIDDEN FindDataRef(Module *module, AddressRef *ref);
#ifdef _WIN32 #ifdef _WIN32
void FindAllCalls(Section* section, CFuncAddr** calls, uint32_t findRefsTo); void FindAllCalls(Section* section, CFuncAddr** calls, uint32 findRefsTo);
#endif // _WIN32 #endif // _WIN32
#endif // _MEMORY_H #endif // _MEMORY_H

View File

@ -2,12 +2,12 @@
#define REHLDS_DEBUG_MAX_EDICTS 2048 #define REHLDS_DEBUG_MAX_EDICTS 2048
uint32_t calcFloatChecksum(uint32_t crc, const float* pFloat) { uint32 calcFloatChecksum(uint32 crc, const float* pFloat) {
uint32_t sVal = *reinterpret_cast<const uint32_t*>(pFloat); uint32 sVal = *reinterpret_cast<const uint32*>(pFloat);
return _mm_crc32_u32(crc, sVal); 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);
crc = calcFloatChecksum(crc, v + 1); crc = calcFloatChecksum(crc, v + 1);
@ -15,7 +15,7 @@ uint32_t calcVec3Checksum(uint32_t crc, const vec_t* v)
return crc; return crc;
} }
uint32_t calcEdictRefChecksum(uint32_t crc, edict_t* ed) { uint32 calcEdictRefChecksum(uint32 crc, edict_t* ed) {
if (ed == NULL) { if (ed == NULL) {
return _mm_crc32_u32(crc, -1); 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); 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) { if (str == 0) {
return _mm_crc32_u8(crc, 0); return _mm_crc32_u8(crc, 0);
} }
@ -39,7 +39,7 @@ uint32_t calcEngStringChecksum(uint32_t crc, int str) {
return crc; 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->classname);
crc = calcEngStringChecksum(crc, ev->globalname); 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->frame);
crc = calcFloatChecksum(crc, &ev->animtime); crc = calcFloatChecksum(crc, &ev->animtime);
crc = calcFloatChecksum(crc, &ev->framerate); crc = calcFloatChecksum(crc, &ev->framerate);
crc = _mm_crc32_u32(crc, *(uint32_t*)&ev->controller[0]); crc = _mm_crc32_u32(crc, *(uint32*)&ev->controller[0]);
crc = _mm_crc32_u16(crc, *(uint16_t*)&ev->blending[0]); crc = _mm_crc32_u16(crc, *(uint16*)&ev->blending[0]);
crc = calcFloatChecksum(crc, &ev->scale); crc = calcFloatChecksum(crc, &ev->scale);
@ -175,7 +175,7 @@ uint32_t calcEntvarsChecksum(uint32_t crc, const entvars_t* ev) {
return crc; 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); crc = _mm_crc32_u32(crc, ed->free);
if (ed->free) if (ed->free)
return crc; return crc;
@ -192,7 +192,7 @@ uint32_t calcEdictChecksum(uint32_t crc, const edict_t* ed) {
} }
void PrintFloat(const float* pVal, std::stringstream &ss) { void PrintFloat(const float* pVal, std::stringstream &ss) {
uint32_t sVal = *reinterpret_cast<const uint32_t*>(pVal); uint32 sVal = *reinterpret_cast<const uint32*>(pVal);
ss << "{ float: " << *pVal << "; raw: " << std::hex << sVal << " }"; ss << "{ float: " << *pVal << "; raw: " << std::hex << sVal << " }";
} }
@ -237,7 +237,7 @@ void PrintTrace(trace_t* trace, std::stringstream &ss)
if (trace->ent == NULL) if (trace->ent == NULL)
ss << "NULL"; ss << "NULL";
else else
ss << (uint32_t)(trace->ent - g_psv.edicts); ss << (uint32)(trace->ent - g_psv.edicts);
ss << "; fraction: "; PrintFloat(&trace->fraction, ss); ss << "; fraction: "; PrintFloat(&trace->fraction, ss);
ss << "; endpos: "; PrintVec3(trace->endpos, ss); ss << "; endpos: "; PrintVec3(trace->endpos, ss);
@ -260,7 +260,7 @@ void PrintEdict(edict_t* ent, std::stringstream &ss, int flags)
} }
ss << "{" ss << "{"
<< " id: " << (uint32_t)(ent - g_psv.edicts); << " id: " << (uint32)(ent - g_psv.edicts);
if (flags & ED_PRINT_POSITION) { if (flags & ED_PRINT_POSITION) {
ss << "; origin: "; PrintVec3(ent->v.origin, ss); 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 << "; movetime: "; PrintFloat(&movetime, ss);
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++) for (int i = 0; i < g_psv.num_edicts; i++)
entCheckSums[i] = calcEdictChecksum(0, &g_psv.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: [ "; ess << " chanedEdicts: [ ";
for (int i = 0; i < g_psv.num_edicts; i++) { 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]) { if (newCrc != entCheckSums[i]) {
ess << " { " << i << ": " << entCheckSums[i] << " -> " << newCrc; ess << " { " << i << ": " << entCheckSums[i] << " -> " << newCrc;
if (65097 == currentCallID) { if (65097 == currentCallID) {
@ -387,7 +387,7 @@ void __cdecl SV_SingleClipMoveToEntity_hooked(edict_t *ent, const vec_t *start,
if (ent == NULL) if (ent == NULL)
ss << "NULL"; ss << "NULL";
else else
ss << (uint32_t)(ent - g_psv.edicts); ss << (uint32)(ent - g_psv.edicts);
ss << "; start: "; PrintVec3(start, ss); ss << "; start: "; PrintVec3(start, ss);
ss << "; mins: "; PrintVec3(mins, ss); ss << "; mins: "; PrintVec3(mins, ss);

View File

@ -65,6 +65,7 @@
<ClCompile Include="..\engine\pmovetst.cpp" /> <ClCompile Include="..\engine\pmovetst.cpp" />
<ClCompile Include="..\engine\pr_cmds.cpp" /> <ClCompile Include="..\engine\pr_cmds.cpp" />
<ClCompile Include="..\engine\pr_edict.cpp" /> <ClCompile Include="..\engine\pr_edict.cpp" />
<ClCompile Include="..\engine\public_amalgamation.cpp" />
<ClCompile Include="..\engine\r_studio.cpp" /> <ClCompile Include="..\engine\r_studio.cpp" />
<ClCompile Include="..\engine\snd_null.cpp" /> <ClCompile Include="..\engine\snd_null.cpp" />
<ClCompile Include="..\engine\sv_log.cpp" /> <ClCompile Include="..\engine\sv_log.cpp" />
@ -115,10 +116,37 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">false</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">false</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\hookers\rehlds_debug.cpp" /> <ClCompile Include="..\hookers\rehlds_debug.cpp" />
<ClCompile Include="..\public\interface.cpp" /> <ClCompile Include="..\public\interface.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\public\registry.cpp" /> <ClCompile Include="..\public\registry.cpp" />
<ClCompile Include="..\public\rehlds\crc32.cpp" /> <ClCompile Include="..\public\rehlds\crc32.cpp">
<ClCompile Include="..\public\rehlds\sys_shared.cpp" /> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\public\rehlds\sys_shared.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\public\steamid.cpp" /> <ClCompile Include="..\public\steamid.cpp" />
<ClCompile Include="..\public\tier0\dbg.cpp" /> <ClCompile Include="..\public\tier0\dbg.cpp" />
<ClCompile Include="..\public\tier0\platform_linux.cpp"> <ClCompile Include="..\public\tier0\platform_linux.cpp">
@ -349,7 +377,6 @@
<ClInclude Include="..\hookers\hooker.h" /> <ClInclude Include="..\hookers\hooker.h" />
<ClInclude Include="..\hookers\memory.h" /> <ClInclude Include="..\hookers\memory.h" />
<ClInclude Include="..\hookers\rehlds_debug.h" /> <ClInclude Include="..\hookers\rehlds_debug.h" />
<ClInclude Include="..\public\archtypes.h" />
<ClInclude Include="..\public\basetypes.h" /> <ClInclude Include="..\public\basetypes.h" />
<ClInclude Include="..\public\commonmacros.h" /> <ClInclude Include="..\public\commonmacros.h" />
<ClInclude Include="..\public\engine_hlds_api.h" /> <ClInclude Include="..\public\engine_hlds_api.h" />

View File

@ -319,6 +319,9 @@
<ClCompile Include="..\rehlds\flight_recorder.cpp"> <ClCompile Include="..\rehlds\flight_recorder.cpp">
<Filter>rehlds</Filter> <Filter>rehlds</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\engine\public_amalgamation.cpp">
<Filter>engine</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\hookers\memory.h"> <ClInclude Include="..\hookers\memory.h">
@ -522,9 +525,6 @@
<ClInclude Include="..\engine\cvar.h"> <ClInclude Include="..\engine\cvar.h">
<Filter>engine\common</Filter> <Filter>engine\common</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\public\archtypes.h">
<Filter>public</Filter>
</ClInclude>
<ClInclude Include="..\public\FileSystem.h"> <ClInclude Include="..\public\FileSystem.h">
<Filter>public</Filter> <Filter>public</Filter>
</ClInclude> </ClInclude>

View File

@ -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 <sys/stat.h>
#include <sys/types.h>
#include <limits.h>
#include <stddef.h>
#define _S_IREAD S_IREAD
#define _S_IWRITE S_IWRITE
typedef long unsigned int ulong;
#endif
#endif // ARCHTYPES_H

View File

@ -1,4 +1,4 @@
#include "precompiled.h" #include "interface.h"
#if !defined ( _WIN32 ) #if !defined ( _WIN32 )

View File

@ -27,29 +27,29 @@
*/ */
#pragma once #pragma once
#include "osconfig.h" #include "archtypes.h"
class IRehldsFlightRecorder class IRehldsFlightRecorder
{ {
public: public:
virtual ~IRehldsFlightRecorder() { } 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 StartMessage(uint16 msg, bool entrance) = 0;
virtual void EndMessage(uint16_t msg, bool entrance) = 0; virtual void EndMessage(uint16 msg, bool entrance) = 0;
virtual void WriteInt8(int8_t v) = 0; virtual void WriteInt8(int8 v) = 0;
virtual void WriteUInt8(uint8_t v) = 0; virtual void WriteUInt8(uint8 v) = 0;
virtual void WriteInt16(int16_t v) = 0; virtual void WriteInt16(int16 v) = 0;
virtual void WriteUInt16(uint16_t v) = 0; virtual void WriteUInt16(uint16 v) = 0;
virtual void WriteInt32(int32_t v) = 0; virtual void WriteInt32(int32 v) = 0;
virtual void WriteUInt32(uint32_t v) = 0; virtual void WriteUInt32(uint32 v) = 0;
virtual void WriteInt64(int64_t v) = 0; virtual void WriteInt64(int64 v) = 0;
virtual void WriteUInt64(uint64_t v) = 0; virtual void WriteUInt64(uint64 v) = 0;
virtual void WriteFloat(float v) = 0; virtual void WriteFloat(float v) = 0;
virtual void WriteDouble(double v) = 0; virtual void WriteDouble(double v) = 0;

View File

@ -33,6 +33,8 @@
#if defined( _WIN32 ) && (! defined( __MINGW32__ )) #if defined( _WIN32 ) && (! defined( __MINGW32__ ))
typedef __int8 int8;
typedef unsigned __int8 uint8;
typedef __int16 int16; typedef __int16 int16;
typedef unsigned __int16 uint16; typedef unsigned __int16 uint16;
typedef __int32 int32; 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 *) typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
#else /* _WIN32 */ #else /* _WIN32 */
typedef char int8;
typedef unsigned char uint8;
typedef short int16; typedef short int16;
typedef unsigned short uint16; typedef unsigned short uint16;
typedef int int32; typedef int int32;

View File

@ -27,7 +27,7 @@
*/ */
#pragma once #pragma once
#include "maintypes.h" #include "archtypes.h"
/* <8f1> ../engine/cmd.h:65 */ /* <8f1> ../engine/cmd.h:65 */
typedef void(*xcommand_t)(void); typedef void(*xcommand_t)(void);

View File

@ -27,7 +27,7 @@
*/ */
#pragma once #pragma once
#include "maintypes.h" #include "const.h"
#define COM_TOKEN_LEN 1024 #define COM_TOKEN_LEN 1024
@ -46,7 +46,7 @@
typedef struct sizebuf_s typedef struct sizebuf_s
{ {
const char *buffername; const char *buffername;
uint16_t flags; uint16 flags;
byte *data; byte *data;
int maxsize; int maxsize;
int cursize; int cursize;

View File

@ -41,9 +41,10 @@
/* polynomial $edb88320 */ /* 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, 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 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 crc32_t_nosse(uint32 iCRC, const uint8 *s, unsigned int len) {
uint32_t crc32val = iCRC; uint32 crc32val = iCRC;
for (unsigned int i = 0; i < len; i++) { for (unsigned int i = 0; i < len; i++) {
crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8); crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
} }
return crc32val; 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) { if (!g_HasSSE42) {
return crc32_t_nosse(iCRC, s, len); return crc32_t_nosse(iCRC, s, len);
} }
uint32_t crc32val = iCRC; uint32 crc32val = iCRC;
unsigned int i = 0; unsigned int i = 0;
for (; i < (len >> 2); i += 4) { 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++) { for (; i < len; i++) {
@ -127,6 +128,6 @@ uint32_t crc32_t(uint32_t iCRC, const uint8_t *s, unsigned int len) {
return crc32val; 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); return crc32_t(0, buf, len);
} }

View File

@ -12,10 +12,10 @@
*/ */
#pragma once #pragma once
#include "osconfig.h" #include "archtypes.h"
/* This computes a 32 bit CRC of the data in the buffer, and returns the /* This computes a 32 bit CRC of the data in the buffer, and returns the
CRC. The polynomial used is 0xedb88320. */ CRC. The polynomial used is 0xedb88320. */
uint32_t crc32(const uint8_t *buf, unsigned int len); uint32 crc32(const uint8 *buf, unsigned int len);
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);

View File

@ -105,13 +105,13 @@ typedef struct
// Engine hands this to DLLs for functionality callbacks // Engine hands this to DLLs for functionality callbacks
typedef struct enginefuncs_s typedef struct enginefuncs_s
{ {
int (*pfnPrecacheModel) (char* s); int (*pfnPrecacheModel) (const char* s);
int (*pfnPrecacheSound) (char* s); int (*pfnPrecacheSound) (const char* s);
void (*pfnSetModel) (edict_t *e, const char *m); void (*pfnSetModel) (edict_t *e, const char *m);
int (*pfnModelIndex) (const char *m); int (*pfnModelIndex) (const char *m);
int (*pfnModelFrames) (int modelIndex); int (*pfnModelFrames) (int modelIndex);
void (*pfnSetSize) (edict_t *e, const float *rgflMin, const float *rgflMax); 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 (*pfnGetSpawnParms) (edict_t *ent);
void (*pfnSaveSpawnParms) (edict_t *ent); void (*pfnSaveSpawnParms) (edict_t *ent);
float (*pfnVecToYaw) (const float *rgflVector); 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 ); void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
int (*pfnNumberOfEntities) (void); int (*pfnNumberOfEntities) (void);
char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo char* (*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo
char* (*pfnInfoKeyValue) (char *infobuffer, char *key); char* (*pfnInfoKeyValue) (char *infobuffer, const char *key);
void (*pfnSetKeyValue) (char *infobuffer, char *key, char *value); void (*pfnSetKeyValue) (char *infobuffer, const char *key, const char *value);
void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char *key, char *value); void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, const char *key, const char *value);
int (*pfnIsMapValid) (char *filename); int (*pfnIsMapValid) (char *filename);
void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex ); void (*pfnStaticDecal) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int (*pfnPrecacheGeneric) (char* s); int (*pfnPrecacheGeneric) (char* s);
@ -249,7 +249,7 @@ typedef struct enginefuncs_s
void (*pfnSetGroupMask) ( int mask, int op ); void (*pfnSetGroupMask) ( int mask, int op );
int (*pfnCreateInstancedBaseline) ( int classname, struct entity_state_s *baseline ); 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 // Forces the client and server to be running with the same version of the specified file
// ( e.g., a player model ). // ( e.g., a player model ).

View File

@ -49,10 +49,4 @@
typedef unsigned int string_t; // from engine's pr_comp.h; 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 #endif // MAINTYPES_H

View File

@ -85,34 +85,6 @@
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#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 #ifdef _WIN32 // WINDOWS
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN

View File

@ -26,7 +26,7 @@
* *
*/ */
#pragma once #pragma once
#include "maintypes.h" #include "archtypes.h"
#include "cmd_rehlds.h" #include "cmd_rehlds.h"
#include "rehlds_interfaces.h" #include "rehlds_interfaces.h"
#include "hookchains.h" #include "hookchains.h"
@ -62,8 +62,8 @@ typedef IVoidHookChain<char*, int> IRehldsHook_SVC_GetChallenge_mod;
typedef IVoidHookChainRegistry<char*, int> IRehldsHookRegistry_SVC_GetChallenge_mod; typedef IVoidHookChainRegistry<char*, int> IRehldsHookRegistry_SVC_GetChallenge_mod;
//SV_CheckKeyInfo hook //SV_CheckKeyInfo hook
typedef IHookChain<int, netadr_t*, char*, uint16_t*, int*, char*, char*> IRehldsHook_SV_CheckKeyInfo; typedef IHookChain<int, netadr_t*, char*, uint16*, int*, char*, char*> IRehldsHook_SV_CheckKeyInfo;
typedef IHookChainRegistry<int, netadr_t*, char*, uint16_t*, int*, char*, char*> IRehldsHookRegistry_SV_CheckKeyInfo; typedef IHookChainRegistry<int, netadr_t*, char*, uint16*, int*, char*, char*> IRehldsHookRegistry_SV_CheckKeyInfo;
//SV_CheckIPRestrictions hook //SV_CheckIPRestrictions hook
typedef IHookChain<int, netadr_t*, int> IRehldsHook_SV_CheckIPRestrictions; typedef IHookChain<int, netadr_t*, int> IRehldsHook_SV_CheckIPRestrictions;
@ -90,8 +90,8 @@ typedef IVoidHookChain<IGameClient*> IRehldsHook_Steam_NotifyClientDisconnect;
typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_Steam_NotifyClientDisconnect; typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_Steam_NotifyClientDisconnect;
//PreProcessPacket //PreProcessPacket
typedef IHookChain<bool, uint8_t*, unsigned int, const netadr_t&> IRehldsHook_PreprocessPacket; typedef IHookChain<bool, uint8*, unsigned int, const netadr_t&> IRehldsHook_PreprocessPacket;
typedef IHookChainRegistry<bool, uint8_t*, unsigned int, const netadr_t&> IRehldsHookRegistry_PreprocessPacket; typedef IHookChainRegistry<bool, uint8*, unsigned int, const netadr_t&> IRehldsHookRegistry_PreprocessPacket;
//ValidateCommand //ValidateCommand
typedef IHookChain<bool, const char*, cmd_source_t, IGameClient*> IRehldsHook_ValidateCommand; typedef IHookChain<bool, const char*, cmd_source_t, IGameClient*> IRehldsHook_ValidateCommand;
@ -102,8 +102,8 @@ typedef IVoidHookChain<IGameClient*> IRehldsHook_ClientConnected;
typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_ClientConnected; typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_ClientConnected;
//HandleNetCommand //HandleNetCommand
typedef IVoidHookChain<IGameClient*, int8_t> IRehldsHook_HandleNetCommand; typedef IVoidHookChain<IGameClient*, int8> IRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistry<IGameClient*, int8_t> IRehldsHookRegistry_HandleNetCommand; typedef IVoidHookChainRegistry<IGameClient*, int8> IRehldsHookRegistry_HandleNetCommand;
//Mod_LoadBrushModel //Mod_LoadBrushModel
typedef IVoidHookChain<model_t*, void*> IRehldsHook_Mod_LoadBrushModel; typedef IVoidHookChain<model_t*, void*> IRehldsHook_Mod_LoadBrushModel;

View File

@ -30,7 +30,7 @@
class INetChan; class INetChan;
class IGameClient; class IGameClient;
#include "maintypes.h" #include "archtypes.h"
#include "const.h" #include "const.h"
#include "netadr.h" #include "netadr.h"
@ -100,6 +100,6 @@ public:
virtual const char* GetModelName() = 0; virtual const char* GetModelName() = 0;
virtual const char* GetName() = 0; virtual const char* GetName() = 0;
virtual uint32_t GetWorldmapCrc() = 0; virtual uint32 GetWorldmapCrc() = 0;
virtual uint8_t* GetClientDllMd5() = 0; virtual uint8* GetClientDllMd5() = 0;
}; };

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#include "osconfig.h" #include "archtypes.h"
#include "crc32.h" #include "crc32.h"
template<typename T_KEY, typename T_VAL, unsigned int ASSOC_2N, unsigned int MAX_VALS> template<typename T_KEY, typename T_VAL, unsigned int ASSOC_2N, unsigned int MAX_VALS>
class CStaticMap { class CStaticMap {
protected: 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)); return crc32((const unsigned char*)&val, sizeof(T_KEY));
} }

View File

@ -141,7 +141,7 @@ typedef struct
{ {
char label[32]; // textual name char label[32]; // textual name
char name[64]; // file 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 int unused2; // was "data" - hack for group 0
} mstudioseqgroup_t; } mstudioseqgroup_t;

View File

@ -25,7 +25,7 @@
* version. * version.
* *
*/ */
#include "precompiled.h" #include "sys_shared.h"
bool Sys_ChechSSE42Support(); bool Sys_ChechSSE42Support();

View File

@ -26,6 +26,5 @@
* *
*/ */
#pragma once #pragma once
#include "maintypes.h"
extern bool g_HasSSE42; extern bool g_HasSSE42;

View File

@ -27,13 +27,13 @@
*/ */
#pragma once #pragma once
#include "maintypes.h" #include "archtypes.h"
/* <2e915> ../engine/userid.h:22 */ /* <2e915> ../engine/userid.h:22 */
typedef struct USERID_s typedef struct USERID_s
{ {
int idtype; int idtype;
uint64_t m_SteamID; uint64 m_SteamID;
unsigned int clientip; unsigned int clientip;
} USERID_t; } USERID_t;

View File

@ -139,7 +139,7 @@ public:
#endif #endif
#ifdef _PS3 #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 BIsReadyToShutdown() = 0;
virtual bool BIsPSNOnline() = 0; virtual bool BIsPSNOnline() = 0;

View File

@ -31,18 +31,8 @@ typedef unsigned char uint8;
#define VALVE_BIG_ENDIAN #define VALVE_BIG_ENDIAN
#endif #endif
typedef unsigned char uint8;
typedef signed char int8;
#if defined( _WIN32 ) #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 #ifdef X64BITS
typedef __int64 intp; // intp is an integer that can accomodate a pointer 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 *) typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
@ -53,12 +43,6 @@ typedef unsigned __int32 uintp;
#else // _WIN32 #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 #ifdef X64BITS
typedef long long intp; typedef long long intp;
typedef unsigned long long uintp; typedef unsigned long long uintp;

View File

@ -27,28 +27,7 @@
// need this for memset // need this for memset
#include <string.h> #include <string.h>
// for when we care about how many bits we use #include "archtypes.h"
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
typedef float float32; typedef float float32;
typedef double float64; typedef double float64;

View File

@ -18,8 +18,8 @@
#include "precompiled.h" #include "precompiled.h"
CRehldsFlightRecorder::CRehldsFlightRecorder() { CRehldsFlightRecorder::CRehldsFlightRecorder() {
m_MetaRegionPtr = (uint8_t*) sys_allocmem(META_REGION_SIZE); m_MetaRegionPtr = (uint8*) sys_allocmem(META_REGION_SIZE);
m_DataRegionPtr = (uint8_t*) sys_allocmem(DATA_REGION_SIZE); m_DataRegionPtr = (uint8*) sys_allocmem(DATA_REGION_SIZE);
if (!m_MetaRegionPtr || !m_DataRegionPtr) { if (!m_MetaRegionPtr || !m_DataRegionPtr) {
rehlds_syserror("%s: direct allocation failed", __FUNCTION__); 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) { if (msg == 0 || msg > m_pMetaHeader->numMessages) {
rehlds_syserror("%s: Invalid message id %u", __FUNCTION__, msg); 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->curMessage = msg;
m_pRecorderState->lastMsgBeginPos = m_pRecorderState->wpos; 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; m_pRecorderState->wpos += 2;
} }
void CRehldsFlightRecorder::EndMessage(uint16_t msg, bool entrance) { void CRehldsFlightRecorder::EndMessage(uint16 msg, bool entrance) {
if (entrance) { if (entrance) {
msg = msg | 0x8000; msg = msg | 0x8000;
} }
@ -126,7 +126,7 @@ void CRehldsFlightRecorder::EndMessage(uint16_t msg, bool entrance) {
if (msgSize > MSG_MAX_SIZE) { if (msgSize > MSG_MAX_SIZE) {
rehlds_syserror("%s: too big message %u; size%u", __FUNCTION__, msg, msgSize); 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->wpos += 2;
m_pRecorderState->curMessage = 0; m_pRecorderState->curMessage = 0;
@ -158,36 +158,36 @@ void CRehldsFlightRecorder::WriteString(const char* s) {
WriteBuffer(s, strlen(s) + 1); WriteBuffer(s, strlen(s) + 1);
} }
void CRehldsFlightRecorder::WriteInt8(int8_t v) { void CRehldsFlightRecorder::WriteInt8(int8 v) {
WritePrimitive<int8_t>(v); WritePrimitive<int8>(v);
} }
void CRehldsFlightRecorder::WriteUInt8(uint8_t v) { void CRehldsFlightRecorder::WriteUInt8(uint8 v) {
WritePrimitive<uint8_t>(v); WritePrimitive<uint8>(v);
} }
void CRehldsFlightRecorder::WriteInt16(int16_t v) { void CRehldsFlightRecorder::WriteInt16(int16 v) {
WritePrimitive<int16_t>(v); WritePrimitive<int16>(v);
} }
void CRehldsFlightRecorder::WriteUInt16(uint16_t v) { void CRehldsFlightRecorder::WriteUInt16(uint16 v) {
WritePrimitive<uint16_t>(v); WritePrimitive<uint16>(v);
} }
void CRehldsFlightRecorder::WriteInt32(int32_t v) { void CRehldsFlightRecorder::WriteInt32(int32 v) {
WritePrimitive<int32_t>(v); WritePrimitive<int32>(v);
} }
void CRehldsFlightRecorder::WriteUInt32(uint32_t v) { void CRehldsFlightRecorder::WriteUInt32(uint32 v) {
WritePrimitive<uint32_t>(v); WritePrimitive<uint32>(v);
} }
void CRehldsFlightRecorder::WriteInt64(int64_t v) { void CRehldsFlightRecorder::WriteInt64(int64 v) {
WritePrimitive<int64_t>(v); WritePrimitive<int64>(v);
} }
void CRehldsFlightRecorder::WriteUInt64(uint64_t v) { void CRehldsFlightRecorder::WriteUInt64(uint64 v) {
WritePrimitive<uint64_t>(v); WritePrimitive<uint64>(v);
} }
void CRehldsFlightRecorder::WriteFloat(float v) { void CRehldsFlightRecorder::WriteFloat(float v) {
@ -198,12 +198,12 @@ void CRehldsFlightRecorder::WriteDouble(double v) {
WritePrimitive<double>(v); WritePrimitive<double>(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) { if (m_pMetaHeader->numMessages >= MSG_MAX_ID) {
rehlds_syserror("%s: can't register message; limit exceeded", __FUNCTION__); rehlds_syserror("%s: can't register message; limit exceeded", __FUNCTION__);
} }
uint16_t msgId = ++m_pMetaHeader->numMessages; uint16 msgId = ++m_pMetaHeader->numMessages;
sizebuf_t sb; sizebuf_t sb;
sb.buffername = "FlightRecorded Meta"; sb.buffername = "FlightRecorded Meta";

View File

@ -40,7 +40,7 @@ private:
struct recorder_state { struct recorder_state {
unsigned int wpos; unsigned int wpos;
unsigned int lastMsgBeginPos; unsigned int lastMsgBeginPos;
uint16_t curMessage; uint16 curMessage;
}; };
struct meta_header { struct meta_header {
@ -55,8 +55,8 @@ private:
}; };
#pragma pack(pop) #pragma pack(pop)
uint8_t* m_MetaRegionPtr; uint8* m_MetaRegionPtr;
uint8_t* m_DataRegionPtr; uint8* m_DataRegionPtr;
meta_header* m_pMetaHeader; meta_header* m_pMetaHeader;
recorder_state* m_pRecorderState; recorder_state* m_pRecorderState;
data_header* m_pDataHeader; data_header* m_pDataHeader;
@ -85,20 +85,20 @@ private:
public: public:
CRehldsFlightRecorder(); CRehldsFlightRecorder();
virtual void StartMessage(uint16_t msg, bool entrance); virtual void StartMessage(uint16 msg, bool entrance);
virtual void EndMessage(uint16_t msg, bool entrance); virtual void EndMessage(uint16 msg, bool entrance);
virtual void WriteInt8(int8_t v); virtual void WriteInt8(int8 v);
virtual void WriteUInt8(uint8_t v); virtual void WriteUInt8(uint8 v);
virtual void WriteInt16(int16_t v); virtual void WriteInt16(int16 v);
virtual void WriteUInt16(uint16_t v); virtual void WriteUInt16(uint16 v);
virtual void WriteInt32(int32_t v); virtual void WriteInt32(int32 v);
virtual void WriteUInt32(uint32_t v); virtual void WriteUInt32(uint32 v);
virtual void WriteInt64(int64_t v); virtual void WriteInt64(int64 v);
virtual void WriteUInt64(uint64_t v); virtual void WriteUInt64(uint64 v);
virtual void WriteFloat(float v); virtual void WriteFloat(float v);
virtual void WriteDouble(double v); virtual void WriteDouble(double v);
@ -106,5 +106,5 @@ public:
virtual void WriteBuffer(const void* data, unsigned int len); virtual void WriteBuffer(const void* data, unsigned int len);
virtual void WriteString(const char* s); 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);
}; };

View File

@ -19,9 +19,9 @@
CRehldsFlightRecorder* g_FlightRecorder; CRehldsFlightRecorder* g_FlightRecorder;
uint16_t g_FRMsg_Frame; uint16 g_FRMsg_Frame;
uint16_t g_FRMsg_FreeEntPrivateData; uint16 g_FRMsg_FreeEntPrivateData;
uint16_t g_FRMsg_AllocEntPrivateData; uint16 g_FRMsg_AllocEntPrivateData;
void FR_Init() { void FR_Init() {

View File

@ -21,9 +21,9 @@
extern CRehldsFlightRecorder* g_FlightRecorder; extern CRehldsFlightRecorder* g_FlightRecorder;
extern uint16_t g_FRMsg_Frame; extern uint16 g_FRMsg_Frame;
extern uint16_t g_FRMsg_FreeEntPrivateData; extern uint16 g_FRMsg_FreeEntPrivateData;
extern uint16_t g_FRMsg_AllocEntPrivateData; extern uint16 g_FRMsg_AllocEntPrivateData;
extern void FR_Init(); extern void FR_Init();

View File

@ -23,21 +23,21 @@ CSimplePlatform::CSimplePlatform() {
#endif #endif
} }
uint32_t CSimplePlatform::time(uint32_t* pTime) uint32 CSimplePlatform::time(uint32* pTime)
{ {
time_t res = ::time((time_t*)NULL); 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; time_t theTime = (time_t)time;
return ::localtime(&theTime); return ::localtime(&theTime);
} }
void CSimplePlatform::srand(uint32_t seed) void CSimplePlatform::srand(uint32 seed)
{ {
return ::srand(seed); return ::srand(seed);
} }

View File

@ -10,9 +10,9 @@ typedef int(__stdcall *setsockopt_proto)(SOCKET s, int level, int optname, const
class IReHLDSPlatform { class IReHLDSPlatform {
public: public:
virtual uint32_t time(uint32_t* pTime) = 0; virtual uint32 time(uint32* pTime) = 0;
virtual struct tm* localtime(uint32_t time) = 0; virtual struct tm* localtime(uint32 time) = 0;
virtual void srand(uint32_t seed) = 0; virtual void srand(uint32 seed) = 0;
virtual int rand() = 0; virtual int rand() = 0;
#ifdef _WIN32 #ifdef _WIN32
@ -65,9 +65,9 @@ private:
public: public:
CSimplePlatform(); CSimplePlatform();
virtual uint32_t time(uint32_t* pTime); virtual uint32 time(uint32* pTime);
virtual struct tm* localtime(uint32_t time); virtual struct tm* localtime(uint32 time);
virtual void srand(uint32_t seed); virtual void srand(uint32 seed);
virtual int rand(); virtual int rand();
#ifdef _WIN32 #ifdef _WIN32

View File

@ -4,6 +4,9 @@
#include "osconfig.h" #include "osconfig.h"
#include "archtypes.h"
#include "mathlib.h"
#include "sys_shared.h" #include "sys_shared.h"
#include "crc32.h" #include "crc32.h"
#include "static_map.h" #include "static_map.h"

View File

@ -27,7 +27,7 @@
*/ */
#pragma once #pragma once
#include "maintypes.h" #include "archtypes.h"
#include "rehlds_api.h" #include "rehlds_api.h"
#include "rehlds_interfaces_impl.h" #include "rehlds_interfaces_impl.h"
@ -56,8 +56,8 @@ typedef IVoidHookChainImpl<char*, int> CRehldsHook_SVC_GetChallenge_mod;
typedef IVoidHookChainRegistryImpl<char*, int> CRehldsHookRegistry_SVC_GetChallenge_mod; typedef IVoidHookChainRegistryImpl<char*, int> CRehldsHookRegistry_SVC_GetChallenge_mod;
//SV_CheckKeyInfo hook //SV_CheckKeyInfo hook
typedef IHookChainImpl<int, netadr_t*, char*, uint16_t*, int*, char*, char*> CRehldsHook_SV_CheckKeyInfo; typedef IHookChainImpl<int, netadr_t*, char*, uint16*, int*, char*, char*> CRehldsHook_SV_CheckKeyInfo;
typedef IHookChainRegistryImpl<int, netadr_t*, char*, uint16_t*, int*, char*, char*> CRehldsHookRegistry_SV_CheckKeyInfo; typedef IHookChainRegistryImpl<int, netadr_t*, char*, uint16*, int*, char*, char*> CRehldsHookRegistry_SV_CheckKeyInfo;
//SV_CheckIPRestrictions hook //SV_CheckIPRestrictions hook
typedef IHookChainImpl<int, netadr_t*, int> CRehldsHook_SV_CheckIPRestrictions; typedef IHookChainImpl<int, netadr_t*, int> CRehldsHook_SV_CheckIPRestrictions;
@ -84,8 +84,8 @@ typedef IVoidHookChainImpl<IGameClient*> CRehldsHook_Steam_NotifyClientDisconnec
typedef IVoidHookChainRegistryImpl<IGameClient*> CRehldsHookRegistry_Steam_NotifyClientDisconnect; typedef IVoidHookChainRegistryImpl<IGameClient*> CRehldsHookRegistry_Steam_NotifyClientDisconnect;
//PreProcessPacket //PreProcessPacket
typedef IHookChainImpl<bool, uint8_t*, unsigned int, const netadr_t&> CRehldsHook_PreprocessPacket; typedef IHookChainImpl<bool, uint8*, unsigned int, const netadr_t&> CRehldsHook_PreprocessPacket;
typedef IHookChainRegistryImpl<bool, uint8_t*, unsigned int, const netadr_t&> CRehldsHookRegistry_PreprocessPacket; typedef IHookChainRegistryImpl<bool, uint8*, unsigned int, const netadr_t&> CRehldsHookRegistry_PreprocessPacket;
//ValidateCommand //ValidateCommand
typedef IHookChainImpl<bool, const char*, cmd_source_t, IGameClient*> CRehldsHook_ValidateCommand; typedef IHookChainImpl<bool, const char*, cmd_source_t, IGameClient*> CRehldsHook_ValidateCommand;
@ -96,8 +96,8 @@ typedef IVoidHookChainImpl<IGameClient*> CRehldsHook_ClientConnected;
typedef IVoidHookChainRegistryImpl<IGameClient*> CRehldsHookRegistry_ClientConnected; typedef IVoidHookChainRegistryImpl<IGameClient*> CRehldsHookRegistry_ClientConnected;
//HandleNetCommand //HandleNetCommand
typedef IVoidHookChainImpl<IGameClient*, int8_t> CRehldsHook_HandleNetCommand; typedef IVoidHookChainImpl<IGameClient*, int8> CRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistryImpl<IGameClient*, int8_t> CRehldsHookRegistry_HandleNetCommand; typedef IVoidHookChainRegistryImpl<IGameClient*, int8> CRehldsHookRegistry_HandleNetCommand;
//Mod_LoadBrushModel //Mod_LoadBrushModel
typedef IVoidHookChainImpl<model_t*, void*> CRehldsHook_Mod_LoadBrushModel; typedef IVoidHookChainImpl<model_t*, void*> CRehldsHook_Mod_LoadBrushModel;

View File

@ -146,11 +146,11 @@ const char* CRehldsServerData::GetName() {
return g_psv.name; return g_psv.name;
} }
uint32_t CRehldsServerData::GetWorldmapCrc() { uint32 CRehldsServerData::GetWorldmapCrc() {
return g_psv.worldmapCRC; return g_psv.worldmapCRC;
} }
uint8_t* CRehldsServerData::GetClientDllMd5() { uint8* CRehldsServerData::GetClientDllMd5() {
return g_psv.clientdllmd5; return g_psv.clientdllmd5;
} }

View File

@ -92,8 +92,8 @@ class CRehldsServerData : public IRehldsServerData {
public: public:
virtual const char* GetModelName(); virtual const char* GetModelName();
virtual const char* GetName(); virtual const char* GetName();
virtual uint32_t GetWorldmapCrc(); virtual uint32 GetWorldmapCrc();
virtual uint8_t* GetClientDllMd5(); virtual uint8* GetClientDllMd5();
}; };
extern CGameClient** g_GameClients; extern CGameClient** g_GameClients;

View File

@ -1,10 +1,10 @@
#include "precompiled.h" #include "precompiled.h"
uint64_t NET_AdrToLong(const netadr_t &a) { uint64 NET_AdrToLong(const netadr_t &a) {
if (a.type != NA_IP) if (a.type != NA_IP)
return -1; 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) 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) 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); bool res = m_Wrapped->SendUserConnectAndAuthenticate(htonl(realIp), pvAuthBlob, cubAuthBlobSize, pSteamIDUser);
if (res) { if (res) {
*pSteamIDUser = m_Anonymizer->Real2FakeSteamId(*pSteamIDUser, __FUNCTION__); *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) 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; bool res;
if (m_Anonymizer->m_OriginalConnectPacketLen) { 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); int res = m_Wrapped->GetNextOutgoingPacket(pOut, cbMaxOut, pNetAdr, pPort);
if (res > 0) { if (res > 0) {
uint32_t fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __FUNCTION__); uint32 fakeIp = m_Anonymizer->Real2FakeIp(ntohl(*pNetAdr), __FUNCTION__);
*pNetAdr = htonl(fakeIp); *pNetAdr = htonl(fakeIp);
//Clear players list //Clear players list
if (res > 6 && *(uint32_t*)pOut == 0xFFFFFFFF && ((uint8_t*)pOut)[4] == 0x44) { if (res > 6 && *(uint32*)pOut == 0xFFFFFFFF && ((uint8*)pOut)[4] == 0x44) {
memset((uint8_t*)pOut + 6, 0, res - 6); memset((uint8*)pOut + 6, 0, res - 6);
} }
//Clear serverinfo //Clear serverinfo
if (res > 6 && *(uint32_t*)pOut == 0xFFFFFFFF && ((uint8_t*)pOut)[4] == 0x49) { if (res > 6 && *(uint32*)pOut == 0xFFFFFFFF && ((uint8*)pOut)[4] == 0x49) {
memset((uint8_t*)pOut + 6, 0, res - 6); memset((uint8*)pOut + 6, 0, res - 6);
} }
} }
return res; return res;
@ -505,19 +505,19 @@ CAnonymizingEngExtInterceptor::CAnonymizingEngExtInterceptor(IReHLDSPlatform* ba
m_OriginalConnectPacketLen = 0; 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; return res;
} }
struct tm* CAnonymizingEngExtInterceptor::localtime(uint32_t time) struct tm* CAnonymizingEngExtInterceptor::localtime(uint32 time)
{ {
struct tm* res = m_BasePlatform->localtime(time); struct tm* res = m_BasePlatform->localtime(time);
return res; return res;
} }
void CAnonymizingEngExtInterceptor::srand(uint32_t seed) void CAnonymizingEngExtInterceptor::srand(uint32 seed)
{ {
m_BasePlatform->srand(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); int res = m_BasePlatform->recvfrom(s, buf, len, flags, from, fromlen);
if (res > 0) { if (res > 0) {
Real2FakeSockaddr(from, __FUNCTION__); Real2FakeSockaddr(from, __FUNCTION__);
if (res > 4 && (*(uint32_t*)buf) == 0xFFFFFFFF) { if (res > 4 && (*(uint32*)buf) == 0xFFFFFFFF) {
unsigned int localLen = res; unsigned int localLen = res;
ProcessConnectionlessPacket((uint8_t*)buf, &localLen); ProcessConnectionlessPacket((uint8*)buf, &localLen);
res = 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) { void CAnonymizingEngExtInterceptor::AnonymizeAddr(const netadr_t& real, const netadr_t& fake) {
uint32_t realIp = *(uint32_t*)(&real.ip[0]); uint32 realIp = *(uint32*)(&real.ip[0]);
uint32_t fakeIp = *(uint32_t*)(&fake.ip[0]); uint32 fakeIp = *(uint32*)(&fake.ip[0]);
m_Fake2RealIpMap[fakeIp] = realIp; m_Fake2RealIpMap[fakeIp] = realIp;
m_Real2FakeIpMap[realIp] = fakeIp; 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); auto itr = m_Fake2RealIpMap.find(fakeIp);
if (itr == m_Fake2RealIpMap.end()) { if (itr == m_Fake2RealIpMap.end()) {
rehlds_syserror("%s: Unmapped fake addr %s", callsite, IpToString(fakeIp)); 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; 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); auto itr = m_Real2FakeIpMap.find(realIp);
if (itr == m_Real2FakeIpMap.end()) { if (itr == m_Real2FakeIpMap.end()) {
Con_Printf("%s: Unmapped real addr %s\n", callsite, IpToString(realIp)); 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) { void CAnonymizingEngExtInterceptor::Real2FakeSockaddr(sockaddr* saddr, const char* callsite) {
sockaddr_in* inaddr = (sockaddr_in*)saddr; sockaddr_in* inaddr = (sockaddr_in*)saddr;
uint32_t realIp = *(uint32_t*)(&inaddr->sin_addr); uint32 realIp = *(uint32*)(&inaddr->sin_addr);
uint32_t fakeIp = Real2FakeIp(realIp, callsite); uint32 fakeIp = Real2FakeIp(realIp, callsite);
*(uint32_t*)(&inaddr->sin_addr) = fakeIp; *(uint32*)(&inaddr->sin_addr) = fakeIp;
} }
void CAnonymizingEngExtInterceptor::Fake2RealSockaddr(sockaddr* saddr, const char* callsite) { void CAnonymizingEngExtInterceptor::Fake2RealSockaddr(sockaddr* saddr, const char* callsite) {
sockaddr_in* inaddr = (sockaddr_in*)saddr; sockaddr_in* inaddr = (sockaddr_in*)saddr;
uint32_t fakeIp = *(uint32_t*)(&inaddr->sin_addr); uint32 fakeIp = *(uint32*)(&inaddr->sin_addr);
uint32_t realIp = Fake2RealIp(fakeIp, callsite); 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]; static char buf[64];
sprintf(buf, "%u.%u.%u.%u", ip & 0xFF, (ip >> 8) & 0xFF, (ip >> 16) & 0xFF, (ip >> 24) & 0xFF); sprintf(buf, "%u.%u.%u.%u", ip & 0xFF, (ip >> 8) & 0xFF, (ip >> 16) & 0xFF, (ip >> 24) & 0xFF);
return buf; return buf;
@ -891,7 +891,7 @@ void CAnonymizingEngExtInterceptor::AnonymizeSteamId(const char* real, const cha
AnonymizeSteamId(realId, fakeId); 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); memcpy(net_message.data, data, *len);
net_message.cursize = *len; net_message.cursize = *len;
MSG_BeginReading(); 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 origuserinfo[1024];
char userinfo[1024]; char userinfo[1024];
char protinfo[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; unsigned int ticketLen = *len - msg_readcount;
if (ticketLen > 0) { if (ticketLen > 0) {

View File

@ -138,33 +138,33 @@ private:
IReHLDSPlatform* m_BasePlatform; IReHLDSPlatform* m_BasePlatform;
std::unordered_map<uint32_t, uint32_t> m_Fake2RealIpMap; std::unordered_map<uint32, uint32> m_Fake2RealIpMap;
std::unordered_map<uint32_t, uint32_t> m_Real2FakeIpMap; std::unordered_map<uint32, uint32> m_Real2FakeIpMap;
uint32_t Fake2RealIp(uint32_t fakeIp, const char* callsite); uint32 Fake2RealIp(uint32 fakeIp, const char* callsite);
uint32_t Real2FakeIp(uint32_t realIp, const char* callsite); uint32 Real2FakeIp(uint32 realIp, const char* callsite);
void Real2FakeSockaddr(sockaddr* saddr, const char* callsite); void Real2FakeSockaddr(sockaddr* saddr, const char* callsite);
void Fake2RealSockaddr(sockaddr* saddr, const char* callsite); void Fake2RealSockaddr(sockaddr* saddr, const char* callsite);
char* IpToString(uint32_t ip); char* IpToString(uint32 ip);
std::unordered_map<uint64_t, uint64_t> m_Fake2RealSteamId; std::unordered_map<uint64, uint64> m_Fake2RealSteamId;
std::unordered_map<uint64_t, uint64_t> m_Real2FakeSteamId; std::unordered_map<uint64, uint64> m_Real2FakeSteamId;
CSteamID Real2FakeSteamId(CSteamID realId, const char* callsite); CSteamID Real2FakeSteamId(CSteamID realId, const char* callsite);
CSteamID Fake2RealSteamId(CSteamID fakeId, const char* callsite); CSteamID Fake2RealSteamId(CSteamID fakeId, const char* callsite);
char* SteamIdToString(const CSteamID& steamid); char* SteamIdToString(const CSteamID& steamid);
void ProcessConnectionlessPacket(uint8_t* data, unsigned int *len); void ProcessConnectionlessPacket(uint8* data, unsigned int *len);
void ProcessConnectPacket(uint8_t* data, unsigned int *len); void ProcessConnectPacket(uint8* data, unsigned int *len);
std::unordered_map<std::string, std::string> m_Real2FakeName; std::unordered_map<std::string, std::string> m_Real2FakeName;
std::unordered_map<std::string, std::string> m_Fake2RealName; std::unordered_map<std::string, std::string> m_Fake2RealName;
std::string Real2FakeName(const char* realName, const char* callsite); std::string Real2FakeName(const char* realName, const char* callsite);
std::string Fake2RealName(const char* fakeName, 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; unsigned int m_OriginalConnectPacketLen;
std::unordered_map<std::string, std::string> m_Real2FakeHost; std::unordered_map<std::string, std::string> m_Real2FakeHost;
@ -176,9 +176,9 @@ private:
public: public:
CAnonymizingEngExtInterceptor(IReHLDSPlatform* basePlatform); CAnonymizingEngExtInterceptor(IReHLDSPlatform* basePlatform);
virtual uint32_t time(uint32_t* pTime); virtual uint32 time(uint32* pTime);
virtual struct tm* localtime(uint32_t time); virtual struct tm* localtime(uint32 time);
virtual void srand(uint32_t seed); virtual void srand(uint32 seed);
virtual int rand(); virtual int rand();
virtual void Sleep(DWORD msec); virtual void Sleep(DWORD msec);

View File

@ -2046,7 +2046,7 @@ void CGameServerSetKeyValueCall::readPrologue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CSteamApiSetBreakpadAppIdCall CSteamApiSetBreakpadAppIdCall
============================================================================ */ ============================================================================ */
CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32_t appId) CSteamApiSetBreakpadAppIdCall::CSteamApiSetBreakpadAppIdCall(uint32 appId)
{ {
m_AppId = appId; m_AppId = appId;
} }
@ -2879,7 +2879,7 @@ void CGetSystemTimeAsFileTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CStdTimeCall CStdTimeCall
============================================================================ */ ============================================================================ */
CStdTimeCall::CStdTimeCall(uint32_t* inTime) CStdTimeCall::CStdTimeCall(uint32* inTime)
{ {
m_InTimeNull = (inTime == NULL); m_InTimeNull = (inTime == NULL);
} }
@ -2904,7 +2904,7 @@ bool CStdTimeCall::compareInputArgs(IEngExtCall* other, bool strict)
return true; return true;
} }
void CStdTimeCall::setResult(uint32_t res) void CStdTimeCall::setResult(uint32 res)
{ {
m_Res = res; m_Res = res;
} }
@ -2933,7 +2933,7 @@ void CStdTimeCall::readEpilogue(std::istream &stream) {
/* ============================================================================ /* ============================================================================
CStdLocalTimeCall CStdLocalTimeCall
============================================================================ */ ============================================================================ */
CStdLocalTimeCall::CStdLocalTimeCall(uint32_t inTime) CStdLocalTimeCall::CStdLocalTimeCall(uint32 inTime)
{ {
m_Time = inTime; m_Time = inTime;
} }

View File

@ -186,7 +186,7 @@ public:
class CQueryPerfFreqCall : public IEngExtCall { class CQueryPerfFreqCall : public IEngExtCall {
public: public:
int64_t m_Freq; int64 m_Freq;
BOOL m_Res; BOOL m_Res;
public: public:
@ -202,7 +202,7 @@ public:
class CQueryPerfCounterCall : public IEngExtCall { class CQueryPerfCounterCall : public IEngExtCall {
public: public:
int64_t m_Counter; int64 m_Counter;
BOOL m_Res; BOOL m_Res;
public: public:
@ -860,11 +860,11 @@ public:
class CSteamApiSetBreakpadAppIdCall : public IEngExtCall { class CSteamApiSetBreakpadAppIdCall : public IEngExtCall {
public: public:
uint32_t m_AppId; uint32 m_AppId;
public: public:
CSteamApiSetBreakpadAppIdCall() { m_AppId = 0; } CSteamApiSetBreakpadAppIdCall() { m_AppId = 0; }
CSteamApiSetBreakpadAppIdCall(uint32_t appId); CSteamApiSetBreakpadAppIdCall(uint32 appId);
virtual bool compareInputArgs(IEngExtCall* other, bool strict); virtual bool compareInputArgs(IEngExtCall* other, bool strict);
virtual std::string toString(); virtual std::string toString();
@ -933,7 +933,7 @@ public:
class CGameServerGetSteamIdCall : public IEngExtCall { class CGameServerGetSteamIdCall : public IEngExtCall {
public: public:
uint64_t m_SteamId; uint64 m_SteamId;
public: public:
CGameServerGetSteamIdCall() { m_SteamId = 0; } CGameServerGetSteamIdCall() { m_SteamId = 0; }
@ -965,8 +965,8 @@ class CGameServerHandleIncomingPacketCall : public IEngExtCall {
public: public:
char m_Data[8192]; char m_Data[8192];
int m_Len; int m_Len;
uint32_t m_Ip; uint32 m_Ip;
uint16_t m_Port; uint16 m_Port;
bool m_Res; bool m_Res;
public: public:
@ -987,9 +987,9 @@ class CGameServerSendUserConnectAndAuthenticateCall : public IEngExtCall {
public: public:
char m_AuthBlob[4096]; char m_AuthBlob[4096];
int m_AuthBlobLen; int m_AuthBlobLen;
uint32_t m_IP; uint32 m_IP;
uint64_t m_OutSteamId; uint64 m_OutSteamId;
bool m_Res; bool m_Res;
public: public:
@ -1008,7 +1008,7 @@ public:
class CGameServerSendUserDisconnectCall : public IEngExtCall { class CGameServerSendUserDisconnectCall : public IEngExtCall {
public: public:
uint64_t m_SteamId; uint64 m_SteamId;
public: public:
CGameServerSendUserDisconnectCall() { m_SteamId = 0; } CGameServerSendUserDisconnectCall() { m_SteamId = 0; }
@ -1023,10 +1023,10 @@ public:
class CGameServerBUpdateUserDataCall : public IEngExtCall { class CGameServerBUpdateUserDataCall : public IEngExtCall {
public: public:
uint64_t m_SteamId; uint64 m_SteamId;
char m_PlayerName[64]; char m_PlayerName[64];
int m_PlayerNameLen; int m_PlayerNameLen;
uint32_t m_Score; uint32 m_Score;
bool m_Res; bool m_Res;
@ -1046,7 +1046,7 @@ public:
class CGameServerCreateUnauthUserConnectionCall : public IEngExtCall { class CGameServerCreateUnauthUserConnectionCall : public IEngExtCall {
public: public:
uint64_t m_SteamId; uint64 m_SteamId;
public: public:
CGameServerCreateUnauthUserConnectionCall() { m_SteamId = 0; } CGameServerCreateUnauthUserConnectionCall() { m_SteamId = 0; }
@ -1146,13 +1146,13 @@ class CStdTimeCall : public IEngExtCall {
public: public:
bool m_InTimeNull; bool m_InTimeNull;
uint32_t m_Res; uint32 m_Res;
public: public:
CStdTimeCall(uint32_t* inTime); CStdTimeCall(uint32* inTime);
CStdTimeCall() { m_InTimeNull = false; m_Res = 0; } CStdTimeCall() { m_InTimeNull = false; m_Res = 0; }
void setResult(uint32_t res); void setResult(uint32 res);
virtual bool compareInputArgs(IEngExtCall* other, bool strict); virtual bool compareInputArgs(IEngExtCall* other, bool strict);
virtual std::string toString(); virtual std::string toString();
virtual ExtCallFuncs getOpcode() { return ECF_CSTD_TIME; } virtual ExtCallFuncs getOpcode() { return ECF_CSTD_TIME; }
@ -1164,12 +1164,12 @@ public:
class CStdLocalTimeCall : public IEngExtCall { class CStdLocalTimeCall : public IEngExtCall {
public: public:
uint32_t m_Time; uint32 m_Time;
struct tm m_Res; struct tm m_Res;
public: public:
CStdLocalTimeCall(uint32_t inTime); CStdLocalTimeCall(uint32 inTime);
CStdLocalTimeCall() { m_Time = 0; memset(&m_Res, 0, sizeof(m_Res)); } CStdLocalTimeCall() { m_Time = 0; memset(&m_Res, 0, sizeof(m_Res)); }
void setResult(struct tm *res); void setResult(struct tm *res);
@ -1184,11 +1184,11 @@ public:
class CStdSrandCall : public IEngExtCall { class CStdSrandCall : public IEngExtCall {
public: public:
uint32_t m_Seed; uint32 m_Seed;
public: public:
CStdSrandCall() { m_Seed = 0; } 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 bool compareInputArgs(IEngExtCall* other, bool strict);
virtual std::string toString(); virtual std::string toString();

View File

@ -24,11 +24,11 @@ CPlayingEngExtInterceptor::CPlayingEngExtInterceptor(const char* fname, bool str
m_GameServerWrapper = NULL; m_GameServerWrapper = NULL;
m_SteamBreakpadContext = NULL; m_SteamBreakpadContext = NULL;
uint32_t cmdlineLen = 0; uint32 cmdlineLen = 0;
char cmdLine[2048]; char cmdLine[2048];
uint16_t versionMajor = 0; uint16 versionMajor = 0;
uint16_t versionMinor = 0; uint16 versionMinor = 0;
m_InStream.read((char*)&versionMinor, 2).read((char*)&versionMajor, 2); m_InStream.read((char*)&versionMinor, 2).read((char*)&versionMajor, 2);
@ -235,13 +235,13 @@ int CPlayingEngExtInterceptor::getOrRegisterSteamCallback(CCallbackBase* cb) {
return id; return id;
} }
uint32_t CPlayingEngExtInterceptor::time(uint32_t* pTime) uint32 CPlayingEngExtInterceptor::time(uint32* pTime)
{ {
CStdTimeCall* playCall = dynamic_cast<CStdTimeCall*>(getNextCall(false, false, ECF_CSTD_TIME, true, __FUNCTION__)); CStdTimeCall* playCall = dynamic_cast<CStdTimeCall*>(getNextCall(false, false, ECF_CSTD_TIME, true, __FUNCTION__));
CStdTimeCall(pTime).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); CStdTimeCall(pTime).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__);
CStdTimeCall* playEndCall = dynamic_cast<CStdTimeCall*>(getNextCall(false, true, ECF_CSTD_TIME, false, __FUNCTION__)); CStdTimeCall* playEndCall = dynamic_cast<CStdTimeCall*>(getNextCall(false, true, ECF_CSTD_TIME, false, __FUNCTION__));
uint32_t res = playEndCall->m_Res; uint32 res = playEndCall->m_Res;
if (pTime != NULL) *pTime = res; if (pTime != NULL) *pTime = res;
freeFuncCall(playCall); freeFuncCall(playEndCall); freeFuncCall(playCall); freeFuncCall(playEndCall);
@ -249,7 +249,7 @@ uint32_t CPlayingEngExtInterceptor::time(uint32_t* pTime)
return res; return res;
} }
struct tm* CPlayingEngExtInterceptor::localtime(uint32_t time) struct tm* CPlayingEngExtInterceptor::localtime(uint32 time)
{ {
CStdLocalTimeCall* playCall = dynamic_cast<CStdLocalTimeCall*>(getNextCall(false, false, ECF_CSTD_LOCALTIME, true, __FUNCTION__)); CStdLocalTimeCall* playCall = dynamic_cast<CStdLocalTimeCall*>(getNextCall(false, false, ECF_CSTD_LOCALTIME, true, __FUNCTION__));
CStdLocalTimeCall(time).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); CStdLocalTimeCall(time).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__);
@ -262,7 +262,7 @@ struct tm* CPlayingEngExtInterceptor::localtime(uint32_t time)
return &m_CurrentTm; return &m_CurrentTm;
} }
void CPlayingEngExtInterceptor::srand(uint32_t seed) void CPlayingEngExtInterceptor::srand(uint32 seed)
{ {
CStdSrandCall* playCall = dynamic_cast<CStdSrandCall*>(getNextCall(false, false, ECF_CSTD_SRAND_CALL, true, __FUNCTION__)); CStdSrandCall* playCall = dynamic_cast<CStdSrandCall*>(getNextCall(false, false, ECF_CSTD_SRAND_CALL, true, __FUNCTION__));
CStdSrandCall(seed).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__); CStdSrandCall(seed).ensureArgsAreEqual(playCall, m_bStrictChecks, __FUNCTION__);

View File

@ -116,7 +116,7 @@ private:
bool m_FuncCallsFree[TESTPLAYER_FUNCTREE_DEPTH]; bool m_FuncCallsFree[TESTPLAYER_FUNCTREE_DEPTH];
std::ifstream m_InStream; std::ifstream m_InStream;
int64_t m_inStreamSize; int64 m_inStreamSize;
bool m_bLastRead; bool m_bLastRead;
std::queue<IEngExtCall*> m_CommandsQueue; std::queue<IEngExtCall*> m_CommandsQueue;
@ -157,9 +157,9 @@ public:
IEngExtCall* getNextCall(bool peek, bool processCallbacks, ExtCallFuncs expectedOpcode, bool needStart, const char* callSource); IEngExtCall* getNextCall(bool peek, bool processCallbacks, ExtCallFuncs expectedOpcode, bool needStart, const char* callSource);
virtual uint32_t time(uint32_t* pTime); virtual uint32 time(uint32* pTime);
virtual struct tm* localtime(uint32_t time); virtual struct tm* localtime(uint32 time);
virtual void srand(uint32_t seed); virtual void srand(uint32 seed);
virtual int rand(); virtual int rand();
virtual void Sleep(DWORD msec); virtual void Sleep(DWORD msec);

View File

@ -516,8 +516,8 @@ CRecordingEngExtInterceptor::CRecordingEngExtInterceptor(const char* fname, IReH
m_RootFunc = m_LastFunc = NULL; m_RootFunc = m_LastFunc = NULL;
m_BasePlatform = basePlatform; m_BasePlatform = basePlatform;
uint16_t versionMajor = TESTSUITE_PROTOCOL_VERSION_MAJOR; uint16 versionMajor = TESTSUITE_PROTOCOL_VERSION_MAJOR;
uint16_t versionMinor = TESTSUITE_PROTOCOL_VERSION_MINOR; uint16 versionMinor = TESTSUITE_PROTOCOL_VERSION_MINOR;
m_OutStream.write((char*)&versionMinor, 2).write((char*)&versionMajor, 2); m_OutStream.write((char*)&versionMinor, 2).write((char*)&versionMajor, 2);
const char* cmdLine = GetCommandLineA(); const char* cmdLine = GetCommandLineA();
@ -529,7 +529,7 @@ CRecordingEngExtInterceptor::CRecordingEngExtInterceptor(const char* fname, IReH
void CRecordingEngExtInterceptor::writeCall(bool start, bool end, IEngExtCall* fcall) void CRecordingEngExtInterceptor::writeCall(bool start, bool end, IEngExtCall* fcall)
{ {
uint16_t opc = fcall->getOpcode(); uint16 opc = fcall->getOpcode();
if (start) if (start)
opc |= (1 << 15); 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); CStdTimeCall fcall(pTime); CRecorderFuncCall frec(&fcall);
PushFunc(&frec); PushFunc(&frec);
uint32_t res = m_BasePlatform->time(pTime); uint32 res = m_BasePlatform->time(pTime);
fcall.setResult(res); fcall.setResult(res);
PopFunc(&frec); PopFunc(&frec);
return res; return res;
} }
struct tm* CRecordingEngExtInterceptor::localtime(uint32_t time) struct tm* CRecordingEngExtInterceptor::localtime(uint32 time)
{ {
CStdLocalTimeCall fcall; CRecorderFuncCall frec(&fcall); CStdLocalTimeCall fcall; CRecorderFuncCall frec(&fcall);
PushFunc(&frec); PushFunc(&frec);
@ -609,7 +609,7 @@ struct tm* CRecordingEngExtInterceptor::localtime(uint32_t time)
return res; return res;
} }
void CRecordingEngExtInterceptor::srand(uint32_t seed) void CRecordingEngExtInterceptor::srand(uint32 seed)
{ {
CStdSrandCall fcall(seed); CRecorderFuncCall frec(&fcall); CStdSrandCall fcall(seed); CRecorderFuncCall frec(&fcall);
PushFunc(&frec); PushFunc(&frec);

View File

@ -158,9 +158,9 @@ public:
void PushFunc(CRecorderFuncCall* func); void PushFunc(CRecorderFuncCall* func);
void PopFunc(CRecorderFuncCall* func); void PopFunc(CRecorderFuncCall* func);
virtual uint32_t time(uint32_t* pTime); virtual uint32 time(uint32* pTime);
virtual struct tm* localtime(uint32_t time); virtual struct tm* localtime(uint32 time);
virtual void srand(uint32_t seed); virtual void srand(uint32 seed);
virtual int rand(); virtual int rand();
virtual void Sleep(DWORD msec); virtual void Sleep(DWORD msec);

View File

@ -4,12 +4,12 @@
/* ============================================================================ /* ============================================================================
external function hooks external function hooks
============================================================================*/ ============================================================================*/
uint32_t __cdecl time_hooked(uint32_t* pTime) uint32 __cdecl time_hooked(uint32* pTime)
{ {
return CRehldsPlatformHolder::get()->time(pTime); return CRehldsPlatformHolder::get()->time(pTime);
} }
struct tm* __cdecl localtime_hooked(uint32_t* pTime) struct tm* __cdecl localtime_hooked(uint32* pTime)
{ {
if (pTime == NULL) if (pTime == NULL)
rehlds_syserror("%s: pTime is NULL", __FUNCTION__); rehlds_syserror("%s: pTime is NULL", __FUNCTION__);
@ -17,7 +17,7 @@ struct tm* __cdecl localtime_hooked(uint32_t* pTime)
return CRehldsPlatformHolder::get()->localtime(*pTime); return CRehldsPlatformHolder::get()->localtime(*pTime);
} }
void __cdecl srand_hooked(uint32_t seed) void __cdecl srand_hooked(uint32 seed)
{ {
CRehldsPlatformHolder::get()->srand(seed); CRehldsPlatformHolder::get()->srand(seed);
} }

View File

@ -10,8 +10,8 @@ TEST(BitsWritingReading, MSG, 5000)
sizebuf_t *buf = &net_message; sizebuf_t *buf = &net_message;
uint32_t ff1 = ((uint32_t)1 << 31) - 1; uint32 ff1 = ((uint32)1 << 31) - 1;
uint32_t ff2 = ((uint32_t)1 << 9) - 1; uint32 ff2 = ((uint32)1 << 9) - 1;
SZ_Clear(buf); SZ_Clear(buf);
@ -23,8 +23,8 @@ TEST(BitsWritingReading, MSG, 5000)
MSG_BeginReading(); MSG_BeginReading();
MSG_StartBitReading(buf); MSG_StartBitReading(buf);
uint32_t t1 = MSG_ReadBits(31); uint32 t1 = MSG_ReadBits(31);
uint32_t t2 = MSG_ReadBits(9); uint32 t2 = MSG_ReadBits(9);
MSG_EndBitReading(buf); MSG_EndBitReading(buf);
UINT32_EQUALS("31/9 Read failed (31)", ff1, t1); 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_EQUALS("9/31 Read failed (31)", ff2, t2);
uint32_t a2, a1 = 5; uint32 a2, a1 = 5;
uint32_t b2, b1 = 0xEFEF; uint32 b2, b1 = 0xEFEF;
uint32_t c2, c1 = 0x7AAEAEAE; uint32 c2, c1 = 0x7AAEAEAE;
SZ_Clear(buf); SZ_Clear(buf);