From c11fdbe3f85d64a5db3fa03c848150db82a39549 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 21 Oct 2020 20:52:16 +0700 Subject: [PATCH 01/61] Fixed typo with null terminated --- rehlds/engine/sv_main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 3bcca62..2ca4709 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -1123,8 +1123,10 @@ void SV_SendServerinfo_internal(sizebuf_t *msg, client_t *client) unsigned char *mapcyclelist = COM_LoadFileForMe(mapcyclefile.string, &len); if (mapcyclelist && len) { - // Trim to 8190 (see MSG_ReadString, also 1 less than expected - see READ_STRING in HLSDK), otherwise client will be unable to parse message - mapcyclelist[8190] = 0; + // Trim to 8190 (see MSG_ReadString, also 1 less than expected), otherwise client will be unable to parse message + if (len > 8190) + mapcyclelist[8190] = 0; + MSG_WriteString(msg, (const char *)mapcyclelist); } else From f535b5b38fa0c6d0758d1004cad068e576a03400 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 9 Nov 2020 01:20:53 +0700 Subject: [PATCH 02/61] ReHLDS API: Implemented SV_ShouldSendConsistencyList ReHLDS API: Bump minor --- gradle.properties | 2 +- rehlds/engine/sv_user.cpp | 18 +++++++++++++++++- rehlds/public/rehlds/rehlds_api.h | 11 ++++++++--- rehlds/public/rehlds/rehlds_interfaces.h | 3 +++ rehlds/rehlds/rehlds_api_impl.cpp | 4 ++++ rehlds/rehlds/rehlds_api_impl.h | 6 ++++++ rehlds/rehlds/rehlds_interfaces_impl.cpp | 10 ++++++++++ rehlds/rehlds/rehlds_interfaces_impl.h | 3 +++ 8 files changed, 52 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2743145..41b3fb9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ majorVersion=3 -minorVersion=7 +minorVersion=8 maintenanceVersion=0 diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 4535117..93f7308 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -311,11 +311,27 @@ int EXT_FUNC SV_TransferConsistencyInfo_internal(void) return c; } +bool EXT_FUNC SV_ShouldSendConsistencyList_mod(IGameClient *cl, bool forceConsistency) +{ + if (g_psvs.maxclients == 1 || g_psv.num_consistency == 0 || cl->IsProxy()) + return false; + + if ((!forceConsistency && mp_consistency.value == 0.0f)) + return false; + + return true; +} + +bool SV_ShouldSendConsistencyList(client_t *client, bool forceConsistency) +{ + return g_RehldsHookchains.m_SV_ShouldSendConsistencyList.callChain(SV_ShouldSendConsistencyList_mod, GetRehldsApiClient(client), forceConsistency); +} + void SV_SendConsistencyList(sizebuf_t *msg) { host_client->has_force_unmodified = FALSE; - if (g_psvs.maxclients == 1 || mp_consistency.value == 0.0f || g_psv.num_consistency == 0 || host_client->proxy) + if (!SV_ShouldSendConsistencyList(host_client, false)) { MSG_WriteBits(0, 1); return; diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 0a73b4f..9f4d51f 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -37,7 +37,7 @@ #include "pr_dlls.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 7 +#define REHLDS_API_VERSION_MINOR 8 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -203,6 +203,10 @@ typedef IHookChainRegistry IRehldsHookRe typedef IVoidHookChain<> IRehldsHook_SV_Frame; typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Frame; +//SV_ShouldSendConsistencyList hook +typedef IHookChain IRehldsHook_SV_ShouldSendConsistencyList; +typedef IHookChainRegistry IRehldsHookRegistry_SV_ShouldSendConsistencyList; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -248,6 +252,7 @@ public: virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient() = 0; virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits() = 0; virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0; + virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0; }; struct RehldsFuncs_t { @@ -316,7 +321,7 @@ struct RehldsFuncs_t { char*(*MSG_ReadStringLine)(); float(*MSG_ReadAngle)(); float(*MSG_ReadHiresAngle)(); - void(*MSG_ReadUsercmd)(usercmd_t *to, usercmd_t *from); + void(*MSG_ReadUsercmd)(struct usercmd_s *to, struct usercmd_s *from); float(*MSG_ReadCoord)(); void(*MSG_ReadVec3Coord)(sizebuf_t *sb, vec3_t fa); @@ -340,7 +345,7 @@ struct RehldsFuncs_t { void(*MSG_WriteFloat)(sizebuf_t *sb, float f); void(*MSG_WriteAngle)(sizebuf_t *sb, float f); void(*MSG_WriteHiresAngle)(sizebuf_t *sb, float f); - void(*MSG_WriteUsercmd)(sizebuf_t *sb, usercmd_t *to, usercmd_t *from); + void(*MSG_WriteUsercmd)(sizebuf_t *sb, struct usercmd_s *to, struct usercmd_s *from); void(*MSG_WriteCoord)(sizebuf_t *sb, float f); void(*MSG_WriteVec3Coord)(sizebuf_t *sb, const vec3_t fa); diff --git a/rehlds/public/rehlds/rehlds_interfaces.h b/rehlds/public/rehlds/rehlds_interfaces.h index 8e12e33..7585d8d 100644 --- a/rehlds/public/rehlds/rehlds_interfaces.h +++ b/rehlds/public/rehlds/rehlds_interfaces.h @@ -73,6 +73,9 @@ public: virtual bool GetLoopback() = 0; virtual struct usercmd_s *GetLastCmd() = 0; + virtual bool IsProxy() = 0; + virtual void SetProxy(bool proxy) = 0; + // this must be the last virtual function in class #ifdef REHLDS_SELF virtual client_t* GetClient() = 0; diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index f4ade26..838305c 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -827,6 +827,10 @@ IRehldsHookRegistry_SV_Frame* CRehldsHookchains::SV_Frame() { return &m_SV_Frame; } +IRehldsHookRegistry_SV_ShouldSendConsistencyList* CRehldsHookchains::SV_ShouldSendConsistencyList() { + return &m_SV_ShouldSendConsistencyList; +} + int EXT_FUNC CRehldsApi::GetMajorVersion() { return REHLDS_API_VERSION_MAJOR; diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 689556b..7c106c7 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -198,6 +198,10 @@ typedef IHookChainRegistryImpl CRehldsHo typedef IVoidHookChainImpl<> CRehldsHook_SV_Frame; typedef IVoidHookChainRegistryImpl<> CRehldsHookRegistry_SV_Frame; +//SV_ShouldSendConsistencyList hook +typedef IHookChainImpl CRehldsHook_SV_ShouldSendConsistencyList; +typedef IHookChainRegistryImpl CRehldsHookRegistry_SV_ShouldSendConsistencyList; + class CRehldsHookchains : public IRehldsHookchains { public: CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect; @@ -241,6 +245,7 @@ public: CRehldsHookRegistry_CreateFakeClient m_CreateFakeClient; CRehldsHookRegistry_SV_CheckConnectionLessRateLimits m_SV_CheckConnectionLessRateLimits; CRehldsHookRegistry_SV_Frame m_SV_Frame; + CRehldsHookRegistry_SV_ShouldSendConsistencyList m_SV_ShouldSendConsistencyList; public: EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect(); @@ -284,6 +289,7 @@ public: EXT_FUNC virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient(); EXT_FUNC virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits(); EXT_FUNC virtual IRehldsHookRegistry_SV_Frame* SV_Frame(); + EXT_FUNC virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList(); }; extern CRehldsHookchains g_RehldsHookchains; diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index a1103a8..2044938 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -71,6 +71,16 @@ void EXT_FUNC CGameClient::SetSpawned(bool spawned) m_pClient->spawned = spawned ? 1 : 0; } +bool EXT_FUNC CGameClient::IsProxy() +{ + return m_pClient->proxy != 0; +} + +void EXT_FUNC CGameClient::SetProxy(bool proxy) +{ + m_pClient->proxy = proxy ? 1 : 0; +} + bool EXT_FUNC CGameClient::IsConnected() { return m_pClient->connected != 0; } diff --git a/rehlds/rehlds/rehlds_interfaces_impl.h b/rehlds/rehlds/rehlds_interfaces_impl.h index 431ca99..c22215f 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.h +++ b/rehlds/rehlds/rehlds_interfaces_impl.h @@ -98,6 +98,9 @@ public: virtual bool GetLoopback(); virtual struct usercmd_s *GetLastCmd(); + virtual bool IsProxy(); + virtual void SetProxy(bool proxy); + virtual client_t* GetClient(); public: From 543728dad22e33e2eed278351ae43e17c4ec113b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 9 Nov 2020 01:22:55 +0700 Subject: [PATCH 03/61] Fix crash MSG_ReadFloat --- rehlds/engine/common.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index c68a11c..52b97f4 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -1033,10 +1033,24 @@ float MSG_ReadFloat(void) { float f; + union + { + unsigned char b[4]; + float f; + int l; + } dat; + if (msg_readcount + 4 <= net_message.cursize) { - f = *((float*)LittleLong(*(int *)&net_message.data[msg_readcount])); + dat.b[0] = net_message.data[msg_readcount]; + dat.b[1] = net_message.data[msg_readcount + 1]; + dat.b[2] = net_message.data[msg_readcount + 2]; + dat.b[3] = net_message.data[msg_readcount + 3]; msg_readcount += 4; + + dat.l = LittleLong(dat.l); + + return dat.f; } else { From 954ec3237c7e2d4ba20b135764aebd3c1befce66 Mon Sep 17 00:00:00 2001 From: Juice Date: Thu, 12 Nov 2020 01:40:08 +0300 Subject: [PATCH 04/61] Fix crash COM_ListMaps (#791) * Fix crash COM_ListMaps --- rehlds/engine/common.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index 52b97f4..4384158 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -2280,23 +2280,35 @@ void COM_ListMaps(char *pszSubString) while (findfn != NULL) { - Q_snprintf(curDir, ARRAYSIZE(curDir), "maps/%s", findfn); - FS_GetLocalPath(curDir, curDir, ARRAYSIZE(curDir)); - - if (strstr(curDir, com_gamedir) && (!nSubStringLen || !Q_strnicmp(findfn, pszSubString, nSubStringLen))) + if (Q_snprintf(curDir, ARRAYSIZE(curDir), "maps/%s", findfn) < ARRAYSIZE(curDir)) { - Q_memset(&header, 0, sizeof(dheader_t)); - Q_sprintf(pFileName, "maps/%s", findfn); + FS_GetLocalPath(curDir, curDir, ARRAYSIZE(curDir)); - fp = FS_Open(pFileName, "rb"); - - if (fp) + if (Q_strstr(curDir, com_gamedir) && (!nSubStringLen || !Q_strnicmp(findfn, pszSubString, nSubStringLen))) { - FS_Read(&header, sizeof(dheader_t), 1, fp); - FS_Close(fp); - } + if (Q_snprintf(pFileName, ARRAYSIZE(pFileName), "maps/%s", findfn) < ARRAYSIZE(pFileName)) + { + Q_memset(&header, 0, sizeof(dheader_t)); - COM_CheckPrintMap(&header, findfn, bShowOutdated != 0); + fp = FS_Open(pFileName, "rb"); + + if (fp) + { + FS_Read(&header, sizeof(dheader_t), 1, fp); + FS_Close(fp); + } + + COM_CheckPrintMap(&header, findfn, bShowOutdated != 0); + } + else + { + Con_Printf("Map name too long: %s\n", findfn); + } + } + } + else + { + Con_Printf("Map name too long: %s\n", findfn); } findfn = Sys_FindNext(NULL); From 83c0b6ea2bc3839724ef3751f5edbf14091d5d18 Mon Sep 17 00:00:00 2001 From: Juice Date: Thu, 3 Dec 2020 16:14:54 +0300 Subject: [PATCH 05/61] HLTV: prevent clients from setting userinfo * keys with setinfo command (#792) --- rehlds/HLTV/common/BaseClient.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rehlds/HLTV/common/BaseClient.cpp b/rehlds/HLTV/common/BaseClient.cpp index 5d4966f..0c3a433 100644 --- a/rehlds/HLTV/common/BaseClient.cpp +++ b/rehlds/HLTV/common/BaseClient.cpp @@ -320,6 +320,10 @@ void BaseClient::CMD_SetInfo(TokenLine *cmd) return; } + if (cmd->GetToken(1)[0] == '*') { + return; + } + m_Userinfo.SetValueForKey(cmd->GetToken(1), cmd->GetToken(2)); UpdateUserInfo(); } From 370dddb8b4ffca5ef71656c460e0919a465ca743 Mon Sep 17 00:00:00 2001 From: Asmodai Date: Tue, 26 Jan 2021 02:13:34 +0300 Subject: [PATCH 06/61] Fix dos attack on connection challenges system --- rehlds/engine/sv_main.cpp | 39 +++++++++++++++++++++++++++++++++ rehlds/public/rehlds/osconfig.h | 2 ++ 2 files changed, 41 insertions(+) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 2ca4709..d9df60d 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -1810,16 +1810,38 @@ challenge_t g_rg_sv_challenges[MAX_CHALLENGES]; int g_oldest_challenge = 0; #endif +typedef struct challenge_buf_s +{ + uint32_t ip; + uint16_t port; + uint32_t salt[14]; +} challenge_buf_t; + +challenge_buf_t g_raw_challenge_buf; + +void SV_ChallengesInit() +{ +#ifdef REHLDS_FIXES + static_assert(sizeof(g_raw_challenge_buf) == 64u, "Invalid g_raw_challenge_buf size"); + for (uint32_t& s : g_raw_challenge_buf.salt) + s = __rdtsc() * rand(); +#endif +} + bool EXT_FUNC SV_CheckChallenge_api(const netadr_t &adr, int nChallengeValue) { if (NET_IsLocalAddress(adr)) return TRUE; +#ifdef REHLDS_FIXES + return SV_GetChallenge(adr) == nChallengeValue; +#else for (int i = 0; i < MAX_CHALLENGES; i++) { if (NET_CompareBaseAdr(adr, g_rg_sv_challenges[i].adr)) return nChallengeValue == g_rg_sv_challenges[i].challenge; } return FALSE; +#endif } int SV_CheckChallenge(netadr_t *adr, int nChallengeValue) @@ -1830,6 +1852,10 @@ int SV_CheckChallenge(netadr_t *adr, int nChallengeValue) if (NET_IsLocalAddress(*adr)) return TRUE; +#ifdef REHLDS_FIXES + if (SV_GetChallenge(*adr) == nChallengeValue) + return TRUE; +#else for (int i = 0; i < MAX_CHALLENGES; i++) { if (NET_CompareBaseAdr(net_from, g_rg_sv_challenges[i].adr)) @@ -1842,6 +1868,7 @@ int SV_CheckChallenge(netadr_t *adr, int nChallengeValue) return TRUE; } } +#endif SV_RejectConnection(adr, "No challenge for your address.\n"); return FALSE; } @@ -2499,6 +2526,16 @@ void SVC_Ping(void) int EXT_FUNC SV_GetChallenge(const netadr_t& adr) { +#ifdef REHLDS_FIXES + uint8_t digest[16]; + g_raw_challenge_buf.ip = *(uint32_t*)adr.ip; + g_raw_challenge_buf.port = adr.port; + MD5Context_t ctx; + MD5Init(&ctx); + MD5Update(&ctx, (uint8_t *)&g_raw_challenge_buf, sizeof(g_raw_challenge_buf)); + MD5Final(digest, &ctx); + return *(int *)digest & 0x7FFFFFFF; +#else int i; #ifndef REHLDS_OPT_PEDANTIC int oldest = 0; @@ -2540,6 +2577,7 @@ int EXT_FUNC SV_GetChallenge(const netadr_t& adr) } return g_rg_sv_challenges[i].challenge; +#endif } void SVC_GetChallenge(void) @@ -7985,6 +8023,7 @@ void SV_Init(void) PM_Init(&g_svmove); SV_AllocClientFrames(); SV_InitDeltas(); + SV_ChallengesInit(); } void SV_Shutdown(void) diff --git a/rehlds/public/rehlds/osconfig.h b/rehlds/public/rehlds/osconfig.h index 9f70ec9..8d889af 100644 --- a/rehlds/public/rehlds/osconfig.h +++ b/rehlds/public/rehlds/osconfig.h @@ -136,6 +136,8 @@ VirtualFree(ptr, 0, MEM_RELEASE); } #else // _WIN32 + #include + #ifndef PAGESIZE #define PAGESIZE 4096 #endif From d6fff73df8ef539ab964adbfed87da24f4ea2836 Mon Sep 17 00:00:00 2001 From: Simeon Nikolov Date: Thu, 28 Jan 2021 00:27:05 +0200 Subject: [PATCH 07/61] add ReHLDS logo in README (#778) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a728d7d..0a1e3d7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Rehlds [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Rehlds_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Rehlds_Publish&guest=1) [![Download](https://camo.githubusercontent.com/65c70643ec7b40eea50971003624c2fb04d8d375/687474703a2f2f7265686c64732e6f72672f76657273696f6e2f7265686c64732e737667)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Rehlds_Publish&buildId=lastSuccessful) +# Rehlds [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Rehlds_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Rehlds_Publish&guest=1) [![Download](https://camo.githubusercontent.com/65c70643ec7b40eea50971003624c2fb04d8d375/687474703a2f2f7265686c64732e6f72672f76657273696f6e2f7265686c64732e737667)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Rehlds_Publish&buildId=lastSuccessful) ReHLDS Reverse-engineered (and bugfixed) HLDS From aaf56989f943eca5c6ff932e25258462d091f011 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Thu, 28 Jan 2021 05:41:57 +0700 Subject: [PATCH 08/61] Cbuf_Execute: Add checks commented out for multi-lines. (#719) --- rehlds/engine/cmd.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index 808d583..d76deae 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -164,8 +164,9 @@ void Cbuf_Execute(void) { int i; char *text; - char line[MAX_CMD_LINE]; + char line[MAX_CMD_LINE] = {0}; int quotes; + bool commented; while (cmd_text.cursize) { @@ -173,12 +174,21 @@ void Cbuf_Execute(void) text = (char *)cmd_text.data; quotes = 0; + commented = false; + +#ifdef REHLDS_FIXES + if (cmd_text.cursize > 1 && text[0] == '/' && text[1] == '/') + commented = true; +#endif + for (i = 0; i < cmd_text.cursize; i++) { if (text[i] == '"') quotes++; - if (!(quotes & 1) && text[i] == ';') - break; // don't break if inside a quoted string + + if (!(quotes & 1) && !commented && text[i] == ';') + break; // don't break if inside a quoted or commented out strings + if (text[i] == '\n') break; } From dc75d828ce30cf759030d290ae3e329727cd3b2b Mon Sep 17 00:00:00 2001 From: theAsmodai Date: Thu, 28 Jan 2021 01:43:02 +0300 Subject: [PATCH 09/61] Don't generate different challenge on port change (#804) --- rehlds/engine/sv_main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index d9df60d..70ef0a2 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -1813,8 +1813,7 @@ int g_oldest_challenge = 0; typedef struct challenge_buf_s { uint32_t ip; - uint16_t port; - uint32_t salt[14]; + uint32_t salt[15]; } challenge_buf_t; challenge_buf_t g_raw_challenge_buf; @@ -2529,7 +2528,6 @@ int EXT_FUNC SV_GetChallenge(const netadr_t& adr) #ifdef REHLDS_FIXES uint8_t digest[16]; g_raw_challenge_buf.ip = *(uint32_t*)adr.ip; - g_raw_challenge_buf.port = adr.port; MD5Context_t ctx; MD5Init(&ctx); MD5Update(&ctx, (uint8_t *)&g_raw_challenge_buf, sizeof(g_raw_challenge_buf)); From 169020067b64100cdf8e5632b56793d9d54bc66a Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Fri, 29 Jan 2021 21:12:32 +0300 Subject: [PATCH 10/61] Add: new chatdelay command. (#777) --- rehlds/HLTV/Proxy/src/Proxy.cpp | 27 +++++++++++++++++++++++++++ rehlds/HLTV/Proxy/src/Proxy.h | 7 ++++++- rehlds/HLTV/Proxy/src/ProxyClient.cpp | 2 +- rehlds/public/HLTV/IProxy.h | 1 + 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/rehlds/HLTV/Proxy/src/Proxy.cpp b/rehlds/HLTV/Proxy/src/Proxy.cpp index cb842f4..ce850e9 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.cpp +++ b/rehlds/HLTV/Proxy/src/Proxy.cpp @@ -80,6 +80,7 @@ Proxy::LocalCommandID_s Proxy::m_LocalCmdReg[] = { { "maxloss", CMD_ID_MAXLOSS, &Proxy::CMD_MaxLoss }, { "protocol", CMD_ID_PROTOCOL, &Proxy::CMD_Protocol }, { "region", CMD_ID_REGION, &Proxy::CMD_Region }, + { "chatdelay", CMD_ID_CHATDELAY, &Proxy::CMD_ChatDelay }, }; #ifndef HOOK_HLTV @@ -188,6 +189,7 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name) m_MaxClients = 128; m_MaxQueries = 100; m_Region = 255; + m_ChatDelay = 6; const int maxRouteAblePacketSize = 1400; m_InfoInfo.Resize(maxRouteAblePacketSize); @@ -2774,3 +2776,28 @@ const char *Proxy::GetDescription() return "Private Server"; } + +void Proxy::CMD_ChatDelay(char *cmdLine) +{ + enum { param_ChatDelay = 1 }; + + TokenLine params(cmdLine); + if (params.CountToken() != 2) + { + m_System->Printf("Syntax: chatdelay \n"); + m_System->Printf("Current clients chat delay is %i.\n", GetChatDelay()); + return; + } + + SetChatDelay(Q_atoi(params.GetToken(param_ChatDelay))); +} + +void Proxy::SetChatDelay(int delay) +{ + m_ChatDelay = delay; +} + +int Proxy::GetChatDelay() const +{ + return m_ChatDelay; +} diff --git a/rehlds/HLTV/Proxy/src/Proxy.h b/rehlds/HLTV/Proxy/src/Proxy.h index a7ab781..d8fb4fd 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.h +++ b/rehlds/HLTV/Proxy/src/Proxy.h @@ -130,6 +130,8 @@ public: EXT_FUNC int GetDispatchMode(); EXT_FUNC unsigned char GetRegion(); EXT_FUNC bool WriteSignonData(int type, BitBuffer *stream); + EXT_FUNC void SetChatDelay(int delay); + EXT_FUNC int GetChatDelay() const; void ReconnectClients(); void ExecuteRcon(NetAddress *from, char *command); @@ -229,7 +231,8 @@ private: CMD_ID_CLEARBANNS, CMD_ID_MAXLOSS, CMD_ID_PROTOCOL, - CMD_ID_REGION + CMD_ID_REGION, + CMD_ID_CHATDELAY }; void CMD_Rcon(char *cmdLine); @@ -284,6 +287,7 @@ private: void CMD_MaxLoss(char *cmdLine); void CMD_Protocol(char *cmdLine); void CMD_Region(char *cmdLine); + void CMD_ChatDelay(char *cmdLine); struct LocalCommandID_s { char *name; @@ -373,6 +377,7 @@ protected: float m_CurrentLoss; ObjectList m_BannList; unsigned char m_Region; + int m_ChatDelay; textmessage_t m_LocalMessage; textmessage_t m_CommentatorMessage; diff --git a/rehlds/HLTV/Proxy/src/ProxyClient.cpp b/rehlds/HLTV/Proxy/src/ProxyClient.cpp index 40bd5b3..82bdd27 100644 --- a/rehlds/HLTV/Proxy/src/ProxyClient.cpp +++ b/rehlds/HLTV/Proxy/src/ProxyClient.cpp @@ -126,7 +126,7 @@ void ProxyClient::CMD_Say(TokenLine *cmd) return; } - if (m_SystemTime >= m_LastChatTime + 6) { + if (m_SystemTime >= m_LastChatTime + m_Proxy->GetChatDelay()) { m_Proxy->ChatSpectator(m_ClientName, chatText); m_LastChatTime = float(m_SystemTime); return; diff --git a/rehlds/public/HLTV/IProxy.h b/rehlds/public/HLTV/IProxy.h index 68f0d75..7313a26 100644 --- a/rehlds/public/HLTV/IProxy.h +++ b/rehlds/public/HLTV/IProxy.h @@ -102,6 +102,7 @@ public: virtual unsigned char GetRegion() = 0; virtual IObjectContainer *GetClients() = 0; virtual bool WriteSignonData(int type, BitBuffer *stream) = 0; + virtual int GetChatDelay() const = 0; }; #define PROXY_INTERFACE_VERSION "proxy001" From 722e19df31052d4ae1758007ef9a28c440e29732 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 6 Feb 2021 20:13:38 +0700 Subject: [PATCH 11/61] Fix local-buffer overrun, may undefined behavior with hitbox blending or crash (reverse-engineering mistake) --- rehlds/engine/r_studio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/r_studio.cpp b/rehlds/engine/r_studio.cpp index d841aee..71e688a 100644 --- a/rehlds/engine/r_studio.cpp +++ b/rehlds/engine/r_studio.cpp @@ -785,7 +785,7 @@ hull_t *SV_HullForStudioModel(const edict_t *pEdict, const vec_t *mins, const ve int iBlend; R_StudioPlayerBlend(pseqdesc, &iBlend, angles); - unsigned char blending = (unsigned char)iBlend; + unsigned char blending[2] = { (unsigned char)iBlend, 0 }; unsigned char controller[4] = { 0x7F, 0x7F, 0x7F, 0x7F }; return R_StudioHull( g_psv.models[pEdict->v.modelindex], @@ -795,7 +795,7 @@ hull_t *SV_HullForStudioModel(const edict_t *pEdict, const vec_t *mins, const ve pEdict->v.origin, size, controller, - &blending, + blending, pNumHulls, pEdict, bSkipShield); From 2f2be916c2de55a9b1c74abbada13f4ac91df170 Mon Sep 17 00:00:00 2001 From: Very Strange Karaulov <62130676+2020karaulov2020@users.noreply.github.com> Date: Mon, 8 Feb 2021 13:28:07 +0300 Subject: [PATCH 12/61] HTLV: RadiusFromBounds is broken (#811) HTLV: RadiusFromBounds fix mistake --- rehlds/HLTV/common/mathlib.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rehlds/HLTV/common/mathlib.cpp b/rehlds/HLTV/common/mathlib.cpp index fb8e5ab..813c450 100644 --- a/rehlds/HLTV/common/mathlib.cpp +++ b/rehlds/HLTV/common/mathlib.cpp @@ -306,8 +306,7 @@ float RadiusFromBounds(const vec_t *mins, const vec_t *maxs) for (int i = 0; i < 3; i++) { float fmin = fabs(mins[i]); - float fmax = fabs(mins[i]); - + float fmax = fabs(maxs[i]); if (fmin > fmax) corner[i] = fmin; else From 3fc9ee2f55876dd72ad4fa96ccc377c8f58cea1a Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 13 Mar 2021 20:36:10 +0700 Subject: [PATCH 13/61] HLDS Lanucher: make sure the timer is high precision (Fixes #799) --- rehlds/dedicated/src/sys_window.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rehlds/dedicated/src/sys_window.cpp b/rehlds/dedicated/src/sys_window.cpp index aa09d5f..f8e614d 100644 --- a/rehlds/dedicated/src/sys_window.cpp +++ b/rehlds/dedicated/src/sys_window.cpp @@ -60,10 +60,16 @@ CSys::CSys() WORD version = MAKEWORD(2, 0); WSADATA wsaData; WSAStartup(version, &wsaData); + + // Request 1ms resolution for windows timer + timeBeginPeriod(1); } CSys::~CSys() { + // Clear previously set timer resolution + timeEndPeriod(1); + WSACleanup(); sys = nullptr; } From 2e8bd9e1eb87893ece02892c4545e1ac3d4334fa Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 16 Mar 2021 00:41:38 +0700 Subject: [PATCH 14/61] Add workflows/build.yml Preparing migration to workflows Fixes warnings Update badges README.md --- .github/workflows/build.yml | 183 +++++++++++++++ CMakeLists.txt | 11 + README.md | 7 +- dep/bzip2/CMakeLists.txt | 21 ++ dep/bzip2/msvc/bzip2.vcxproj | 37 --- dep/cppunitlite/msvc/cppunitlite.vcxproj | 37 --- rehlds/CMakeLists.txt | 148 ++++++++++++ rehlds/HLTV/CMakeLists.txt | 8 + rehlds/HLTV/Console/CMakeLists.txt | 100 ++++++++ rehlds/HLTV/Console/msvc/Console.vcxproj | 73 +----- rehlds/HLTV/Console/msvc/PreBuild.bat | 220 ++++++++++++++++++ rehlds/HLTV/Console/src/System.cpp | 71 +++--- rehlds/HLTV/Console/src/System.h | 6 +- rehlds/HLTV/Core/CMakeLists.txt | 121 ++++++++++ rehlds/HLTV/Core/msvc/Core.vcxproj | 74 ------ rehlds/HLTV/Core/src/Delta.cpp | 18 +- rehlds/HLTV/Core/src/World.cpp | 7 +- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 96 ++++++++ .../HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj | 58 ----- rehlds/HLTV/Director/CMakeLists.txt | 103 ++++++++ rehlds/HLTV/Director/msvc/Director.vcxproj | 54 ----- rehlds/HLTV/Proxy/CMakeLists.txt | 126 ++++++++++ rehlds/HLTV/Proxy/msvc/Proxy.vcxproj | 134 ----------- rehlds/HLTV/Proxy/src/Proxy.cpp | 18 +- rehlds/HLTV/common/BitBuffer.cpp | 12 +- rehlds/HLTV/common/DemoFile.cpp | 6 +- rehlds/HLTV/common/InfoString.cpp | 20 +- rehlds/HLTV/common/NetAddress.cpp | 6 +- rehlds/HLTV/common/common.cpp | 4 +- rehlds/common/IBaseSystem.h | 2 +- rehlds/common/TextConsoleUnix.cpp | 6 +- rehlds/common/TextConsoleUnix.h | 6 +- rehlds/common/TextConsoleWin32.cpp | 10 +- rehlds/common/TextConsoleWin32.h | 10 +- rehlds/common/commandline.cpp | 6 +- rehlds/common/stdc++compat.cpp | 2 +- rehlds/common/textconsole.cpp | 4 +- rehlds/common/textconsole.h | 14 +- rehlds/dedicated/CMakeLists.txt | 95 ++++++++ rehlds/dedicated/msvc/dedicated.vcxproj | 70 ------ rehlds/dedicated/src/dedicated_exports.cpp | 4 +- rehlds/dedicated/src/isys.h | 10 +- rehlds/dedicated/src/sys_ded.cpp | 8 +- rehlds/dedicated/src/sys_ded.h | 4 +- rehlds/dedicated/src/sys_linux.cpp | 20 +- rehlds/dedicated/src/sys_window.cpp | 20 +- rehlds/engine/SystemWrapper.cpp | 79 ++++--- rehlds/engine/SystemWrapper.h | 4 +- rehlds/engine/common.cpp | 2 +- rehlds/engine/cvar.cpp | 2 - rehlds/engine/decals.cpp | 10 +- rehlds/engine/delta.cpp | 28 ++- rehlds/engine/filesystem.cpp | 8 +- rehlds/engine/filesystem_.h | 2 +- rehlds/engine/host.cpp | 2 +- rehlds/engine/host_cmd.cpp | 9 +- rehlds/engine/iengine.h | 2 +- rehlds/engine/mathlib_sse.cpp | 8 +- rehlds/engine/model.cpp | 4 +- rehlds/engine/net_chan.cpp | 2 +- rehlds/engine/net_ws.cpp | 2 +- rehlds/engine/pr_cmds.cpp | 7 +- rehlds/engine/sv_log.cpp | 2 +- rehlds/engine/sv_main.cpp | 48 ++-- rehlds/engine/sv_phys.cpp | 2 +- rehlds/engine/sv_upld.cpp | 5 +- rehlds/engine/sv_user.cpp | 20 +- rehlds/engine/sv_user.h | 3 - rehlds/engine/sys_dll.cpp | 2 +- rehlds/engine/sys_dll2.cpp | 4 +- rehlds/engine/sys_dll2.h | 4 +- rehlds/engine/sys_engine.cpp | 2 +- rehlds/engine/sys_engine.h | 2 +- rehlds/engine/tmessage.cpp | 24 +- rehlds/engine/unicode_strtools.cpp | 18 +- rehlds/engine/vid_null.cpp | 2 +- rehlds/filesystem/CMakeLists.txt | 4 + .../FileSystem_Stdio/CMakeLists.txt | 93 ++++++++ .../FileSystem_Stdio/src/BaseFileSystem.cpp | 14 +- .../src/filesystem_helpers.cpp | 2 +- rehlds/hookers/HLTV/Core/DeltaEx.cpp | 14 +- rehlds/public/engine_hlds_api.h | 2 +- rehlds/public/idedicatedexports.h | 2 +- rehlds/public/interface.cpp | 4 +- rehlds/public/rehlds/rehlds_api.h | 4 +- rehlds/public/tier0/characterset.cpp | 2 +- rehlds/public/tier0/dbg.cpp | 4 +- rehlds/public/utlbuffer.cpp | 4 +- rehlds/public/utlrbtree.h | 7 +- rehlds/rehlds/jitasm.h | 2 +- rehlds/rehlds/platform.cpp | 6 +- rehlds/rehlds/rehlds_api_impl.h | 4 +- rehlds/version/appversion.sh | 158 +++++++++++++ 93 files changed, 1863 insertions(+), 842 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 CMakeLists.txt create mode 100644 dep/bzip2/CMakeLists.txt create mode 100644 rehlds/CMakeLists.txt create mode 100644 rehlds/HLTV/CMakeLists.txt create mode 100644 rehlds/HLTV/Console/CMakeLists.txt create mode 100644 rehlds/HLTV/Console/msvc/PreBuild.bat create mode 100644 rehlds/HLTV/Core/CMakeLists.txt create mode 100644 rehlds/HLTV/DemoPlayer/CMakeLists.txt create mode 100644 rehlds/HLTV/Director/CMakeLists.txt create mode 100644 rehlds/HLTV/Proxy/CMakeLists.txt create mode 100644 rehlds/dedicated/CMakeLists.txt create mode 100644 rehlds/filesystem/CMakeLists.txt create mode 100644 rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt create mode 100755 rehlds/version/appversion.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ec82c82 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,183 @@ +name: C/C++ CI + +on: + push: + branches: [master] + pull_request: + types: [opened, reopened, synchronize] + release: + types: [published] + +jobs: + windows: + name: 'Windows' + runs-on: windows-latest + env: + solution: 'msvc/ReHLDS.sln' + buildPlatform: 'Win32' + buildConfiguration: 'Release' + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Nuget + uses: nuget/setup-nuget@v1 + with: + nuget-api-key: ${{ secrets.NuGetAPIKey }} + nuget-version: '5.x' + - run: nuget restore '${{ env.solution }}' + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.0.2 + with: + vs-version: '16.8' + + - name: Build ReHLDS + run: + msbuild ${{ env.solution }} /t:Clean,Build -p:Configuration="${{ env.buildConfiguration }}" /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + + - name: Move files + run: | + mkdir publish\debug + mkdir publish\bin\win32\valve\dlls + move msvc\${{ env.buildConfiguration }}\hlds.exe publish\bin\win32\hlds.exe + move msvc\${{ env.buildConfiguration }}\hltv.exe publish\bin\win32\hltv.exe + move msvc\${{ env.buildConfiguration }}\swds.dll publish\bin\win32\swds.dll + move msvc\${{ env.buildConfiguration }}\core.dll publish\bin\win32\core.dll + move msvc\${{ env.buildConfiguration }}\proxy.dll publish\bin\win32\proxy.dll + move msvc\${{ env.buildConfiguration }}\demoplayer.dll publish\bin\win32\demoplayer.dll + move msvc\${{ env.buildConfiguration }}\filesystem_stdio.dll publish\bin\win32\filesystem_stdio.dll + move msvc\${{ env.buildConfiguration }}\director.dll publish\bin\win32\valve\dlls\director.dll + move msvc\${{ env.buildConfiguration }}\hlds.pdb publish\debug\hlds.pdb + move msvc\${{ env.buildConfiguration }}\hltv.pdb publish\debug\hltv.pdb + move msvc\${{ env.buildConfiguration }}\swds.pdb publish\debug\swds.pdb + move msvc\${{ env.buildConfiguration }}\core.pdb publish\debug\core.pdb + move msvc\${{ env.buildConfiguration }}\proxy.pdb publish\debug\proxy.pdb + move msvc\${{ env.buildConfiguration }}\demoplayer.pdb publish\debug\demoplayer.pdb + move msvc\${{ env.buildConfiguration }}\filesystem_stdio.pdb publish\debug\filesystem_stdio.pdb + move msvc\${{ env.buildConfiguration }}\director.pdb publish\debug\director.pdb + + - name: Deploy artifacts + uses: actions/upload-artifact@v2 + with: + name: win32 + path: publish/* + + linux: + name: 'Linux' + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Check dependencies + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y gcc-multilib g++-multilib + sudo apt-get install -y build-essential + sudo apt-get install -y libc6-dev libc6-dev-i386 + sudo apt-get install -y p7zip-full + + - name: Build + run: | + mkdir build + cd build + cmake ../ + make + + - name: Prepare HLSDK + run: | + mkdir -p publish/hlsdk + rsync -a rehlds/common/ publish/hlsdk/common/ + rsync -a rehlds/dlls/ publish/hlsdk/dlls/ + rsync -a rehlds/pm_shared/ publish/hlsdk/pm_shared/ + rsync -a rehlds/public/ publish/hlsdk/public/ --exclude rehlds/ + rsync -a rehlds/public/rehlds/ publish/hlsdk/engine + + - name: Move files + run: | + mkdir -p publish/bin/linux32/valve/dlls + mv build/rehlds/engine_i486.so publish/bin/linux32/engine_i486.so + mv rehlds/version/appversion.h publish/appversion.h + mv build/rehlds/dedicated/hlds_linux publish/bin/linux32/hlds_linux + mv build/rehlds/HLTV/Console/hltv publish/bin/linux32/hltv + mv build/rehlds/HLTV/Core/core.so publish/bin/linux32/core.so + mv build/rehlds/HLTV/Proxy/proxy.so publish/bin/linux32/proxy.so + mv build/rehlds/HLTV/DemoPlayer/demoplayer.so publish/bin/linux32/demoplayer.so + mv build/rehlds/HLTV/Director/director.so publish/bin/linux32/valve/dlls/director.so + mv build/rehlds/filesystem/FileSystem_Stdio/filesystem_stdio.so publish/bin/linux32/filesystem_stdio.so + + - name: Deploy artifacts + uses: actions/upload-artifact@v2 + id: upload-job + with: + name: linux32 + path: publish/* + + - name: Cleanup temporary artifacts + if: success() && steps.upload-job.outcome == 'success' + run: | + rm -rf hlsdk + rm -f appversion.h + + publish: + needs: [windows, linux] + name: 'Publish' + runs-on: ubuntu-latest + steps: + - name: Deploying linux artifacts + uses: actions/download-artifact@v2 + with: + name: linux32 + + - name: Deploying windows artifacts + uses: actions/download-artifact@v2 + with: + name: win32 + + - name: Reading appversion.h + run: | + if [ -e appversion.h ]; then + APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g') + if [ $? -ne 0 ]; then + APP_VERSION="" + else + # Remove quotes + APP_VERSION=$(echo $APP_VERSION | xargs) + echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV + fi + fi + rm -f appversion.h + + - name: Packaging bin/dbg + id: packaging-job + if: | + github.event_name == 'release' && + github.event.action == 'published' && + startsWith(github.ref, 'refs/tags/') + run: | + 7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/ hlsdk/ + 7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/ + + - name: Publish artifacts + uses: softprops/action-gh-release@v1 + id: publish-job + if: | + startsWith(github.ref, 'refs/tags/') && + steps.packaging-job.outcome == 'success' + with: + files: | + *.zip + *.7z + env: + GITHUB_TOKEN: ${{ secrets.API_TOKEN }} + + - name: Cleanup temporary artifacts + if: success() && steps.publish-job.outcome == 'success' + run: | + rm -rf bin debug hlsdk + rm -f *.7z *.zip appversion.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2046105 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(rehlds CXX) + +if (WIN32) + message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/ReHLDS.sln instead it!") +endif() + +add_subdirectory(rehlds) +add_subdirectory(rehlds/dedicated) +add_subdirectory(rehlds/filesystem) +add_subdirectory(rehlds/HLTV) diff --git a/README.md b/README.md index 0a1e3d7..b2a1e90 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -# Rehlds [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Rehlds_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Rehlds_Publish&guest=1) [![Download](https://camo.githubusercontent.com/65c70643ec7b40eea50971003624c2fb04d8d375/687474703a2f2f7265686c64732e6f72672f76657273696f6e2f7265686c64732e737667)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Rehlds_Publish&buildId=lastSuccessful) ReHLDS - +# ReHLDS [![C/C++ CI](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml/badge.svg)](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml) [![Download](https://camo.githubusercontent.com/7ab483250adb4037b26e9575331218ee51108190d0938b7836d32f1209ccf907/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f647265616d7374616c6b65722f7265686c64732e737667)](https://github.com/dreamstalker/rehlds/releases/latest) [![Downloads](https://camo.githubusercontent.com/d37654956d99bb9fb7a348fdac39b214d6ae14a7cfb9f96bf873c6b46cdf9ef6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f647265616d7374616c6b65722f7265686c64732f746f74616c3f636f6c6f723d696d706f7274616e74)]() [![Percentage of issues still open](http://isitmaintained.com/badge/open/dreamstalker/rehlds.svg)](http://isitmaintained.com/project/dreamstalker/rehlds "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ReHLDS Reverse-engineered (and bugfixed) HLDS ## What is this? @@ -7,7 +6,7 @@ ReHLDS is a result of reverse engineering of original HLDS (build 6152/6153) usi Along with reverse engineering, a lot of defects and (potential) bugs were found and fixed -You can try play on one of the servers that using rehlds: http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version +You can try play on one of the servers that using rehlds: [Game Tracker](http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version) ## Goals of the project
    @@ -19,7 +18,7 @@ You can try play on one of the servers that using rehlds: http://www.gametracker Rehlds is fully compatible with latest official HLDS downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information.
    Warning! Rehlds is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool. -Compiled binaries are available here: http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/rehlds/rehlds/ +Compiled binaries are available here: [Artifact releases](https://github.com/dreamstalker/rehlds/releases) Rehlds binaries require SSE, SSE2 and SSE3 instruction sets to run and can benefit from SSE4.1 and SSE4.2. diff --git a/dep/bzip2/CMakeLists.txt b/dep/bzip2/CMakeLists.txt new file mode 100644 index 0000000..74f4b99 --- /dev/null +++ b/dep/bzip2/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.1) +project(bzip2 C) + +set(BZIP2_SRCS + "src/blocksort.c" + "src/bzlib.c" + "src/compress.c" + "src/crctable.c" + "src/decompress.c" + "src/huffman.c" + "src/precompiled.c" + "src/randtable.c" + "src/bzlib_private.h" +) + +include_directories( + "include" +) + +add_library(bzip2 STATIC ${BZIP2_SRCS}) +set_target_properties(bzip2 PROPERTIES COMPILE_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) diff --git a/dep/bzip2/msvc/bzip2.vcxproj b/dep/bzip2/msvc/bzip2.vcxproj index 55fab7d..d11db95 100644 --- a/dep/bzip2/msvc/bzip2.vcxproj +++ b/dep/bzip2/msvc/bzip2.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -39,16 +35,6 @@ true Unicode - - StaticLibrary - false - v120 - v140 - v141 - v142 - true - Unicode - @@ -58,9 +44,6 @@ - - - @@ -97,25 +80,6 @@ true - - - Level3 - Use - MaxSpeed - true - true - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)..\include\ - MultiThreaded - bzlib_private.h - - - Windows - true - true - true - - @@ -129,7 +93,6 @@ Create Create - Create diff --git a/dep/cppunitlite/msvc/cppunitlite.vcxproj b/dep/cppunitlite/msvc/cppunitlite.vcxproj index b44933d..09143e8 100644 --- a/dep/cppunitlite/msvc/cppunitlite.vcxproj +++ b/dep/cppunitlite/msvc/cppunitlite.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -55,16 +51,6 @@ true MultiByte - - StaticLibrary - false - v120 - v140 - v141 - v142 - true - MultiByte - @@ -74,9 +60,6 @@ - - - @@ -115,26 +98,6 @@ true - - - Level3 - - - MaxSpeed - true - true - WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreaded - $(ProjectDir)..\include\ - false - - - Windows - true - true - true - - diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt new file mode 100644 index 0000000..16543a9 --- /dev/null +++ b/rehlds/CMakeLists.txt @@ -0,0 +1,148 @@ +cmake_minimum_required(VERSION 3.1) +project(engine CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) +option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-exceptions") + +# Remove noxref code and data +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + -fpermissive\ + -Wno-unknown-pragmas -Wno-invalid-offsetof\ + -Wno-unused-variable -Wno-unused-result -Wno-unused-function -Wno-delete-non-virtual-dtor\ + -Wno-write-strings -Wno-format\ + -Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes") + + if (NOT USE_CLANG_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-unused-but-set-variable -Wno-class-memaccess") + endif() +endif() + +if (NOT DEBUG AND USE_STATIC_LIBSTDC) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"") +endif() + +if (USE_STATIC_LIBSTDC) + add_definitions(-DBUILD_STATIC_LIBSTDC) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++") +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/engine" + "${PROJECT_SOURCE_DIR}/common" + "${PROJECT_SOURCE_DIR}/pm_shared" + "${PROJECT_SOURCE_DIR}/rehlds" + "${PROJECT_SOURCE_DIR}/testsuite" +) + +set(PROJECT_BZIP2_DIR + "${PROJECT_SOURCE_DIR}/../dep/bzip2/include" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/public" + "${PROJECT_SOURCE_DIR}/public/rehlds" +) + +file(GLOB ENGINE_SRCS + "engine/*.cpp" + "rehlds/*.cpp" + "version/*.cpp" +) + +list(REMOVE_ITEM ENGINE_SRCS EXCLUDE + "${PROJECT_SOURCE_DIR}/rehlds/precompiled.cpp" + "${PROJECT_SOURCE_DIR}/rehlds/RehldsRuntimeConfig.cpp" + "${PROJECT_SOURCE_DIR}/rehlds/structSizeCheck.cpp" +) + +file(GLOB COMMON_SRCS + "common/BaseSystemModule.cpp" + "common/ObjectList.cpp" + "common/TokenLine.cpp" +) + +file(GLOB PUBLIC_SRCS + "public/tier0/dbg.cpp" + "public/registry.cpp" + "public/steamid.cpp" + "public/utlbuffer.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_BZIP2_DIR} + ${PROJECT_PUBLIC_DIR} +) + +link_directories(${PROJECT_SOURCE_DIR}/lib/linux32) + +add_definitions( + -DSWDS + -DREHLDS_JIT + -DREHLDS_SSE + -DREHLDS_FIXES + -DREHLDS_CHECKS + -DREHLDS_API + -DREHLDS_SELF + -DREHLDS_OPT_PEDANTIC + -DHAVE_OPT_STRTOOLS + -DUSE_BREAKPAD_HANDLER + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_unlink=unlink + -D_vsnprintf=vsnprintf + -D_vsnwprintf=vswprintf +) + +if (NOT TARGET bzip2) + add_subdirectory(../dep/bzip2 lib) +endif() + +if (NOT TARGET appversion) + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}") +endif() + +add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS}) +set_property(TARGET engine PROPERTY LIBRARY_OUTPUT_NAME engine_i486) +set_target_properties(engine PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +target_link_libraries(engine dl rt m aelf32 bzip2 steam_api) +add_dependencies(engine appversion) diff --git a/rehlds/HLTV/CMakeLists.txt b/rehlds/HLTV/CMakeLists.txt new file mode 100644 index 0000000..abfaf71 --- /dev/null +++ b/rehlds/HLTV/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(HLTV CXX) + +add_subdirectory(Console) +add_subdirectory(Core) +add_subdirectory(Proxy) +add_subdirectory(DemoPlayer) +add_subdirectory(Director) diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt new file mode 100644 index 0000000..2d85a32 --- /dev/null +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -0,0 +1,100 @@ +cmake_minimum_required(VERSION 3.1) +project(hltv CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + -fpermissive\ + -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../.." + "${PROJECT_SOURCE_DIR}/../../engine" + "${PROJECT_SOURCE_DIR}/../../common" + "${PROJECT_SOURCE_DIR}/../../public" + "${PROJECT_SOURCE_DIR}/../../public/rehlds" +) + +set(HLTV_SRCS + "src/System.cpp" + "src/public_amalgamation.cpp" +) + +set(COMMON_SRCS + "../../common/BaseSystemModule.cpp" + "../../common/TokenLine.cpp" + "../../common/ObjectList.cpp" + "../../common/textconsole.cpp" + "../../common/TextConsoleUnix.cpp" + "../../common/minidump.cpp" + "../../HLTV/common/random.cpp" + "../../HLTV/common/common.cpp" + "../../engine/mem.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_PUBLIC_DIR} +) + +add_definitions( + -DLAUNCHER_FIXES + -D_CONSOLE + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_vsnprintf=vsnprintf + -D_snprintf=snprintf +) + +if (NOT TARGET appversion) + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") +endif() + +add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS}) +target_link_libraries(hltv dl) +set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +add_dependencies(hltv appversion) diff --git a/rehlds/HLTV/Console/msvc/Console.vcxproj b/rehlds/HLTV/Console/msvc/Console.vcxproj index cdeb0e3..3ecc3b6 100644 --- a/rehlds/HLTV/Console/msvc/Console.vcxproj +++ b/rehlds/HLTV/Console/msvc/Console.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -34,62 +30,50 @@ Use Use - Use Use Use - Use Use Use - Use Use Use - Use Use Use - Use Use Use - Use Use - Use Use Use - Use Use Use Use - Use Create - Create Create Use - Use Use Use - Use Use @@ -125,16 +109,6 @@ true MultiByte - - Application - false - v120_xp - v140_xp - v141_xp - v142 - true - MultiByte - @@ -146,9 +120,6 @@ - - - true @@ -158,10 +129,6 @@ false hltv - - false - hltv - Use @@ -190,6 +157,10 @@ build.always.run build.always.run + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\..\version\" "$(ProjectDir)..\..\..\") + Setup version from Git revision + @@ -222,38 +193,10 @@ build.always.run build.always.run - - - - Level3 - Use - Disabled - true - true - HLTV;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - $(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;%(AdditionalIncludeDirectories) - precompiled.h - MultiThreaded - - - Windows - true - true - true - user32.lib;%(AdditionalDependencies) - - - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") - - - Automatic deployment script - - - echo Empty Action - Force build to run Pre-Build event - build.always.run - build.always.run - + + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\..\version\" "$(ProjectDir)..\..\..\") + Setup version from Git revision + diff --git a/rehlds/HLTV/Console/msvc/PreBuild.bat b/rehlds/HLTV/Console/msvc/PreBuild.bat new file mode 100644 index 0000000..c9f7989 --- /dev/null +++ b/rehlds/HLTV/Console/msvc/PreBuild.bat @@ -0,0 +1,220 @@ +@setlocal enableextensions enabledelayedexpansion +@echo on +:: +:: Pre-build auto-versioning script +:: + +set srcdir=%~1 +set repodir=%~2 + +set old_version= +set version_major=0 +set version_minor=0 +set version_maintenance=0 +set version_modifed= + +set commitSHA= +set commitURL= +set commitCount=0 +set branch_name=master + +for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" +set "YYYY=%dt:~0,4%" +set "MM=%dt:~4,2%" +set "DD=%dt:~6,2%" +set "hour=%dt:~8,2%" +set "min=%dt:~10,2%" +set "sec=%dt:~12,2%" + +:: +:: Remove leading zero from MM (e.g 09 > 9) +:: +for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I + +:: +:: Index into array to get month name +:: +for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I" + +:: +:: Check for git.exe presence +:: +CALL git.exe describe >NUL 2>&1 +set errlvl="%ERRORLEVEL%" + +:: +:: Read old appversion.h, if present +:: +IF EXIST "%srcdir%\appversion.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( + IF %%i==#define ( + IF %%j==APP_VERSION ( + :: Remove quotes + set v=%%k + set old_version=!v:"=! + ) + ) + ) +) + +IF %errlvl% == "1" ( + echo can't locate git.exe - auto-versioning step won't be performed + + :: if we haven't appversion.h, we need to create it + IF NOT "%old_version%" == "" ( + set commitCount=0 + ) +) + +:: +:: Read major, minor and maintenance version components from Version.h +:: +IF EXIST "%srcdir%\version.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( + IF %%i==#define ( + IF %%j==VERSION_MAJOR set version_major=%%k + IF %%j==VERSION_MINOR set version_minor=%%k + IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k + ) + ) +) ELSE ( + FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do ( + IF NOT [%%j] == [] ( + IF %%i==majorVersion set version_major=%%j + IF %%i==minorVersion set version_minor=%%j + IF %%i==maintenanceVersion set version_maintenance=%%j + ) + ) +) + +:: +:: Read revision and release date from it +:: +IF NOT %errlvl% == "1" ( + :: Get current branch + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO ( + set branch_name=%%i + ) + + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO ( + IF NOT [%%i] == [] ( + set commitCount=%%i + ) + ) +) + +:: +:: Get remote url repository +:: +IF NOT %errlvl% == "1" ( + + set branch_remote=origin + :: Get remote name by current branch + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( + set branch_remote=%%i + ) + :: Get remote url + FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( + set commitURL=%%i + ) + :: Get commit id + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO ( + set shafull=%%i + set commitSHA=!shafull:~0,+7! + ) + + IF [!commitURL!] == [] ( + + FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( + set commitURL=%%i + ) + + :: strip .git + if "x!commitURL:~-4!"=="x.git" ( + set commitURL=!commitURL:~0,-4! + ) + + :: append extra string + If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( + set commitURL=!commitURL!/commits/ + ) ELSE ( + set commitURL=!commitURL!/commit/ + ) + + ) ELSE ( + :: strip .git + if "x!commitURL:~-4!"=="x.git" ( + set commitURL=!commitURL:~0,-4! + ) + :: replace : to / + set commitURL=!commitURL::=/! + + :: append extra string + If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( + set commitURL=https://!commitURL!/commits/ + ) ELSE ( + set commitURL=https://!commitURL!/commit/ + ) + ) +) + +:: +:: Detect local modifications +:: +set localChanged=0 +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( + set localChanged=1 + ) +) + +IF [%localChanged%]==[1] ( + set version_modifed=+m +) + +:: +:: Now form full version string like 1.0.0.1 +:: + +set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed% + +:: +:: Update appversion.h if version has changed or modifications/mixed revisions detected +:: +IF NOT "%new_version%"=="%old_version%" goto _update +goto _exit + +:_update +echo Updating appversion.h, new version is "%new_version%", the old one was %old_version% + +echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" +echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo // This file is generated automatically.>>"%srcdir%\appversion.h" +echo // Don't edit it.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // Version defines>>"%srcdir%\appversion.h" +echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h" + +echo.>>"%srcdir%\appversion.h" +echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h" +echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h" + +echo.>>"%srcdir%\appversion.h" +echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h" +echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +:: +:: Do update of version.cpp file last modify time to force it recompile +:: +copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" +endlocal + +:_exit +exit /B 0 diff --git a/rehlds/HLTV/Console/src/System.cpp b/rehlds/HLTV/Console/src/System.cpp index 54db254..982d292 100644 --- a/rehlds/HLTV/Console/src/System.cpp +++ b/rehlds/HLTV/Console/src/System.cpp @@ -48,7 +48,7 @@ char *System::GetBaseDir() return COM_GetBaseDir(); } -void Sys_Printf(char *fmt, ...) +void Sys_Printf(const char *fmt, ...) { // Dump text to debugging console. va_list argptr; @@ -151,49 +151,56 @@ bool System::RegisterCommand(char *name, ISystemModule *module, int commandID) return true; } -void System::ExecuteString(char *commands) +void System::ExecuteString(const char *commands) { if (!commands || !commands[0]) return; - int size = 0; - char singleCmd[256] = ""; - bool quotes = false; - char *p = singleCmd; - char *c = commands; + // Remove format characters to block format string attacks + COM_RemoveEvilChars(const_cast(commands)); - COM_RemoveEvilChars(c); - while (true) + bool bInQuote = false; + + char *pszDest; + char singleCmd[256] = {0}; + + const char *pszSource = commands; + while (*pszSource) { - *p = *c; + // Parse out single commands and execute them + pszDest = singleCmd; - if (++size >= sizeof(singleCmd)) + unsigned int i; + for (i = 0; i < ARRAYSIZE(singleCmd); i++) { - DPrintf("WARNING! System::ExecuteString: Command token too long.\n"); - break; + char c = *pszSource++; + + *pszDest++ = c; + + if (c == '"') + { + bInQuote = !bInQuote; + } + else if (c == ';' && !bInQuote) + { + // End of command and not in a quoted string + break; + } } - if (*c == '"') - quotes = !quotes; - - if ((*c != ';' || quotes) && *c) + if (i >= ARRAYSIZE(singleCmd)) { - ++p; - } - else - { - *p = '\0'; - - char *cmd = singleCmd; - while (*cmd == ' ') { cmd++; } - - DispatchCommand(cmd); - p = singleCmd; - size = 0; + Printf("WARNING! System::ExecuteString: Command token too long.\n"); + return; } - if (!*c++) - break; + *pszDest = '\0'; + + char *pszCmd = singleCmd; + while (*pszCmd == ' ') + pszCmd++; // skip leading whitespaces + + DispatchCommand(pszCmd); } } @@ -887,7 +894,7 @@ void System::UpdateTime() m_SystemTime = m_Counter.GetCurTime(); } -char *System::GetInput() +const char *System::GetInput() { return m_Console.GetLine(); } diff --git a/rehlds/HLTV/Console/src/System.h b/rehlds/HLTV/Console/src/System.h index 7d3c560..01ab9e3 100644 --- a/rehlds/HLTV/Console/src/System.h +++ b/rehlds/HLTV/Console/src/System.h @@ -57,7 +57,7 @@ public: Panel *GetPanel(); bool RegisterCommand(char *name, ISystemModule *module, int commandID); void GetCommandMatches(char *string, ObjectList *pMatchList); - void ExecuteString(char *commands); + void ExecuteString(const char *commands); void ExecuteFile(char *filename); void Errorf(char *fmt, ...); char *CheckParam(char *param); @@ -102,7 +102,7 @@ protected: bool DispatchCommand(char *command); void ExecuteCommandLine(); void UpdateTime(); - char *GetInput(); + const char *GetInput(); bool StartVGUI(); void StopVGUI(); void SetName(char *newName); @@ -183,4 +183,4 @@ private: extern System gSystem; -void Sys_Printf(char *fmt, ...); +void Sys_Printf(const char *fmt, ...); diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt new file mode 100644 index 0000000..032b673 --- /dev/null +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -0,0 +1,121 @@ +cmake_minimum_required(VERSION 3.1) +project(core CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + -fpermissive\ + -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ + -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") + + if (USE_CLANG_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") + endif() +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../" +) + +set(PROJECT_BZIP2_DIR + "${PROJECT_SOURCE_DIR}/../../../dep/bzip2/include" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../.." + "${PROJECT_SOURCE_DIR}/../../engine" + "${PROJECT_SOURCE_DIR}/../../common" + "${PROJECT_SOURCE_DIR}/../../pm_shared" + "${PROJECT_SOURCE_DIR}/../../public" + "${PROJECT_SOURCE_DIR}/../../public/rehlds" +) + +set(CORE_SRCS + "src/BSPModel.cpp" + "src/Delta.cpp" + "src/NetSocket.cpp" + "src/Network.cpp" + "src/Server.cpp" + "src/World.cpp" + "src/public_amalgamation.cpp" +) + +set(COMMON_SRCS + "../../common/BaseSystemModule.cpp" + "../../common/ObjectDictionary.cpp" + "../../common/ObjectList.cpp" + "../../common/TokenLine.cpp" + "../../HLTV/common/BitBuffer.cpp" + "../../HLTV/common/byteorder.cpp" + "../../HLTV/common/common.cpp" + "../../HLTV/common/DemoFile.cpp" + "../../HLTV/common/DirectorCmd.cpp" + "../../HLTV/common/InfoString.cpp" + "../../HLTV/common/mathlib.cpp" + "../../HLTV/common/md5.cpp" + "../../HLTV/common/munge.cpp" + "../../HLTV/common/NetAddress.cpp" + "../../HLTV/common/NetChannel.cpp" + "../../HLTV/common/random.cpp" + "../../engine/mem.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_BZIP2_DIR} + ${PROJECT_PUBLIC_DIR} +) + +add_definitions( + -DHLTV + -DHLTV_FIXES + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_vsnprintf=vsnprintf + -D_snprintf=snprintf +) + +if (NOT TARGET bzip2) + add_subdirectory(../../../dep/bzip2 lib) +endif() + +add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS}) +target_link_libraries(core dl bzip2) +set_target_properties(core PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) diff --git a/rehlds/HLTV/Core/msvc/Core.vcxproj b/rehlds/HLTV/Core/msvc/Core.vcxproj index 21d4a79..0ae9902 100644 --- a/rehlds/HLTV/Core/msvc/Core.vcxproj +++ b/rehlds/HLTV/Core/msvc/Core.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -39,16 +35,6 @@ true MultiByte - - DynamicLibrary - false - v120_xp - v140_xp - v141_xp - v142 - true - MultiByte - @@ -60,9 +46,6 @@ - - - true @@ -71,9 +54,6 @@ false - - false - Use @@ -142,41 +122,6 @@ build.always.run - - - Level3 - Use - MaxSpeed - true - true - HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;CORE_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - $(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;$(ProjectDir)\..\..\..\..\dep\bzip2\include;%(AdditionalIncludeDirectories) - precompiled.h - MultiThreaded - true - - - Windows - true - true - true - psapi.lib;ws2_32.lib;%(AdditionalDependencies) - - - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") - - - Automatic deployment script - - - echo Empty Action - Force build to run Pre-Build event - build.always.run - build.always.run - - @@ -186,17 +131,14 @@ true true - true true true - true true true - true @@ -214,58 +156,44 @@ Use precompiled.h Use - Use precompiled.h - precompiled.h Use precompiled.h Use - Use precompiled.h - precompiled.h Use precompiled.h Use - Use precompiled.h - precompiled.h Use precompiled.h Use - Use precompiled.h - precompiled.h Create precompiled.h Create - Create precompiled.h - precompiled.h Use precompiled.h Use - Use precompiled.h - precompiled.h Use precompiled.h Use - Use precompiled.h - precompiled.h @@ -277,12 +205,10 @@ true true - true true true - true diff --git a/rehlds/HLTV/Core/src/Delta.cpp b/rehlds/HLTV/Core/src/Delta.cpp index a1e5d75..54b96c2 100644 --- a/rehlds/HLTV/Core/src/Delta.cpp +++ b/rehlds/HLTV/Core/src/Delta.cpp @@ -42,13 +42,13 @@ delta_t *Delta::m_CustomentityDelta = nullptr; delta_description_t Delta::m_MetaDescription[] = { - { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, 0, 0 }, - { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, 0, 0 }, - { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 }, - { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 }, + { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} }, + { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} }, + { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, + { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, }; delta_t Delta::m_MetaDelta[] = @@ -453,7 +453,7 @@ void Delta::MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFie st2 = (char *)&to[pTest->fieldOffset]; // Not sure why it is case insensitive, but it looks so - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) { + if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) { pTest->flags |= FDT_MARK; } break; @@ -972,7 +972,7 @@ int Delta::TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) st2 = (char *)&to[pTest->fieldOffset]; // Not sure why it is case insensitive, but it looks so - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) + if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) { different = true; length = Q_strlen(st2) * 8; diff --git a/rehlds/HLTV/Core/src/World.cpp b/rehlds/HLTV/Core/src/World.cpp index 8fb764f..5d8f1fd 100644 --- a/rehlds/HLTV/Core/src/World.cpp +++ b/rehlds/HLTV/Core/src/World.cpp @@ -1208,11 +1208,12 @@ void World::ClearEntityCache() { if (m_DeltaCache) { - for (int i = 0; i < m_MaxCacheIndex; i++) { + for (int i = 0; i < m_MaxCacheIndex; i++) + { + m_DeltaCache[i].seqNr = 0; + m_DeltaCache[i].deltaNr = 0; m_DeltaCache[i].buffer.Free(); } - - Q_memset(m_DeltaCache, 0, sizeof(deltaCache_t) * m_MaxCacheIndex); } if (m_FrameCache) { diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt new file mode 100644 index 0000000..17d85c3 --- /dev/null +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -0,0 +1,96 @@ +cmake_minimum_required(VERSION 3.1) +project(demoplayer CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + -fpermissive\ + -Wno-unused-result -Wno-unknown-pragmas\ + -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../.." + "${PROJECT_SOURCE_DIR}/../../engine" + "${PROJECT_SOURCE_DIR}/../../common" + "${PROJECT_SOURCE_DIR}/../../pm_shared" + "${PROJECT_SOURCE_DIR}/../../public" + "${PROJECT_SOURCE_DIR}/../../public/rehlds" +) + +set(DEMOPLAYER_SRCS + "src/DemoPlayer.cpp" + "src/public_amalgamation.cpp" +) + +set(COMMON_SRCS + "../../common/BaseSystemModule.cpp" + "../../common/ObjectDictionary.cpp" + "../../common/ObjectList.cpp" + "../../common/TokenLine.cpp" + "../../HLTV/common/BitBuffer.cpp" + "../../HLTV/common/byteorder.cpp" + "../../HLTV/common/common.cpp" + "../../HLTV/common/DirectorCmd.cpp" + "../../HLTV/common/mathlib.cpp" + "../../engine/mem.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_PUBLIC_DIR} +) + +add_definitions( + -DHLTV + -DHLTV_FIXES + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_vsnprintf=vsnprintf + -D_snprintf=snprintf +) + +add_library(demoplayer SHARED ${DEMOPLAYER_SRCS} ${COMMON_SRCS}) +target_link_libraries(demoplayer dl) +set_target_properties(demoplayer PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) diff --git a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj index 515fd01..45a7a94 100644 --- a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj +++ b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -22,12 +18,10 @@ true - true true true - true true @@ -39,7 +33,6 @@ Create Create - Create @@ -51,7 +44,6 @@ true - true true @@ -88,16 +80,6 @@ true MultiByte - - DynamicLibrary - false - v120_xp - v140_xp - v141_xp - v142 - true - MultiByte - @@ -109,9 +91,6 @@ - - - true @@ -119,9 +98,6 @@ false - - false - Use @@ -184,40 +160,6 @@ build.always.run - - - Level3 - Use - MaxSpeed - true - true - HOOK_HLTV;HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DEMOPLAYER_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitiHOOons) - precompiled.h - $(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories) - MultiThreaded - true - - - Windows - true - true - true - psapi.lib;%(AdditionalDependencies) - false - - - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") - - - Automatic deployment script - - - echo Empty Action - Force build to run Pre-Build event - build.always.run - build.always.run - - diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt new file mode 100644 index 0000000..7667adb --- /dev/null +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required(VERSION 3.1) +project(director CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + -fpermissive\ + -Wno-unused-result -Wno-unknown-pragmas\ + -Wno-write-strings -Wno-strict-aliasing") +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../.." + "${PROJECT_SOURCE_DIR}/../../engine" + "${PROJECT_SOURCE_DIR}/../../common" + "${PROJECT_SOURCE_DIR}/../../pm_shared" + "${PROJECT_SOURCE_DIR}/../../public" + "${PROJECT_SOURCE_DIR}/../../public/rehlds" +) + +set(DIRECTOR_SRCS + "src/Director.cpp" + "src/public_amalgamation.cpp" +) + +set(COMMON_SRCS + "../../common/BaseSystemModule.cpp" + "../../common/ObjectDictionary.cpp" + "../../common/ObjectList.cpp" + "../../common/TokenLine.cpp" + "../../HLTV/common/BitBuffer.cpp" + "../../HLTV/common/byteorder.cpp" + "../../HLTV/common/common.cpp" + "../../HLTV/common/DirectorCmd.cpp" + "../../HLTV/common/mathlib.cpp" + "../../HLTV/common/random.cpp" + "../../engine/mem.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_PUBLIC_DIR} +) + +add_definitions( + -DHLTV + -DHLTV_FIXES + -DDIRECTOR_MODULE + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_vsnprintf=vsnprintf + -D_snprintf=snprintf +) + +if (NOT TARGET appversion) + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") +endif() + +add_library(director SHARED ${appversion.sh} ${DIRECTOR_SRCS} ${COMMON_SRCS}) +target_link_libraries(director dl) +set_target_properties(director PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +add_dependencies(director appversion) diff --git a/rehlds/HLTV/Director/msvc/Director.vcxproj b/rehlds/HLTV/Director/msvc/Director.vcxproj index 76cf66d..3f8a675 100644 --- a/rehlds/HLTV/Director/msvc/Director.vcxproj +++ b/rehlds/HLTV/Director/msvc/Director.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -39,16 +35,6 @@ true MultiByte - - DynamicLibrary - false - v120_xp - v140_xp - v141_xp - v142 - true - MultiByte - @@ -60,9 +46,6 @@ - - - true @@ -70,9 +53,6 @@ false - - false - Use @@ -135,39 +115,6 @@ Automatic deployment script - - - Level3 - Use - MaxSpeed - true - true - HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DIRECTOR_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - $(ProjectDir)\..\..\;$(ProjectDir)\..\src;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories) - precompiled.h - MultiThreaded - true - - - Windows - true - true - true - %(AdditionalDependencies) - - - echo Empty Action - Force build to run Pre-Build event - build.always.run - build.always.run - - - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") - - - Automatic deployment script - - @@ -184,7 +131,6 @@ Create Create - Create diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt new file mode 100644 index 0000000..3365aee --- /dev/null +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -0,0 +1,126 @@ +cmake_minimum_required(VERSION 3.1) +project(proxy CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + -fpermissive\ + -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ + -Wno-write-strings -Wno-strict-aliasing") + + if (USE_CLANG_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") + endif() +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../" + "${PROJECT_SOURCE_DIR}/../Director/src" +) + +set(PROJECT_BZIP2_DIR + "${PROJECT_SOURCE_DIR}/../../../dep/bzip2/include" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../.." + "${PROJECT_SOURCE_DIR}/../../engine" + "${PROJECT_SOURCE_DIR}/../../common" + "${PROJECT_SOURCE_DIR}/../../pm_shared" + "${PROJECT_SOURCE_DIR}/../../public" + "${PROJECT_SOURCE_DIR}/../../public/rehlds" +) + +set(PROXY_SRCS + "src/Proxy.cpp" + "src/Status.cpp" + "src/Master.cpp" + "src/ProxyClient.cpp" + "src/DemoClient.cpp" + "src/FakeClient.cpp" + "src/public_amalgamation.cpp" + "../Director/src/Director.cpp" +) + +set(COMMON_SRCS + "../../common/BaseSystemModule.cpp" + "../../common/ObjectDictionary.cpp" + "../../common/ObjectList.cpp" + "../../common/TokenLine.cpp" + "../../HLTV/common/BaseClient.cpp" + "../../HLTV/common/BitBuffer.cpp" + "../../HLTV/common/byteorder.cpp" + "../../HLTV/common/common.cpp" + "../../HLTV/common/DemoFile.cpp" + "../../HLTV/common/DirectorCmd.cpp" + "../../HLTV/common/InfoString.cpp" + "../../HLTV/common/mathlib.cpp" + "../../HLTV/common/md5.cpp" + "../../HLTV/common/munge.cpp" + "../../HLTV/common/NetAddress.cpp" + "../../HLTV/common/NetChannel.cpp" + "../../HLTV/common/random.cpp" + "../../engine/mem.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_BZIP2_DIR} + ${PROJECT_PUBLIC_DIR} +) + +link_directories(${PROJECT_SOURCE_DIR}/../../lib/linux32) + +add_definitions( + -DHLTV + -DHLTV_FIXES + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_vsnprintf=vsnprintf + -D_snprintf=snprintf +) + +if (NOT TARGET bzip2) + add_subdirectory(../../../dep/bzip2 lib) +endif() + +add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS}) +target_link_libraries(proxy dl bzip2 steam_api) +set_target_properties(proxy PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) diff --git a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj index a5324d2..44bb4d8 100644 --- a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj +++ b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -20,264 +16,195 @@ - - - - - - - - true true - true true true - true Use - Use Use - - Use - Use Use - - - - - - Use - Use Use - - Use - Use Use - - Use - Use Use - - Use - Use Use - - Use - Use Use - - Use - Use Use - - Use - Use Use - - Use - Use Use - - - - - - Use - Use Use - - Use - Use Use - - - - Create Create - Create Use - Use Use - - Use - Use Use - - Use - Use Use - - Use - Use Use - - @@ -289,7 +216,6 @@ true true - true @@ -344,16 +270,6 @@ true MultiByte - - DynamicLibrary - false - v120_xp - v140_xp - v141_xp - v142 - true - MultiByte - @@ -365,9 +281,6 @@ - - - true @@ -377,10 +290,6 @@ false proxy - - false - proxy - Use @@ -456,49 +365,6 @@ Automatic deployment script - - - Level3 - Use - MaxSpeed - true - true - HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;PROXY_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - $(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\Director\src;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;$(ProjectDir)\..\..\..\..\dep\bzip2\include;%(AdditionalIncludeDirectories) - precompiled.h - MultiThreaded - true - false - - - Windows - true - true - true - psapi.lib;ws2_32.lib;steam_api.lib;%(AdditionalDependencies) - $(ProjectDir)../../../lib - - - - - - - - - - - echo Empty Action - Force build to run Pre-Build event - build.always.run - build.always.run - - - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") - - - Automatic deployment script - - diff --git a/rehlds/HLTV/Proxy/src/Proxy.cpp b/rehlds/HLTV/Proxy/src/Proxy.cpp index ce850e9..c4d4aa6 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.cpp +++ b/rehlds/HLTV/Proxy/src/Proxy.cpp @@ -210,7 +210,13 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name) Q_memset(m_LastRconCommand, 0, sizeof(m_LastRconCommand)); Q_memset(m_OffLineText, 0, sizeof(m_OffLineText)); Q_memset(m_SignonCommands, 0, sizeof(m_SignonCommands)); - Q_memset(m_Challenges, 0, sizeof(m_Challenges)); + + for (int i = 0; i < MAX_CHALLENGES; i++) + { + m_Challenges[i].adr.Clear(); + m_Challenges[i].challenge = 0; + m_Challenges[i].time = 0.0f; + } m_LoopCommands.Init(); m_BannList.Init(); @@ -836,10 +842,10 @@ void Proxy::Broadcast(byte *data, int length, int groupType, bool isReliable) while (client) { if (client->IsActive() - && ((groupType & GROUP_CLIENT) && client->GetClientType() == TYPE_CLIENT) - || ((groupType & GROUP_PROXY) && client->GetClientType() == TYPE_PROXY) - || ((groupType & GROUP_VOICE) && client->IsHearingVoices()) - || ((groupType & GROUP_CHAT) && client->HasChatEnabled())) + && (((groupType & GROUP_CLIENT) && client->GetClientType() == TYPE_CLIENT) + || ((groupType & GROUP_PROXY) && client->GetClientType() == TYPE_PROXY) + || ((groupType & GROUP_VOICE) && client->IsHearingVoices()) + || ((groupType & GROUP_CHAT) && client->HasChatEnabled()))) { client->Send(data, length, isReliable); } @@ -966,7 +972,7 @@ void Proxy::CMD_Name(char *cmdLine) } char name[MAX_NAME]; - int len = Q_strlen(params.GetToken(1)); + unsigned int len = Q_strlen(params.GetToken(1)); if (len > sizeof(name) - 1) { m_System->Printf("Invalid name length.\n"); return; diff --git a/rehlds/HLTV/common/BitBuffer.cpp b/rehlds/HLTV/common/BitBuffer.cpp index f730896..89bf0fc 100644 --- a/rehlds/HLTV/common/BitBuffer.cpp +++ b/rehlds/HLTV/common/BitBuffer.cpp @@ -67,15 +67,15 @@ const uint32 INVBITTABLE[] = 0xFFFFFFFF, }; -BitBuffer::BitBuffer() : m_Data(nullptr), +BitBuffer::BitBuffer() : + m_Overflowed(false), + m_Data(nullptr), m_CurByte(nullptr), m_CurBit(0), m_MaxSize(0), - m_Overflowed(false), m_LittleEndian(false), m_OwnData(false) { - ; } BitBuffer::BitBuffer(void *newData, unsigned int size) @@ -345,7 +345,8 @@ void BitBuffer::WriteBuf(BitBuffer *buf, int length) char *BitBuffer::ReadString() { - int c = 0, l = 0; + int c = 0; + unsigned int l = 0; static char string[8192]; while ((c = ReadChar(), c) && c != -1 && l < sizeof(string) - 1) { @@ -358,7 +359,8 @@ char *BitBuffer::ReadString() char *BitBuffer::ReadStringLine() { - int c = 0, l = 0; + int c = 0; + unsigned int l = 0; static char string[2048]; while ((c = ReadChar(), c) && c != '\n' && c != -1 && l < sizeof(string) - 1) { diff --git a/rehlds/HLTV/common/DemoFile.cpp b/rehlds/HLTV/common/DemoFile.cpp index f3ddbee..d955248 100644 --- a/rehlds/HLTV/common/DemoFile.cpp +++ b/rehlds/HLTV/common/DemoFile.cpp @@ -29,10 +29,10 @@ #include "precompiled.h" DemoFile::DemoFile() : - m_FileSystem(nullptr), m_FileHandle(FILESYSTEM_INVALID_HANDLE), m_DemoChannel(nullptr), - m_Entries(nullptr) + m_Entries(nullptr), + m_FileSystem(nullptr) { Reset(); } @@ -545,6 +545,8 @@ void DemoFile::ReadDemoPacket(BitBuffer *demoData, demo_info_t *demoInfo) case DemoCmd::PayLoad: demoData->WriteLong(msglen); break; + default: + break; } demoData->WriteBuf(msgbuf, msglen); diff --git a/rehlds/HLTV/common/InfoString.cpp b/rehlds/HLTV/common/InfoString.cpp index 070206e..9e0bc03 100644 --- a/rehlds/HLTV/common/InfoString.cpp +++ b/rehlds/HLTV/common/InfoString.cpp @@ -28,8 +28,9 @@ #include "precompiled.h" -InfoString::InfoString(char *string, unsigned int maxSize) - : m_String(nullptr), m_MaxSize(0) +InfoString::InfoString(char *string, unsigned int maxSize) : + m_MaxSize(0), + m_String(nullptr) { unsigned int len = Q_strlen(string) + 1; if (len < maxSize) { @@ -40,19 +41,22 @@ InfoString::InfoString(char *string, unsigned int maxSize) SetString(string); } -InfoString::InfoString() - : m_String(nullptr), m_MaxSize(0) +InfoString::InfoString() : + m_MaxSize(0), + m_String(nullptr) { } -InfoString::InfoString(unsigned int maxSize) - : m_String(nullptr), m_MaxSize(0) +InfoString::InfoString(unsigned int maxSize) : + m_MaxSize(0), + m_String(nullptr) { SetMaxSize(maxSize); } -InfoString::InfoString(char *string) - : m_String(nullptr), m_MaxSize(0) +InfoString::InfoString(char *string) : + m_MaxSize(0), + m_String(nullptr) { unsigned int len = Q_strlen(string) + 1; if (len < MAX_INFO_LEN) { diff --git a/rehlds/HLTV/common/NetAddress.cpp b/rehlds/HLTV/common/NetAddress.cpp index 2ee99c0..089af9d 100644 --- a/rehlds/HLTV/common/NetAddress.cpp +++ b/rehlds/HLTV/common/NetAddress.cpp @@ -28,9 +28,11 @@ #include "precompiled.h" -NetAddress::NetAddress() : - m_Port(0), m_IP(), m_String() +NetAddress::NetAddress() { + m_Port = 0; + Q_memset(m_IP, 0, sizeof(m_IP)); + Q_memset(m_String, 0, sizeof(m_String)); } void NetAddress::SetPort(int16 port) diff --git a/rehlds/HLTV/common/common.cpp b/rehlds/HLTV/common/common.cpp index 84916cf..0da0ef4 100644 --- a/rehlds/HLTV/common/common.cpp +++ b/rehlds/HLTV/common/common.cpp @@ -220,7 +220,7 @@ char *COM_FileExtension(char *in) #else // #ifdef HLTV_FIXES static char exten[MAX_PATH]; char *c, *d = nullptr; - int i; + unsigned int i; // Search for the first dot after the last path separator c = in; @@ -537,7 +537,7 @@ void NORETURN HLTV_SysError(const char *fmt, ...) fprintf(fl, "%s\n", string); fclose(fl); - int *null = 0; + volatile int *null = 0; *null = 0; exit(-1); } diff --git a/rehlds/common/IBaseSystem.h b/rehlds/common/IBaseSystem.h index 9f50fe3..9b0f687 100644 --- a/rehlds/common/IBaseSystem.h +++ b/rehlds/common/IBaseSystem.h @@ -74,7 +74,7 @@ public: virtual bool RegisterCommand(char *name, ISystemModule *module, int commandID) = 0; virtual void GetCommandMatches(char *string, ObjectList *pMatchList) = 0; - virtual void ExecuteString(char *commands) = 0; + virtual void ExecuteString(const char *commands) = 0; virtual void ExecuteFile(char *filename) = 0; virtual void Errorf(char *fmt, ...) = 0; diff --git a/rehlds/common/TextConsoleUnix.cpp b/rehlds/common/TextConsoleUnix.cpp index 32671ae..90af60c 100644 --- a/rehlds/common/TextConsoleUnix.cpp +++ b/rehlds/common/TextConsoleUnix.cpp @@ -133,7 +133,7 @@ int CTextConsoleUnix::kbhit() return select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv) != -1 && FD_ISSET(STDIN_FILENO, &rfds); } -char *CTextConsoleUnix::GetLine() +const char *CTextConsoleUnix::GetLine() { // early return for 99.999% case :) if (!kbhit()) @@ -273,7 +273,7 @@ char *CTextConsoleUnix::GetLine() return NULL; } -void CTextConsoleUnix::PrintRaw(char *pszMsg, int nChars) +void CTextConsoleUnix::PrintRaw(const char *pszMsg, int nChars) { if (nChars == 0) { @@ -288,7 +288,7 @@ void CTextConsoleUnix::PrintRaw(char *pszMsg, int nChars) } } -void CTextConsoleUnix::Echo(char *pszMsg, int nChars) +void CTextConsoleUnix::Echo(const char *pszMsg, int nChars) { if (nChars == 0) { diff --git a/rehlds/common/TextConsoleUnix.h b/rehlds/common/TextConsoleUnix.h index b40cbc4..bc14575 100644 --- a/rehlds/common/TextConsoleUnix.h +++ b/rehlds/common/TextConsoleUnix.h @@ -44,9 +44,9 @@ public: bool Init(IBaseSystem *system = nullptr); void ShutDown(); - void PrintRaw(char *pszMsg, int nChars = 0); - void Echo(char *pszMsg, int nChars = 0); - char *GetLine(); + void PrintRaw(const char *pszMsg, int nChars = 0); + void Echo(const char *pszMsg, int nChars = 0); + const char *GetLine(); int GetWidth(); private: diff --git a/rehlds/common/TextConsoleWin32.cpp b/rehlds/common/TextConsoleWin32.cpp index aeaefb3..1ac38f3 100644 --- a/rehlds/common/TextConsoleWin32.cpp +++ b/rehlds/common/TextConsoleWin32.cpp @@ -111,7 +111,7 @@ void CTextConsoleWin32::SetVisible(bool visible) m_ConsoleVisible = visible; } -char *CTextConsoleWin32::GetLine() +const char *CTextConsoleWin32::GetLine() { while (true) { @@ -203,7 +203,7 @@ char *CTextConsoleWin32::GetLine() return nullptr; } -void CTextConsoleWin32::PrintRaw(char *pszMsg, int nChars) +void CTextConsoleWin32::PrintRaw(const char *pszMsg, int nChars) { #ifdef LAUNCHER_FIXES char outputStr[2048]; @@ -225,7 +225,7 @@ void CTextConsoleWin32::PrintRaw(char *pszMsg, int nChars) #endif } -void CTextConsoleWin32::Echo(char *pszMsg, int nChars) +void CTextConsoleWin32::Echo(const char *pszMsg, int nChars) { PrintRaw(pszMsg, nChars); } @@ -245,7 +245,7 @@ int CTextConsoleWin32::GetWidth() return nWidth; } -void CTextConsoleWin32::SetStatusLine(char *pszStatus) +void CTextConsoleWin32::SetStatusLine(const char *pszStatus) { Q_strncpy(statusline, pszStatus, sizeof(statusline) - 1); statusline[sizeof(statusline) - 2] = '\0'; @@ -269,7 +269,7 @@ void CTextConsoleWin32::UpdateStatus() WriteConsoleOutputCharacter(houtput, statusline, 80, coord, &dwWritten); } -void CTextConsoleWin32::SetTitle(char *pszTitle) +void CTextConsoleWin32::SetTitle(const char *pszTitle) { SetConsoleTitle(pszTitle); } diff --git a/rehlds/common/TextConsoleWin32.h b/rehlds/common/TextConsoleWin32.h index 656110e..70ba857 100644 --- a/rehlds/common/TextConsoleWin32.h +++ b/rehlds/common/TextConsoleWin32.h @@ -39,13 +39,13 @@ public: bool Init(IBaseSystem *system = nullptr); void ShutDown(); - void SetTitle(char *pszTitle); - void SetStatusLine(char *pszStatus); + void SetTitle(const char *pszTitle); + void SetStatusLine(const char *pszStatus); void UpdateStatus(); - void PrintRaw(char * pszMsz, int nChars = 0); - void Echo(char * pszMsz, int nChars = 0); - char *GetLine(); + void PrintRaw(const char *pszMsz, int nChars = 0); + void Echo(const char *pszMsz, int nChars = 0); + const char *GetLine(); int GetWidth(); void SetVisible(bool visible); diff --git a/rehlds/common/commandline.cpp b/rehlds/common/commandline.cpp index 9be292c..4fc4970 100644 --- a/rehlds/common/commandline.cpp +++ b/rehlds/common/commandline.cpp @@ -61,7 +61,6 @@ char *CopyString(const char *src) void CCommandLine::CreateCmdLine(int argc, const char *argv[]) { char cmdline[4096] = ""; - const int MAX_CHARS = sizeof(cmdline) - 1; for (int i = 0; i < argc; ++i) { @@ -88,7 +87,10 @@ void CCommandLine::LoadParametersFromFile(const char *&pSrc, char *&pDst, int ma // Suck out the file name char szFileName[ MAX_PATH ]; char *pOut; + +#if 0 char *pDestStart = pDst; +#endif // Skip the @ sign pSrc++; @@ -342,7 +344,7 @@ const char *CCommandLine::CheckParm(const char *psz, char **ppszValue) const sz[i] = p2[i]; i++; - } while (i < sizeof(sz)); + } while ((unsigned)i < sizeof(sz)); sz[i] = '\0'; *ppszValue = sz; diff --git a/rehlds/common/stdc++compat.cpp b/rehlds/common/stdc++compat.cpp index 6177fee..363e440 100644 --- a/rehlds/common/stdc++compat.cpp +++ b/rehlds/common/stdc++compat.cpp @@ -1,6 +1,6 @@ #include -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(BUILD_STATIC_LIBSTDC) // if build with static libstdc++ then ignore void NORETURN Sys_Error(const char *error, ...); // This file adds the necessary compatibility tricks to avoid symbols with diff --git a/rehlds/common/textconsole.cpp b/rehlds/common/textconsole.cpp index 45d13d7..b996eec 100644 --- a/rehlds/common/textconsole.cpp +++ b/rehlds/common/textconsole.cpp @@ -74,7 +74,7 @@ void CTextConsole::ShutDown() ; } -void CTextConsole::Print(char *pszMsg) +void CTextConsole::Print(const char *pszMsg) { if (m_nConsoleTextLen) { @@ -264,7 +264,7 @@ void CTextConsole::ReceiveStandardChar(const char ch) int nCount; // If the line buffer is maxed out, ignore this char - if (m_nConsoleTextLen >= (sizeof(m_szConsoleText) - 2)) + if ((unsigned)m_nConsoleTextLen >= (sizeof(m_szConsoleText) - 2)) { return; } diff --git a/rehlds/common/textconsole.h b/rehlds/common/textconsole.h index 9d1b67e..d9d673b 100644 --- a/rehlds/common/textconsole.h +++ b/rehlds/common/textconsole.h @@ -39,16 +39,16 @@ public: virtual bool Init(IBaseSystem *system = nullptr); virtual void ShutDown(); - virtual void Print(char *pszMsg); + virtual void Print(const char *pszMsg); - virtual void SetTitle(char *pszTitle) {} - virtual void SetStatusLine(char *pszStatus) {} + virtual void SetTitle(const char *pszTitle) {} + virtual void SetStatusLine(const char *pszStatus) {} virtual void UpdateStatus() {} // Must be provided by children - virtual void PrintRaw(char *pszMsg, int nChars = 0) = 0; - virtual void Echo(char *pszMsg, int nChars = 0) = 0; - virtual char *GetLine() = 0; + virtual void PrintRaw(const char *pszMsg, int nChars = 0) = 0; + virtual void Echo(const char *pszMsg, int nChars = 0) = 0; + virtual const char *GetLine() = 0; virtual int GetWidth() = 0; virtual void SetVisible(bool visible); @@ -92,4 +92,4 @@ protected: #include "TextConsoleUnix.h" #endif // defined(_WIN32) -void Sys_Printf(char *fmt, ...); +void Sys_Printf(const char *fmt, ...); diff --git a/rehlds/dedicated/CMakeLists.txt b/rehlds/dedicated/CMakeLists.txt new file mode 100644 index 0000000..0f53ac5 --- /dev/null +++ b/rehlds/dedicated/CMakeLists.txt @@ -0,0 +1,95 @@ +cmake_minimum_required(VERSION 3.1) +project(hlds CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") + + if (NOT DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + endif() +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + -fpermissive\ + -Wno-unused-result") +endif() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../" +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../engine" + "${PROJECT_SOURCE_DIR}/../common" + "${PROJECT_SOURCE_DIR}/../public" + "${PROJECT_SOURCE_DIR}/../public/rehlds" +) + +set(DEDICATED_SRCS + "src/dbg.cpp" + "src/dedicated_exports.cpp" + "src/public_amalgamation.cpp" + "src/sys_ded.cpp" + "src/sys_linux.cpp" + "src/vgui/vguihelpers.cpp" +) + +set(COMMON_SRCS + "../common/textconsole.cpp" + "../common/TextConsoleUnix.cpp" + "../common/SteamAppStartUp.cpp" + "../common/ObjectList.cpp" + "../common/commandline.cpp" + "../common/minidump.cpp" + "../engine/mem.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_PUBLIC_DIR} +) + +add_definitions( + -DLAUNCHER_FIXES + -D_CONSOLE + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_strdup=strdup + -D_vsnprintf=vsnprintf +) + +add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS}) +target_link_libraries(hlds dl) +set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) diff --git a/rehlds/dedicated/msvc/dedicated.vcxproj b/rehlds/dedicated/msvc/dedicated.vcxproj index 96c4544..a05bc81 100644 --- a/rehlds/dedicated/msvc/dedicated.vcxproj +++ b/rehlds/dedicated/msvc/dedicated.vcxproj @@ -5,10 +5,6 @@ Debug Win32 - - Release Swds - Win32 - Release Win32 @@ -40,16 +36,6 @@ true MultiByte - - Application - false - v120_xp - v140_xp - v141_xp - v142 - true - MultiByte - @@ -59,9 +45,6 @@ - - - true @@ -71,10 +54,6 @@ false hlds - - false - hlds - Use @@ -155,51 +134,6 @@ build.always.run - - - Level3 - Use - Full - true - true - WIN32;LAUNCHER_FIXES;NDEBUG;DEDICATED;_CRT_SECURE_NO_WARNINGS;USE_BREAKPAD_HANDLER;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - $(ProjectDir)..\src;$(ProjectDir)..\..\;$(ProjectDir)..\..\common;$(ProjectDir)..\..\engine;$(ProjectDir)..\..\public;$(ProjectDir)..\..\public\rehlds;%(AdditionalIncludeDirectories) - MultiThreaded - false - StreamingSIMDExtensions2 - - - AnySuitable - true - true - precompiled.h - - - Windows - true - true - true - ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - - - Setup version from Git revision - - - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") - - - Automatic deployment script - - - echo Empty Action - Force build to run Pre-Build event - build.always.run - build.always.run - - @@ -208,7 +142,6 @@ true true - true @@ -230,7 +163,6 @@ true true - true @@ -239,14 +171,12 @@ Create Create - Create true true - true diff --git a/rehlds/dedicated/src/dedicated_exports.cpp b/rehlds/dedicated/src/dedicated_exports.cpp index f248d9c..060e007 100644 --- a/rehlds/dedicated/src/dedicated_exports.cpp +++ b/rehlds/dedicated/src/dedicated_exports.cpp @@ -30,12 +30,12 @@ class CDedicatedExports: public IDedicatedExports { public: - EXT_FUNC void Sys_Printf(char *text); + EXT_FUNC void Sys_Printf(const char *text); }; EXPOSE_SINGLE_INTERFACE(CDedicatedExports, IDedicatedExports, VENGINE_DEDICATEDEXPORTS_API_VERSION); -void CDedicatedExports::Sys_Printf(char *text) +void CDedicatedExports::Sys_Printf(const char *text) { ::Sys_Printf_Safe(text); } diff --git a/rehlds/dedicated/src/isys.h b/rehlds/dedicated/src/isys.h index e973916..fc4a0fe 100644 --- a/rehlds/dedicated/src/isys.h +++ b/rehlds/dedicated/src/isys.h @@ -36,18 +36,18 @@ public: virtual bool GetExecutableName(char *out) = 0; virtual void ErrorMessage(int level, const char *msg) = 0; - virtual void WriteStatusText(char *szText) = 0; + virtual void WriteStatusText(const char *szText) = 0; virtual void UpdateStatus(int force) = 0; - virtual long LoadLibrary(char *lib) = 0; + virtual long LoadLibrary(const char *lib) = 0; virtual void FreeLibrary(long library) = 0; virtual bool CreateConsoleWindow(void) = 0; virtual void DestroyConsoleWindow(void) = 0; - virtual void ConsoleOutput(char *string) = 0; - virtual char *ConsoleInput(void) = 0; - virtual void Printf(char *fmt, ...) = 0; + virtual void ConsoleOutput(const char *string) = 0; + virtual const char *ConsoleInput(void) = 0; + virtual void Printf(const char *fmt, ...) = 0; }; extern ISys *sys; diff --git a/rehlds/dedicated/src/sys_ded.cpp b/rehlds/dedicated/src/sys_ded.cpp index df0cfea..eae9147 100644 --- a/rehlds/dedicated/src/sys_ded.cpp +++ b/rehlds/dedicated/src/sys_ded.cpp @@ -40,7 +40,7 @@ CSysModule *g_pFileSystemModule = nullptr; CreateInterfaceFn g_FilesystemFactoryFn; -void Sys_Printf_Safe(char *text) +void Sys_Printf_Safe(const char *text) { if (sys) { @@ -48,7 +48,7 @@ void Sys_Printf_Safe(char *text) } } -void Sys_Printf(char *fmt, ...) +void Sys_Printf(const char *fmt, ...) { // Dump text to debugging console. va_list argptr; @@ -76,7 +76,7 @@ void ProcessConsoleInput() if (!engineAPI) return; - char *inputLine = console.GetLine(); + const char *inputLine = console.GetLine(); if (inputLine) { char szBuf[256]; @@ -85,7 +85,7 @@ void ProcessConsoleInput() } } -char *UTIL_GetBaseDir() +const char *UTIL_GetBaseDir() { return "."; } diff --git a/rehlds/dedicated/src/sys_ded.h b/rehlds/dedicated/src/sys_ded.h index 17603e9..b0912f8 100644 --- a/rehlds/dedicated/src/sys_ded.h +++ b/rehlds/dedicated/src/sys_ded.h @@ -38,5 +38,5 @@ extern CreateInterfaceFn g_FilesystemFactoryFn; int RunEngine(); int StartServer(char* cmdline); -void Sys_Printf_Safe(char *text); -void Sys_Printf(char *fmt, ...); +void Sys_Printf_Safe(const char *text); +void Sys_Printf(const char *fmt, ...); diff --git a/rehlds/dedicated/src/sys_linux.cpp b/rehlds/dedicated/src/sys_linux.cpp index 5a0cf11..814eb18 100644 --- a/rehlds/dedicated/src/sys_linux.cpp +++ b/rehlds/dedicated/src/sys_linux.cpp @@ -37,18 +37,18 @@ public: bool GetExecutableName(char *out) override; NORETURN void ErrorMessage(int level, const char *msg) override; - void WriteStatusText(char *szText) override; + void WriteStatusText(const char *szText) override; void UpdateStatus(int force) override; - long LoadLibrary(char *lib) override; + long LoadLibrary(const char *lib) override; void FreeLibrary(long library) override; bool CreateConsoleWindow() override; void DestroyConsoleWindow() override; - void ConsoleOutput(char *string) override; - char *ConsoleInput() override; - void Printf(char *fmt, ...) override; + void ConsoleOutput(const char *string) override; + const char *ConsoleInput() override; + void Printf(const char *fmt, ...) override; }; CSys g_Sys; @@ -206,7 +206,7 @@ void CSys::ErrorMessage(int level, const char *msg) exit(-1); } -void CSys::WriteStatusText(char *szText) +void CSys::WriteStatusText(const char *szText) { } @@ -214,7 +214,7 @@ void CSys::UpdateStatus(int force) { } -long CSys::LoadLibrary(char *lib) +long CSys::LoadLibrary(const char *lib) { char cwd[1024]; char absolute_lib[1024]; @@ -258,18 +258,18 @@ void CSys::DestroyConsoleWindow() } // Print text to the dedicated console -void CSys::ConsoleOutput(char *string) +void CSys::ConsoleOutput(const char *string) { printf("%s", string); fflush(stdout); } -char *CSys::ConsoleInput() +const char *CSys::ConsoleInput() { return console.GetLine(); } -void CSys::Printf(char *fmt, ...) +void CSys::Printf(const char *fmt, ...) { // Dump text to debugging console. va_list argptr; diff --git a/rehlds/dedicated/src/sys_window.cpp b/rehlds/dedicated/src/sys_window.cpp index f8e614d..02661d7 100644 --- a/rehlds/dedicated/src/sys_window.cpp +++ b/rehlds/dedicated/src/sys_window.cpp @@ -37,18 +37,18 @@ public: bool GetExecutableName(char *out) override; void ErrorMessage(int level, const char *msg) override; - void WriteStatusText(char *szText) override; + void WriteStatusText(const char *szText) override; void UpdateStatus(int force) override; - long LoadLibrary(char *lib) override; + long LoadLibrary(const char *lib) override; void FreeLibrary(long library) override; bool CreateConsoleWindow() override; void DestroyConsoleWindow() override; - void ConsoleOutput(char *string) override; - char *ConsoleInput() override; - void Printf(char *fmt, ...) override; + void ConsoleOutput(const char *string) override; + const char *ConsoleInput() override; + void Printf(const char *fmt, ...) override; }; CSys g_Sys; @@ -93,7 +93,7 @@ void CSys::ErrorMessage(int level, const char *msg) PostQuitMessage(0); } -void CSys::WriteStatusText(char *szText) +void CSys::WriteStatusText(const char *szText) { SetConsoleTitle(szText); } @@ -125,7 +125,7 @@ void CSys::UpdateStatus(int force) console.UpdateStatus(); } -long CSys::LoadLibrary(char *lib) +long CSys::LoadLibrary(const char *lib) { void *hDll = ::LoadLibrary(lib); return (long)hDll; @@ -160,7 +160,7 @@ void CSys::DestroyConsoleWindow() DeinitConProc(); } -void CSys::ConsoleOutput(char *string) +void CSys::ConsoleOutput(const char *string) { if (g_bVGui) { @@ -172,12 +172,12 @@ void CSys::ConsoleOutput(char *string) } } -char *CSys::ConsoleInput() +const char *CSys::ConsoleInput() { return console.GetLine(); } -void CSys::Printf(char *fmt, ...) +void CSys::Printf(const char *fmt, ...) { // Dump text to debugging console. va_list argptr; diff --git a/rehlds/engine/SystemWrapper.cpp b/rehlds/engine/SystemWrapper.cpp index 83aa088..ba3ca9c 100644 --- a/rehlds/engine/SystemWrapper.cpp +++ b/rehlds/engine/SystemWrapper.cpp @@ -54,7 +54,7 @@ BOOL SystemWrapper_LoadModule(char *interfacename, char *library, char *instance return FALSE; } -void SystemWrapper_ExecuteString(char *command) +void SystemWrapper_ExecuteString(const char *command) { gSystemWrapper.ExecuteString(command); } @@ -234,7 +234,7 @@ void SystemWrapper::CMD_UnloadModule(char *cmdLine) SystemWrapper::library_t *SystemWrapper::GetLibrary(char *name) { - char fixedname[MAX_PATH]; + char fixedname[MAX_PATH-4]; // reserve for extension so/dll Q_strlcpy(fixedname, name); COM_FixSlashes(fixedname); @@ -550,49 +550,56 @@ bool SystemWrapper::RemoveModule(ISystemModule *module) return false; } -void SystemWrapper::ExecuteString(char *commands) +void SystemWrapper::ExecuteString(const char *commands) { if (!commands || !commands[0]) return; - int size = 0; - char singleCmd[256] = ""; - bool quotes = false; - char *p = singleCmd; - char *c = commands; + // Remove format characters to block format string attacks + COM_RemoveEvilChars(const_cast(commands)); - COM_RemoveEvilChars(c); - while (true) + bool bInQuote = false; + + char *pszDest; + char singleCmd[256] = {0}; + + const char *pszSource = commands; + while (*pszSource) { - *p = *c; + // Parse out single commands and execute them + pszDest = singleCmd; - if (++size >= sizeof(singleCmd)) + unsigned int i; + for (i = 0; i < ARRAYSIZE(singleCmd); i++) { - DPrintf("WARNING! System::ExecuteString: Command token too long.\n"); - break; + char c = *pszSource++; + + *pszDest++ = c; + + if (c == '"') + { + bInQuote = !bInQuote; + } + else if (c == ';' && !bInQuote) + { + // End of command and not in a quoted string + break; + } } - if (*c == '"') - quotes = !quotes; - - if ((*c != ';' || quotes) && *c) + if (i >= ARRAYSIZE(singleCmd)) { - ++p; - } - else - { - *p = '\0'; - - char *cmd = singleCmd; - while (*cmd == ' ') { cmd++; } - - DispatchCommand(cmd); - p = singleCmd; - size = 0; + Printf("WARNING! System::ExecuteString: Command token too long.\n"); + return; } - if (!*c++) - break; + *pszDest = '\0'; + + char *pszCmd = singleCmd; + while (*pszCmd == ' ') + pszCmd++; // skip leading whitespaces + + DispatchCommand(pszCmd); } } @@ -699,7 +706,7 @@ void EngineWrapper::DemoUpdateClientData(client_data_t *cdat) void EngineWrapper::CL_QueueEvent(int flags, int index, float delay, event_args_t *pargs) { #ifndef SWDS - CL_QueueEvent(flags, index, delay, pargs); + ::CL_QueueEvent(flags, index, delay, pargs); #endif // SWDS } @@ -713,14 +720,14 @@ void EngineWrapper::HudWeaponAnim(int iAnim, int body) void EngineWrapper::CL_DemoPlaySound(int channel, char *sample, float attenuation, float volume, int flags, int pitch) { #ifndef SWDS - CL_DemoPlaySound(channel, sample, attenuation, volume, flags, pitch); + ::CL_DemoPlaySound(channel, sample, attenuation, volume, flags, pitch); #endif // SWDS } void EngineWrapper::ClientDLL_ReadDemoBuffer(int size, unsigned char *buffer) { #ifndef SWDS - ClientDLL_ReadDemoBuffer(); + ::ClientDLL_ReadDemoBuffer(); #endif // SWDS } @@ -741,7 +748,7 @@ char *EngineWrapper::GetStatusLine() void EngineWrapper::Cbuf_AddText(char *text) { - Cbuf_AddText(text); + ::Cbuf_AddText(text); } #ifdef REHLDS_FIXES diff --git a/rehlds/engine/SystemWrapper.h b/rehlds/engine/SystemWrapper.h index 9cbcb7c..fd5c5fc 100644 --- a/rehlds/engine/SystemWrapper.h +++ b/rehlds/engine/SystemWrapper.h @@ -93,7 +93,7 @@ public: EXT_FUNC Panel *GetPanel(); EXT_FUNC bool RegisterCommand(char *name, ISystemModule *module, int commandID); EXT_FUNC void GetCommandMatches(char *string, ObjectList *pMatchList); - EXT_FUNC void ExecuteString(char *commands); + EXT_FUNC void ExecuteString(const char *commands); EXT_FUNC void ExecuteFile(char *filename); EXT_FUNC void Errorf(char *fmt, ...); EXT_FUNC char *CheckParam(char *param); @@ -146,7 +146,7 @@ void SystemWrapper_Init(); void SystemWrapper_ShutDown(); void SystemWrapper_RunFrame(double time); BOOL SystemWrapper_LoadModule(char *interfacename, char *library, char *instancename = nullptr); -void SystemWrapper_ExecuteString(char *command); +void SystemWrapper_ExecuteString(const char *command); void SystemWrapper_CommandForwarder(); int COM_BuildNumber(); diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index 4384158..b9d1210 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -2393,7 +2393,7 @@ void EXT_FUNC COM_GetGameDir(char *szGameDir) { if (szGameDir) { - Q_snprintf(szGameDir, MAX_PATH - 1 , "%s", com_gamedir); + Q_snprintf(szGameDir, MAX_PATH, "%s", com_gamedir); } } diff --git a/rehlds/engine/cvar.cpp b/rehlds/engine/cvar.cpp index 37d18ed..9285fa2 100644 --- a/rehlds/engine/cvar.cpp +++ b/rehlds/engine/cvar.cpp @@ -430,11 +430,9 @@ NOXREF void Cvar_RemoveHudCvars(void) const char *Cvar_IsMultipleTokens(const char *varname) { static char firstToken[516]; - int tokens; char *name; firstToken[0] = 0; - tokens = 0; name = (char *)varname; name = COM_Parse(name); diff --git a/rehlds/engine/decals.cpp b/rehlds/engine/decals.cpp index ff382ea..975d7f9 100644 --- a/rehlds/engine/decals.cpp +++ b/rehlds/engine/decals.cpp @@ -538,15 +538,17 @@ void Decal_Init(void) for (i = 0; i < ARRAYSIZE(pszPathID); i++) { hfile = FS_OpenPathID("decals.wad", "rb", pszPathID[i]); -#ifdef REHLDS_FIXES + if (!hfile) + { +#ifdef REHLDS_FIXES if (found || i < ARRAYSIZE(pszPathID) - 1) continue; - else #else - if (i == 0 && !hfile) + if (i == 0) #endif - Sys_Error("%s: Couldn't find '%s' in \"%s\" search path\n", __func__, "decals.wad", pszPathID[i]); + Sys_Error("%s: Couldn't find '%s' in \"%s\" search path\n", __func__, "decals.wad", pszPathID[i]); + } #ifdef REHLDS_FIXES found = true; diff --git a/rehlds/engine/delta.cpp b/rehlds/engine/delta.cpp index 6f81baf..5a63b08 100644 --- a/rehlds/engine/delta.cpp +++ b/rehlds/engine/delta.cpp @@ -82,13 +82,13 @@ static delta_definition_t g_DeltaDataDefinition[] = static delta_description_t g_MetaDescription[] = { - { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, 0, 0 }, - { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, 0, 0 }, - { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 }, - { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 }, + { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} }, + { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} }, + { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, + { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, }; delta_t g_MetaDelta[] = @@ -463,7 +463,7 @@ int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) case DT_STRING: st1 = (char*)&from[pTest->fieldOffset]; st2 = (char*)&to[pTest->fieldOffset]; - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) // Not sure why it is case insensitive, but it looks so + if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) // Not sure why it is case insensitive, but it looks so { #ifndef REHLDS_FIXES pTest->flags |= FDT_MARK; @@ -558,7 +558,7 @@ void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFiel case DT_STRING: st1 = (char*)&from[pTest->fieldOffset]; st2 = (char*)&to[pTest->fieldOffset]; - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) // Not sure why it is case insensitive, but it looks so + if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) // Not sure why it is case insensitive, but it looks so pTest->flags |= FDT_MARK; break; default: @@ -1239,7 +1239,7 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link Sys_Error("%s: Expecting fieldname\n", __func__); } - Q_strncpy(pField->delta->fieldName, com_token, 31); + Q_strlcpy(pField->delta->fieldName, com_token); pField->delta->fieldName[31] = 0; pField->delta->fieldOffset = DELTA_FindOffset(count, pdefinition, com_token); @@ -1454,8 +1454,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) } if (Q_stricmp(com_token, "none")) { - Q_strncpy(source, com_token, sizeof(source)-1); - source[sizeof(source)-1] = 0; + Q_strlcpy(source, com_token); // Parse custom encoder function name pstream = COM_Parse(pstream); @@ -1464,8 +1463,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) Sys_Error("%s: Expecting encoder\n", __func__); } - Q_strncpy(encoder, com_token, sizeof(encoder)-1); - encoder[sizeof(encoder)-1] = 0; + Q_strlcpy(encoder, com_token); } // Parse fields @@ -1496,7 +1494,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) if (encoder[0] != 0) { - Q_strncpy((*ppdesc)->conditionalencodename, encoder, sizeof((*ppdesc)->conditionalencodename) - 1); + Q_strlcpy((*ppdesc)->conditionalencodename, encoder); (*ppdesc)->conditionalencodename[sizeof((*ppdesc)->conditionalencodename) - 1] = 0; (*ppdesc)->conditionalencode = 0; } diff --git a/rehlds/engine/filesystem.cpp b/rehlds/engine/filesystem.cpp index 7d01f81..12c4a5a 100644 --- a/rehlds/engine/filesystem.cpp +++ b/rehlds/engine/filesystem.cpp @@ -241,7 +241,7 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char if (bLanguage && pLanguage) { - char baseDir[4096]; + char baseDir[MAX_PATH]; char *tempPtr; Q_snprintf(szTemp, 511, "%s/%s_%s", GetBaseDirectory(), szFallback, pLanguage); @@ -283,7 +283,7 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char if (Q_stricmp(szFallback, "valve")) { - const int BufLen = 128; + const int BufLen = 256; char *szFileName = new char[BufLen]; Q_snprintf(szFileName, BufLen - 1, "Resource/%s_%%language%%.txt", szFallback); @@ -298,7 +298,7 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char int FileSystem_SetGameDirectory(const char *pDefaultDir, const char *pGameDir) { char temp[512]; - char language[256]; + char language[128]; const char *pchLang; g_pFileSystem->RemoveAllSearchPaths(); @@ -474,7 +474,7 @@ int FileSystem_AddFallbackGameDir(const char *pGameDir) return 1; } -int FileSystem_Init(char *basedir, void *voidfilesystemFactory) +int FileSystem_Init(const char *basedir, void *voidfilesystemFactory) { #ifdef REHLDS_CHECKS Q_strncpy(s_pBaseDir, basedir, ARRAYSIZE(s_pBaseDir)); diff --git a/rehlds/engine/filesystem_.h b/rehlds/engine/filesystem_.h index 198cf5b..f171400 100644 --- a/rehlds/engine/filesystem_.h +++ b/rehlds/engine/filesystem_.h @@ -52,5 +52,5 @@ int Host_GetVideoLevel(void); void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char *pLanguage, bool bLowViolenceBuild_); int FileSystem_SetGameDirectory(const char *pDefaultDir, const char *pGameDir); int FileSystem_AddFallbackGameDir(const char *pGameDir); -int FileSystem_Init(char *basedir, void *voidfilesystemFactory); +int FileSystem_Init(const char *basedir, void *voidfilesystemFactory); void FileSystem_Shutdown(void); diff --git a/rehlds/engine/host.cpp b/rehlds/engine/host.cpp index e6e2bf9..f30cfad 100644 --- a/rehlds/engine/host.cpp +++ b/rehlds/engine/host.cpp @@ -1041,7 +1041,7 @@ void Host_Version(void) gpszVersionString[sizeof(gpszVersionString) - 1] = 0; if (COM_CheckParm("-steam")) { - char szSteamVersionId[32]; + char szSteamVersionId[16]; FS_GetInterfaceVersion(szSteamVersionId, sizeof(szSteamVersionId) - 1); Q_snprintf(gpszVersionString, sizeof(gpszVersionString), "%s/%s", &com_token[Q_strlen("PatchVersion=")], szSteamVersionId); gpszVersionString[sizeof(gpszVersionString) - 1] = 0; diff --git a/rehlds/engine/host_cmd.cpp b/rehlds/engine/host_cmd.cpp index 9cac571..d76815c 100644 --- a/rehlds/engine/host_cmd.cpp +++ b/rehlds/engine/host_cmd.cpp @@ -377,7 +377,7 @@ void Host_UpdateStats(void) fscanf(pFile, "%d %s %c %d %d %d %d %d %lu %lu \t\t\t%lu %lu %lu %ld %ld %ld %ld %ld %ld %lu \t\t\t%lu %ld %lu %lu %lu %lu %lu %lu %lu %lu \t\t\t%lu %lu %lu %lu %lu %lu", &dummy, statFile, - &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, + (char *)&dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &ctime, &stime, &dummy, &dummy, &dummy, &dummy, &dummy, @@ -423,7 +423,12 @@ void GetStatsString(char *buf, int bufSize) for (int i = 0; i < g_psvs.maxclients; i++) { host_client = &g_psvs.clients[i]; - if (!host_client->active && !host_client->connected && !host_client->spawned || host_client->fakeclient) + + // Fake clients are ignored + if (host_client->fakeclient) + continue; + + if (!host_client->active && !host_client->connected && !host_client->spawned) continue; players++; diff --git a/rehlds/engine/iengine.h b/rehlds/engine/iengine.h index 10b30f4..eaa5243 100644 --- a/rehlds/engine/iengine.h +++ b/rehlds/engine/iengine.h @@ -42,7 +42,7 @@ public: virtual ~IEngine() {} - virtual bool Load(bool dedicated, char *basedir, char *cmdline) = 0; + virtual bool Load(bool dedicated, const char *basedir, const char *cmdline) = 0; virtual void Unload() = 0; virtual void SetState(int iState) = 0; virtual int GetState() = 0; diff --git a/rehlds/engine/mathlib_sse.cpp b/rehlds/engine/mathlib_sse.cpp index e99d85a..9342d01 100644 --- a/rehlds/engine/mathlib_sse.cpp +++ b/rehlds/engine/mathlib_sse.cpp @@ -48,10 +48,10 @@ const avec4_t deg2rad = const aivec4_t negmask[4] = { - 0x80000000, - 0x80000000, - 0x80000000, - 0x80000000 + {0x80000000}, + {0x80000000}, + {0x80000000}, + {0x80000000} }; const aivec4_t negmask_1001 = diff --git a/rehlds/engine/model.cpp b/rehlds/engine/model.cpp index 11b3214..4c29ecc 100644 --- a/rehlds/engine/model.cpp +++ b/rehlds/engine/model.cpp @@ -152,7 +152,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name) if (mod->needload == NL_UNREFERENCED) { - if (!avail || mod->type != mod_alias && mod->type != mod_studio) + if (!avail || (mod->type != mod_alias && mod->type != mod_studio)) avail = mod; } } @@ -1329,7 +1329,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer) if (i < mod->numsubmodels - 1) { - char name[10]; + char name[12]; Q_snprintf(name, ARRAYSIZE(name), "*%i", i + 1); loadmodel = Mod_FindName(0, name); diff --git a/rehlds/engine/net_chan.cpp b/rehlds/engine/net_chan.cpp index 957676a..88c5bae 100644 --- a/rehlds/engine/net_chan.cpp +++ b/rehlds/engine/net_chan.cpp @@ -412,7 +412,7 @@ void Netchan_Transmit(netchan_t *chan, int length, byte *data) // If it's not in-memory, then we'll need to copy it in frame the file handle. if (pbuf->isfile && !pbuf->isbuffer) { - char compressedfilename[MAX_PATH]; + char compressedfilename[MAX_PATH+5]; // room for extension string FileHandle_t hfile; if (pbuf->iscompressed) { diff --git a/rehlds/engine/net_ws.cpp b/rehlds/engine/net_ws.cpp index 76da8d5..219b73a 100644 --- a/rehlds/engine/net_ws.cpp +++ b/rehlds/engine/net_ws.cpp @@ -873,7 +873,7 @@ qboolean NET_QueuePacket(netsrc_t sock) for (int protocol = 0; protocol < 1; protocol++) #endif // _WIN32 { - SOCKET net_socket; + SOCKET net_socket = INV_SOCK; if (protocol == 0) net_socket = ip_sockets[sock]; diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index be18e51..c56eaec 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -384,7 +384,7 @@ void EXT_FUNC TraceSphere(const float *v1, const float *v2, int fNoMonsters, flo void EXT_FUNC TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr) { - int oldMovetype, oldSolid; + int oldMovetype = MOVETYPE_NONE, oldSolid = SOLID_NOT; if (hullNumber < 0 || hullNumber > 3) hullNumber = 0; @@ -1280,7 +1280,10 @@ void EXT_FUNC EV_Playback(int flags, const edict_t *pInvoker, unsigned short eve continue; } - if (cl == host_client && (flags & FEV_NOTHOST) && cl->lw || (flags & FEV_HOSTONLY) && cl->edict != pInvoker) + if ((flags & FEV_NOTHOST) && cl->lw && cl == host_client) + continue; + + if ((flags & FEV_HOSTONLY) && cl->edict != pInvoker) continue; if (flags & FEV_RELIABLE) diff --git a/rehlds/engine/sv_log.cpp b/rehlds/engine/sv_log.cpp index 48e8c43..ccd0fb1 100644 --- a/rehlds/engine/sv_log.cpp +++ b/rehlds/engine/sv_log.cpp @@ -119,7 +119,7 @@ void Log_Open(void) time_t ltime; struct tm *today; char szFileBase[MAX_PATH]; - char szTestFile[MAX_PATH]; + char szTestFile[MAX_PATH+8]; // room for extra string int i; FileHandle_t fp; char *temp; diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 70ef0a2..a34d900 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -2059,7 +2059,9 @@ qboolean SV_CheckForDuplicateNames(char *userinfo, qboolean bIsReconnecting, int return changed; char newname[MAX_NAME]; - Q_snprintf(newname, sizeof(newname), "(%d)%-0.*s", ++dupc, 28, rawname); + const int maxLenDupName = MAX_NAME - (sizeof("(d)") - 1); + + Q_snprintf(newname, sizeof(newname), "(%d)%.*s", ++dupc, maxLenDupName - 1, rawname); #ifdef REHLDS_FIXES // Fix possibly incorrectly cut UTF8 chars @@ -5461,7 +5463,10 @@ void SV_PropagateCustomizations(void) // For each active player for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++) { - if (!pHost->active && !pHost->spawned || pHost->fakeclient) + if (pHost->fakeclient) + continue; + + if (!pHost->active && !pHost->spawned) continue; // Send each customization to current player @@ -6590,7 +6595,10 @@ void SV_BanId_f(void) for (int i = 0; i < g_psvs.maxclients; i++) { client_t *cl = &g_psvs.clients[i]; - if (!cl->active && !cl->connected && !cl->spawned || cl->fakeclient) + if (cl->fakeclient) + continue; + + if (!cl->active && !cl->connected && !cl->spawned) continue; if (!Q_stricmp(SV_GetClientIDString(cl), idstring)) @@ -6663,7 +6671,10 @@ void SV_BanId_f(void) for (int i = 0; i < g_psvs.maxclients; i++) { client_t *cl = &g_psvs.clients[i]; - if (!cl->active && !cl->connected && !cl->spawned || cl->fakeclient) + if (cl->fakeclient) + continue; + + if (!cl->active && !cl->connected && !cl->spawned) continue; if (SV_CompareUserID(&cl->network_userid, id)) @@ -7325,7 +7336,10 @@ void SV_KickPlayer(int nPlayerSlot, int nReason) Q_sprintf(rgchT, "%s was automatically disconnected\nfrom this secure server.\n", client->name); for (int i = 0; i < g_psvs.maxclients; i++) { - if (!g_psvs.clients[i].active && !g_psvs.clients[i].spawned || g_psvs.clients[i].fakeclient) + if (g_psvs.clients[i].fakeclient) + continue; + + if (!g_psvs.clients[i].active && !g_psvs.clients[i].spawned) continue; MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_centerprint); @@ -7522,7 +7536,7 @@ void SV_BeginFileDownload_f(void) { if (host_client->fully_connected || sv_send_resources.value == 0.0f || - sv_downloadurl.string != NULL && sv_downloadurl.string[0] != 0 && Q_strlen(sv_downloadurl.string) <= 128 && sv_allow_dlfile.value == 0.0f || + (sv_downloadurl.string != NULL && sv_downloadurl.string[0] != 0 && Q_strlen(sv_downloadurl.string) <= 128 && sv_allow_dlfile.value == 0.0f) || Netchan_CreateFileFragments(TRUE, &host_client->netchan, name) == 0) { SV_FailDownload(name); @@ -8166,17 +8180,17 @@ typedef struct GameToAppIDMapItem_s } GameToAppIDMapItem_t; GameToAppIDMapItem_t g_GameToAppIDMap[11] = { - 0x0A, "cstrike", - 0x14, "tfc", - 0x1E, "dod", - 0x28, "dmc", - 0x32, "gearbox", - 0x3C, "ricochet", - 0x46, "valve", - 0x50, "czero", - 0x64, "czeror", - 0x82, "bshift", - 0x96, "cstrike_beta", + { 0x0A, "cstrike" }, + { 0x14, "tfc" }, + { 0x1E, "dod" }, + { 0x28, "dmc" }, + { 0x32, "gearbox" }, + { 0x3C, "ricochet" }, + { 0x46, "valve" }, + { 0x50, "czero" }, + { 0x64, "czeror" }, + { 0x82, "bshift" }, + { 0x96, "cstrike_beta" }, }; int GetGameAppID(void) diff --git a/rehlds/engine/sv_phys.cpp b/rehlds/engine/sv_phys.cpp index 8f2be63..8fff595 100644 --- a/rehlds/engine/sv_phys.cpp +++ b/rehlds/engine/sv_phys.cpp @@ -1255,7 +1255,7 @@ void PF_WaterMove(edict_t *pSelf) if (!(flags & (FL_IMMUNE_WATER | FL_GODMODE))) { - if ((flags & FL_SWIM) && (waterlevel < drownlevel) || (waterlevel >= drownlevel)) + if (((flags & FL_SWIM) && waterlevel < drownlevel) || (waterlevel >= drownlevel)) { if (pSelf->v.air_finished < g_psv.time && pSelf->v.pain_finished < g_psv.time) { diff --git a/rehlds/engine/sv_upld.cpp b/rehlds/engine/sv_upld.cpp index 63a266e..e28a0e3 100644 --- a/rehlds/engine/sv_upld.cpp +++ b/rehlds/engine/sv_upld.cpp @@ -173,7 +173,10 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl // Send resource to all other active players for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++) { - if (!pHost->active && !pHost->spawned || pHost->fakeclient) + if (pHost->fakeclient) + continue; + + if (!pHost->active && !pHost->spawned) continue; if (pHost == pPlayer && bSkipPlayer) diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 93f7308..f859302 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -28,11 +28,6 @@ #include "precompiled.h" -typedef struct command_s -{ - char *command; -} command_t; - sv_adjusted_positions_t truepositions[MAX_CLIENTS]; qboolean g_balreadymoved; @@ -47,9 +42,9 @@ edict_t *sv_player; qboolean nofind; #if defined(SWDS) && defined(REHLDS_FIXES) -command_t clcommands[] = { "status", "name", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "setinfo", "sendents", "fullupdate", "setpause", "unpause", NULL }; +const char *clcommands[] = { "status", "name", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "setinfo", "sendents", "fullupdate", "setpause", "unpause", NULL }; #else -command_t clcommands[23] = { "status", "god", "notarget", "fly", "name", "noclip", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "nextdl", "setinfo", "showinfo", "sendents", "fullupdate", "setpause", "unpause", NULL }; +const char *clcommands[23] = { "status", "god", "notarget", "fly", "name", "noclip", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "nextdl", "setinfo", "showinfo", "sendents", "fullupdate", "setpause", "unpause", NULL }; #endif cvar_t sv_edgefriction = { "edgefriction", "2", FCVAR_SERVER, 0.0f, NULL }; @@ -560,7 +555,10 @@ void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs) if ((check->v.flags & FL_CLIENT) && check->v.health <= 0.0) continue; - if (check->v.mins[2] == 0.0 && check->v.maxs[2] == 1.0 || Length(check->v.size) == 0.0) + if (check->v.mins[2] == 0.0 && check->v.maxs[2] == 1.0) + continue; + + if (Length(check->v.size) == 0.0) continue; fmin = check->v.absmin; @@ -1031,11 +1029,11 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed) int SV_ValidateClientCommand(char *pszCommand) { - char *p; + const char *p; int i = 0; COM_Parse(pszCommand); - while ((p = clcommands[i].command) != NULL) + while ((p = clcommands[i]) != NULL) { if (!Q_stricmp(com_token, p)) { @@ -1742,7 +1740,7 @@ void SV_ParseCvarValue2(client_t *cl) Con_DPrintf("Cvar query response: name:%s, request ID %d, cvar:%s, value:%s\n", cl->name, requestID, cvarName, value); } -void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, int8 opcode) { +void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) { client_t* cl = client->GetClient(); if (opcode < clc_bad || opcode > clc_cvarvalue2) { diff --git a/rehlds/engine/sv_user.h b/rehlds/engine/sv_user.h index 8da3360..e5fa453 100644 --- a/rehlds/engine/sv_user.h +++ b/rehlds/engine/sv_user.h @@ -35,8 +35,6 @@ const int CMD_MAXBACKUP = 64; -typedef struct command_s command_t; - typedef struct sv_adjusted_positions_s { int active; @@ -59,7 +57,6 @@ typedef struct clc_func_s } clc_func_t; extern edict_t *sv_player; -extern command_t clcommands[23]; extern sv_adjusted_positions_t truepositions[MAX_CLIENTS]; extern qboolean g_balreadymoved; diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 86d2ae3..add30da 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -490,7 +490,7 @@ void NORETURN Sys_Error(const char *error, ...) #endif // SWDS //Allahu akbar! - int *null = 0; + volatile int *null = 0; *null = 0; exit(-1); } diff --git a/rehlds/engine/sys_dll2.cpp b/rehlds/engine/sys_dll2.cpp index 75aee66..3f2b09e 100644 --- a/rehlds/engine/sys_dll2.cpp +++ b/rehlds/engine/sys_dll2.cpp @@ -455,7 +455,7 @@ void Sys_ShowProgressTicks(char *specialProgressMsg) } } -int Sys_InitGame(char *lpOrgCmdLine, char *pBaseDir, void *pwnd, int bIsDedicated) +int Sys_InitGame(const char *lpOrgCmdLine, const char *pBaseDir, void *pwnd, int bIsDedicated) { host_initialized = FALSE; @@ -640,7 +640,7 @@ NOXREF int BuildMapCycleListHints(char **hints) } */ -bool CDedicatedServerAPI::Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) +bool CDedicatedServerAPI::Init(const char *basedir, const char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) { dedicated_ = (IDedicatedExports *)launcherFactory(VENGINE_DEDICATEDEXPORTS_API_VERSION, NULL); if (!dedicated_) diff --git a/rehlds/engine/sys_dll2.h b/rehlds/engine/sys_dll2.h index 74a247b..1c62ebc 100644 --- a/rehlds/engine/sys_dll2.h +++ b/rehlds/engine/sys_dll2.h @@ -58,7 +58,7 @@ private: char m_OrigCmd[1024]; public: - EXT_FUNC virtual bool Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory); + EXT_FUNC virtual bool Init(const char *basedir, const char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory); EXT_FUNC virtual int Shutdown(); EXT_FUNC virtual bool RunFrame(); EXT_FUNC virtual void AddConsoleText(char *text); @@ -93,7 +93,7 @@ NOXREF void Sys_ShutdownLauncherInterface(); void Sys_InitAuthentication(); NOXREF void Sys_ShutdownAuthentication(); void Sys_ShowProgressTicks(char *specialProgressMsg); -int Sys_InitGame(char *lpOrgCmdLine, char *pBaseDir, void *pwnd, int bIsDedicated); +int Sys_InitGame(const char *lpOrgCmdLine, const char *pBaseDir, void *pwnd, int bIsDedicated); void Sys_ShutdownGame(); void ClearIOStates(); diff --git a/rehlds/engine/sys_engine.cpp b/rehlds/engine/sys_engine.cpp index ed10b35..beef432 100644 --- a/rehlds/engine/sys_engine.cpp +++ b/rehlds/engine/sys_engine.cpp @@ -81,7 +81,7 @@ void ForceReloadProfile() } } -bool CEngine::Load(bool dedicated, char *basedir, char *cmdline) +bool CEngine::Load(bool dedicated, const char *basedir, const char *cmdline) { bool success = false; SetState(DLL_ACTIVE); diff --git a/rehlds/engine/sys_engine.h b/rehlds/engine/sys_engine.h index cedb535..805b89f 100644 --- a/rehlds/engine/sys_engine.h +++ b/rehlds/engine/sys_engine.h @@ -56,7 +56,7 @@ public: CEngine(); virtual ~CEngine(); - virtual bool Load(bool dedicated, char *rootDir, char *cmdLine); + virtual bool Load(bool dedicated, const char *rootDir, const char *cmdLine); virtual void Unload(); virtual void SetState(int iState); virtual int GetState(); diff --git a/rehlds/engine/tmessage.cpp b/rehlds/engine/tmessage.cpp index 2e518bc..5bc8a15 100644 --- a/rehlds/engine/tmessage.cpp +++ b/rehlds/engine/tmessage.cpp @@ -44,17 +44,19 @@ const char *gNetworkMessageNames[MAX_NETMESSAGE] = client_textmessage_t gNetworkTextMessage[MAX_NETMESSAGE] = { - 0, // effect - 255, 255, 255, 255, - 255, 255, 255, 255, - -1.0f, // x - -1.0f, // y - 0.0f, // fadein - 0.0f, // fadeout - 0.0f, // holdtime - 0.0f, // fxTime, - NETWORK_MESSAGE1,// pName message name. - gNetworkTextMessageBuffer[0] // pMessage + { + 0, // effect + 255, 255, 255, 255, + 255, 255, 255, 255, + -1.0f, // x + -1.0f, // y + 0.0f, // fadein + 0.0f, // fadeout + 0.0f, // holdtime + 0.0f, // fxTime, + NETWORK_MESSAGE1,// pName message name. + gNetworkTextMessageBuffer[0] // pMessage + } }; char* EXT_FUNC memfgets(unsigned char *pMemFile, int fileSize, int *pFilePos, char *pBuffer, int bufferSize) diff --git a/rehlds/engine/unicode_strtools.cpp b/rehlds/engine/unicode_strtools.cpp index 2bd19bd..818145b 100644 --- a/rehlds/engine/unicode_strtools.cpp +++ b/rehlds/engine/unicode_strtools.cpp @@ -565,22 +565,22 @@ int Q_UChar32ToUTF8(uchar32 uVal, char * pUTF8Out) { else if (uVal <= 0x7FF) { *pUTF8Out = (uVal >> 6) | 0xC0; - pUTF8Out[1] = uVal & 0x3F | 0x80; + pUTF8Out[1] = (uVal & 0x3F) | 0x80; return 2; } else if (uVal <= 0xFFFF) { - *pUTF8Out = (uVal >> 12) | 0xE0; - pUTF8Out[2] = uVal & 0x3F | 0x80; - pUTF8Out[1] = (uVal >> 6) & 0x3F | 0x80; + *pUTF8Out = ((uVal >> 12)) | 0xE0; + pUTF8Out[2] = (uVal & 0x3F) | 0x80; + pUTF8Out[1] = (((uVal >> 6)) & 0x3F) | 0x80; return 3; } else { - *pUTF8Out = (uVal >> 18) & 7 | 0xF0; - pUTF8Out[1] = (uVal >> 12) & 0x3F | 0x80; - pUTF8Out[3] = uVal & 0x3F | 0x80; - pUTF8Out[2] = (uVal >> 6) & 0x3F | 0x80; + *pUTF8Out = ((uVal >> 18) & 7) | 0xF0; + pUTF8Out[1] = ((uVal >> 12) & 0x3F) | 0x80; + pUTF8Out[3] = (uVal & 0x3F) | 0x80; + pUTF8Out[2] = ((uVal >> 6) & 0x3F) | 0x80; return 4; } } @@ -600,7 +600,7 @@ int __cdecl Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out) } else { - pUTF16Out[1] = uVal & 0x3FF | 0xDC00; + pUTF16Out[1] = (uVal & 0x3FF) | 0xDC00; pUTF16Out[0] = ((uVal - 0x10000) >> 10) | 0xD800; return 2; } diff --git a/rehlds/engine/vid_null.cpp b/rehlds/engine/vid_null.cpp index 500eba6..391f09a 100644 --- a/rehlds/engine/vid_null.cpp +++ b/rehlds/engine/vid_null.cpp @@ -71,7 +71,7 @@ void R_InitTextures() { for (int y = 0; y < texSize; y++, dest++) { - if (x < (texSize / 2) == y < (texSize / 2)) + if ((x < (texSize / 2)) == (y < (texSize / 2))) *dest = -1; else *dest = 0; diff --git a/rehlds/filesystem/CMakeLists.txt b/rehlds/filesystem/CMakeLists.txt new file mode 100644 index 0000000..cc26eee --- /dev/null +++ b/rehlds/filesystem/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.1) +project(rehlds CXX) + +add_subdirectory(FileSystem_Stdio) diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt new file mode 100644 index 0000000..9e22885 --- /dev/null +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -0,0 +1,93 @@ +cmake_minimum_required(VERSION 3.1) +project(filesystem_stdio CXX) + +option(DEBUG "Build with debug information." OFF) +option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) +option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(WRAP_FUNCS_LIST + "scandir" "opendir" "freopen" "fopen" "fopen64" "open" "open64" "creat" + "access" "stat" "lstat" "__xstat" "__lxstat" "__xstat64" "__lxstat64" + "chmod" "chown" "lchown" "unlink" "symlink" "link" "mknod" "mount" + "mkfifo" "rename" "utime" "utimes" "mkdir" "rmdir" +) + +if (USE_INTEL_COMPILER) + set(CMAKE_C_COMPILER "/opt/intel/bin/icc") + set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") +elseif (USE_CLANG_COMPILER) + set(CMAKE_C_COMPILER "/usr/bin/clang") + set(CMAKE_CXX_COMPILER "/usr/bin/clang++") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") + +if (DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") +endif() + +if (USE_INTEL_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") +else() + # Produce code optimized for the most common IA32/AMD64/EM64T processors. + # As new processors are deployed in the marketplace, the behavior of this option will change. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + -fpermissive\ + -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-variable -Wno-unused-function\ + -Wno-write-strings -Wno-sign-compare") + + if (NOT USE_CLANG_COMPILER) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess") + endif() +endif() + +foreach(f ${WRAP_FUNCS_LIST}) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-wrap,${f}") +endforeach() + +set(PROJECT_SRC_DIR + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/../.." +) + +set(PROJECT_PUBLIC_DIR + "${PROJECT_SOURCE_DIR}/../../common" + "${PROJECT_SOURCE_DIR}/../../public" + "${PROJECT_SOURCE_DIR}/../../public/rehlds" +) + +set(FILESYSTEM_STDIO_SRCS + "src/BaseFileSystem.cpp" + "src/filesystem_helpers.cpp" + "src/FileSystem_Stdio.cpp" + "src/linux_support.cpp" + "src/pathmatch.cpp" + "src/public_amalgamation.cpp" +) + +include_directories( + ${PROJECT_SRC_DIR} + ${PROJECT_PUBLIC_DIR} +) + +add_definitions( + -D_LINUX + -DLINUX + -D_GLIBCXX_USE_CXX11_ABI=0 + -D_strdup=strdup + -D_stricmp=strcasecmp + -D_strnicmp=strncasecmp + -D_vsnprintf=vsnprintf + -D_snprintf=snprintf + -D_unlink=unlink +) + +add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS}) +set_target_properties(filesystem_stdio PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +target_link_libraries(filesystem_stdio dl) diff --git a/rehlds/filesystem/FileSystem_Stdio/src/BaseFileSystem.cpp b/rehlds/filesystem/FileSystem_Stdio/src/BaseFileSystem.cpp index 7591428..85c04cb 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/BaseFileSystem.cpp +++ b/rehlds/filesystem/FileSystem_Stdio/src/BaseFileSystem.cpp @@ -1132,8 +1132,8 @@ bool IsWildCardMatch(const char *wildcardString, const char *stringToCheck) // we only want to advance the pointers if we successfully assigned // both of our char variables, so we'll do it here rather than in the // loop condition itself - *stringToCheck++; - *wildcardString++; + stringToCheck++; + wildcardString++; // if this isn't a case-sensitive match, make both chars uppercase wcChar = toupper(wcChar); @@ -1148,7 +1148,7 @@ bool IsWildCardMatch(const char *wildcardString, const char *stringToCheck) // until we've either found a match or the string has // ended if (starMatchesZero) - *stringToCheck--; + stringToCheck--; while (*stringToCheck) { @@ -1501,7 +1501,7 @@ void CBaseFileSystem::Warning(FileWarningLevel_t level, const char *fmt, ...) #ifdef _WIN32 OutputDebugString(warningtext); #else - fprintf(stderr, warningtext); + fprintf(stderr, "%s", warningtext); #endif } } @@ -1654,15 +1654,15 @@ bool CBaseFileSystem::CSearchPath::PackFileLessFunc(CPackFileEntry const &src1, } CBaseFileSystem::CSearchPath::CSearchPath() : - m_PackFiles(0, MAX_ENTRY_PATH, CSearchPath::PackFileLessFunc), m_Path(CUtlSymbol("")), m_bIsMapPath(false), m_bIsPackFile(false), - m_bAllowWrite(true), m_lPackFileTime(0), + m_hPackFile(nullptr), m_nNumPackFiles(0), m_iCurSearchFile(0), - m_hPackFile(nullptr) + m_bAllowWrite(true), + m_PackFiles(0, MAX_ENTRY_PATH, CSearchPath::PackFileLessFunc) { } diff --git a/rehlds/filesystem/FileSystem_Stdio/src/filesystem_helpers.cpp b/rehlds/filesystem/FileSystem_Stdio/src/filesystem_helpers.cpp index 097fd60..67aa18e 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/filesystem_helpers.cpp +++ b/rehlds/filesystem/FileSystem_Stdio/src/filesystem_helpers.cpp @@ -172,7 +172,7 @@ void NORETURN FileSystem_SysError(const char *fmt, ...) fprintf(fl, "%s\n", string); fclose(fl); - int *null = 0; + volatile int *null = 0; *null = 0; exit(-1); } diff --git a/rehlds/hookers/HLTV/Core/DeltaEx.cpp b/rehlds/hookers/HLTV/Core/DeltaEx.cpp index 4630e76..3c2c58c 100644 --- a/rehlds/hookers/HLTV/Core/DeltaEx.cpp +++ b/rehlds/hookers/HLTV/Core/DeltaEx.cpp @@ -63,13 +63,13 @@ delta_definition_t g_DeltaDataDefinition[] = delta_description_t g_MetaDescription[] = { - { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, 0, 0 }, - { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, 0, 0 }, - { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, 0, 0 }, - { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 }, - { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 } + { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} }, + { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} }, + { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} }, + { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, + { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} } }; namespace Delta { diff --git a/rehlds/public/engine_hlds_api.h b/rehlds/public/engine_hlds_api.h index 007237e..8ae9b01 100644 --- a/rehlds/public/engine_hlds_api.h +++ b/rehlds/public/engine_hlds_api.h @@ -39,7 +39,7 @@ class IDedicatedServerAPI : public IBaseInterface { public: - virtual bool Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) = 0; + virtual bool Init(const char *basedir, const char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) = 0; virtual int Shutdown() = 0; virtual bool RunFrame() = 0; virtual void AddConsoleText(char *text) = 0; diff --git a/rehlds/public/idedicatedexports.h b/rehlds/public/idedicatedexports.h index 2444e22..4e20b03 100644 --- a/rehlds/public/idedicatedexports.h +++ b/rehlds/public/idedicatedexports.h @@ -34,7 +34,7 @@ class IDedicatedExports : public IBaseInterface { public: virtual ~IDedicatedExports() {}; - virtual void Sys_Printf(char *text) = 0; + virtual void Sys_Printf(const char *text) = 0; }; #define VENGINE_DEDICATEDEXPORTS_API_VERSION "VENGINE_DEDICATEDEXPORTS_API_VERSION001" diff --git a/rehlds/public/interface.cpp b/rehlds/public/interface.cpp index d5a35ad..3394746 100644 --- a/rehlds/public/interface.cpp +++ b/rehlds/public/interface.cpp @@ -130,7 +130,7 @@ CSysModule *Sys_LoadModule(const char *pModuleName) HMODULE hDLL = LoadLibrary(pModuleName); #else HMODULE hDLL = nullptr; - char szAbsoluteModuleName[1024]; + char szAbsoluteModuleName[2048]; if (pModuleName[0] != '/') { char szCwd[1024]; @@ -150,7 +150,7 @@ CSysModule *Sys_LoadModule(const char *pModuleName) if (!hDLL) { - char str[512]; + char str[2048+6]; // room for extension string #if defined(_WIN32) _snprintf(str, sizeof(str), "%s.dll", pModuleName); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 9f4d51f..506d474 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -108,8 +108,8 @@ typedef IVoidHookChain IRehldsHook_ClientConnected; typedef IVoidHookChainRegistry IRehldsHookRegistry_ClientConnected; //HandleNetCommand -typedef IVoidHookChain IRehldsHook_HandleNetCommand; -typedef IVoidHookChainRegistry IRehldsHookRegistry_HandleNetCommand; +typedef IVoidHookChain IRehldsHook_HandleNetCommand; +typedef IVoidHookChainRegistry IRehldsHookRegistry_HandleNetCommand; //Mod_LoadBrushModel typedef IVoidHookChain IRehldsHook_Mod_LoadBrushModel; diff --git a/rehlds/public/tier0/characterset.cpp b/rehlds/public/tier0/characterset.cpp index 9088b64..e179e2e 100644 --- a/rehlds/public/tier0/characterset.cpp +++ b/rehlds/public/tier0/characterset.cpp @@ -44,7 +44,7 @@ void CharacterSetBuild(characterset_t *pSetBuffer, const char *pszSetString) while (pszSetString[i]) { - pSetBuffer->set[pszSetString[i]] = 1; + pSetBuffer->set[(unsigned)pszSetString[i]] = 1; i++; } } diff --git a/rehlds/public/tier0/dbg.cpp b/rehlds/public/tier0/dbg.cpp index df1c6ce..dfd73d8 100644 --- a/rehlds/public/tier0/dbg.cpp +++ b/rehlds/public/tier0/dbg.cpp @@ -140,7 +140,7 @@ SpewRetval_t _SpewMessage(SpewType_t spewType, char const* pMsgFormat, va_list /* Printf the file and line for warning + assert only... */ int len = 0; - if ((spewType == SPEW_ASSERT)) + if (spewType == SPEW_ASSERT) { len = sprintf(pTempBuffer, "%s (%d) : ", s_pFileName, s_Line); } @@ -149,7 +149,7 @@ SpewRetval_t _SpewMessage(SpewType_t spewType, char const* pMsgFormat, va_list len += vsprintf(&pTempBuffer[len], pMsgFormat, args); // Add \n for warning and assert - if ((spewType == SPEW_ASSERT)) + if (spewType == SPEW_ASSERT) { len += sprintf(&pTempBuffer[len], "\n"); } diff --git a/rehlds/public/utlbuffer.cpp b/rehlds/public/utlbuffer.cpp index 69ba751..13aec0e 100644 --- a/rehlds/public/utlbuffer.cpp +++ b/rehlds/public/utlbuffer.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ +//========= Copyright 1996-2001, Valve LLC, All rights reserved. ============ // // The copyright to the contents herein is the property of Valve, L.L.C. // The contents may be used and/or copied only with the written permission of @@ -205,7 +205,7 @@ int CUtlBuffer::VaScanf(char const* pFmt, va_list list) char c; char* pEnd; - while (c = *pFmt++) + while ((c = *pFmt++)) { // Stop if we hit the end of the buffer if (m_Get >= Size()) diff --git a/rehlds/public/utlrbtree.h b/rehlds/public/utlrbtree.h index 45bed14..67463dc 100644 --- a/rehlds/public/utlrbtree.h +++ b/rehlds/public/utlrbtree.h @@ -234,11 +234,12 @@ protected: // Constructor, Destructor template CUtlRBTree::CUtlRBTree(int growSize, int initSize, LessFunc_t lessfunc) : - m_Elements(growSize, initSize), m_LessFunc(lessfunc), + m_Elements(growSize, initSize), m_Root(InvalidIndex()), - m_NumElements(0), m_TotalElements(0), - m_FirstFree(InvalidIndex()) + m_NumElements(0), + m_FirstFree(InvalidIndex()), + m_TotalElements(0) { } diff --git a/rehlds/rehlds/jitasm.h b/rehlds/rehlds/jitasm.h index a33113f..13cb32e 100644 --- a/rehlds/rehlds/jitasm.h +++ b/rehlds/rehlds/jitasm.h @@ -322,7 +322,7 @@ namespace detail bool operator==(const Opd& rhs) const { - if ((opdtype_ & O_TYPE_TYPE_MASK) != (rhs.opdtype_ & O_TYPE_TYPE_MASK) || opdsize_ != opdsize_) {return false;} + if ((opdtype_ & O_TYPE_TYPE_MASK) != (rhs.opdtype_ & O_TYPE_TYPE_MASK) || opdsize_ != rhs.opdsize_) {return false;} if (IsReg()) {return reg_ == rhs.reg_ && reg_assignable_ == rhs.reg_assignable_;} if (IsMem()) {return base_ == rhs.base_ && index_ == rhs.index_ && scale_ == rhs.scale_ && disp_ == rhs.disp_ && addrsize_ == rhs.addrsize_;} if (IsImm()) {return imm_ == rhs.imm_;} diff --git a/rehlds/rehlds/platform.cpp b/rehlds/rehlds/platform.cpp index 21a08f6..d6e8a79 100644 --- a/rehlds/rehlds/platform.cpp +++ b/rehlds/rehlds/platform.cpp @@ -102,7 +102,7 @@ int CSimplePlatform::setsockopt(SOCKET s, int level, int optname, const char* op #ifdef _WIN32 return setsockopt_v11(s, level, optname, optval, optlen); #else - return setsockopt(s, level, optname, optval, optlen); + return ::setsockopt(s, level, optname, optval, optlen); #endif } @@ -213,6 +213,8 @@ void NORETURN rehlds_syserror(const char* fmt, ...) { fclose(fl); //TerminateProcess(GetCurrentProcess(), 1); - *((int*)NULL) = 0; + volatile int *null = 0; + *null = 0; + while (true); } diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 7c106c7..3af1e94 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -103,8 +103,8 @@ typedef IVoidHookChainImpl CRehldsHook_ClientConnected; typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_ClientConnected; //HandleNetCommand -typedef IVoidHookChainImpl CRehldsHook_HandleNetCommand; -typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_HandleNetCommand; +typedef IVoidHookChainImpl CRehldsHook_HandleNetCommand; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_HandleNetCommand; //Mod_LoadBrushModel typedef IVoidHookChainImpl CRehldsHook_Mod_LoadBrushModel; diff --git a/rehlds/version/appversion.sh b/rehlds/version/appversion.sh new file mode 100755 index 0000000..7ced0d1 --- /dev/null +++ b/rehlds/version/appversion.sh @@ -0,0 +1,158 @@ +#!/bin/bash + +init() +{ + SOURCE_DIR=$@ + GIT_DIR=$SOURCE_DIR/.. + VERSION_FILE=$GIT_DIR/gradle.properties + APPVERSION_FILE=$SOURCE_DIR/version/appversion.h + + if test -z "`git --version`"; then + echo "Please install git client" + echo "sudo apt-get install git" + exit -1 + fi + + # Read old version + if [ -e $APPVERSION_FILE ]; then + OLD_VERSION=$(cat $APPVERSION_FILE | grep -wi '#define APP_VERSION' | sed -e 's/#define APP_VERSION[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g') + if [ $? -ne 0 ]; then + OLD_VERSION="" + else + # Remove quotes + OLD_VERSION=$(echo $OLD_VERSION | xargs) + fi + fi + + # Get major, minor and maintenance information from gradle.properties + MAJOR=$(sed -nr -e '/majorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + if [ $? -ne 0 -o "$MAJOR" = "" ]; then + MAJOR=0 + fi + + MINOR=$(sed -nr -e '/minorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + if [ $? -ne 0 -o "$MINOR" = "" ]; then + MINOR=0 + fi + + MAINTENANCE=$(sed -nr -e '/maintenanceVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + if [ $? -ne 0 -o "$MAINTENANCE" = "" ]; then + MAINTENANCE=0 + fi + + BRANCH_NAME=$(git -C "$GIT_DIR/" rev-parse --abbrev-ref HEAD) + if [ $? -ne 0 -o "$BRANCH_NAME" = "" ]; then + BRANCH_NAME=master + fi + + COMMIT_COUNT=$(git -C "$GIT_DIR/" rev-list --count $BRANCH_NAME) + if [ $? -ne 0 -o "$COMMIT_COUNT" = "" ]; then + COMMIT_COUNT=0 + fi + + # + # Configure remote url repository + # + # Get remote name by current branch + BRANCH_REMOTE=$(git -C "$GIT_DIR/" config branch.$BRANCH_NAME.remote) + if [ $? -ne 0 -o "$BRANCH_REMOTE" = "" ]; then + BRANCH_REMOTE=origin + fi + + # Get commit id + COMMIT_SHA=$(git -C "$GIT_DIR/" rev-parse --verify HEAD) + COMMIT_SHA=${COMMIT_SHA:0:7} + + # Get remote url + COMMIT_URL=$(git -C "$GIT_DIR/" config remote.$BRANCH_REMOTE.url) + + URL_CONSTRUCT=0 + + if [[ "$COMMIT_URL" == *"git@"* ]]; then + URL_CONSTRUCT=1 + + # Strip prefix 'git@' + COMMIT_URL=${COMMIT_URL#git@} + + # Strip postfix '.git' + COMMIT_URL=${COMMIT_URL%.git} + + # Replace ':' to '/' + COMMIT_URL=${COMMIT_URL/:/\/} + + elif [[ "$COMMIT_URL" == *"https://"* ]]; then + URL_CONSTRUCT=1 + + # Strip prefix 'https://' + COMMIT_URL=${COMMIT_URL#https://} + + # Strip postfix '.git' + COMMIT_URL=${COMMIT_URL%.git} + fi + + if test "$URL_CONSTRUCT" -eq 1; then + # Append extra string + if [[ "$COMMIT_URL" == *"bitbucket.org"* ]]; then + COMMIT_URL=$(echo https://$COMMIT_URL/commits/) + else + COMMIT_URL=$(echo https://$COMMIT_URL/commit/) + fi + fi + + # + # Detect local modifications + # + if [ `git -C "$GIT_DIR/" ls-files -m | wc -l` = 0 ]; then + MODIFIED= + else + MODIFIED=+m + fi + + NEW_VERSION="$MAJOR.$MINOR.$MAINTENANCE.$COMMIT_COUNT-dev$MODIFIED" + + # Update appversion.h if version has changed or modifications/mixed revisions detected + if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then + update_appversion + fi +} + +update_appversion() +{ + day=$(date +%m) + year=$(date +%Y) + hours=$(date +%H:%M:%S) + month=$(LANG=en_us_88591; date +"%b") + + # Write appversion.h + echo Updating appversion.h, new version is '"'$NEW_VERSION'"', the old one was $OLD_VERSION + + echo -e "#ifndef __APPVERSION_H__\r">"$APPVERSION_FILE" + echo -e "#define __APPVERSION_H__\r">>"$APPVERSION_FILE" + echo -e "\r">>"$APPVERSION_FILE" + echo -e "//\r">>"$APPVERSION_FILE" + echo -e "// This file is generated automatically.\r">>"$APPVERSION_FILE" + echo -e "// Don't edit it.\r">>"$APPVERSION_FILE" + echo -e "//\r">>"$APPVERSION_FILE" + echo -e "\r">>"$APPVERSION_FILE" + echo -e "// Version defines\r">>"$APPVERSION_FILE" + echo -e '#define APP_VERSION "'$NEW_VERSION'"\r'>>"$APPVERSION_FILE" + + echo -e "#define APP_VERSION_C $MAJOR,$MINOR,$MAINTENANCE,$COMMIT_COUNT\r">>"$APPVERSION_FILE" + echo -e '#define APP_VERSION_STRD "'$MAJOR.$MINOR.$MAINTENANCE.$COMMIT_COUNT'"\r'>>"$APPVERSION_FILE" + echo -e "#define APP_VERSION_FLAGS 0x0L\r">>"$APPVERSION_FILE" + echo -e "\r">>"$APPVERSION_FILE" + echo -e '#define APP_COMMIT_DATE "'$month $day $year'"\r'>>"$APPVERSION_FILE" + echo -e '#define APP_COMMIT_TIME "'$hours'"\r'>>"$APPVERSION_FILE" + echo -e "\r">>"$APPVERSION_FILE" + + echo -e '#define APP_COMMIT_SHA "'$COMMIT_SHA'"\r'>>"$APPVERSION_FILE" + echo -e '#define APP_COMMIT_URL "'$COMMIT_URL'"\r'>>"$APPVERSION_FILE" + echo -e "\r">>"$APPVERSION_FILE" + echo -e "#endif //__APPVERSION_H__\r">>"$APPVERSION_FILE" +} + +# Initialise +init $* + +# Exit normally +exit 0 From ce0bfa11abe3a7ed6847717d8fd0524a08d83e43 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 16 Mar 2021 23:35:52 +0700 Subject: [PATCH 15/61] CMakeLists.txt: Configure for compat oldest libstdc++ CMakeLists.txt: Add -fno-stack-protector ExecuteString: Fix parser build.yml: Add paths-ignore README.md --- .github/workflows/build.yml | 3 +++ rehlds/CMakeLists.txt | 4 ++-- rehlds/HLTV/Console/CMakeLists.txt | 11 +++++++---- rehlds/HLTV/Console/src/System.cpp | 8 ++++---- rehlds/HLTV/Core/CMakeLists.txt | 4 ++-- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 4 ++-- rehlds/HLTV/Director/CMakeLists.txt | 4 ++-- rehlds/HLTV/Proxy/CMakeLists.txt | 4 ++-- rehlds/dedicated/CMakeLists.txt | 11 +++++++---- rehlds/engine/SystemWrapper.cpp | 8 ++++---- rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt | 4 ++-- 11 files changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec82c82..6120ccd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,9 @@ name: C/C++ CI on: push: branches: [master] + paths-ignore: + - '**.md' + pull_request: types: [opened, reopened, synchronize] release: diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index 16543a9..f8fdd50 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() if (USE_INTEL_COMPILER) @@ -40,7 +40,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unknown-pragmas -Wno-invalid-offsetof\ -Wno-unused-variable -Wno-unused-result -Wno-unused-function -Wno-delete-non-virtual-dtor\ -Wno-write-strings -Wno-format\ diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt index 2d85a32..b6253bb 100644 --- a/rehlds/HLTV/Console/CMakeLists.txt +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -16,15 +16,18 @@ elseif (USE_CLANG_COMPILER) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") endif() +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie -Wl,--no-export-dynamic") if (USE_INTEL_COMPILER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") @@ -38,7 +41,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") endif() @@ -96,5 +99,5 @@ endif() add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS}) target_link_libraries(hltv dl) -set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") add_dependencies(hltv appversion) diff --git a/rehlds/HLTV/Console/src/System.cpp b/rehlds/HLTV/Console/src/System.cpp index 982d292..e6a5437 100644 --- a/rehlds/HLTV/Console/src/System.cpp +++ b/rehlds/HLTV/Console/src/System.cpp @@ -173,19 +173,19 @@ void System::ExecuteString(const char *commands) unsigned int i; for (i = 0; i < ARRAYSIZE(singleCmd); i++) { - char c = *pszSource++; - - *pszDest++ = c; + const char c = *pszSource++; if (c == '"') { bInQuote = !bInQuote; } - else if (c == ';' && !bInQuote) + else if ((c == ';' && !bInQuote) || !c) { // End of command and not in a quoted string break; } + + *pszDest++ = c; } if (i >= ARRAYSIZE(singleCmd)) diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index 032b673..e969086 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() if (USE_INTEL_COMPILER) @@ -36,7 +36,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index 17d85c3..819e50f 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() if (USE_INTEL_COMPILER) @@ -36,7 +36,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") endif() diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index 7667adb..bb6a81c 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() if (USE_INTEL_COMPILER) @@ -36,7 +36,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-write-strings -Wno-strict-aliasing") endif() diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 3365aee..47317fe 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() if (USE_INTEL_COMPILER) @@ -36,7 +36,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-write-strings -Wno-strict-aliasing") diff --git a/rehlds/dedicated/CMakeLists.txt b/rehlds/dedicated/CMakeLists.txt index 0f53ac5..808159c 100644 --- a/rehlds/dedicated/CMakeLists.txt +++ b/rehlds/dedicated/CMakeLists.txt @@ -16,15 +16,18 @@ elseif (USE_CLANG_COMPILER) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") endif() +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") +set(CMAKE_EXE_LINKER_FLAGS "-no-pie -Wl,--no-export-dynamic") if (USE_INTEL_COMPILER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") @@ -38,7 +41,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unused-result") endif() @@ -92,4 +95,4 @@ add_definitions( add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS}) target_link_libraries(hlds dl) -set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") diff --git a/rehlds/engine/SystemWrapper.cpp b/rehlds/engine/SystemWrapper.cpp index ba3ca9c..5b059b7 100644 --- a/rehlds/engine/SystemWrapper.cpp +++ b/rehlds/engine/SystemWrapper.cpp @@ -572,19 +572,19 @@ void SystemWrapper::ExecuteString(const char *commands) unsigned int i; for (i = 0; i < ARRAYSIZE(singleCmd); i++) { - char c = *pszSource++; - - *pszDest++ = c; + const char c = *pszSource++; if (c == '"') { bInQuote = !bInQuote; } - else if (c == ';' && !bInQuote) + else if ((c == ';' && !bInQuote) || !c) { // End of command and not in a quoted string break; } + + *pszDest++ = c; } if (i >= ARRAYSIZE(singleCmd)) diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt index 9e22885..ab6c8bc 100644 --- a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -28,7 +28,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() if (USE_INTEL_COMPILER) @@ -38,7 +38,7 @@ else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ - -fpermissive\ + -fpermissive -fno-sized-deallocation\ -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-variable -Wno-unused-function\ -Wno-write-strings -Wno-sign-compare") From 42fd0fadfae4c2cbe3ac888887354b7f9f3db7ea Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 22 Mar 2021 23:56:12 +0700 Subject: [PATCH 16/61] ExecuteString: Fix parser Closes #821 --- rehlds/HLTV/Console/src/System.cpp | 3 ++- rehlds/engine/SystemWrapper.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rehlds/HLTV/Console/src/System.cpp b/rehlds/HLTV/Console/src/System.cpp index e6a5437..9a20fee 100644 --- a/rehlds/HLTV/Console/src/System.cpp +++ b/rehlds/HLTV/Console/src/System.cpp @@ -173,7 +173,7 @@ void System::ExecuteString(const char *commands) unsigned int i; for (i = 0; i < ARRAYSIZE(singleCmd); i++) { - const char c = *pszSource++; + const char c = *pszSource; if (c == '"') { @@ -186,6 +186,7 @@ void System::ExecuteString(const char *commands) } *pszDest++ = c; + pszSource++; } if (i >= ARRAYSIZE(singleCmd)) diff --git a/rehlds/engine/SystemWrapper.cpp b/rehlds/engine/SystemWrapper.cpp index 5b059b7..f20168f 100644 --- a/rehlds/engine/SystemWrapper.cpp +++ b/rehlds/engine/SystemWrapper.cpp @@ -572,7 +572,7 @@ void SystemWrapper::ExecuteString(const char *commands) unsigned int i; for (i = 0; i < ARRAYSIZE(singleCmd); i++) { - const char c = *pszSource++; + const char c = *pszSource; if (c == '"') { @@ -585,6 +585,7 @@ void SystemWrapper::ExecuteString(const char *commands) } *pszDest++ = c; + pszSource++; } if (i >= ARRAYSIZE(singleCmd)) From 80b849f39ebed2d1ba9ccabc827a72c4ad40cf2b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 01:10:55 +0700 Subject: [PATCH 17/61] HLTV: Downgrade GLIBC version --- rehlds/HLTV/Director/CMakeLists.txt | 4 ++++ rehlds/HLTV/Director/src/Director.cpp | 21 ++++++++++++++++++++- rehlds/HLTV/Proxy/CMakeLists.txt | 4 ++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index bb6a81c..af56fc9 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -41,6 +41,10 @@ else() -Wno-write-strings -Wno-strict-aliasing") endif() +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=expf") +endif() + set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/../" diff --git a/rehlds/HLTV/Director/src/Director.cpp b/rehlds/HLTV/Director/src/Director.cpp index eae4092..0b7448d 100644 --- a/rehlds/HLTV/Director/src/Director.cpp +++ b/rehlds/HLTV/Director/src/Director.cpp @@ -32,6 +32,25 @@ EXPOSE_SINGLE_INTERFACE(Director, IDirector, DIRECTOR_INTERFACE_VERSION); #endif // DIRECTOR_MODULE +#if !defined(_WIN32) && __GNUC__ >= 8 + +#define GLIBC_expf_VERSION "2.0" + +// +// Building go on GCC 8.3 or greater that have newest expf GLIBC.2.27 than +// available on the destination virtual machine, so we can downgrade GLIBC version +// for this function. +// Use for linker: -Wl,--wrap=expf + +extern int expf(int __fd, int __cmd, ...); +__asm__(".symver expf,expf@GLIBC_" GLIBC_expf_VERSION); +DLL_EXPORT float __wrap_expf(float x) +{ + return expf(x); +} + +#endif // #if defined(_WIN32) + bool Director::Init(IBaseSystem *system, int serial, char *name) { BaseSystemModule::Init(system, serial, name); @@ -49,7 +68,7 @@ bool Director::Init(IBaseSystem *system, int serial, char *name) m_slowMotion = 0.5f; for (int i = 0; i < MAX_WORLD_HISTORY; i++) { - m_gaussFilter[i] = 1.0f / exp((i * i) / 10000.0f); + m_gaussFilter[i] = 1.0f / expf((i * i) / 10000.0f); } m_World = nullptr; diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 47317fe..18230dd 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -45,6 +45,10 @@ else() endif() endif() +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=expf") +endif() + set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/../" From 7ea66866599ab4ba6169db1b8aeb7ab32e38a134 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 01:14:18 +0700 Subject: [PATCH 18/61] HLTV:Console: Fix typo CMakeLists.txt: Fix typo linker flags --- rehlds/HLTV/Console/src/System.cpp | 2 +- rehlds/HLTV/Director/CMakeLists.txt | 2 +- rehlds/HLTV/Proxy/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rehlds/HLTV/Console/src/System.cpp b/rehlds/HLTV/Console/src/System.cpp index 9a20fee..9aa184a 100644 --- a/rehlds/HLTV/Console/src/System.cpp +++ b/rehlds/HLTV/Console/src/System.cpp @@ -234,7 +234,7 @@ ISystemModule *System::FindModule(char *type, char *name) while (module) { if (Q_stricmp(type, module->GetType()) == 0 - && (!name || Q_stricmp(name, module->GetType()) == 0)) { + && (!name || Q_stricmp(name, module->GetName()) == 0)) { return module; } diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index af56fc9..a390f0f 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -42,7 +42,7 @@ else() endif() if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=expf") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--wrap=expf") endif() set(PROJECT_SRC_DIR diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 18230dd..16f439a 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -46,7 +46,7 @@ else() endif() if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=expf") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--wrap=expf") endif() set(PROJECT_SRC_DIR From 77f004fdfc30f573c49a614e4d27a4fe05173dab Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 03:13:18 +0700 Subject: [PATCH 19/61] CMakeLists.txt: force run path for libsteam_api.so --- rehlds/CMakeLists.txt | 4 ++-- rehlds/HLTV/Proxy/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index f8fdd50..73fb168 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -109,8 +109,6 @@ include_directories( ${PROJECT_PUBLIC_DIR} ) -link_directories(${PROJECT_SOURCE_DIR}/lib/linux32) - add_definitions( -DSWDS -DREHLDS_JIT @@ -133,6 +131,8 @@ add_definitions( -D_vsnwprintf=vswprintf ) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/.' -L${PROJECT_SOURCE_DIR}/lib/linux32") + if (NOT TARGET bzip2) add_subdirectory(../dep/bzip2 lib) endif() diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 16f439a..00466cd 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -106,8 +106,6 @@ include_directories( ${PROJECT_PUBLIC_DIR} ) -link_directories(${PROJECT_SOURCE_DIR}/../../lib/linux32) - add_definitions( -DHLTV -DHLTV_FIXES @@ -121,6 +119,8 @@ add_definitions( -D_snprintf=snprintf ) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/.' -L${PROJECT_SOURCE_DIR}/../../lib/linux32") + if (NOT TARGET bzip2) add_subdirectory(../../../dep/bzip2 lib) endif() From b7a4f1e18a28a6555d920da888b95603a7b2aaf5 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 16:47:06 +0700 Subject: [PATCH 20/61] Fix wrong initialization values Resolves #822, Closes #823 --- rehlds/engine/mathlib_sse.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rehlds/engine/mathlib_sse.cpp b/rehlds/engine/mathlib_sse.cpp index 9342d01..483a643 100644 --- a/rehlds/engine/mathlib_sse.cpp +++ b/rehlds/engine/mathlib_sse.cpp @@ -46,12 +46,12 @@ const avec4_t deg2rad = (float)M_PI / 180.f }; -const aivec4_t negmask[4] = +const aivec4_t negmask = { - {0x80000000}, - {0x80000000}, - {0x80000000}, - {0x80000000} + 0x80000000, + 0x80000000, + 0x80000000, + 0x80000000 }; const aivec4_t negmask_1001 = From 91bf77ac9e54666501bbe98d47a83d3fc9cd4682 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 17:08:58 +0700 Subject: [PATCH 21/61] appversion.sh fix typo day formatting --- rehlds/version/appversion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/version/appversion.sh b/rehlds/version/appversion.sh index 7ced0d1..0304798 100755 --- a/rehlds/version/appversion.sh +++ b/rehlds/version/appversion.sh @@ -118,7 +118,7 @@ init() update_appversion() { - day=$(date +%m) + day=$(date +%d) year=$(date +%Y) hours=$(date +%H:%M:%S) month=$(LANG=en_us_88591; date +"%b") From a579f566791ad27d371ea0a6b1295a4a4f486748 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 20:07:32 +0700 Subject: [PATCH 22/61] CMakeLists.txt configure for GCC 8.3 --- rehlds/CMakeLists.txt | 6 +++++- rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index 73fb168..33c5d1f 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -47,7 +47,11 @@ else() -Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes") if (NOT USE_CLANG_COMPILER) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-unused-but-set-variable -Wno-class-memaccess") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable") + + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess") + endif() endif() endif() diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt index ab6c8bc..72b486e 100644 --- a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -42,7 +42,7 @@ else() -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-variable -Wno-unused-function\ -Wno-write-strings -Wno-sign-compare") - if (NOT USE_CLANG_COMPILER) + if (NOT USE_CLANG_COMPILER AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess") endif() endif() From 8aca7cfd8f08e844c8711c642bca9244f2d0b789 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 23 Mar 2021 20:09:54 +0700 Subject: [PATCH 23/61] CalcSurfaceExtents: Fixed a fatal error on some maps due loss of floating point --- rehlds/engine/model.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rehlds/engine/model.cpp b/rehlds/engine/model.cpp index 4c29ecc..a4581e5 100644 --- a/rehlds/engine/model.cpp +++ b/rehlds/engine/model.cpp @@ -866,10 +866,12 @@ void CalcSurfaceExtents(msurface_t *s) for (j = 0; j < 2; j++) { - val = v->position[0] * tex->vecs[j][0] + - v->position[1] * tex->vecs[j][1] + - v->position[2] * tex->vecs[j][2] + - tex->vecs[j][3]; + // FIXED: loss of floating point + val = v->position[0] * (double)tex->vecs[j][0] + + v->position[1] * (double)tex->vecs[j][1] + + v->position[2] * (double)tex->vecs[j][2] + + (double)tex->vecs[j][3]; + if (val < mins[j]) mins[j] = val; if (val > maxs[j]) From af4776487bf450e19c33225f4089c93d69c51e03 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 24 Mar 2021 17:52:21 +0700 Subject: [PATCH 24/61] Windows: Set fetch-depth 0 to fetch all history for proper appversion generate --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6120ccd..a02c29f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup Nuget uses: nuget/setup-nuget@v1 with: From f27be28abb1215b9e8a13919a85dd842d2b07fca Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 25 Mar 2021 07:19:15 +0700 Subject: [PATCH 25/61] CMakeLists.txt: Configure for more compat to older linux distros (Debian 7, Centoc 6 etc) --- .github/workflows/build.yml | 17 +++++ dep/bzip2/CMakeLists.txt | 4 +- rehlds/CMakeLists.txt | 11 ++- rehlds/HLTV/Console/CMakeLists.txt | 11 ++- rehlds/HLTV/Core/CMakeLists.txt | 11 ++- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 7 +- rehlds/HLTV/Director/CMakeLists.txt | 5 +- rehlds/HLTV/Director/src/Director.cpp | 11 +-- rehlds/HLTV/Proxy/CMakeLists.txt | 13 ++-- rehlds/HLTV/common/DirectorCmd.cpp | 4 +- rehlds/HLTV/common/DirectorCmd.h | 2 +- rehlds/dedicated/CMakeLists.txt | 11 ++- rehlds/engine/sys_dll.cpp | 14 ++++ .../FileSystem_Stdio/CMakeLists.txt | 5 ++ rehlds/version/glibc_test.sh | 71 +++++++++++++++++++ 15 files changed, 172 insertions(+), 25 deletions(-) create mode 100755 rehlds/version/glibc_test.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a02c29f..4d89f67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,6 +117,23 @@ jobs: mv build/rehlds/HLTV/Director/director.so publish/bin/linux32/valve/dlls/director.so mv build/rehlds/filesystem/FileSystem_Stdio/filesystem_stdio.so publish/bin/linux32/filesystem_stdio.so + - name: Run GLIBC/ABI version compat test + run: | + binaries=( + "publish/bin/linux32/engine_i486.so" + "publish/bin/linux32/hlds_linux" + "publish/bin/linux32/hltv" + "publish/bin/linux32/core.so" + "publish/bin/linux32/proxy.so" + "publish/bin/linux32/demoplayer.so" + "publish/bin/linux32/valve/dlls/director.so" + "publish/bin/linux32/filesystem_stdio.so" + ) + bash ./rehlds/version/glibc_test.sh ${binaries[@]} + if [[ $? -ne 0 ]]; then + exit 1 # Assertion failed + fi + - name: Deploy artifacts uses: actions/upload-artifact@v2 id: upload-job diff --git a/dep/bzip2/CMakeLists.txt b/dep/bzip2/CMakeLists.txt index 74f4b99..841ed41 100644 --- a/dep/bzip2/CMakeLists.txt +++ b/dep/bzip2/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.1) project(bzip2 C) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g0 -O1 -fno-stack-protector") + set(BZIP2_SRCS "src/blocksort.c" "src/bzlib.c" @@ -18,4 +20,4 @@ include_directories( ) add_library(bzip2 STATIC ${BZIP2_SRCS}) -set_target_properties(bzip2 PROPERTIES COMPILE_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(bzip2 PROPERTIES COMPILE_FLAGS "-m32") diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index 33c5d1f..9c0bf35 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -17,7 +17,7 @@ elseif (USE_CLANG_COMPILER) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-exceptions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-plt -fno-exceptions") # Remove noxref code and data set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") @@ -34,7 +34,7 @@ if (USE_INTEL_COMPILER) if (NOT DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. @@ -55,6 +55,10 @@ else() endif() endif() +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") +endif() + if (NOT DEBUG AND USE_STATIC_LIBSTDC) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"") endif() @@ -127,6 +131,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup @@ -147,6 +152,6 @@ endif() add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS}) set_property(TARGET engine PROPERTY LIBRARY_OUTPUT_NAME engine_i486) -set_target_properties(engine PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(engine PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE OFF) target_link_libraries(engine dl rt m aelf32 bzip2 steam_api) add_dependencies(engine appversion) diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt index b6253bb..80a8e8f 100644 --- a/rehlds/HLTV/Console/CMakeLists.txt +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -40,9 +40,17 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") + + if (NOT USE_CLANG_COMPILER AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + endif() +endif() + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -86,6 +94,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index e969086..0fbdb9a 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -35,16 +35,24 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") if (USE_CLANG_COMPILER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") + else() + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + endif() endif() endif() +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") +endif() + set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/../" @@ -105,6 +113,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index 819e50f..3161e1d 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -35,12 +35,16 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") endif() +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") +endif() + set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/../" @@ -84,6 +88,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index a390f0f..fa7264f 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -35,14 +35,14 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-write-strings -Wno-strict-aliasing") endif() if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--wrap=expf") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -90,6 +90,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup diff --git a/rehlds/HLTV/Director/src/Director.cpp b/rehlds/HLTV/Director/src/Director.cpp index 0b7448d..a9c8262 100644 --- a/rehlds/HLTV/Director/src/Director.cpp +++ b/rehlds/HLTV/Director/src/Director.cpp @@ -40,14 +40,9 @@ EXPOSE_SINGLE_INTERFACE(Director, IDirector, DIRECTOR_INTERFACE_VERSION); // Building go on GCC 8.3 or greater that have newest expf GLIBC.2.27 than // available on the destination virtual machine, so we can downgrade GLIBC version // for this function. -// Use for linker: -Wl,--wrap=expf +// NOTE: This workaround seem not compatible with -flto compile GCC option. -extern int expf(int __fd, int __cmd, ...); __asm__(".symver expf,expf@GLIBC_" GLIBC_expf_VERSION); -DLL_EXPORT float __wrap_expf(float x) -{ - return expf(x); -} #endif // #if defined(_WIN32) @@ -389,9 +384,9 @@ float Director::AddBestGenericCut() int seqNrMod = m_nextCutSeqnr % m_historyLength; float sumTarget2Rank[MAX_CLIENTS]; - float bestTarget2Rank, bestRank = 0; + float bestTarget2Rank, bestRank = 0.0f; float targetRankSum = 0; - int newTarget, newTarget2; + int newTarget = 0, newTarget2 = 0; int bestTarget2; for (int i = 0; i < MAX_CLIENTS; i++) diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 00466cd..69653f4 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -16,7 +16,7 @@ elseif (USE_CLANG_COMPILER) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-plt -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") @@ -30,23 +30,27 @@ if (USE_INTEL_COMPILER) if (NOT DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-write-strings -Wno-strict-aliasing") if (USE_CLANG_COMPILER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") + else() + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + endif() endif() endif() if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--wrap=expf") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -112,6 +116,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup diff --git a/rehlds/HLTV/common/DirectorCmd.cpp b/rehlds/HLTV/common/DirectorCmd.cpp index 6ee3de1..2f8e32c 100644 --- a/rehlds/HLTV/common/DirectorCmd.cpp +++ b/rehlds/HLTV/common/DirectorCmd.cpp @@ -583,7 +583,7 @@ void DirectorCmd::WriteToStream(BitBuffer *stream) } } -char *DirectorCmd::ToString() +const char *DirectorCmd::ToString() { int i1, i2, i3; float f1, f2, f3, f4; @@ -592,7 +592,7 @@ char *DirectorCmd::ToString() char *t1 = m_CMD_Name[m_Type]; char t2[1024]; - static char s[1024]; + static char s[2048]; Q_memset(s, 0, sizeof(s)); switch (m_Type) diff --git a/rehlds/HLTV/common/DirectorCmd.h b/rehlds/HLTV/common/DirectorCmd.h index 88e5101..3d25af7 100644 --- a/rehlds/HLTV/common/DirectorCmd.h +++ b/rehlds/HLTV/common/DirectorCmd.h @@ -40,7 +40,7 @@ public: void Copy(DirectorCmd *cmd); void Resize(int size); void FromString(char *string); - char *ToString(); + const char *ToString(); void WriteToStream(BitBuffer *stream); bool ReadFromStream(BitBuffer *stream); int GetType(); diff --git a/rehlds/dedicated/CMakeLists.txt b/rehlds/dedicated/CMakeLists.txt index 808159c..1ee3e93 100644 --- a/rehlds/dedicated/CMakeLists.txt +++ b/rehlds/dedicated/CMakeLists.txt @@ -40,9 +40,17 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result") + + if (NOT USE_CLANG_COMPILER AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + endif() +endif() + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -87,6 +95,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -D_strdup=strdup diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index add30da..507f51c 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -597,6 +597,20 @@ double EXT_FUNC Sys_FloatTime(void) #else // not _WIN32 +#if __GNUC__ >= 8 + +#define GLIBC_clock_gettime_VERSION "2.2" + +// +// Building go on GCC 8.3 or greater that have newest clock_gettime GLIBC.2.17 than +// available on the destination virtual machine, so we can downgrade GLIBC version +// for this function. +// NOTE: This workaround seem not compatible with -flto compile GCC option. + +__asm__(".symver clock_gettime,clock_gettime@GLIBC_" GLIBC_clock_gettime_VERSION); + +#endif // #if __GNUC__ >= 8 + double Sys_FloatTime(void) { static struct timespec start_time; diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt index 72b486e..52f3a96 100644 --- a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -51,6 +51,10 @@ foreach(f ${WRAP_FUNCS_LIST}) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-wrap,${f}") endforeach() +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") +endif() + set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/../.." @@ -80,6 +84,7 @@ add_definitions( -D_LINUX -DLINUX -D_GLIBCXX_USE_CXX11_ABI=0 + -U_FORTIFY_SOURCE -D_strdup=strdup -D_stricmp=strcasecmp -D_strnicmp=strncasecmp diff --git a/rehlds/version/glibc_test.sh b/rehlds/version/glibc_test.sh new file mode 100755 index 0000000..3dc1fbb --- /dev/null +++ b/rehlds/version/glibc_test.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +main() +{ + files=($@) + + declare -A threshold_version + threshold_version[CXXABI]="1.3.5" + threshold_version[GLIBCXX]="3.4.15" + threshold_version[GLIBC]="2.7" + + for k in "${!threshold_version[@]}"; do + for f in "${files[@]}" + do + : + version=$(readelf -sV $f | sed -n 's/.*@'$k'_//p' | sort -u -V | tail -1 | cut -d ' ' -f 1) + if [[ ! -z "$version" ]]; then + check_version_greater $version ${threshold_version[$k]} + if [[ $? -eq 1 ]]; then + echo -e "\033[0;31mAssertion failed:\033[0m Binary \033[0;32m${f}\033[0m has ${k}_\033[0;33m$version\033[0m greater than max version ${k}_\033[0;33m${threshold_version[$k]}\033[0m" + exit -1 + fi + fi + done + + echo -e "[\033[0;32mOK\033[0m] ${k}_\033[0;33m${threshold_version[$k]}\033[0m" + done +} + +check_version_greater() +{ + if [[ -z "$1" || $1 == $2 ]]; then + return 0 + fi + + local IFS=. + local i ver1=($1) ver2=($2) + + # fill empty fields in ver1 with zeros + for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)) + do + ver1[i]=0 + done + + for ((i = 0; i < ${#ver1[@]}; i++)) + do + if [[ -z ${ver2[i]} ]] + then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + return 1 + fi + + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + break + fi + done + + return 0 +} + +# Initialize +main $* + +# Exit normally +exit 0 From 3c63e415332aec071a33abda8fb27c231af7d9f5 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 27 Mar 2021 22:50:57 +0700 Subject: [PATCH 26/61] QuaternionSlerp: Fix wrong values Related #763 --- rehlds/engine/r_studio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/r_studio.cpp b/rehlds/engine/r_studio.cpp index 71e688a..5b12b83 100644 --- a/rehlds/engine/r_studio.cpp +++ b/rehlds/engine/r_studio.cpp @@ -187,9 +187,9 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt) cosom = p[0] * q[0] + p[1] * q[1] + p[2] * q[2] + p[3] * q[3]; - if ((1.0 + cosom) > 0.00000001) + if ((1.0 + cosom) > 0.000001) { - if ((1.0 - cosom) > 0.00000001) + if ((1.0 - cosom) > 0.000001) { omega = acos(cosom); sinom = sin(omega); From 80f0f3c7eadadc5b36db31191307c407ac5c68e7 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 5 Apr 2021 00:01:21 +0700 Subject: [PATCH 27/61] glibc_test.sh: bump minor version up to 11 --- rehlds/version/glibc_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/version/glibc_test.sh b/rehlds/version/glibc_test.sh index 3dc1fbb..2e67a90 100755 --- a/rehlds/version/glibc_test.sh +++ b/rehlds/version/glibc_test.sh @@ -7,7 +7,7 @@ main() declare -A threshold_version threshold_version[CXXABI]="1.3.5" threshold_version[GLIBCXX]="3.4.15" - threshold_version[GLIBC]="2.7" + threshold_version[GLIBC]="2.11" for k in "${!threshold_version[@]}"; do for f in "${files[@]}" From 2965e0ea7f6fe69cb56c8843b974974dc7a101c8 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 5 Apr 2021 00:04:00 +0700 Subject: [PATCH 28/61] Added libraries libm/librt built on glibc 2.11.1 (Fixes #827) --- rehlds/HLTV/Console/CMakeLists.txt | 2 +- rehlds/HLTV/Core/CMakeLists.txt | 2 +- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 2 +- rehlds/HLTV/Director/CMakeLists.txt | 11 ++++------- rehlds/HLTV/Director/src/Director.cpp | 14 -------------- rehlds/HLTV/Proxy/CMakeLists.txt | 4 ++-- rehlds/engine/sys_dll.cpp | 14 -------------- rehlds/lib/linux32/libm.so | Bin 0 -> 149392 bytes rehlds/lib/linux32/librt.so | Bin 0 -> 30684 bytes 9 files changed, 9 insertions(+), 40 deletions(-) create mode 100644 rehlds/lib/linux32/libm.so create mode 100644 rehlds/lib/linux32/librt.so diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt index 80a8e8f..90a78bd 100644 --- a/rehlds/HLTV/Console/CMakeLists.txt +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -40,7 +40,7 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index 0fbdb9a..5acbef8 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -35,7 +35,7 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index 3161e1d..8d8366d 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -35,7 +35,7 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index fa7264f..4582be4 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -35,7 +35,7 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-write-strings -Wno-strict-aliasing") @@ -98,11 +98,8 @@ add_definitions( -D_snprintf=snprintf ) -if (NOT TARGET appversion) - add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") -endif() +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/.' -L${PROJECT_SOURCE_DIR}/../../lib/linux32") -add_library(director SHARED ${appversion.sh} ${DIRECTOR_SRCS} ${COMMON_SRCS}) -target_link_libraries(director dl) +add_library(director SHARED ${DIRECTOR_SRCS} ${COMMON_SRCS}) +target_link_libraries(director dl m) set_target_properties(director PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) -add_dependencies(director appversion) diff --git a/rehlds/HLTV/Director/src/Director.cpp b/rehlds/HLTV/Director/src/Director.cpp index a9c8262..2787de3 100644 --- a/rehlds/HLTV/Director/src/Director.cpp +++ b/rehlds/HLTV/Director/src/Director.cpp @@ -32,20 +32,6 @@ EXPOSE_SINGLE_INTERFACE(Director, IDirector, DIRECTOR_INTERFACE_VERSION); #endif // DIRECTOR_MODULE -#if !defined(_WIN32) && __GNUC__ >= 8 - -#define GLIBC_expf_VERSION "2.0" - -// -// Building go on GCC 8.3 or greater that have newest expf GLIBC.2.27 than -// available on the destination virtual machine, so we can downgrade GLIBC version -// for this function. -// NOTE: This workaround seem not compatible with -flto compile GCC option. - -__asm__(".symver expf,expf@GLIBC_" GLIBC_expf_VERSION); - -#endif // #if defined(_WIN32) - bool Director::Init(IBaseSystem *system, int serial, char *name) { BaseSystemModule::Init(system, serial, name); diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 69653f4..9d0a7e9 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -35,7 +35,7 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-write-strings -Wno-strict-aliasing") @@ -131,5 +131,5 @@ if (NOT TARGET bzip2) endif() add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS}) -target_link_libraries(proxy dl bzip2 steam_api) +target_link_libraries(proxy dl m bzip2 steam_api) set_target_properties(proxy PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 507f51c..add30da 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -597,20 +597,6 @@ double EXT_FUNC Sys_FloatTime(void) #else // not _WIN32 -#if __GNUC__ >= 8 - -#define GLIBC_clock_gettime_VERSION "2.2" - -// -// Building go on GCC 8.3 or greater that have newest clock_gettime GLIBC.2.17 than -// available on the destination virtual machine, so we can downgrade GLIBC version -// for this function. -// NOTE: This workaround seem not compatible with -flto compile GCC option. - -__asm__(".symver clock_gettime,clock_gettime@GLIBC_" GLIBC_clock_gettime_VERSION); - -#endif // #if __GNUC__ >= 8 - double Sys_FloatTime(void) { static struct timespec start_time; diff --git a/rehlds/lib/linux32/libm.so b/rehlds/lib/linux32/libm.so new file mode 100644 index 0000000000000000000000000000000000000000..b0430eb9f08e60805008d80a77b8fcee80500197 GIT binary patch literal 149392 zcmd3P33wF6)^<;b5F|1|qky0UjXNrj}HSD)|sp6~h5o~l#JsZ-~i zI(2I4PPXHYTWmI)X8dcWHPZ-<>Zxh?UmH6hN@Vra610}u zqXXu{e73=77|I*ZAi#W#yyTyqW43}m$jD6&uDeaBT06aMOQ?5mf=74i*4BPJPUwf5}sCg zE-6g-qGjG=t+bN3gy;;%J+tF-mTNQTd=e9L8*(+RLv${FUrLF)IUzYAXTj{kHc7|2 zYh|hNT1@jV3tx(Tx+r0lmXI)8Tbvv1XmLi*RN!Aduw8jV%sK7ihu(0Jc6NN5q+#wT z2b5uD>;rMyoG2{;ttUQvMhx+H)@Ey3%XN;OH?;=C)*B%E;3Gw5^NZT6Y3jneK|c##&b zInG{=jFPi&j@EK)3DMDU!?e!Ll7_{ncO0cPo4xkYK~V|kzl;)s9}G|RkGwq9zq64@ zS)8jf&qLT2Pdhvv@LYh0|1Ok4#BV1+33xiI)I=3tqCz9M6p_mfz!F}8_>~IoqQa|H zcn!j?c)H=~uF`s_u$Kz2LwG%&8x-7Ig$!;|@jeLqs<;vKQ<45gf(ma|;XoA*vgF@_ z_+SexwMx^5AnkTb`W=?I5xvuhSi)o#zgva(AiNjPFa=AE*R=Z-d_TemRs10p8o_WQ z(kL8ZfgiENME%6LX{BguH6+8~%cuU>{OMIdw z{)8pY=p+SCM(9*=1}+t!f^eFOPe(Wd&yxx^f-FR4;+drqvW*NC=BUu!C_P`nPpfc_ z3Oxv)!Q;jAES>^9{5KcRJQ3pz4)&tz2k~UhhK2`Be2tTu=|69dBM_7cXSiwe6hR7FqzElaD5tierP_Q+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 Subject: [PATCH 29/61] CMakeLists.txt configure Intel C++ Compiler build.yml: use container linux86buildtools Minor refactoring --- .github/workflows/build.yml | 20 +-- CMakeLists.txt | 4 + dep/bzip2/CMakeLists.txt | 4 +- rehlds/CMakeLists.txt | 160 ++++++++++++++---- rehlds/HLTV/Console/CMakeLists.txt | 33 ++-- .../HLTV/Console/src/public_amalgamation.cpp | 1 + rehlds/HLTV/Core/CMakeLists.txt | 27 +-- rehlds/HLTV/Core/src/public_amalgamation.cpp | 1 + rehlds/HLTV/DemoPlayer/CMakeLists.txt | 26 +-- .../DemoPlayer/src/public_amalgamation.cpp | 1 + rehlds/HLTV/Director/CMakeLists.txt | 30 ++-- .../HLTV/Director/src/public_amalgamation.cpp | 1 + rehlds/HLTV/Proxy/CMakeLists.txt | 37 ++-- rehlds/HLTV/Proxy/src/public_amalgamation.cpp | 1 + rehlds/common/stdc++compat.cpp | 45 ++++- rehlds/dedicated/CMakeLists.txt | 34 ++-- rehlds/dedicated/src/public_amalgamation.cpp | 1 + .../FileSystem_Stdio/CMakeLists.txt | 48 +++--- .../FileSystem_Stdio/src/pathmatch.cpp | 4 +- .../src/public_amalgamation.cpp | 1 + rehlds/version/appversion.sh | 6 +- rehlds/version/glibc_test.sh | 16 +- 22 files changed, 330 insertions(+), 171 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d89f67..2b287c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,6 +72,7 @@ jobs: linux: name: 'Linux' runs-on: ubuntu-latest + container: s1lentq/linux86buildtools:latest steps: - name: Checkout @@ -79,21 +80,9 @@ jobs: with: fetch-depth: 0 - - name: Check dependencies + - name: Build using Intel C++ Compiler run: | - sudo dpkg --add-architecture i386 - sudo apt-get update - sudo apt-get install -y gcc-multilib g++-multilib - sudo apt-get install -y build-essential - sudo apt-get install -y libc6-dev libc6-dev-i386 - sudo apt-get install -y p7zip-full - - - name: Build - run: | - mkdir build - cd build - cmake ../ - make + rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8 - name: Prepare HLSDK run: | @@ -133,7 +122,8 @@ jobs: if [[ $? -ne 0 ]]; then exit 1 # Assertion failed fi - + shell: bash + - name: Deploy artifacts uses: actions/upload-artifact@v2 id: upload-job diff --git a/CMakeLists.txt b/CMakeLists.txt index 2046105..3607bbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,10 @@ if (WIN32) message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/ReHLDS.sln instead it!") endif() +add_custom_target(appversion DEPENDS + COMMAND "${PROJECT_SOURCE_DIR}/rehlds/version/appversion.sh" "${PROJECT_SOURCE_DIR}" +) + add_subdirectory(rehlds) add_subdirectory(rehlds/dedicated) add_subdirectory(rehlds/filesystem) diff --git a/dep/bzip2/CMakeLists.txt b/dep/bzip2/CMakeLists.txt index 841ed41..50e77a6 100644 --- a/dep/bzip2/CMakeLists.txt +++ b/dep/bzip2/CMakeLists.txt @@ -20,4 +20,6 @@ include_directories( ) add_library(bzip2 STATIC ${BZIP2_SRCS}) -set_target_properties(bzip2 PROPERTIES COMPILE_FLAGS "-m32") +set_target_properties(bzip2 PROPERTIES + COMPILE_FLAGS "-m32" +) diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index 9c0bf35..d0583a5 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -1,23 +1,33 @@ +#---------------------------------------- +# 1. Preparing build: +# rm -rf build +# mkdir build && cd build +# +# 2. Select compiler and build it +# - Compile with Clang: +# CC="clang" CXX="clang++" cmake .. +# make +# +# - Compile with Intel C++ Compiler: +# CC="icc" CXX="icpc" cmake .. +# make +# +# - Compile with GCC Compiler: +# cmake .. +# make +#---------------------------------------- + cmake_minimum_required(VERSION 3.1) project(engine CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-plt -fno-exceptions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-exceptions") # Remove noxref code and data set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") @@ -28,8 +38,16 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -if (USE_INTEL_COMPILER) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") + # -fp-model=precise + # ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations + # https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html#fp-model-fp_GUID-99936BBA-1508-4E9F-AC09-FA98613CE2F5 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -fp-model=precise\ + -fasm-blocks\ + -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) @@ -39,28 +57,33 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unknown-pragmas -Wno-invalid-offsetof\ -Wno-unused-variable -Wno-unused-result -Wno-unused-function -Wno-delete-non-virtual-dtor\ -Wno-write-strings -Wno-format\ -Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes") - if (NOT USE_CLANG_COMPILER) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable") + # Check if not Clang compiler + if (NOT $ENV{CXX} MATCHES "clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt -Wno-unused-but-set-variable") + # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess") endif() endif() endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() -if (NOT DEBUG AND USE_STATIC_LIBSTDC) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"") +if (NOT DEBUG) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ + -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"") endif() if (USE_STATIC_LIBSTDC) @@ -86,25 +109,83 @@ set(PROJECT_PUBLIC_DIR "${PROJECT_SOURCE_DIR}/public/rehlds" ) -file(GLOB ENGINE_SRCS - "engine/*.cpp" - "rehlds/*.cpp" - "version/*.cpp" +set(ENGINE_SRCS + engine/sv_main.cpp + engine/sv_user.cpp + engine/sv_phys.cpp + engine/sv_move.cpp + engine/sv_pmove.cpp + engine/sv_log.cpp + engine/sv_remoteaccess.cpp + engine/sv_steam3.cpp + engine/sv_upld.cpp + engine/sys_dll.cpp + engine/sys_dll2.cpp + engine/sys_engine.cpp + engine/sys_linuxwind.cpp + engine/SystemWrapper.cpp + engine/host.cpp + engine/host_cmd.cpp + engine/net_chan.cpp + engine/net_ws.cpp + engine/pmove.cpp + engine/pmovetst.cpp + engine/pr_cmds.cpp + engine/pr_edict.cpp + engine/wad.cpp + engine/model.cpp + engine/world.cpp + engine/zone.cpp + engine/cmd.cpp + engine/cmodel.cpp + engine/com_custom.cpp + engine/common.cpp + engine/crc.cpp + engine/cvar.cpp + engine/decals.cpp + engine/delta.cpp + engine/delta_jit.cpp + engine/ed_strpool.cpp + engine/filesystem.cpp + engine/filesystem_internal.cpp + engine/hashpak.cpp + engine/info.cpp + engine/ipratelimit.cpp + engine/l_studio.cpp + engine/textures.cpp + engine/tmessage.cpp + engine/traceinit.cpp + engine/unicode_strtools.cpp + engine/buildnum.cpp + engine/mathlib.cpp + engine/mathlib_sse.cpp + engine/md5.cpp + engine/mem.cpp + engine/module.cpp + engine/r_studio.cpp + engine/vid_null.cpp + engine/cl_null.cpp + engine/snd_null.cpp + engine/sse_mathfun.cpp + engine/public_amalgamation.cpp + rehlds/flight_recorder.cpp + rehlds/FlightRecorderImpl.cpp + rehlds/hookchains_impl.cpp + rehlds/main.cpp + rehlds/platform.cpp + rehlds/public_amalgamation.cpp + rehlds/rehlds_api_impl.cpp + rehlds/rehlds_interfaces_impl.cpp + rehlds/rehlds_security.cpp ) -list(REMOVE_ITEM ENGINE_SRCS EXCLUDE - "${PROJECT_SOURCE_DIR}/rehlds/precompiled.cpp" - "${PROJECT_SOURCE_DIR}/rehlds/RehldsRuntimeConfig.cpp" - "${PROJECT_SOURCE_DIR}/rehlds/structSizeCheck.cpp" -) - -file(GLOB COMMON_SRCS +set(COMMON_SRCS "common/BaseSystemModule.cpp" "common/ObjectList.cpp" "common/TokenLine.cpp" ) -file(GLOB PUBLIC_SRCS +set(PUBLIC_SRCS "public/tier0/dbg.cpp" "public/registry.cpp" "public/steamid.cpp" @@ -140,18 +221,27 @@ add_definitions( -D_vsnwprintf=vswprintf ) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/.' -L${PROJECT_SOURCE_DIR}/lib/linux32") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ + -Wl,-rpath,'$ORIGIN/.' \ + -L${PROJECT_SOURCE_DIR}/lib/linux32") if (NOT TARGET bzip2) add_subdirectory(../dep/bzip2 lib) endif() if (NOT TARGET appversion) - add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}") + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/..") endif() add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS}) -set_property(TARGET engine PROPERTY LIBRARY_OUTPUT_NAME engine_i486) -set_target_properties(engine PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE OFF) -target_link_libraries(engine dl rt m aelf32 bzip2 steam_api) add_dependencies(engine appversion) + +set_target_properties(engine PROPERTIES + LIBRARY_OUTPUT_NAME engine_i486 + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) + +target_link_libraries(engine dl rt m aelf32 bzip2 steam_api) diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt index 90a78bd..d2ad58f 100644 --- a/rehlds/HLTV/Console/CMakeLists.txt +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -2,20 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(hltv CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") @@ -29,7 +19,8 @@ endif() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie -Wl,--no-export-dynamic") -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") @@ -40,15 +31,18 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") - if (NOT USE_CLANG_COMPILER AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + # Check if not Clang compiler AND GCC >= 8.3 + if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -103,10 +97,17 @@ add_definitions( ) if (NOT TARGET appversion) - add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../../..") endif() add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS}) -target_link_libraries(hltv dl) -set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") add_dependencies(hltv appversion) + +target_link_libraries(hltv dl) +set_target_properties(hltv PROPERTIES + LIBRARY_OUTPUT_NAME hltv + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/HLTV/Console/src/public_amalgamation.cpp b/rehlds/HLTV/Console/src/public_amalgamation.cpp index 1fc308c..5047b3e 100644 --- a/rehlds/HLTV/Console/src/public_amalgamation.cpp +++ b/rehlds/HLTV/Console/src/public_amalgamation.cpp @@ -1,3 +1,4 @@ #include "precompiled.h" #include "interface.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index 5acbef8..e1b3be4 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -2,19 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(core CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) - -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") @@ -24,7 +15,8 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") @@ -40,15 +32,18 @@ else() -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") - if (USE_CLANG_COMPILER) + # Check Clang compiler + if ($ENV{CXX} MATCHES "clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") else() + # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -127,4 +122,10 @@ endif() add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS}) target_link_libraries(core dl bzip2) -set_target_properties(core PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(core PROPERTIES + LIBRARY_OUTPUT_NAME core + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/HLTV/Core/src/public_amalgamation.cpp b/rehlds/HLTV/Core/src/public_amalgamation.cpp index 1fc308c..5047b3e 100644 --- a/rehlds/HLTV/Core/src/public_amalgamation.cpp +++ b/rehlds/HLTV/Core/src/public_amalgamation.cpp @@ -1,3 +1,4 @@ #include "precompiled.h" #include "interface.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index 8d8366d..85dccd2 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -2,19 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(demoplayer CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) - -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") @@ -24,7 +15,8 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") @@ -35,12 +27,14 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -98,4 +92,10 @@ add_definitions( add_library(demoplayer SHARED ${DEMOPLAYER_SRCS} ${COMMON_SRCS}) target_link_libraries(demoplayer dl) -set_target_properties(demoplayer PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(demoplayer PROPERTIES + LIBRARY_OUTPUT_NAME demoplayer + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/HLTV/DemoPlayer/src/public_amalgamation.cpp b/rehlds/HLTV/DemoPlayer/src/public_amalgamation.cpp index 1fc308c..5047b3e 100644 --- a/rehlds/HLTV/DemoPlayer/src/public_amalgamation.cpp +++ b/rehlds/HLTV/DemoPlayer/src/public_amalgamation.cpp @@ -1,3 +1,4 @@ #include "precompiled.h" #include "interface.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index 4582be4..6bd896c 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -2,19 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(director CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) - -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") @@ -24,7 +15,8 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") @@ -35,12 +27,14 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ -Wno-write-strings -Wno-strict-aliasing") endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -98,8 +92,16 @@ add_definitions( -D_snprintf=snprintf ) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/.' -L${PROJECT_SOURCE_DIR}/../../lib/linux32") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ + -Wl,-rpath,'$ORIGIN/.' \ + -L${PROJECT_SOURCE_DIR}/../../lib/linux32") add_library(director SHARED ${DIRECTOR_SRCS} ${COMMON_SRCS}) target_link_libraries(director dl m) -set_target_properties(director PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(director PROPERTIES + LIBRARY_OUTPUT_NAME director + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/HLTV/Director/src/public_amalgamation.cpp b/rehlds/HLTV/Director/src/public_amalgamation.cpp index 1fc308c..5047b3e 100644 --- a/rehlds/HLTV/Director/src/public_amalgamation.cpp +++ b/rehlds/HLTV/Director/src/public_amalgamation.cpp @@ -1,3 +1,4 @@ #include "precompiled.h" #include "interface.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 9d0a7e9..63f6126 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -2,21 +2,12 @@ cmake_minimum_required(VERSION 3.1) project(proxy CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-plt -fno-exceptions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") if (DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") @@ -24,7 +15,8 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") @@ -35,20 +27,26 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-write-strings -Wno-strict-aliasing") - if (USE_CLANG_COMPILER) + # Check Clang compiler + if ($ENV{CXX} MATCHES "clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt") + + # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -124,7 +122,9 @@ add_definitions( -D_snprintf=snprintf ) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN/.' -L${PROJECT_SOURCE_DIR}/../../lib/linux32") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ + -Wl,-rpath,'$ORIGIN/.' \ + -L${PROJECT_SOURCE_DIR}/../../lib/linux32") if (NOT TARGET bzip2) add_subdirectory(../../../dep/bzip2 lib) @@ -132,4 +132,9 @@ endif() add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS}) target_link_libraries(proxy dl m bzip2 steam_api) -set_target_properties(proxy PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) +set_target_properties(proxy PROPERTIES + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/HLTV/Proxy/src/public_amalgamation.cpp b/rehlds/HLTV/Proxy/src/public_amalgamation.cpp index 1fc308c..5047b3e 100644 --- a/rehlds/HLTV/Proxy/src/public_amalgamation.cpp +++ b/rehlds/HLTV/Proxy/src/public_amalgamation.cpp @@ -1,3 +1,4 @@ #include "precompiled.h" #include "interface.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/common/stdc++compat.cpp b/rehlds/common/stdc++compat.cpp index 363e440..1937b9b 100644 --- a/rehlds/common/stdc++compat.cpp +++ b/rehlds/common/stdc++compat.cpp @@ -1,15 +1,23 @@ #include +#include #if !defined(_WIN32) && !defined(BUILD_STATIC_LIBSTDC) // if build with static libstdc++ then ignore -void NORETURN Sys_Error(const char *error, ...); // This file adds the necessary compatibility tricks to avoid symbols with // version GLIBCXX_3.4.16 and bigger, keeping binary compatibility with libstdc++ 4.6.1. namespace std { + +#if __cpp_exceptions + logic_error::logic_error(const char *__arg) : exception(), _M_msg(__arg) {} + out_of_range::out_of_range(const char *__arg) : logic_error(__arg) {} + out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {} +#endif // #if __cpp_exceptions + // We shouldn't be throwing exceptions at all, but it sadly turns out we call STL (inline) functions that do. void __throw_out_of_range_fmt(const char *fmt, ...) { + #if __cpp_exceptions va_list ap; char buf[1024]; // That should be big enough. @@ -18,16 +26,43 @@ namespace std buf[sizeof(buf) - 1] = '\0'; va_end(ap); - Sys_Error(buf); + throw std::out_of_range(buf); + #else + abort(); + #endif } }; // namespace std -// Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, -// but that's equivalent, version-wise. Those calls are added by the compiler +// Was added in GCC 4.9 +// Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, but that's equivalent, version-wise. +// Those calls are added by the compiler // itself on `new Class[n]` calls. extern "C" void __cxa_throw_bad_array_new_length() { - Sys_Error("Bad array new length."); +#if __cpp_exceptions + throw std::bad_array_new_length(); +#else + abort(); +#endif } + +#if defined(__INTEL_COMPILER) && __cplusplus >= 201402L +// This operator delete sized deallocations was added in c++14 +// and required at least not less than CXXABI_1.3.9 +// we should to keep CXXABI_1.3.8 for binary compatibility with oldest libstdc++. +// GCC and Clang allow to compile C++14 code with -fno-sized-deallocation to disable the new feature, but ICC isn't allow +// so that our C++14 library code would never call that version of operator delete, +// for ICC compiler we must override those operators for static linking to the library. +void operator delete[](void *ptr, std::size_t size) noexcept +{ + ::operator delete(ptr); +} + +void operator delete(void *ptr, std::size_t size) noexcept +{ + ::operator delete(ptr); +} +#endif + #endif // !defined(_WIN32) diff --git a/rehlds/dedicated/CMakeLists.txt b/rehlds/dedicated/CMakeLists.txt index 1ee3e93..5c6675d 100644 --- a/rehlds/dedicated/CMakeLists.txt +++ b/rehlds/dedicated/CMakeLists.txt @@ -2,20 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(hlds CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") @@ -29,7 +19,8 @@ endif() set(CMAKE_EXE_LINKER_FLAGS "-no-pie -Wl,--no-export-dynamic") -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") @@ -40,15 +31,18 @@ if (USE_INTEL_COMPILER) else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result") - if (NOT USE_CLANG_COMPILER AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + # Check if not Clang compiler AND GCC >= 8.3 + if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -102,6 +96,18 @@ add_definitions( -D_vsnprintf=vsnprintf ) +if (NOT TARGET appversion) + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") +endif() + add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS}) +add_dependencies(hlds appversion) + target_link_libraries(hlds dl) -set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") +set_target_properties(hlds PROPERTIES + OUTPUT_NAME hlds_linux + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/dedicated/src/public_amalgamation.cpp b/rehlds/dedicated/src/public_amalgamation.cpp index 1fc308c..5047b3e 100644 --- a/rehlds/dedicated/src/public_amalgamation.cpp +++ b/rehlds/dedicated/src/public_amalgamation.cpp @@ -1,3 +1,4 @@ #include "precompiled.h" #include "interface.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt index 52f3a96..05302be 100644 --- a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -2,26 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(filesystem_stdio CXX) option(DEBUG "Build with debug information." OFF) -option(USE_INTEL_COMPILER "Use the Intel compiler." OFF) -option(USE_CLANG_COMPILER "Use the Clang compiler." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(WRAP_FUNCS_LIST - "scandir" "opendir" "freopen" "fopen" "fopen64" "open" "open64" "creat" - "access" "stat" "lstat" "__xstat" "__lxstat" "__xstat64" "__lxstat64" - "chmod" "chown" "lchown" "unlink" "symlink" "link" "mknod" "mount" - "mkfifo" "rename" "utime" "utimes" "mkdir" "rmdir" -) - -if (USE_INTEL_COMPILER) - set(CMAKE_C_COMPILER "/opt/intel/bin/icc") - set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc") -elseif (USE_CLANG_COMPILER) - set(CMAKE_C_COMPILER "/usr/bin/clang") - set(CMAKE_CXX_COMPILER "/usr/bin/clang++") -endif() +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") @@ -31,26 +15,38 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") endif() -if (USE_INTEL_COMPILER) +# Check Intel C++ compiler +if ($ENV{CXX} MATCHES "icpc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ - -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-variable -Wno-unused-function\ + -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-result -Wno-unused-function\ -Wno-write-strings -Wno-sign-compare") - if (NOT USE_CLANG_COMPILER AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + # Check if not Clang compiler AND GCC >= 8.3 + if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess") endif() endif() +# NOTE: Don't use IPO or LTO with '--wrap' may make this feature ineffective +set(WRAP_FUNCS_LIST + "scandir" "opendir" "freopen" "fopen" "fopen64" "open" "open64" "creat" + "access" "stat" "lstat" "__xstat" "__lxstat" "__xstat64" "__lxstat64" + "chmod" "chown" "lchown" "unlink" "symlink" "link" "mknod" "mount" + "mkfifo" "rename" "utime" "utimes" "mkdir" "rmdir" +) + foreach(f ${WRAP_FUNCS_LIST}) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-wrap,${f}") endforeach() +# GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") endif() @@ -94,5 +90,13 @@ add_definitions( ) add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS}) -set_target_properties(filesystem_stdio PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON) + +set_target_properties(filesystem_stdio PROPERTIES + LIBRARY_OUTPUT_NAME filesystem_stdio + PREFIX "" + COMPILE_FLAGS "-m32" + LINK_FLAGS "-m32" + POSITION_INDEPENDENT_CODE OFF +) + target_link_libraries(filesystem_stdio dl) diff --git a/rehlds/filesystem/FileSystem_Stdio/src/pathmatch.cpp b/rehlds/filesystem/FileSystem_Stdio/src/pathmatch.cpp index 9d4f722..20ff233 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/pathmatch.cpp +++ b/rehlds/filesystem/FileSystem_Stdio/src/pathmatch.cpp @@ -769,9 +769,9 @@ extern "C" { return __wrap_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); } - int __wrap_access(const char *pathname, int mode) + WRAP(access, int, const char *pathname, int mode) { - return __real_access(CWrap(pathname, false), mode); + return CALL(access)(CWrap(pathname, false), mode); } WRAP(stat, int, const char *path, struct stat *buf) diff --git a/rehlds/filesystem/FileSystem_Stdio/src/public_amalgamation.cpp b/rehlds/filesystem/FileSystem_Stdio/src/public_amalgamation.cpp index 1776bc6..6cc63ef 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/public_amalgamation.cpp +++ b/rehlds/filesystem/FileSystem_Stdio/src/public_amalgamation.cpp @@ -5,3 +5,4 @@ #include "tier0/dbg.cpp" #include "tier0/characterset.cpp" +#include "stdc++compat.cpp" diff --git a/rehlds/version/appversion.sh b/rehlds/version/appversion.sh index 0304798..caf5ede 100755 --- a/rehlds/version/appversion.sh +++ b/rehlds/version/appversion.sh @@ -3,9 +3,9 @@ init() { SOURCE_DIR=$@ - GIT_DIR=$SOURCE_DIR/.. - VERSION_FILE=$GIT_DIR/gradle.properties - APPVERSION_FILE=$SOURCE_DIR/version/appversion.h + GIT_DIR=$SOURCE_DIR + VERSION_FILE=$SOURCE_DIR/gradle.properties + APPVERSION_FILE=$SOURCE_DIR/rehlds/version/appversion.h if test -z "`git --version`"; then echo "Please install git client" diff --git a/rehlds/version/glibc_test.sh b/rehlds/version/glibc_test.sh index 2e67a90..8463a90 100755 --- a/rehlds/version/glibc_test.sh +++ b/rehlds/version/glibc_test.sh @@ -14,7 +14,15 @@ main() do : version=$(readelf -sV $f | sed -n 's/.*@'$k'_//p' | sort -u -V | tail -1 | cut -d ' ' -f 1) - if [[ ! -z "$version" ]]; then + + # version no present - skipped + if [[ -z "$version" ]]; then + version="UND" + # version is private - skipped + elif [ "$version" = "PRIVATE" ]; then + version="PRV" + # ensure numeric + elif [[ $version =~ ^[0-9]+$ ]]; then check_version_greater $version ${threshold_version[$k]} if [[ $? -eq 1 ]]; then echo -e "\033[0;31mAssertion failed:\033[0m Binary \033[0;32m${f}\033[0m has ${k}_\033[0;33m$version\033[0m greater than max version ${k}_\033[0;33m${threshold_version[$k]}\033[0m" @@ -23,7 +31,11 @@ main() fi done - echo -e "[\033[0;32mOK\033[0m] ${k}_\033[0;33m${threshold_version[$k]}\033[0m" + if [[ "$version" = "PRV" || "$version" = "UND" ]]; then + echo -e "[\033[0;90mSKIP\033[0m] \033[0;33m${version}\033[0m < ${k}_\033[0;33m${threshold_version[$k]}\033[0m" + else + echo -e "[\033[0;32mOK\033[0m] \033[0;33m${version}\033[0m < ${k}_\033[0;33m${threshold_version[$k]}\033[0m" + fi done } From c893651bf06393a1fef191981351a89c21cade8d Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 8 Apr 2021 05:04:42 +0700 Subject: [PATCH 30/61] Remove gradle & cleanup --- .gitignore | 5 - README.md | 79 ++-- build.gradle | 55 --- build.sh | 39 ++ buildSrc/build.gradle | 27 -- .../builder/FileSystemTreeBuilder.groovy | 58 --- .../dirsync/builder/FileTreeMerger.groovy | 60 --- .../dirsync/builder/PostBuildPass.groovy | 22 - .../dirsync/builder/ZipTreeBuilder.groovy | 53 --- .../dirsync/merger/FileTreeComparator.groovy | 97 ---- .../dirsync/merger/FileTreeDiffApplier.groovy | 103 ----- .../model/synccmd/AbstractSyncCmd.groovy | 4 - .../dirsync/model/synccmd/CopyDirCmd.groovy | 8 - .../dirsync/model/synccmd/CopyFileCmd.groovy | 9 - .../dirsync/model/synccmd/DeleteDirCmd.groovy | 7 - .../model/synccmd/DeleteFileCmd.groovy | 7 - .../model/synccmd/ReplaceFileCmd.groovy | 8 - .../model/tree/AbstractFileTreeNode.groovy | 27 -- .../dirsync/model/tree/DirectoryNode.groovy | 42 -- .../groovy/dirsync/model/tree/FSMapper.groovy | 50 --- .../groovy/dirsync/model/tree/FileNode.groovy | 8 - .../dirsync/model/tree/TreePhysMapper.groovy | 11 - .../groovy/dirsync/model/tree/ZipData.groovy | 9 - .../dirsync/model/tree/ZipTreeMapper.groovy | 72 --- .../gradlecpp/CppUnitTestExtension.groovy | 19 - .../groovy/gradlecpp/CppUnitTestPlugin.groovy | 256 ----------- .../gradlecpp/RehldsPlayTestPlugin.groovy | 17 - .../gradlecpp/RehldsPlayTestTask.groovy | 80 ---- .../groovy/gradlecpp/VelocityUtils.groovy | 34 -- .../teamcity/TeamCityIntegration.groovy | 84 ---- .../rehlds/testdemo/RehldsDemoRunner.groovy | 81 ---- .../rehlds/testdemo/RehldsTestInfo.groovy | 9 - .../rehlds/testdemo/RehldsTestParser.groovy | 63 --- .../src/main/groovy/versioning/GitInfo.groovy | 16 - .../groovy/versioning/GitVersioner.groovy | 126 ------ .../versioning/RehldsVersionInfo.groovy | 56 --- .../dirsync/builder/ZipTreeBuilderTest.groovy | 44 -- dep/bzip2/build.gradle | 79 ---- dep/cppunitlite/build.gradle | 64 --- flightrec/decoder/build.gradle | 35 -- flightrec/decoder/pub/decoder.bat | 47 -- flightrec/decoder/pub/extDecoders/.keep | 0 .../main/java/com/google/cloud/Crc32c.java | 156 ------- .../java/org/rehlds/flightrec/Consts.java | 14 - .../rehlds/AllocEntPrivateDataV1Decoder.java | 22 - .../rehlds/AllocEntPrivateDataV2Decoder.java | 22 - .../decoders/rehlds/FrameV1Decoder.java | 30 -- .../decoders/rehlds/FrameV2Decoder.java | 32 -- .../rehlds/FreeEntPrivateDataV1Decoder.java | 21 - .../decoders/rehlds/LogV1Decoder.java | 22 - .../decoders/rehlds/RehldsDecodersModule.java | 18 - .../flightrec/filescan/FileScanResult.java | 9 - .../filescan/FlightRecFileScanner.java | 100 ----- .../flightrec/filescan/HeaderScanResult.java | 17 - .../flightrec/logparser/DataHeader.java | 12 - .../flightrec/logparser/FlightLogParser.java | 179 -------- .../logparser/LogParsingException.java | 12 - .../flightrec/logparser/MetaHeader.java | 14 - .../flightrec/logparser/RecorderState.java | 16 - .../logtree/FlightLogTreeBuilder.java | 72 --- .../rehlds/flightrec/logtree/LogTreeNode.java | 21 - .../flightrec/logtree/LogTreeNodeComplex.java | 36 -- .../flightrec/logtree/LogTreeNodeLeaf.java | 20 - .../rehlds/flightrec/main/FlightRecorder.java | 230 ---------- .../org/rehlds/flightrec/main/RunConfig.java | 8 - .../textlogwriter/TextLogWriter.java | 185 -------- .../org/rehlds/flightrec/util/JarUtils.java | 31 -- .../logtree/FlightLogTreeBuilderTest.groovy | 181 -------- .../java/com/google/cloud/Crc32cTest.java | 43 -- flightrec/decoder_api/build.gradle | 74 --- .../flightrec/api/DecodedExtraData.java | 28 -- .../rehlds/flightrec/api/DecoderModule.java | 7 - .../rehlds/flightrec/api/EntranceKind.java | 7 - .../flightrec/api/FlightrecMessage.java | 35 -- .../flightrec/api/FlightrecMessageDef.java | 22 - .../flightrec/api/FlightrecMessageType.java | 49 -- .../rehlds/flightrec/api/ImmutablePair.java | 11 - .../rehlds/flightrec/api/MessageDecoder.java | 6 - .../flightrec/api/SimpleDecoderModule.java | 35 -- .../rehlds/flightrec/api/util/Globals.java | 8 - .../api/util/SizebufOverflowException.java | 10 - .../flightrec/api/util/UtilByteBuffer.java | 79 ---- .../flightrec/api/util/UtilSizeBuf.java | 159 ------- .../flightrec/util/UtilByteBufferTest.java | 127 ------ getucrtinfo.bat | 4 - gradle.properties | 3 - gradle/wrapper/gradle-wrapper.jar | Bin 52279 -> 0 bytes gradle/wrapper/gradle-wrapper.properties | 6 - gradlew | 164 ------- gradlew.bat | 90 ---- publish.gradle | 186 -------- rehlds/HLTV/Console/build.gradle | 173 ------- rehlds/HLTV/Console/msvc/PreBuild.bat | 8 - rehlds/HLTV/Core/build.gradle | 186 -------- rehlds/HLTV/DemoPlayer/build.gradle | 171 ------- rehlds/HLTV/Director/build.gradle | 171 ------- rehlds/HLTV/Proxy/build.gradle | 198 -------- rehlds/HLTV/README.md | 10 - rehlds/HLTV/build.gradle | 13 - rehlds/build.gradle | 425 ------------------ rehlds/dedicated/README.md | 12 - rehlds/dedicated/build.gradle | 173 ------- .../filesystem/FileSystem_Stdio/build.gradle | 158 ------- rehlds/filesystem/build.gradle | 5 - rehlds/msvc/PreBuild.bat | 8 - rehlds/version/appversion.sh | 8 +- rehlds/version/appversion.vm | 18 - rehlds/version/version.cpp | 10 - rehlds/version/version.h | 10 + settings.gradle | 8 - shared.gradle | 36 -- shared_gcc.gradle | 71 --- shared_icc.gradle | 75 ---- shared_msvc.gradle | 140 ------ 114 files changed, 90 insertions(+), 6600 deletions(-) delete mode 100644 build.gradle create mode 100755 build.sh delete mode 100644 buildSrc/build.gradle delete mode 100644 buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy delete mode 100644 buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy delete mode 100644 buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy delete mode 100644 buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestTask.groovy delete mode 100644 buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy delete mode 100644 buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy delete mode 100644 buildSrc/src/main/groovy/rehlds/testdemo/RehldsDemoRunner.groovy delete mode 100644 buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestInfo.groovy delete mode 100644 buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestParser.groovy delete mode 100644 buildSrc/src/main/groovy/versioning/GitInfo.groovy delete mode 100644 buildSrc/src/main/groovy/versioning/GitVersioner.groovy delete mode 100644 buildSrc/src/main/groovy/versioning/RehldsVersionInfo.groovy delete mode 100644 buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy delete mode 100644 dep/bzip2/build.gradle delete mode 100644 dep/cppunitlite/build.gradle delete mode 100644 flightrec/decoder/build.gradle delete mode 100644 flightrec/decoder/pub/decoder.bat delete mode 100644 flightrec/decoder/pub/extDecoders/.keep delete mode 100644 flightrec/decoder/src/main/java/com/google/cloud/Crc32c.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/Consts.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV1Decoder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV2Decoder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV1Decoder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV2Decoder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FreeEntPrivateDataV1Decoder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/LogV1Decoder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/RehldsDecodersModule.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FileScanResult.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FlightRecFileScanner.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/HeaderScanResult.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/DataHeader.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/FlightLogParser.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/LogParsingException.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/MetaHeader.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/RecorderState.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/FlightLogTreeBuilder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNode.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeComplex.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeLeaf.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/main/FlightRecorder.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/main/RunConfig.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/textlogwriter/TextLogWriter.java delete mode 100644 flightrec/decoder/src/main/java/org/rehlds/flightrec/util/JarUtils.java delete mode 100644 flightrec/decoder/src/test/groovy/org/rehlds/flightrec/logtree/FlightLogTreeBuilderTest.groovy delete mode 100644 flightrec/decoder/src/test/java/com/google/cloud/Crc32cTest.java delete mode 100644 flightrec/decoder_api/build.gradle delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecodedExtraData.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecoderModule.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/EntranceKind.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessage.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageDef.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageType.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/ImmutablePair.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/MessageDecoder.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/SimpleDecoderModule.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/Globals.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/SizebufOverflowException.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilByteBuffer.java delete mode 100644 flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilSizeBuf.java delete mode 100644 flightrec/decoder_api/src/test/java/org/rehlds/flightrec/util/UtilByteBufferTest.java delete mode 100644 getucrtinfo.bat delete mode 100644 gradle.properties delete mode 100644 gradle/wrapper/gradle-wrapper.jar delete mode 100644 gradle/wrapper/gradle-wrapper.properties delete mode 100755 gradlew delete mode 100644 gradlew.bat delete mode 100644 publish.gradle delete mode 100644 rehlds/HLTV/Console/build.gradle delete mode 100644 rehlds/HLTV/Core/build.gradle delete mode 100644 rehlds/HLTV/DemoPlayer/build.gradle delete mode 100644 rehlds/HLTV/Director/build.gradle delete mode 100644 rehlds/HLTV/Proxy/build.gradle delete mode 100644 rehlds/HLTV/build.gradle delete mode 100644 rehlds/build.gradle delete mode 100644 rehlds/dedicated/build.gradle delete mode 100644 rehlds/filesystem/FileSystem_Stdio/build.gradle delete mode 100644 rehlds/filesystem/build.gradle delete mode 100644 rehlds/version/appversion.vm delete mode 100644 rehlds/version/version.cpp create mode 100644 rehlds/version/version.h delete mode 100644 settings.gradle delete mode 100644 shared.gradle delete mode 100644 shared_gcc.gradle delete mode 100644 shared_icc.gradle delete mode 100644 shared_msvc.gradle diff --git a/.gitignore b/.gitignore index 574a0f2..78329c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ **/build -**/.gradle -.idea *.iml *.bat *.log @@ -21,6 +19,3 @@ **/msvc/ipch rehlds/version/appversion.h -rehlds/_rehldsTestImg -rehlds/_dev -publish diff --git a/README.md b/README.md index b2a1e90..eb8fb4f 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' ## Configuring Bugfixed version of rehlds contains an additional cvars: + +

    +Click to expand +
    • listipcfgfile // File for permanent ip bans. Default: listip.cfg
    • syserror_logfile // File for the system error log. Default: sys_error.log @@ -57,64 +61,55 @@ Bugfixed version of rehlds contains an additional cvars:
    • sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist.
    +
    + ## Commands -Bugfixed version of rehlds contains an additional commands: +Bugfixed version of rehlds contains an additional commands
    • rescount // Prints the total count of precached resources in the server console
    • reslist <sound | model | decal | generic | event> // Separately prints the details of the precached resources for sounds, models, decals, generic and events in server console. Useful for managing resources and dealing with the goldsource precache limits.
    ## Build instructions -There are several software requirements for building rehlds: -
      -
    1. Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
    2. -
    3. For Windows: Visual Studio 2013 and later
    4. -
    5. For Linux: Intel C++ Compiler 13 and later or GCC 4.9.2 or later (some earlier versions might work too)
    6. -
    - ### Checking requirements -#### JDK version -Windows
    > %JAVA_HOME%\bin\javac -version
    -javac 1.8.0_25
    +There are several software requirements for building rehlds:
    +
    +#### Windows
    +
    +Visual Studio 2013 and later
     
    -Linux -
    $ javac -version
    -javac 1.7.0_65
    -
    - -#### Visual Studio -Help -> About - -#### ICC -
    $ icc --version
    -icc (ICC) 15.0.1 20141023
    -
    - -#### GCC -
    $ gcc --version
    -gcc (Debian 4.9.2-10) 4.9.2
    +#### Linux
    +
    +cmake >= 3.10
    +GCC >= 4.9.2 (Optional)
    +ICC >= 15.0.1 20141023 (Optional)
    +LLVM (Clang) >= 6.0 (Optional)
     
    ### Building -On Windows: -
    gradlew --max-workers=1 clean buildRelease
    -* For faster building without unit tests use this:exclamation: -
    gradlew --max-workers=1 clean buildFixes
    -NOTE: You can also use `Visual Studio` to build, just select from the solution configurations list `Release Swds` or `Debug Swds`
    -On Linux (ICC): -
    ./gradlew --max-workers=1 clean buildRelease
    -* For faster building without unit tests use this:exclamation: -
    ./gradlew --max-workers=1 clean buildFixes
    +#### Windows +Use `Visual Studio` to build, open `msvc/ReHLDS.sln` and just select from the solution configurations list `Release Swds` or `Debug Swds` -On Linux (GCC): -
    ./gradlew --max-workers=1 -PuseGcc clean buildRelease
    -* For faster building without unit tests use this:exclamation: -
    ./gradlew --max-workers=1 -PuseGcc clean buildFixes
    +#### Linux -Also there is a task `buildEngine`, it builds only engine, without other parts of the project.
    -Compiled binaries will be placed in the rehlds/build/binaries/ directory +
      +
    • +ICC: +
      ./build.sh --compiler=intel
      +
    • + +
    • +LLVM (Clang): +
      ./build.sh --compiler=clang
      +
    • + +
    • +GCC: +
      ./build.sh --compiler=gcc
      +
    • +
    ## How can I help the project? Just install it on your game server and report problems you faced. diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 4ac20c5..0000000 --- a/build.gradle +++ /dev/null @@ -1,55 +0,0 @@ -import versioning.GitVersioner -import versioning.RehldsVersionInfo -import org.joda.time.DateTime - -apply plugin: 'maven-publish' -apply from: 'shared.gradle' -group = 'rehlds' - -apply plugin: 'idea' - -idea { - project { - languageLevel = 'JDK_1_7' - } -} - -def gitInfo = GitVersioner.versionForDir(project.rootDir) -RehldsVersionInfo versionInfo -if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') { - def m = gitInfo.tag =~ /^v(\d+)\.(\d+)(\.(\d+))?$/ - if (!m.find()) { - throw new RuntimeException("Invalid git version tag name ${gitInfo.tag}") - } - - versionInfo = new RehldsVersionInfo( - majorVersion: m.group(1) as int, - minorVersion: m.group(2) as int, - maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, - localChanges: gitInfo.localChanges, - commitDate: gitInfo.commitDate, - commitSHA: gitInfo.commitSHA, - commitURL: gitInfo.commitURL - ) -} else { - versionInfo = new RehldsVersionInfo( - majorVersion: project.majorVersion as int, - minorVersion: project.minorVersion as int, - maintenanceVersion: project.maintenanceVersion as int, - suffix: 'dev', - localChanges: gitInfo ? gitInfo.localChanges : true, - commitDate: gitInfo ? gitInfo.commitDate : new DateTime(), - commitSHA: gitInfo ? gitInfo.commitSHA : "", - commitURL: gitInfo ? gitInfo.commitURL : "", - commitCount: gitInfo ? (gitInfo.commitCount as int) : null - ) -} - -project.ext.rehldsVersionInfo = versionInfo -project.version = versionInfo.asMavenVersion() - -apply from: 'publish.gradle' - -task wrapper(type: Wrapper) { - gradleVersion = '2.4' -} diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b891edd --- /dev/null +++ b/build.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +CC=gcc +CXX=g++ + +n=0 +args=() +for i in "$@" +do +case $i in + -j=*|--jobs=*) + jobs="${i#*=}" + shift + ;; + -c=*|--compiler=*) + C="${i#*=}" + shift + ;; + *) + args[$n]="$i" + ((++n)) + ;; +esac +done + +case "$C" in + ("intel"|"icc") CC=icc CXX=icpc ;; + ("gcc") CC=gcc CXX=g++ ;; + ("clang") CC=clang CXX=clang++ ;; + *) + ;; +esac + +rm -rf build +mkdir build +pushd build +CC=$CC CXX=$CXX cmake ${args[@]} .. +make -j${jobs} +popd diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index e206d80..0000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: 'groovy' - -repositories { - //mavenLocal() - mavenCentral() - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/' - } - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/' - } - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/' - } -} - -dependencies { - compile gradleApi() - compile localGroovy() - compile 'commons-io:commons-io:2.4' - compile 'commons-lang:commons-lang:2.6' - compile 'joda-time:joda-time:2.7' - - compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2' - compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r' - compile 'org.apache.velocity:velocity:1.7' -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy b/buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy deleted file mode 100644 index dad66d7..0000000 --- a/buildSrc/src/main/groovy/dirsync/builder/FileSystemTreeBuilder.groovy +++ /dev/null @@ -1,58 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import groovy.transform.CompileStatic - -class FileSystemTreeBuilder { - - @CompileStatic - private static FileNode buildNodeForFile(File file, DirectoryNode parent) { - if (parent.getChildren(file.name)) { - throw new RuntimeException("Parent dir ${parent.name} already contains child node ${file.name}"); - } - - return new FileNode( - name: file.name, - lastModifiedDate: file.lastModified(), - data: file, - parent: parent, - size: file.size() - ); - } - - @CompileStatic - private static DirectoryNode buildNodeForDirectoryRecursive(File dir, DirectoryNode parent) { - if (!dir.isDirectory()) { - throw new RuntimeException("File ${dir.absolutePath} is not a directory") - } - - if (parent != null && parent.getChildren(dir.name)) { - throw new RuntimeException("Parent dir ${parent.name} already contains child node ${dir.name}"); - } - - DirectoryNode thisNode = new DirectoryNode( - name: dir.name, - lastModifiedDate: dir.lastModified(), - data: dir, - parent: parent - ); - - dir.eachFile { File f -> - if (f.isDirectory()) { - thisNode.childNodes[f.name] = buildNodeForDirectoryRecursive(f, thisNode) - } else { - thisNode.childNodes[f.name] = buildNodeForFile(f, thisNode) - } - } - - return thisNode; - } - - static DirectoryNode buildFileSystemTree(File rootDir) { - def root = buildNodeForDirectoryRecursive(rootDir, null); - PostBuildPass.doPostBuild(root) - - return root - } -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy b/buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy deleted file mode 100644 index 9251e2f..0000000 --- a/buildSrc/src/main/groovy/dirsync/builder/FileTreeMerger.groovy +++ /dev/null @@ -1,60 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode - -class FileTreeMerger { - - private static void mergeContentsRecursive(DirectoryNode newParent, DirectoryNode toMerge) { - toMerge.childNodes.each { cn -> - def node = cn.value - def existingNode = newParent.childNodes[node.name] - if (existingNode) { - if (!(existingNode instanceof DirectoryNode) || !(node instanceof DirectoryNode)) - throw new RuntimeException("Failed to merge non-directory nodes ${node.fullPath}") - - def existingDirNode = existingNode as DirectoryNode - def dirNode = node as DirectoryNode - - existingDirNode.lastModifiedDate = Math.max(existingDirNode.lastModifiedDate, dirNode.lastModifiedDate) - mergeContentsRecursive(existingDirNode, dirNode) - } else { - if (node instanceof DirectoryNode) { - def dirNode = node as DirectoryNode - def newNode = new DirectoryNode( - name: dirNode.name, - data: dirNode.data, - parent: newParent, - lastModifiedDate: dirNode.lastModifiedDate - ) - newParent.childNodes[node.name] = newNode - - mergeContentsRecursive(newNode, dirNode) - } else { - FileNode fileNode = node as FileNode - FileNode newNode = new FileNode( - name: fileNode.name, - data: fileNode.data, - parent: newParent, - lastModifiedDate: fileNode.lastModifiedDate, - size: fileNode.size - ) - - newParent.childNodes[node.name] = newNode - } - } - } - } - - public static DirectoryNode mergeTrees(DirectoryNode tree1, DirectoryNode tree2) { - DirectoryNode newRoot = new DirectoryNode( - name: tree1.name ?: tree2.name - ) - - mergeContentsRecursive(newRoot, tree1) - mergeContentsRecursive(newRoot, tree2) - PostBuildPass.doPostBuild(newRoot) - - return newRoot - } -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy b/buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy deleted file mode 100644 index 6dc41aa..0000000 --- a/buildSrc/src/main/groovy/dirsync/builder/PostBuildPass.groovy +++ /dev/null @@ -1,22 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode - -class PostBuildPass { - - private static void postProcessRecursive(DirectoryNode dir) { - dir.childNodes.each { cne -> - def childNode = cne.value - childNode.fullPath = dir.fullPath ? dir.fullPath + '/' + childNode.name : childNode.name - if (childNode instanceof DirectoryNode) { - def childDirNode = childNode as DirectoryNode - postProcessRecursive(childDirNode) - } - } - } - - static void doPostBuild(DirectoryNode root) { - root.fullPath = '' - postProcessRecursive(root) - } -} diff --git a/buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy b/buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy deleted file mode 100644 index 94e6ffe..0000000 --- a/buildSrc/src/main/groovy/dirsync/builder/ZipTreeBuilder.groovy +++ /dev/null @@ -1,53 +0,0 @@ -package dirsync.builder - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import dirsync.model.tree.ZipData - -import java.util.zip.ZipFile - -class ZipTreeBuilder { - static DirectoryNode buildForZipArchive(String zipArchive, ZipFile zf) { - DirectoryNode root = new DirectoryNode<>() - - zf.entries().each { ze -> - def path = ze.name.replace('\\', '/') - if (path.endsWith('/')) - path = path.substring(0, path.length() - 1) - - def parentPath = path.contains('/') ? path.substring(0, path.lastIndexOf('/')) : '' - def childPath = path.contains('/') ? path.substring(path.lastIndexOf('/') + 1) : path - - def parentNode = (DirectoryNode) root.getByPath(parentPath) - if (parentNode == null) - throw new RuntimeException("Error reading ${zipArchive}: could not find parent path ${parentPath} for path ${path}") - - def childNode = parentNode.getChildren(childPath) - if (childNode) - throw new RuntimeException("Error reading ${zipArchive}: duplicate path ${path}") - - if (ze.directory) { - childNode = new DirectoryNode( - name: childPath, - lastModifiedDate: ze.time, - data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive), - parent: parentNode - ); - } else { - childNode = new FileNode( - name: childPath, - lastModifiedDate: ze.time, - data: new ZipData(zipEntryName: ze.name, zipArchiveName: zipArchive), - parent: parentNode, - size: ze.size - ); - } - parentNode.childNodes[childPath] = childNode - - //println '' + ze.directory + ' ' + ze.name + ' ' + parentPath + ' ' + childPath - } - - PostBuildPass.doPostBuild(root) - return root - } -} diff --git a/buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy b/buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy deleted file mode 100644 index 89b0c76..0000000 --- a/buildSrc/src/main/groovy/dirsync/merger/FileTreeComparator.groovy +++ /dev/null @@ -1,97 +0,0 @@ -package dirsync.merger - -import dirsync.model.synccmd.AbstractSyncCmd -import dirsync.model.synccmd.CopyDirCmd -import dirsync.model.synccmd.CopyFileCmd -import dirsync.model.synccmd.DeleteDirCmd -import dirsync.model.synccmd.DeleteFileCmd -import dirsync.model.synccmd.ReplaceFileCmd -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import groovy.transform.TypeChecked - -@TypeChecked -class FileTreeComparator { - - private static void mergeDirsRecursive(DirectoryNode left, DirectoryNode right, List> diffs) { - - // left => right - left.childNodes.each { le -> - def leftNode = le.value - def rightNode = right.childNodes[leftNode.name] - - if (rightNode == null) { - switch (leftNode) { - case DirectoryNode: - def leftDirNode = leftNode as DirectoryNode - diffs << new CopyDirCmd<>(src: leftDirNode, dstParentDir: right) - break - - case FileNode: - def leftFileNode = leftNode as FileNode - diffs << new CopyFileCmd<>(src: leftFileNode, dstDir: right) - break - - default: - throw new RuntimeException("Invalid node class ${leftNode.class.name}") - } - - return - } - - if (rightNode.class != leftNode.class) { - throw new RuntimeException("node classes mismatch: ${leftNode.class.name} != ${rightNode.class.name}") - } - - switch (rightNode) { - case DirectoryNode: - def leftDirNode = leftNode as DirectoryNode - def rightDirNode = rightNode as DirectoryNode - mergeDirsRecursive(leftDirNode, rightDirNode, diffs) - break - - case FileNode: - def leftFileNode = leftNode as FileNode - def rightFileNode = rightNode as FileNode - if (leftFileNode.size != rightFileNode.size || leftFileNode.lastModifiedDate != rightFileNode.lastModifiedDate) { - diffs << new ReplaceFileCmd<>(src: leftFileNode, dst: rightFileNode) - } - break - - default: - throw new RuntimeException("Invalid node class ${rightNode.class.name}") - } - } // ~left => right - - //right => left - right.childNodes.each { re -> - def rightNode = re.value - def leftNode = left.childNodes[rightNode.name] - - if (leftNode != null) { - return //already processed in left => right - } - - switch (rightNode) { - case DirectoryNode: - def rightDirNode = rightNode as DirectoryNode - diffs << new DeleteDirCmd<>(dirNode: rightDirNode) - break - - case FileNode: - def rightFileNode = rightNode as FileNode - diffs << new DeleteFileCmd<>(node: rightFileNode) - break - - default: - throw new RuntimeException("Invalid node class ${rightNode.class.name}") - } - } // ~right => left - } - - static List> mergeTrees(DirectoryNode leftRoot, DirectoryNode rightRoot) { - List> res = [] - mergeDirsRecursive(leftRoot, rightRoot, res) - return res - } -} diff --git a/buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy b/buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy deleted file mode 100644 index 59fe4b6..0000000 --- a/buildSrc/src/main/groovy/dirsync/merger/FileTreeDiffApplier.groovy +++ /dev/null @@ -1,103 +0,0 @@ -package dirsync.merger - -import dirsync.model.synccmd.AbstractSyncCmd -import dirsync.model.synccmd.CopyDirCmd -import dirsync.model.synccmd.CopyFileCmd -import dirsync.model.synccmd.DeleteDirCmd -import dirsync.model.synccmd.DeleteFileCmd -import dirsync.model.synccmd.ReplaceFileCmd -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode -import dirsync.model.tree.TreePhysMapper -import groovy.transform.TypeChecked -import org.apache.commons.io.IOUtils - -@TypeChecked -public class FileTreeDiffApplier { - - static void copyDirRecursive(DirectoryNode src, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.createDirectory(src.fullPath) - src.childNodes.each { ce -> - def childNode = ce.value - def childPath = childNode.fullPath - switch (childNode) { - case FileNode: - srcMapper.fileContent(childNode.data).withStream { InputStream inStream -> - dstMapper.createFile(childPath).withStream { OutputStream outStream -> - IOUtils.copy(inStream, outStream) - } - - dstMapper.setFileLastUpdatedDate(childPath, childNode.lastModifiedDate) - } - break; - - case DirectoryNode: - copyDirRecursive(childNode as DirectoryNode, srcMapper, dstMapper) - break; - - default: - throw new RuntimeException("Invalid node class: ${childNode.class.name}") - } - } - } - - static void handleCopyFile(CopyFileCmd fileCopy, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - def dstPath = fileCopy.dstDir.fullPath ? fileCopy.dstDir.fullPath + '/' + fileCopy.src.name : fileCopy.src.name - srcMapper.fileContent(fileCopy.src.data).withStream { InputStream inStream -> - dstMapper.createFile(dstPath).withStream { OutputStream outStream -> - IOUtils.copy(inStream, outStream) - } - - dstMapper.setFileLastUpdatedDate(dstPath, fileCopy.src.lastModifiedDate) - } - } - - static void handleDeleteDir(DeleteDirCmd delDir, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.removeDirectory(delDir.dirNode.fullPath) - } - - static void handleDeleteFile(DeleteFileCmd delFile, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.removeFile(delFile.node.fullPath) - } - - static void handleReplaceFile(ReplaceFileCmd replaceFile, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - dstMapper.removeFile(replaceFile.dst.fullPath) - srcMapper.fileContent(replaceFile.src.data).withStream { InputStream inStream -> - dstMapper.createFile(replaceFile.dst.fullPath).withStream { OutputStream outStream -> - IOUtils.copy(inStream, outStream) - } - - dstMapper.setFileLastUpdatedDate(replaceFile.dst.fullPath, replaceFile.src.lastModifiedDate) - } - } - - static void applyDiffs(List> diffs, TreePhysMapper srcMapper, TreePhysMapper dstMapper) { - diffs.each { diff -> - switch (diff) { - case CopyDirCmd: - def copyDir = diff as CopyDirCmd - copyDirRecursive(copyDir.src, srcMapper, dstMapper) - break - - case CopyFileCmd: - handleCopyFile(diff as CopyFileCmd, srcMapper, dstMapper) - break - - case DeleteDirCmd: - handleDeleteDir(diff as DeleteDirCmd, srcMapper, dstMapper) - break - - case DeleteFileCmd: - handleDeleteFile(diff as DeleteFileCmd, srcMapper, dstMapper) - break - - case ReplaceFileCmd: - handleReplaceFile(diff as ReplaceFileCmd, srcMapper, dstMapper) - break - - default: - throw new RuntimeException("Invalid diff command ${diff.class.name}") - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy deleted file mode 100644 index 6351762..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/AbstractSyncCmd.groovy +++ /dev/null @@ -1,4 +0,0 @@ -package dirsync.model.synccmd - -class AbstractSyncCmd { -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy deleted file mode 100644 index bead311..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyDirCmd.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.DirectoryNode - -class CopyDirCmd extends AbstractSyncCmd { - DirectoryNode src - DirectoryNode dstParentDir -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy deleted file mode 100644 index 2f25866..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/CopyFileCmd.groovy +++ /dev/null @@ -1,9 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FileNode - -class CopyFileCmd extends AbstractSyncCmd { - FileNode src - DirectoryNode dstDir -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy deleted file mode 100644 index 2103c7a..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteDirCmd.groovy +++ /dev/null @@ -1,7 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.DirectoryNode - -class DeleteDirCmd extends AbstractSyncCmd { - DirectoryNode dirNode -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy deleted file mode 100644 index 66a87e2..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/DeleteFileCmd.groovy +++ /dev/null @@ -1,7 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.FileNode - -class DeleteFileCmd extends AbstractSyncCmd { - FileNode node -} diff --git a/buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy b/buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy deleted file mode 100644 index 3da6dd0..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/synccmd/ReplaceFileCmd.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package dirsync.model.synccmd - -import dirsync.model.tree.FileNode - -class ReplaceFileCmd extends AbstractSyncCmd { - FileNode src - FileNode dst -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy deleted file mode 100644 index 68ae342..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/AbstractFileTreeNode.groovy +++ /dev/null @@ -1,27 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -abstract class AbstractFileTreeNode { - DirectoryNode parent - String name - String fullPath - long lastModifiedDate - T data - - boolean equals(o) { - if (this.is(o)) return true - if (getClass() != o.class) return false - - AbstractFileTreeNode that = (AbstractFileTreeNode) o - - if (name != that.name) return false - - return true - } - - int hashCode() { - return (name != null ? name.hashCode() : 0) - } -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy deleted file mode 100644 index 2062c1d..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/DirectoryNode.groovy +++ /dev/null @@ -1,42 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -class DirectoryNode extends AbstractFileTreeNode { - Map> childNodes = new HashMap<>() - - AbstractFileTreeNode getChildren(String name) { - return childNodes[name]; - } - - AbstractFileTreeNode getChildren(String[] names, int idx) { - if (idx == names.length) - return this - - AbstractFileTreeNode c = childNodes[names[idx]] - if (c == null) - return null - - if (c instanceof DirectoryNode) { - def d = (DirectoryNode) c; - return d.getChildren(names, idx + 1) - } - - return null; - } - - AbstractFileTreeNode getByPath(String path) { - path = path.replace('\\', '/') - if (path.endsWith('/')) - path = path.substring(0, path.length() - 1) - - if (path.empty) { - return this - } - - String[] components = path.split('/') - return getChildren(components, 0) - } - -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy deleted file mode 100644 index 95cf3c0..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/FSMapper.groovy +++ /dev/null @@ -1,50 +0,0 @@ -package dirsync.model.tree - -class FSMapper extends TreePhysMapper { - final File root - - FSMapper(File root) { - this.root = root - } - - @Override - InputStream fileContent(File file) { - return file.newDataInputStream() - } - - @Override - void createDirectory(String dir) { - def target = new File(root, dir) - if (!target.mkdirs()) { - throw new RuntimeException("Failed to create directory ${target.absolutePath}") - } - } - - @Override - void removeDirectory(String dir) { - def target = new File(root, dir) - if (!target.deleteDir()) { - throw new RuntimeException("Failed to delete directory ${target.absolutePath}") - } - } - - @Override - void removeFile(String path) { - def target = new File(root, path) - if (!target.delete()) { - throw new RuntimeException("Failed to delete file ${target.absolutePath}") - } - } - - @Override - OutputStream createFile(String path) { - def target = new File(root, path) - return target.newOutputStream() - } - - @Override - void setFileLastUpdatedDate(String path, long date) { - def target = new File(root, path) - target.setLastModified(date) - } -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy deleted file mode 100644 index d34591e..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/FileNode.groovy +++ /dev/null @@ -1,8 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -class FileNode extends AbstractFileTreeNode { - long size -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy deleted file mode 100644 index 2c60d66..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/TreePhysMapper.groovy +++ /dev/null @@ -1,11 +0,0 @@ -package dirsync.model.tree - -abstract class TreePhysMapper { - abstract InputStream fileContent(T file) - abstract void createDirectory(String dir) - abstract void removeDirectory(String dir) - abstract void removeFile(String path) - abstract OutputStream createFile(String path) - - abstract void setFileLastUpdatedDate(String path, long date) -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy deleted file mode 100644 index 6e89d34..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/ZipData.groovy +++ /dev/null @@ -1,9 +0,0 @@ -package dirsync.model.tree - -import groovy.transform.CompileStatic - -@CompileStatic -class ZipData { - String zipEntryName - String zipArchiveName -} diff --git a/buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy b/buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy deleted file mode 100644 index 9b0126c..0000000 --- a/buildSrc/src/main/groovy/dirsync/model/tree/ZipTreeMapper.groovy +++ /dev/null @@ -1,72 +0,0 @@ -package dirsync.model.tree - -import dirsync.builder.FileTreeMerger -import dirsync.builder.ZipTreeBuilder -import sun.reflect.generics.reflectiveObjects.NotImplementedException - -import java.util.zip.ZipFile - -public class ZipTreeMapper extends TreePhysMapper implements Closeable { - Map zipArchives = [:] - - void addZipArchive(String zipArchive) { - zipArchives[zipArchive] = new ZipFile(zipArchive) - } - - DirectoryNode buildFileTree() { - def root = new DirectoryNode() - zipArchives.each { ze -> - def zipTree = ZipTreeBuilder.buildForZipArchive(ze.key, ze.value) - root = FileTreeMerger.mergeTrees(root, zipTree) - } - - return root - } - - @Override - void close() throws IOException { - zipArchives.each { ze -> - try { ze.value.close() } catch (Exception ignored) { } - } - } - - @Override - InputStream fileContent(ZipData file) { - def archive = zipArchives[file.zipArchiveName] - if (!archive) { - throw new RuntimeException("Archive ${file.zipArchiveName} is not loaded"); - } - - def zipEntry = archive.getEntry(file.zipEntryName) - if (!zipEntry) { - throw new RuntimeException("File ${file.zipEntryName} not found in archive ${file.zipArchiveName}"); - } - - return archive.getInputStream(zipEntry) - } - - @Override - void createDirectory(String dir) { - throw new NotImplementedException() - } - - @Override - void removeDirectory(String dir) { - throw new NotImplementedException() - } - - @Override - void removeFile(String path) { - throw new NotImplementedException() - } - - @Override - OutputStream createFile(String path) { - throw new NotImplementedException() - } - - @Override - void setFileLastUpdatedDate(String path, long date) { - throw new NotImplementedException() - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy b/buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy deleted file mode 100644 index fe94d87..0000000 --- a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestExtension.groovy +++ /dev/null @@ -1,19 +0,0 @@ -package gradlecpp - -import org.gradle.api.Project -import org.gradle.nativeplatform.NativeBinarySpec - -class CppUnitTestExtension { - Project _project - - CppUnitTestExtension(Project p) { - _project = p - } - - void eachTestExecutable(Closure action) { - _project.binaries.each { NativeBinarySpec bin -> - if (!bin.hasProperty('cppUnitTestsExecutable')) return - action(bin) - } - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy b/buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy deleted file mode 100644 index 3616c90..0000000 --- a/buildSrc/src/main/groovy/gradlecpp/CppUnitTestPlugin.groovy +++ /dev/null @@ -1,256 +0,0 @@ -package gradlecpp - -import gradlecpp.teamcity.TeamCityIntegration -import org.gradle.api.Action -import org.gradle.api.GradleException -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.internal.project.AbstractProject -import org.gradle.model.internal.core.DirectNodeModelAction -import org.gradle.model.internal.core.ModelActionRole -import org.gradle.model.internal.core.ModelPath -import org.gradle.model.internal.core.ModelReference -import org.gradle.model.internal.core.MutableModelNode -import org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor -import org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor -import org.gradle.model.internal.registry.ModelRegistry -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.internal.AbstractNativeBinarySpec - -import org.doomedsociety.gradlecpp.GradleCppUtils - -class CppUnitTestPlugin implements Plugin { - - private static class TestExecStatus { - boolean successful - boolean warning - int exitCode - String output - long durationMsec - String cmdLine - String execDir - } - - static void onBinariesCreated(Project p, String desc, Closure action) { - ModelRegistry mr = (p as AbstractProject).getModelRegistry() - def modelPath = ModelPath.path("binaries") - ModelRuleDescriptor ruleDescriptor = new SimpleModelRuleDescriptor(desc); - - mr.configure(ModelActionRole.Finalize, DirectNodeModelAction.of(ModelReference.of(modelPath), ruleDescriptor, new Action() { - @Override - void execute(MutableModelNode node) { - action() - } - })) - } - - @Override - void apply(Project project) { - project.extensions.create('cppUnitTest', CppUnitTestExtension, project) - onBinariesCreated(project, 'CppUnitTestPlugin::AttachUnitTest', { - processCppUnitTests(project) - }) - } - - - - /** - * Attaches test tasks to C/C++ libraries build tasks - */ - static void processCppUnitTests(Project p) { - //println "processCppUnitTests::afterEvaluate on ${p.name}: project type is ${p.projectType}" - - p.binaries.all { NativeBinarySpec bin -> - if (!(bin.component instanceof NativeLibrarySpec)) { - return - } - - def testComponentName = bin.component.name + '_tests' - Collection testCandidates = p.binaries.matching { it.component.name == testComponentName && bin.buildType == it.buildType && bin.flavor == it.flavor } - if (testCandidates.size() > 1) { - throw new GradleException("Found >1 test candidates for library ${bin.component.name} in project ${p}: ${testCandidates}") - } else if (!testCandidates.empty) { - def testBinary = testCandidates.first() - GradleCppUtils.onTasksCreated(p, 'CppUnitTestPlugin::AttachUnitTestTask', { - attachTestTaskToCppLibrary(bin, testBinary) - }) - String testTaskName = bin.namingScheme.getTaskName('unitTest') - bin.ext.cppUnitTestTask = testTaskName - } else { - throw new GradleException("No tests found for library ${bin.component.name} in project ${p}") - } - } - - } - - static TestExecStatus runTestExecutable(NativeBinarySpec testSubject, String executable, List params, String phase, int timeout) { - def execFile = new File(executable) - def outDir = new File(testSubject.buildTask.project.buildDir, "tests/${testSubject.name}/run") - outDir.mkdirs() - - def outPath = new File(outDir, "${phase}.log") - - def cmdParams = []; - cmdParams << execFile.absolutePath - cmdParams.addAll(params) - - def execDir = execFile.parentFile - def pb = new ProcessBuilder(cmdParams).redirectErrorStream(true).directory(execDir) - if (!GradleCppUtils.windows) { - pb.environment().put('LD_LIBRARY_PATH', '.') - } - - - def sout = new StringBuffer() - - long startTime = System.currentTimeMillis() - def p = pb.start() - p.consumeProcessOutput(sout, sout) - - p.waitForOrKill(timeout * 1000) - long endTime = System.currentTimeMillis() - - int exitVal = p.exitValue() - - outPath.withWriter('UTF-8') { writer -> - writer.write(sout.toString()) - } - - return new TestExecStatus( - exitCode: exitVal, - successful: (exitVal == 0 || exitVal == 3), - warning: (exitVal == 3), - output: sout.toString(), - durationMsec: endTime - startTime, - cmdLine: cmdParams.join(' '), - execDir: execDir.absolutePath - ) - } - - static void dumpTestExecStatus(TestExecStatus stat) { - if (!stat) { - println "Execution of test executable failed" - } - - println "Test executable command: ${stat.cmdLine}" - println "Test executable run directury: ${stat.execDir}" - println "Test executable exit code: ${stat.exitCode}" - println "Test executable output BEGIN" - println stat.output - println "Test executable output END" - } - - static void attachTestTaskToCppLibrary(NativeBinarySpec libBin, NativeBinarySpec testExecBin) { - Project p = libBin.buildTask.project - - def libBinImpl = libBin as AbstractNativeBinarySpec - def libLinkTask = GradleCppUtils.getLinkTask(libBin) - def testExecLinkTask = GradleCppUtils.getLinkTask(testExecBin) - - // collect all output files from library and test executable - def depFiles = [] - depFiles.addAll(libLinkTask.outputs.files.files) - depFiles.addAll(testExecLinkTask.outputs.files.files) - - //create 'tests' task - def testTaskName = libBinImpl.namingScheme.getTaskName('unitTest') - def testTask = p.task(testTaskName, { Task testTask -> - - //output dir - def testResDir = new File(p.buildDir, "tests/${libBin.name}") - - //inputs/outputs for up-to-date check - testTask.outputs.dir testResDir - testTask.inputs.files depFiles - - //dependencies on library and test executable - testTask.dependsOn libLinkTask - testTask.dependsOn testExecLinkTask - - // binary build depends on unit test - libBin.buildTask.dependsOn testTask - - // extra project-specific dependencies - def testDepsTask = p.tasks.findByName('testDeps') - if (testDepsTask != null) { - testTask.dependsOn testDepsTask - } - - // task actions - testTask.doLast { - - //temporary file that store info about all tests (XML) - File allTests = File.createTempFile('j4s-testinfo', 'data') - allTests.deleteOnExit() - - //fill file with test info - print "Fetching test info..." - def getTestsStatus = runTestExecutable(libBin, testExecBin.executableFile.absolutePath, ['-writeTestInfo', allTests.absolutePath], '__getTests', 5000) - if (!getTestsStatus.successful) { - println " Failed" - dumpTestExecStatus(getTestsStatus) - throw new GradleException("Unable to fetch test names") - } - println " OK" - getTestsStatus = null // allow GC to collect it - - // parse the test info file - def root = new XmlSlurper().parse(allTests) - - // run all tests - println "Running ${root.test.size()} tests..." - TeamCityIntegration.suiteStarted("unitTests.${libBin.name}") - int failCount = 0; - int warnCount = 0; - root.test.list().each { testInfo -> - def testName = '' + testInfo.@name.text() - def testGroup = '' + testInfo.@group.text() - def testTimeout = ('' + testInfo.@timeout.text()) as int - - if (!TeamCityIntegration.writeOutput) { - print " ${testGroup}-${testName}..." - System.out.flush() - } - - TeamCityIntegration.testStarted("${testGroup}-${testName}") - def testExecStatus = runTestExecutable(libBin, testExecBin.executableFile.absolutePath, ['-runTest', testGroup, testName], "${testGroup}-${testName}", testTimeout) - if (!testExecStatus.successful) { - if (!TeamCityIntegration.writeOutput) { - println " Failed" - } - - TeamCityIntegration.testFailed("${testGroup}-${testName}", "test executable return code is ${testExecStatus.exitCode}", "test executable return code is ${testExecStatus.exitCode}") - dumpTestExecStatus(testExecStatus) - failCount++ - } else { - if (!TeamCityIntegration.writeOutput) { - - if (testExecStatus.warning) { - println " WARNING" - dumpTestExecStatus(testExecStatus) - warnCount++ - } - else - println " OK" - } - } - - TeamCityIntegration.testStdOut("${testGroup}-${testName}", testExecStatus.output) - TeamCityIntegration.testFinished("${testGroup}-${testName}", testExecStatus.durationMsec) - - } - TeamCityIntegration.suiteFinished("unitTests.${libBin.name}") - - if (failCount) { - throw new GradleException("CPP unit tests: ${failCount} tests failed"); - } - - else if (warnCount) { - println "CPP unit tests: ${warnCount} tests warnings"; - } - } - }) - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestPlugin.groovy b/buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestPlugin.groovy deleted file mode 100644 index efc98ca..0000000 --- a/buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestPlugin.groovy +++ /dev/null @@ -1,17 +0,0 @@ -package gradlecpp - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class RehldsPlayTestPlugin implements Plugin { - @Override - void apply(Project project) { - project.configurations { - rehlds_playtest_image - } - - project.dependencies { - rehlds_playtest_image 'rehlds.testimg:testimg:0.2' - } - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestTask.groovy b/buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestTask.groovy deleted file mode 100644 index bc5d890..0000000 --- a/buildSrc/src/main/groovy/gradlecpp/RehldsPlayTestTask.groovy +++ /dev/null @@ -1,80 +0,0 @@ -package gradlecpp - -import gradlecpp.teamcity.TeamCityIntegration -import org.apache.commons.lang.SystemUtils -import org.gradle.api.DefaultTask -import org.gradle.api.file.FileCollection -import org.gradle.api.tasks.TaskAction -import org.gradle.nativeplatform.NativeBinarySpec -import rehlds.testdemo.RehldsDemoRunner -import rehlds.testdemo.RehldsTestParser - -class RehldsPlayTestTask extends DefaultTask { - - def FileCollection testDemos - def Closure postExtractAction - def File rehldsImageRoot - def File rehldsTestLogs - def NativeBinarySpec testFor - - @TaskAction - def doPlay() { - if (!SystemUtils.IS_OS_WINDOWS) { - return - } - - if (!testDemos) { - println 'RehldsPlayTestTask: no demos attached to the testDemos property' - } - - rehldsImageRoot.mkdirs() - rehldsTestLogs.mkdirs() - - def demoRunner = new RehldsDemoRunner(this.project.configurations.rehlds_playtest_image.getFiles(), rehldsImageRoot, postExtractAction) - - println "Preparing engine..." - demoRunner.prepareEngine() - - println "Running ${testDemos.getFiles().size()} ReHLDS test demos..." - - TeamCityIntegration.suiteStarted("rehldsDemo.${testFor.name}") - int failCount = 0; - testDemos.getFiles().each { f -> - def testInfo = RehldsTestParser.parseTestInfo(f) - TeamCityIntegration.testStarted(testInfo.testName) - - if (!TeamCityIntegration.writeOutput) { - print "Running ReHLDS test demo ${testInfo.testName} " - System.out.flush() - } - - - def testRes = demoRunner.runTest(testInfo, rehldsTestLogs) - - if (testRes.success) { - if (!TeamCityIntegration.writeOutput) { - println ' OK' - } - } else { - - TeamCityIntegration.testFailed(testInfo.testName, "Exit code: ${testRes.returnCode}", "Exit code: ${testRes.returnCode}") - if (!TeamCityIntegration.writeOutput) { - println ' Failed' - println "ReHLDS testdemo ${testInfo.testName} playback failed. Exit status is ${testRes.returnCode}." - println "Dumping console output:" - println testRes.hldsConsoleOutput - } - - failCount++ - } - - TeamCityIntegration.testStdOut(testInfo.testName, testRes.hldsConsoleOutput) - TeamCityIntegration.testFinished(testInfo.testName, testRes.duration) - } - TeamCityIntegration.suiteFinished("rehldsDemo.${testFor.name}") - - if (failCount) { - throw new RuntimeException("Rehlds testdemos: failed ${failCount} tests") - } - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy b/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy deleted file mode 100644 index 55eca36..0000000 --- a/buildSrc/src/main/groovy/gradlecpp/VelocityUtils.groovy +++ /dev/null @@ -1,34 +0,0 @@ -package gradlecpp - -import org.apache.velocity.Template -import org.apache.velocity.VelocityContext -import org.apache.velocity.app.Velocity - -class VelocityUtils { - - static { - Properties p = new Properties(); - - p.setProperty("resource.loader", "class"); - p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); - p.setProperty("class.resource.loader.path", ""); - - p.setProperty("input.encoding", "UTF-8"); - p.setProperty("output.encoding", "UTF-8"); - - Velocity.init(p); - } - - static String renderTemplate(File tplFile, Map ctx) { - Template tpl = Velocity.getTemplate(tplFile.absolutePath) - if (!tpl) { - throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found") - } - - def velocityContext = new VelocityContext(ctx) - def sw = new StringWriter() - tpl.merge(velocityContext, sw) - - return sw.toString() - } -} diff --git a/buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy b/buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy deleted file mode 100644 index fd532c5..0000000 --- a/buildSrc/src/main/groovy/gradlecpp/teamcity/TeamCityIntegration.groovy +++ /dev/null @@ -1,84 +0,0 @@ -package gradlecpp.teamcity - -import groovy.transform.CompileStatic - - -class TeamCityIntegration { - - static final String flowId = System.getenv('TEAMCITY_PROCESS_FLOW_ID') - static final boolean underTeamcity = System.getenv('TEAMCITY_PROJECT_NAME') - static boolean writeOutput = underTeamcity - - @CompileStatic - private static String escape(String s) { - StringBuilder sb = new StringBuilder((int)(s.length() * 1.2)); - for (char c in s.chars) { - switch (c) { - case '\n': sb.append('|n'); break; - case '\r': sb.append('|r'); break; - case '\'': sb.append('|\''); break; - case '|': sb.append('||'); break; - case ']': sb.append('|]'); break; - default: sb.append(c); - } - } - - return sb.toString() - } - - @CompileStatic - static void writeMessage(String name, Map params) { - if (!writeOutput) return - StringBuilder sb = new StringBuilder() - sb.append('##teamcity[').append(name) - params.each { e -> - if (e.value != null) { - sb.append(' ').append('' + e.key).append('=\'').append(escape('' + e.value)).append('\'') - } - } - sb.append(']') - - println sb.toString() - } - - static void suiteStarted(String suiteName) { - writeMessage('testSuiteStarted', [name: suiteName, flowId: flowId ?: null]) - } - - static void suiteFinished(String suiteName) { - writeMessage('testSuiteFinished', [name: suiteName, flowId: flowId ?: null]) - } - - static void testStarted(String testName) { - writeMessage('testStarted', [name: testName, flowId: flowId ?: null]) - } - - static void testStdOut(String testName, String output) { - writeMessage('testStdOut', [name: testName, out: output, flowId: flowId ?: null]) - } - - static void testFinished(String testName, long durationMs) { - writeMessage('testFinished', [ - name: testName, - flowId: flowId ?: null, - duration: (durationMs >= 0) ? durationMs : null - ]) - } - - static void testFailed(String testName, String message, String details) { - writeMessage('testFailed', [ - name: testName, - flowId: flowId ?: null, - message: message, - details: details - ]) - } - - static void testIgnored(String testName, String message) { - writeMessage('testIgnored', [ - name: testName, - flowId: flowId ?: null, - message: message, - ]) - } -} diff --git a/buildSrc/src/main/groovy/rehlds/testdemo/RehldsDemoRunner.groovy b/buildSrc/src/main/groovy/rehlds/testdemo/RehldsDemoRunner.groovy deleted file mode 100644 index 213a3db..0000000 --- a/buildSrc/src/main/groovy/rehlds/testdemo/RehldsDemoRunner.groovy +++ /dev/null @@ -1,81 +0,0 @@ -package rehlds.testdemo - -import dirsync.builder.FileSystemTreeBuilder -import dirsync.merger.FileTreeComparator -import dirsync.merger.FileTreeDiffApplier -import dirsync.model.tree.DirectoryNode -import dirsync.model.tree.FSMapper -import dirsync.model.tree.ZipData -import dirsync.model.tree.ZipTreeMapper - -class RehldsDemoRunner { - ZipTreeMapper rehldsImage = new ZipTreeMapper() - File rootDir - DirectoryNode engineImageTree - Closure postExtract - - static class TestResult { - boolean success - int returnCode - String hldsConsoleOutput - long duration - } - - RehldsDemoRunner(Collection engineImageZips, File rootDir, Closure postExtract) { - this.rootDir = rootDir - engineImageZips.each { f -> - rehldsImage.addZipArchive(f.absolutePath) - } - engineImageTree = rehldsImage.buildFileTree() - this.postExtract = postExtract - } - - void prepareEngine() { - def existingTree = FileSystemTreeBuilder.buildFileSystemTree(rootDir) - def cmds = FileTreeComparator.mergeTrees(engineImageTree, existingTree) - - FSMapper fsMapper = new FSMapper(rootDir) - FileTreeDiffApplier.applyDiffs(cmds, rehldsImage, fsMapper) - if (postExtract != null) { - postExtract.run() - } - } - - TestResult runTest(RehldsTestInfo info, File testLogDir) { - long startTime = System.currentTimeMillis() - prepareEngine() - - def outPath = new File(testLogDir, "${info.testName}_run.log") - - def cmdParams = [] - cmdParams << new File(rootDir, 'hlds.exe').absolutePath - cmdParams.addAll(info.hldsArgs) - if (info.rehldsExtraArgs) { - cmdParams.addAll(info.rehldsExtraArgs) - } - cmdParams << '--rehlds-test-play' << info.testBinFile.absolutePath - - def pb = new ProcessBuilder(cmdParams).redirectErrorStream(true).directory(rootDir) - def sout = new StringBuffer() - - - def p = pb.start() - p.consumeProcessOutput(sout, sout) - - p.waitForOrKill(info.timeoutSeconds * 1000) - int exitVal = p.exitValue() - - outPath.withWriter('UTF-8') { writer -> - writer.write(sout.toString()) - } - - long endTime = System.currentTimeMillis() - - return new TestResult( - success: (exitVal == 777), - returnCode: exitVal, - hldsConsoleOutput: sout.toString(), - duration: endTime - startTime - ) - } -} diff --git a/buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestInfo.groovy b/buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestInfo.groovy deleted file mode 100644 index e4a218d..0000000 --- a/buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestInfo.groovy +++ /dev/null @@ -1,9 +0,0 @@ -package rehlds.testdemo - -class RehldsTestInfo { - String testName - List hldsArgs - String rehldsExtraArgs - int timeoutSeconds - File testBinFile -} diff --git a/buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestParser.groovy b/buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestParser.groovy deleted file mode 100644 index 74b24df..0000000 --- a/buildSrc/src/main/groovy/rehlds/testdemo/RehldsTestParser.groovy +++ /dev/null @@ -1,63 +0,0 @@ -package rehlds.testdemo - -import groovy.util.slurpersupport.GPathResult -import org.apache.commons.io.IOUtils - -import java.util.zip.ZipFile - -class RehldsTestParser { - static final String REHLDS_TEST_METAINFO_FILE = 'rehlds_test_metainfo.xml' - - static RehldsTestInfo parseTestInfo(File testArchive) { - def zf = new ZipFile(testArchive); - try { - def metaInfoEntry = zf.getEntry(REHLDS_TEST_METAINFO_FILE) - if (metaInfoEntry == null) { - throw new RuntimeException("Unable to open ${REHLDS_TEST_METAINFO_FILE} in ${testArchive.absolutePath}") - } - - GPathResult metaInfo = null - zf.getInputStream(metaInfoEntry).withStream { InputStream ins -> - metaInfo = new XmlSlurper().parse(ins) - } - - RehldsTestInfo testInfo = new RehldsTestInfo( - testName: metaInfo.name.text(), - hldsArgs: metaInfo.runArgs.arg.list().collect { it.text().trim() }, - timeoutSeconds: metaInfo.timeout.text() as int - ) - - //validate testInfo - if (!testInfo.testName) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: test name is not specified") - } - - if (!testInfo.hldsArgs) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: run arguments are not specified") - } - - if (testInfo.timeoutSeconds <= 0) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: bad timeout") - } - - def testBinName = testInfo.testName + '.bin' - def testBinEntry = zf.getEntry(testBinName) - if (testBinEntry == null) { - throw new RuntimeException("Error parsing ${testArchive.absolutePath}: test binary ${testBinName} not found inside archive") - } - - testInfo.testBinFile = File.createTempFile(testBinName, 'rehlds') - testInfo.testBinFile.deleteOnExit() - zf.getInputStream(testBinEntry).withStream { InputStream ins -> - testInfo.testBinFile.withOutputStream { OutputStream os -> - IOUtils.copy(ins, os) - } - } - - return testInfo - } finally { - try { zf.close() } catch (Exception ignored) { } - } - - } -} diff --git a/buildSrc/src/main/groovy/versioning/GitInfo.groovy b/buildSrc/src/main/groovy/versioning/GitInfo.groovy deleted file mode 100644 index 7532e0b..0000000 --- a/buildSrc/src/main/groovy/versioning/GitInfo.groovy +++ /dev/null @@ -1,16 +0,0 @@ -package versioning - -import groovy.transform.CompileStatic -import groovy.transform.TypeChecked -import org.joda.time.DateTime - -@CompileStatic @TypeChecked -class GitInfo { - boolean localChanges - DateTime commitDate - String branch - String tag - String commitSHA - String commitURL - Integer commitCount -} diff --git a/buildSrc/src/main/groovy/versioning/GitVersioner.groovy b/buildSrc/src/main/groovy/versioning/GitVersioner.groovy deleted file mode 100644 index 8370411..0000000 --- a/buildSrc/src/main/groovy/versioning/GitVersioner.groovy +++ /dev/null @@ -1,126 +0,0 @@ -package versioning - -import java.util.Set; - -import groovy.transform.CompileStatic -import groovy.transform.TypeChecked -import org.eclipse.jgit.api.Git -import org.eclipse.jgit.api.Status; -import org.eclipse.jgit.lib.ObjectId -import org.eclipse.jgit.lib.Repository -import org.eclipse.jgit.lib.StoredConfig -import org.eclipse.jgit.revwalk.RevCommit -import org.eclipse.jgit.revwalk.RevWalk -import org.eclipse.jgit.storage.file.FileRepositoryBuilder -import org.joda.time.DateTime -import org.joda.time.DateTimeZone - -@CompileStatic @TypeChecked -class GitVersioner { - - static GitInfo versionForDir(String dir) { - versionForDir(new File(dir)) - } - static int getCountCommit(Repository repo) { - Iterable commits = Git.wrap(repo).log().call() - int count = 0; - commits.each { - count++; - } - - return count; - } - static String prepareUrlToCommits(String url) { - if (url == null) { - // default remote url - return "https://github.com/dreamstalker/rehlds/commit/"; - } - - StringBuilder sb = new StringBuilder(); - String childPath; - int pos = url.indexOf('@'); - if (pos != -1) { - childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/'); - sb.append('https://'); - } else { - pos = url.lastIndexOf('.git'); - childPath = (pos == -1) ? url : url.substring(0, pos); - } - - // support for different links to history of commits - if (url.indexOf('bitbucket.org') != -1) { - sb.append(childPath).append('/commits/'); - } else { - sb.append(childPath).append('/commit/'); - } - return sb.toString(); - } - // check uncommited changes - static boolean getUncommittedChanges(Repository repo) { - Git git = new Git(repo); - Status status = git.status().call(); - - Set uncommittedChanges = status.getUncommittedChanges(); - for(String uncommitted : uncommittedChanges) { - return true; - } - - return false; - } - static GitInfo versionForDir(File dir) { - FileRepositoryBuilder builder = new FileRepositoryBuilder() - Repository repo = builder.setWorkTree(dir) - .findGitDir() - .build() - - ObjectId head = repo.resolve('HEAD') - if (!head) { - return null - } - - final StoredConfig cfg = repo.getConfig(); - - def commit = new RevWalk(repo).parseCommit(head) - if (!commit) { - throw new RuntimeException("Can't find last commit.") - } - - def localChanges = getUncommittedChanges(repo); - def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC); - if (localChanges) { - commitDate = new DateTime(); - } - - def branch = repo.getBranch() - - String url = null; - String remote_name = cfg.getString("branch", branch, "remote"); - - if (remote_name == null) { - for (String remotes : cfg.getSubsections("remote")) { - if (url != null) { - println 'Found a second remote: (' + remotes + '), url: (' + cfg.getString("remote", remotes, "url") + ')' - continue; - } - - url = cfg.getString("remote", remotes, "url"); - } - } else { - url = cfg.getString("remote", remote_name, "url"); - } - - String commitURL = prepareUrlToCommits(url); - String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key - String commitSHA = commit.getId().abbreviate(7).name(); - - return new GitInfo( - localChanges: localChanges, - commitDate: commitDate, - branch: branch, - tag: tag, - commitSHA: commitSHA, - commitURL: commitURL, - commitCount: getCountCommit(repo) - ) - } -} diff --git a/buildSrc/src/main/groovy/versioning/RehldsVersionInfo.groovy b/buildSrc/src/main/groovy/versioning/RehldsVersionInfo.groovy deleted file mode 100644 index ae0da00..0000000 --- a/buildSrc/src/main/groovy/versioning/RehldsVersionInfo.groovy +++ /dev/null @@ -1,56 +0,0 @@ -package versioning - -import groovy.transform.CompileStatic -import groovy.transform.ToString -import groovy.transform.TypeChecked -import org.joda.time.format.DateTimeFormat -import org.joda.time.DateTime - -@CompileStatic @TypeChecked -@ToString(includeNames = true) -class RehldsVersionInfo { - int majorVersion - int minorVersion - Integer maintenanceVersion - String suffix - - boolean localChanges - DateTime commitDate - String commitSHA - String commitURL - Integer commitCount - - String asMavenVersion(boolean extra = true) { - StringBuilder sb = new StringBuilder() - sb.append(majorVersion).append('.' + minorVersion); - if (maintenanceVersion != null) { - sb.append('.' + maintenanceVersion); - } - - if (commitCount != null) { - sb.append('.' + commitCount) - } - - if (extra && suffix) { - sb.append('-' + suffix) - } - - // do mark for this build like a modified version - if (extra && localChanges) { - sb.append('+m'); - } - - return sb.toString() - } - String asCommitDate() { - String pattern = "MMM d yyyy"; - if (commitDate.getDayOfMonth() >= 10) { - pattern = "MMM d yyyy"; - } - - return DateTimeFormat.forPattern(pattern).withLocale(Locale.ENGLISH).print(commitDate); - } - String asCommitTime() { - return DateTimeFormat.forPattern('HH:mm:ss').withLocale(Locale.ENGLISH).print(commitDate); - } -} diff --git a/buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy b/buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy deleted file mode 100644 index a6d3c99..0000000 --- a/buildSrc/src/test/groovy/dirsync/builder/ZipTreeBuilderTest.groovy +++ /dev/null @@ -1,44 +0,0 @@ -package dirsync.builder - -import org.junit.Test - -import java.io.File - -import dirsync.builder.ZipTreeBuilder - -import java.util.zip.ZipEntry -import java.util.zip.ZipFile -import java.util.zip.ZipOutputStream; - -import static org.junit.Assert.*; - -class ZipTreeBuilderTest { - - @Test - void test1() { - File zipFile = File.createTempFile('ZipTreeBuilderTest', 'zip') - zipFile.deleteOnExit() - - new ZipOutputStream(zipFile.newDataOutputStream()).withStream { ZipOutputStream zos -> - zos.putNextEntry(new ZipEntry('aRootFile1.txt')) - zos.write(65) //'A' - - zos.putNextEntry(new ZipEntry('dir1/')) - zos.putNextEntry(new ZipEntry('dir1/dir2/')) - - zos.putNextEntry(new ZipEntry('dir1/dir2/d1d2f1.txt')) - zos.write(65); zos.write(66) //'AB' - - zos.putNextEntry(new ZipEntry('dir1/d1f1.txt')) - zos.write(65); zos.write(66); zos.write(67) //'ABC' - - zos.putNextEntry(new ZipEntry('zRootFile2.txt')) - zos.write(65); zos.write(66); zos.write(67); zos.write(68) //'ABCD' - } - - ZipFile zf = new ZipFile(zipFile.absolutePath) - def tree = ZipTreeBuilder.buildForZipArchive(zipFile.absolutePath, zf) - - assert tree.childNodes.size() == 3 - } -} \ No newline at end of file diff --git a/dep/bzip2/build.gradle b/dep/bzip2/build.gradle deleted file mode 100644 index 09fef5a..0000000 --- a/dep/bzip2/build.gradle +++ /dev/null @@ -1,79 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - - -apply plugin: 'c' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -void setupToolchain(NativeBinarySpec b) { - def cfg = rootProject.createToolchainConfig(b) - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'bzlib_private.h', - pchSourceSet: 'bz2_pch' - ) - } - - ToolchainConfigUtils.apply(project, cfg, b) -} - -model { - buildTypes { - debug - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - bzip2(NativeLibrarySpec) { - targetPlatform 'x86' - - sources { - bz2_main(CSourceSet) { - source { - srcDir "src" - include "**/*.c" - exclude "precompiled.c" - } - exportedHeaders { - srcDir "include" - } - } - - bz2_pch(CSourceSet) { - source { - srcDir "src" - include "precompiled.c" - } - exportedHeaders { - srcDir "include" - } - } - } - - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - } -} diff --git a/dep/cppunitlite/build.gradle b/dep/cppunitlite/build.gradle deleted file mode 100644 index bae46b8..0000000 --- a/dep/cppunitlite/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -void setupToolchain(NativeBinarySpec b) { - def cfg = rootProject.createToolchainConfig(b) - - ToolchainConfigUtils.apply(project, cfg, b) -} - -model { - buildTypes { - debug - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - cppunitlite(NativeLibrarySpec) { - targetPlatform 'x86' - - sources { - cppul_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - } - - exportedHeaders { - srcDir "include" - } - } - } - - - binaries.all { NativeBinarySpec b -> - project.setupToolchain(b) - } - } - } -} - diff --git a/flightrec/decoder/build.gradle b/flightrec/decoder/build.gradle deleted file mode 100644 index 707f713..0000000 --- a/flightrec/decoder/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -apply plugin: 'java' -apply plugin: 'groovy' - -group = 'org.rehlds.flightrec' -version = rootProject.version - -sourceCompatibility = '1.7' -targetCompatibility = '1.7' - -repositories { - mavenCentral() -} - -dependencies { - testCompile 'org.codehaus.groovy:groovy-all:2.4.5' - testCompile "junit:junit:4.12" - compile project(':flightrec/decoder_api') -} - -task uberjar(type: Jar, dependsOn: ['check', ':flightrec/decoder_api:build']) { - from files(sourceSets.main.output.classesDir) - from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } - exclude('META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.LIST') //exclude all signing stuff - - manifest { - attributes 'Main-Class': 'org.rehlds.flightrec.main.FlightRecorder' - attributes 'Implementation-Vendor': 'Sun Microsystems, Inc' - attributes 'Implementation-Title': 'Java Runtime Environment' - attributes 'Implementation-Version': '1.7.0' - } -} - -tasks.withType(AbstractCompile) { - options.encoding = 'UTF-8' -} diff --git a/flightrec/decoder/pub/decoder.bat b/flightrec/decoder/pub/decoder.bat deleted file mode 100644 index 813a720..0000000 --- a/flightrec/decoder/pub/decoder.bat +++ /dev/null @@ -1,47 +0,0 @@ -@if "%DEBUG%" == "" @echo off -setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -set CMD_LINE_ARGS=%* -"%JAVA_EXE%" -jar "%DIRNAME%/decoder.jar" %CMD_LINE_ARGS% - -:end -goto mainEnd - -:fail -exit /b 1 - -:mainEnd -endlocal diff --git a/flightrec/decoder/pub/extDecoders/.keep b/flightrec/decoder/pub/extDecoders/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/flightrec/decoder/src/main/java/com/google/cloud/Crc32c.java b/flightrec/decoder/src/main/java/com/google/cloud/Crc32c.java deleted file mode 100644 index 28f898a..0000000 --- a/flightrec/decoder/src/main/java/com/google/cloud/Crc32c.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. - -package com.google.cloud; - -import java.util.zip.Checksum; - -/** - * This class generates a CRC32C checksum, defined by rfc3720 section B.4. - * - * - */ -public final class Crc32c implements Checksum { - - private static final long[] CRC_TABLE = { - 0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, - 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, - 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b, - 0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, - 0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b, - 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384, - 0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, - 0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b, - 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a, - 0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, - 0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5, - 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa, - 0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, - 0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a, - 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a, - 0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, - 0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48, - 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957, - 0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, - 0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198, - 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927, - 0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, - 0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8, - 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7, - 0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, - 0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789, - 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859, - 0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, - 0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9, - 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6, - 0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, - 0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829, - 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c, - 0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, - 0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043, - 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c, - 0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, - 0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc, - 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c, - 0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, - 0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652, - 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d, - 0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, - 0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982, - 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d, - 0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, - 0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2, - 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed, - 0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, - 0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f, - 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff, - 0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, - 0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f, - 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540, - 0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, - 0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f, - 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee, - 0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, - 0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321, - 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e, - 0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, - 0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e, - 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e, - 0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351 - }; - - private static final long LONG_MASK = 0xffffffffL; - private static final long BYTE_MASK = 0xff; - - private long crc; - - public Crc32c() { - crc = 0; - } - - /** - * Updates the checksum with a new byte. - * @param b the new byte. - */ - @Override - public void update(int b) { - long newCrc = crc; - newCrc = updateByte((byte) b, newCrc); - crc = newCrc; - } - - /** - * Updates the checksum with an array of bytes. - * @param bArray the array of bytes. - * @param off the offset into the array where the update should begin. - * @param len the length of data to examine. - */ - @Override - public void update(byte[] bArray, int off, int len) { - long newCrc = crc; - for (int i = off; i < off + len; i++) { - newCrc = updateByte(bArray[i], newCrc); - } - crc = newCrc; - } - - public void update(byte[] bArray) { - update(bArray, 0, bArray.length); - } - - /** - * Returns the value of the checksum. - * @return the long representation of the checksum (high bits set to zero). - */ - @Override - public long getValue() { - return crc; - } - - /** - * Returns the value of the checksum. - * @return the 4-byte array representation of the checksum in network byte order (big endian). - */ - public byte[] getValueAsBytes() { - long value = crc; - byte[] result = new byte[4]; - for (int i = 3; i >= 0; i--) { - result[i] = (byte) (value & 0xffL); - value >>= 8; - } - return result; - } - - /** - * Resets the crc. - */ - @Override - public void reset() { - crc = 0; - } - - private long updateByte(byte newByte, long crc) { - byte b = (byte) (newByte & BYTE_MASK); - int index = (int) ((crc ^ b) & BYTE_MASK); - return (CRC_TABLE[index] ^ (crc >> 8)) & LONG_MASK; - } -} \ No newline at end of file diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/Consts.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/Consts.java deleted file mode 100644 index 7c307ee..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/Consts.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.rehlds.flightrec; - -public class Consts { - public final static String META_HEADER_SIG_STR = "REHLDS_FLIGHTREC_META"; - public final static String DATA_HEADER_SIG_STR = "REHLDS_FLIGHTREC_DATA"; - - public static byte[] META_HEADER_SIG_BYTES = (META_HEADER_SIG_STR + META_HEADER_SIG_STR + META_HEADER_SIG_STR + ":").getBytes(); - public static byte[] DATA_HEADER_SIG_BYTES = (DATA_HEADER_SIG_STR + DATA_HEADER_SIG_STR + DATA_HEADER_SIG_STR + ":").getBytes(); - - public static int META_HEADER_SIZE = 128; - public static int DATA_HEADER_SIZE = 128; - - public static int MAX_HEADER_SIZE = Math.max(META_HEADER_SIZE, DATA_HEADER_SIZE); -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV1Decoder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV1Decoder.java deleted file mode 100644 index a02ef7b..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV1Decoder.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - - -import org.rehlds.flightrec.api.DecodedExtraData; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.api.MessageDecoder; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class AllocEntPrivateDataV1Decoder implements MessageDecoder { - @Override - public FlightrecMessageType getMessageType() { - return new FlightrecMessageType("rehlds", "AllocEntPrivateData", 1, false); - } - - @Override - public DecodedExtraData decode(FlightrecMessage msg) { - UtilSizeBuf sb = msg.getDataSizebuf(); - long ptr = sb.readUInt32(); - return DecodedExtraData.create("pPrivData", "0x" + Long.toHexString(ptr)); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV2Decoder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV2Decoder.java deleted file mode 100644 index 42f89dd..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/AllocEntPrivateDataV2Decoder.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - -import org.rehlds.flightrec.api.DecodedExtraData; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.api.MessageDecoder; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class AllocEntPrivateDataV2Decoder implements MessageDecoder { - @Override - public FlightrecMessageType getMessageType() { - return new FlightrecMessageType("rehlds", "AllocEntPrivateData", 2, false); - } - - @Override - public DecodedExtraData decode(FlightrecMessage msg) { - UtilSizeBuf sb = msg.getDataSizebuf(); - long ptr = sb.readUInt32(); - long size = sb.readUInt32(); - return DecodedExtraData.create("pPrivData", "0x" + Long.toHexString(ptr), "size", "" + size); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV1Decoder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV1Decoder.java deleted file mode 100644 index e013329..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV1Decoder.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - -import org.rehlds.flightrec.api.DecodedExtraData; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.api.MessageDecoder; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class FrameV1Decoder implements MessageDecoder { - @Override - public FlightrecMessageType getMessageType() { - return new FlightrecMessageType("rehlds", "Frame", 1, true); - } - - DecodedExtraData decodeStart(UtilSizeBuf sb) { - double startTime = sb.readDouble(); - return DecodedExtraData.create("startTime", "" + startTime); - } - - DecodedExtraData decodeEnd(UtilSizeBuf sb) { - return DecodedExtraData.EMPTY; - } - - @Override - public DecodedExtraData decode(FlightrecMessage msg) { - UtilSizeBuf sb = msg.getDataSizebuf(); - return msg.isEnterMessage() ? decodeStart(sb) : decodeEnd(sb); - } - -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV2Decoder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV2Decoder.java deleted file mode 100644 index d731005..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FrameV2Decoder.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - -import org.rehlds.flightrec.api.DecodedExtraData; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.api.MessageDecoder; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class FrameV2Decoder implements MessageDecoder { - @Override - public FlightrecMessageType getMessageType() { - return new FlightrecMessageType("rehlds", "Frame", 2, true); - } - - DecodedExtraData decodeStart(UtilSizeBuf sb) { - long frameId = sb.readInt64(); - double startTime = sb.readDouble(); - return DecodedExtraData.create("frameId", "" + frameId, "startTime", "" + startTime); - } - - DecodedExtraData decodeEnd(UtilSizeBuf sb) { - long frameId = sb.readInt64(); - return DecodedExtraData.create("frameId", "" + frameId); - } - - @Override - public DecodedExtraData decode(FlightrecMessage msg) { - UtilSizeBuf sb = msg.getDataSizebuf(); - return msg.isEnterMessage() ? decodeStart(sb) : decodeEnd(sb); - } - -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FreeEntPrivateDataV1Decoder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FreeEntPrivateDataV1Decoder.java deleted file mode 100644 index b306e92..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/FreeEntPrivateDataV1Decoder.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - -import org.rehlds.flightrec.api.DecodedExtraData; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.api.MessageDecoder; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class FreeEntPrivateDataV1Decoder implements MessageDecoder { - @Override - public FlightrecMessageType getMessageType() { - return new FlightrecMessageType("rehlds", "FreeEntPrivateData", 1, false); - } - - @Override - public DecodedExtraData decode(FlightrecMessage msg) { - UtilSizeBuf sb = msg.getDataSizebuf(); - long ptr = sb.readUInt32(); - return DecodedExtraData.create("pPrivData", "0x" + Long.toHexString(ptr)); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/LogV1Decoder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/LogV1Decoder.java deleted file mode 100644 index 8925cd2..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/LogV1Decoder.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - -import org.rehlds.flightrec.api.DecodedExtraData; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.api.MessageDecoder; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class LogV1Decoder implements MessageDecoder { - @Override - public FlightrecMessageType getMessageType() { - return new FlightrecMessageType("rehlds", "Log", 1, false); - } - - @Override - public DecodedExtraData decode(FlightrecMessage msg) { - UtilSizeBuf sb = msg.getDataSizebuf(); - String prefix = sb.readString(); - String message = sb.readString(); - return DecodedExtraData.create("prefix", prefix, "message", message); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/RehldsDecodersModule.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/RehldsDecodersModule.java deleted file mode 100644 index 2292281..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/decoders/rehlds/RehldsDecodersModule.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.rehlds.flightrec.decoders.rehlds; - -import org.rehlds.flightrec.api.SimpleDecoderModule; - -public class RehldsDecodersModule extends SimpleDecoderModule { - - public RehldsDecodersModule() { - super("Rehlds decoders (built-in)", "0.2"); - registerDecoder(new FrameV1Decoder()); - registerDecoder(new FreeEntPrivateDataV1Decoder()); - registerDecoder(new AllocEntPrivateDataV1Decoder()); - - registerDecoder(new FrameV2Decoder()); - - registerDecoder(new LogV1Decoder()); - registerDecoder(new AllocEntPrivateDataV2Decoder()); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FileScanResult.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FileScanResult.java deleted file mode 100644 index ed91a5a..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FileScanResult.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.rehlds.flightrec.filescan; - -import java.util.ArrayList; -import java.util.List; - -public class FileScanResult { - public List metaHeaders = new ArrayList<>(); - public List dataHeaders = new ArrayList<>(); -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FlightRecFileScanner.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FlightRecFileScanner.java deleted file mode 100644 index e67f5cb..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/FlightRecFileScanner.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.rehlds.flightrec.filescan; - -import com.google.cloud.Crc32c; -import org.rehlds.flightrec.api.util.UtilByteBuffer; -import org.rehlds.flightrec.api.util.UtilSizeBuf; -import static org.rehlds.flightrec.Consts.*; - -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.Arrays; -import java.util.List; - - - -public class FlightRecFileScanner { - RandomAccessFile file; - long fileLen; - FileScanResult scanRes = new FileScanResult(); - - private byte readBuf[] = new byte[65536]; - private byte header[] = new byte[MAX_HEADER_SIZE]; - private UtilSizeBuf headerSBuf = new UtilSizeBuf("header", new UtilByteBuffer(header), 0, header.length); - - private FlightRecFileScanner(RandomAccessFile file) throws IOException { - this.file = file; - this.fileLen = file.length(); - } - - private void examineHeader(byte[] data, int size, int pos) throws IOException { - if (pos + MAX_HEADER_SIZE < size) { - System.arraycopy(data, pos, header, 0, MAX_HEADER_SIZE); - } else { - return; //will be read in next iteration - } - - headerSBuf.reset(); - String matchedType = null; - if (Arrays.equals(META_HEADER_SIG_BYTES, Arrays.copyOfRange(header, 0, META_HEADER_SIG_BYTES.length))) { - matchedType = META_HEADER_SIG_STR; - headerSBuf.skip(META_HEADER_SIG_BYTES.length); - } else if (Arrays.equals(DATA_HEADER_SIG_BYTES, Arrays.copyOfRange(header, 0, DATA_HEADER_SIG_BYTES.length))) { - matchedType = DATA_HEADER_SIG_STR; - headerSBuf.skip(DATA_HEADER_SIG_BYTES.length); - } - - if (matchedType == null) { - return; - } - - List resList = (matchedType.equals(META_HEADER_SIG_STR)) ? scanRes.metaHeaders : scanRes.dataHeaders; - int version = headerSBuf.readInt32(); - int allocSize = headerSBuf.readInt32(); - - Crc32c crc32 = new Crc32c(); - crc32.update(header, 0, headerSBuf.tell()); - long calculatedChecksum = crc32.getValue(); - long bufChecksum = headerSBuf.readUInt32(); - - if (calculatedChecksum != bufChecksum) { - resList.add(new HeaderScanResult(file.getFilePointer() - size + pos, allocSize, false, "Checksum mismatch", version)); - return; - } - - long endPos = file.getFilePointer() - size + pos + allocSize; - if (endPos > file.length()) { - resList.add(new HeaderScanResult(file.getFilePointer() - size + pos, allocSize, false, "Regions partially lays outside the file", version)); - return; - } - resList.add(new HeaderScanResult(file.getFilePointer() - size + pos, allocSize, true, null, version)); - } - - private void scanForHeaders(byte[] data, int size) throws IOException { - int maxHeaderSize = Math.max(META_HEADER_SIG_STR.length(), DATA_HEADER_SIG_STR.length()); - for (int i = 0; i < size - maxHeaderSize; i++) { - if (data[i + 15] == META_HEADER_SIG_BYTES[15] && data[i + 16] == META_HEADER_SIG_BYTES[16] && data[i + 17] == META_HEADER_SIG_BYTES[17] && data[i + 18] == META_HEADER_SIG_BYTES[18]) { - examineHeader(data, size, i); - } else if (data[i + 15] == DATA_HEADER_SIG_BYTES[15] && data[i + 16] == DATA_HEADER_SIG_BYTES[16] && data[i + 17] == DATA_HEADER_SIG_BYTES[17] && data[i + 18] == DATA_HEADER_SIG_BYTES[18]) { - examineHeader(data, size, i); - } - } - } - - private void doScan() throws IOException { - file.seek(0); - int read; - - while (-1 != (read = file.read(readBuf))) { - scanForHeaders(readBuf, read); - if (read == readBuf.length) { - file.seek(file.getFilePointer() - MAX_HEADER_SIZE * 2); - } - } - } - - public static FileScanResult scan(RandomAccessFile file) throws IOException { - FlightRecFileScanner scanner = new FlightRecFileScanner(file); - scanner.doScan(); - return scanner.scanRes; - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/HeaderScanResult.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/HeaderScanResult.java deleted file mode 100644 index 46e93c4..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/filescan/HeaderScanResult.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.rehlds.flightrec.filescan; - -public class HeaderScanResult { - public long pos; - public int len; - public boolean valid; - public String error; - public int version; - - public HeaderScanResult(long pos, int len, boolean valid, String error, int version) { - this.pos = pos; - this.len = len; - this.valid = valid; - this.error = error; - this.version = version; - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/DataHeader.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/DataHeader.java deleted file mode 100644 index c0b961f..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/DataHeader.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.rehlds.flightrec.logparser; - -public class DataHeader { - public int prevItrLastPos; - - public DataHeader(int prevItrLastPos) { - this.prevItrLastPos = prevItrLastPos; - } - - public DataHeader() { - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/FlightLogParser.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/FlightLogParser.java deleted file mode 100644 index cde2e84..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/FlightLogParser.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.rehlds.flightrec.logparser; - -import org.rehlds.flightrec.api.EntranceKind; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageDef; -import org.rehlds.flightrec.api.FlightrecMessageType; -import org.rehlds.flightrec.filescan.HeaderScanResult; -import org.rehlds.flightrec.api.util.UtilByteBuffer; -import org.rehlds.flightrec.api.util.UtilSizeBuf; -import static org.rehlds.flightrec.Consts.*; - -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.*; - -public class FlightLogParser { - UtilByteBuffer metaRegion; - UtilByteBuffer dataRegion; - - MetaHeader metaHeader; - RecorderState recorderState; - DataHeader dataHeader; - - Map msgTypes = new HashMap<>(); - List messages = new ArrayList<>(); - - void parseMessageDefinition(UtilSizeBuf sbuf) { - int msgId = sbuf.readUInt16(); - String module = sbuf.readString(); - String messageName = sbuf.readString(); - long msgVersion = sbuf.readUInt32(); - boolean inOut = sbuf.readBool(); - - FlightrecMessageDef msgDef = new FlightrecMessageDef(module, messageName, msgVersion, inOut, msgId); - - if (msgTypes.containsKey(msgId)) { - System.out.println("Duplicate message id: " + msgTypes.get(msgId) + " and " + msgDef); - } - - msgTypes.put(msgId, msgDef.msgType); - } - - void parseMetaRegion() { - metaHeader = new MetaHeader(); - UtilSizeBuf metaSBuf = new UtilSizeBuf("meta region", metaRegion); - metaSBuf.skip(META_HEADER_SIG_BYTES.length); //skip signature - metaSBuf.readInt32(); //version - metaSBuf.readInt32(); //allocSize - metaSBuf.readInt32(); //checksum - metaHeader.numDefinitions = metaSBuf.readInt32(); - metaHeader.metaRegionPos = metaSBuf.readInt32(); - - recorderState = new RecorderState(); - recorderState.wpos = metaSBuf.readInt32(); - recorderState.lastMsgBeginPos = metaSBuf.readInt32(); - recorderState.curMessage = metaSBuf.readUInt16(); - - metaSBuf = new UtilSizeBuf("meta region defs", metaRegion, META_HEADER_SIZE, metaHeader.metaRegionPos); - for (int i = 0; i < metaHeader.numDefinitions; i++) { - int defKind = metaSBuf.readUInt8(); - switch (defKind) { - case 1: //MRT_MESSAGE_DEF - parseMessageDefinition(metaSBuf); - break; - - default: - throw new RuntimeException("Invalid meta definition type" + defKind); - } - } - - dataHeader = new DataHeader(); - dataHeader.prevItrLastPos = dataRegion.readInt32(DATA_HEADER_SIG_BYTES.length + 12); - } - - public FlightLogParser(UtilByteBuffer metaRegion, UtilByteBuffer dataRegion) { - this.metaRegion = metaRegion; - this.dataRegion = dataRegion; - } - - void doParseMessage(UtilSizeBuf msg) { - int opc = msg.readUInt16(); - boolean entrance = (0 != (opc & 0x8000)); - opc &= 0x7FFF; - - FlightrecMessageType msgType = msgTypes.get(opc); - if (msgType == null) { - throw new RuntimeException("Invalid message opcode @" + Long.toHexString(msg.getAbsoluteCurrentPos() - 2) + ": " + opc); - } - - EntranceKind entranceKind; - if (msgType.inout) { - entranceKind = entrance ? EntranceKind.ENTRANCE_ENTER : EntranceKind.ENTRANCE_LEAVE; - } else { - entranceKind = EntranceKind.ENTRANCE_UNUSED; - } - - FlightrecMessage flMsg = new FlightrecMessage(msgType, entranceKind, msg.getBuffer(), msg.getAbsoluteCurrentPos(), msg.getMaxSize() - 2); - messages.add(flMsg); - } - - void parseMessage(UtilSizeBuf msg) { - int startPos = msg.getStartPos(); - try { - doParseMessage(msg); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("Error while parsing message @" + startPos); - } - } - - List parse() { - parseMetaRegion(); - - UtilByteBuffer flightData = dataRegion.cutLeft(DATA_HEADER_SIZE); - - boolean flippedToEnd = false; - - /* - Each message has following layout: - Opcode [2 bytes] - Data [0+ bytes] - Length of opcode + data [2 bytes] - */ - int curMsgPos = (recorderState.curMessage == 0) ? recorderState.wpos : recorderState.lastMsgBeginPos; - curMsgPos -= 2; //position of the Length field of the message - - UtilSizeBuf msg = new UtilSizeBuf("flightrec_message", flightData, 0, 0); - - while (true) { - if (flippedToEnd && curMsgPos <= recorderState.wpos) - break; - - if (curMsgPos <= 0) { //move read pointer to the end of the data region - if (dataHeader.prevItrLastPos == -1) //wpos never reached end of the region - break; - - curMsgPos = dataHeader.prevItrLastPos - 2; - flippedToEnd = true; - continue; - } - - int msgLen = flightData.readUInt16(curMsgPos); - int msgStartPos = curMsgPos - msgLen; - if (msgStartPos < 0) { - throw new RuntimeException("Corrupted data region; read msgLen=" + msgLen + " at " + curMsgPos + ", but it is too large (startPos < 0)"); - } - - if (flippedToEnd && msgStartPos < recorderState.wpos) { - break; - } - - msg.init(msgStartPos, msgLen); - parseMessage(msg); - - curMsgPos = msgStartPos - 2; - } - - return messages; - } - - public static List doParse(RandomAccessFile f, HeaderScanResult metaHeader, HeaderScanResult dataHeader) throws IOException { - //read regions to byte buffers - f.seek(metaHeader.pos); - byte[] metaRegionData = new byte[metaHeader.len]; - f.readFully(metaRegionData); - - f.seek(dataHeader.pos); - byte[] dataRegionData = new byte[dataHeader.len]; - f.readFully(dataRegionData); - - UtilByteBuffer metaRegion = new UtilByteBuffer(metaRegionData); - UtilByteBuffer dataRegion = new UtilByteBuffer(dataRegionData); - - List res = new FlightLogParser(metaRegion, dataRegion).parse(); - Collections.reverse(res); - return res; - } -} - diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/LogParsingException.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/LogParsingException.java deleted file mode 100644 index bd65f3d..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/LogParsingException.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.rehlds.flightrec.logparser; - -public class LogParsingException extends RuntimeException { - - public LogParsingException(String message) { - super(message); - } - - public LogParsingException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/MetaHeader.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/MetaHeader.java deleted file mode 100644 index 19b3eba..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/MetaHeader.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.rehlds.flightrec.logparser; - -public class MetaHeader { - public int numDefinitions; - public int metaRegionPos; - - public MetaHeader(int numMessages, int metaRegionPos) { - this.numDefinitions = numMessages; - this.metaRegionPos = metaRegionPos; - } - - public MetaHeader() { - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/RecorderState.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/RecorderState.java deleted file mode 100644 index a965b64..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logparser/RecorderState.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.rehlds.flightrec.logparser; - -public class RecorderState { - public int wpos; - public int lastMsgBeginPos; - public int curMessage; - - public RecorderState(int wpos, int lastMsgBeginPos, int curMessage) { - this.wpos = wpos; - this.lastMsgBeginPos = lastMsgBeginPos; - this.curMessage = curMessage; - } - - public RecorderState() { - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/FlightLogTreeBuilder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/FlightLogTreeBuilder.java deleted file mode 100644 index d7332af..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/FlightLogTreeBuilder.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.rehlds.flightrec.logtree; - -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.api.FlightrecMessageType; - -import java.util.List; - -public class FlightLogTreeBuilder { - LogTreeNodeComplex rootNode = new LogTreeNodeComplex(null, null, null); - LogTreeNodeComplex currentNode = rootNode; - - void handleEnterMessage(FlightrecMessage msg) { - LogTreeNodeComplex n = new LogTreeNodeComplex(currentNode, msg, null); - currentNode.addChild(n); - currentNode = n; - } - - void handleLeaveMessage(FlightrecMessage msg) { - if (currentNode == rootNode) { - currentNode.leaveMsg = msg; - rootNode = new LogTreeNodeComplex(null, null, null); - rootNode.addChild(currentNode); - currentNode.setParent(rootNode); - currentNode = rootNode; - return; - } - - if (currentNode.enterMsg != null) { - FlightrecMessageType startType = currentNode.enterMsg.messageType; - FlightrecMessageType endType = msg.messageType; - if (!startType.equals(endType)) { - throw new RuntimeException("Closing message @" + Long.toHexString(msg.rawDataPos) + " has invalid type " + endType + "; expected " + startType); - } - } - - currentNode.leaveMsg = msg; - currentNode = currentNode.parent; - } - - void handleSimpleMessage(FlightrecMessage msg) { - LogTreeNodeLeaf leafNode = new LogTreeNodeLeaf(currentNode, msg); - currentNode.addChild(leafNode); - } - - void doBuildLogTree(List messages) { - for (FlightrecMessage msg : messages) { - switch (msg.entranceKind) { - case ENTRANCE_ENTER: - handleEnterMessage(msg); - break; - - case ENTRANCE_LEAVE: - handleLeaveMessage(msg); - break; - - case ENTRANCE_UNUSED: - handleSimpleMessage(msg); - break; - - default: - throw new RuntimeException("Invalid exntrance kind"); - } - } - } - - - public static LogTreeNodeComplex buildTree(List messages) { - FlightLogTreeBuilder builder = new FlightLogTreeBuilder(); - builder.doBuildLogTree(messages); - return builder.rootNode; - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNode.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNode.java deleted file mode 100644 index de6d14f..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNode.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.rehlds.flightrec.logtree; - -import java.util.List; - -public abstract class LogTreeNode { - LogTreeNodeComplex parent; - - protected LogTreeNode(LogTreeNodeComplex parent) { - this.parent = parent; - } - - abstract List getChildren(); - - LogTreeNodeComplex getParent() { - return parent; - } - - public void setParent(LogTreeNodeComplex parent) { - this.parent = parent; - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeComplex.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeComplex.java deleted file mode 100644 index 3f99094..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeComplex.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.rehlds.flightrec.logtree; - -import org.rehlds.flightrec.api.FlightrecMessage; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class LogTreeNodeComplex extends LogTreeNode { - public FlightrecMessage enterMsg; - public FlightrecMessage leaveMsg; - - public LogTreeNodeComplex(LogTreeNodeComplex parent, FlightrecMessage enterMsg, FlightrecMessage leaveMsg) { - super(parent); - this.enterMsg = enterMsg; - this.leaveMsg = leaveMsg; - } - - List children = Collections.emptyList(); - - - - @Override - public List getChildren() { - return children; - } - - public void addChild(LogTreeNode node) { - if (children.isEmpty()) { - children = new ArrayList<>(); - } - - children.add(node); - } - -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeLeaf.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeLeaf.java deleted file mode 100644 index bfdb6ca..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/logtree/LogTreeNodeLeaf.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.rehlds.flightrec.logtree; - -import org.rehlds.flightrec.api.FlightrecMessage; - -import java.util.Collections; -import java.util.List; - -public class LogTreeNodeLeaf extends LogTreeNode { - public FlightrecMessage msg; - - public LogTreeNodeLeaf(LogTreeNodeComplex parent, FlightrecMessage msg) { - super(parent); - this.msg = msg; - } - - @Override - List getChildren() { - return Collections.emptyList(); - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/main/FlightRecorder.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/main/FlightRecorder.java deleted file mode 100644 index f6fd5cc..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/main/FlightRecorder.java +++ /dev/null @@ -1,230 +0,0 @@ -package org.rehlds.flightrec.main; - -import org.rehlds.flightrec.api.DecoderModule; -import org.rehlds.flightrec.api.FlightrecMessage; -import org.rehlds.flightrec.decoders.rehlds.RehldsDecodersModule; -import org.rehlds.flightrec.filescan.FileScanResult; -import org.rehlds.flightrec.filescan.FlightRecFileScanner; -import org.rehlds.flightrec.filescan.HeaderScanResult; -import org.rehlds.flightrec.logtree.FlightLogTreeBuilder; -import org.rehlds.flightrec.logtree.LogTreeNodeComplex; -import org.rehlds.flightrec.logparser.FlightLogParser; -import org.rehlds.flightrec.textlogwriter.TextLogWriter; -import org.rehlds.flightrec.util.JarUtils; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.*; - -public class FlightRecorder { - RunConfig cfg; - List decoderModules = new ArrayList<>(); - - public FlightRecorder(RunConfig cfg) { - this.cfg = cfg; - } - - private boolean checkConfig() { - if (cfg.dumpFile == null) { - System.out.println("Dump file is not selected, please use --dump-file parameter to specify it"); - return false; - } - - if (cfg.outFile == null) { - cfg.outFile = new File(cfg.dumpFile.getAbsolutePath() + ".flog"); - } - - return true; - } - - private List scanFile(RandomAccessFile f) throws IOException { - FileScanResult scanResult = FlightRecFileScanner.scan(f); - - System.out.println("Dump file scan results: "); - for (HeaderScanResult hdr : scanResult.metaHeaders) { - System.out.print(String.format("\tMeta header @ 0x%08X; len=%d; version=%d; valid=%s", hdr.pos, hdr.len, hdr.version, "" + (hdr.error == null))); - if (hdr.error != null) { - System.out.print("; error: " + hdr.error); - } - System.out.println(); - } - for (HeaderScanResult hdr : scanResult.dataHeaders) { - System.out.print(String.format("\tData header @ 0x%08X; len=%d; version=%d; valid=%s", hdr.pos, hdr.len, hdr.version, "" + (hdr.error == null))); - if (hdr.error != null) { - System.out.print("; error: " + hdr.error); - } - System.out.println(); - } - - HeaderScanResult validMetaHeader = null; - HeaderScanResult validDataHeader = null; - - for (HeaderScanResult metaHeader : scanResult.metaHeaders) { - if (metaHeader.error != null) { - continue; - } - - if (validMetaHeader != null) { - System.out.println("Multiple meta headers found, exiting"); - return null; - } - - validMetaHeader = metaHeader; - } - - for (HeaderScanResult dataHeader : scanResult.dataHeaders) { - if (dataHeader.error != null) { - continue; - } - - if (validDataHeader != null) { - System.out.println("Multiple data headers found, exiting"); - return null; - } - - validDataHeader = dataHeader; - } - - if (validMetaHeader == null) { - System.out.println("Meta header not found, exiting"); - return null; - } - - if (validDataHeader == null) { - System.out.println("Data header not found, exiting"); - return null; - } - - return FlightLogParser.doParse(f, validMetaHeader, validDataHeader); - } - - private LogTreeNodeComplex buildTree(List messages) { - return FlightLogTreeBuilder.buildTree(messages); - } - - private boolean writeOutputFile(LogTreeNodeComplex logTreeRoot) { - TextLogWriter.decodeAndWrite(logTreeRoot, cfg.outFile, decoderModules); - System.out.println("Written decoded log to '" + cfg.outFile.getAbsolutePath() + ";"); - return true; - } - - public boolean run() { - registerBuiltinDecoders(); - loadExternalDecoders(); - - if (!checkConfig()) { - return false; - } - - List messages; - try(RandomAccessFile f = new RandomAccessFile(cfg.dumpFile, "r")) { - messages = scanFile(f); - } catch (IOException e) { - e.printStackTrace(); - return false; - } - - if (messages == null) { - return false; - } - - System.out.println("Read " + messages.size() + " messages from '" + cfg.dumpFile.getAbsolutePath() + "'"); - LogTreeNodeComplex treeRootNode = buildTree(messages); - if (treeRootNode == null) { - return false; - } - - if (!writeOutputFile(treeRootNode)) { - return false; - } - - return true; - } - - private void loadExternalDecoders() { - File f = JarUtils.getJarFileOfClass(FlightRecorder.class); - if (f == null) { - System.out.println("Could not locate main JAR, external decoders will not be loaded"); - return; - } - - File extDir = new File(f.getParentFile(), "extDecoders"); - if (!extDir.exists() || !extDir.isDirectory()) { - System.out.println("Directory '" + extDir.getAbsolutePath() + "' doesn't exist"); - } - - File[] jarFiles = extDir.listFiles(new FileFilter() { - @Override - public boolean accept(File pathname) { - return pathname.getName().toLowerCase().endsWith(".jar"); - } - }); - - ArrayList jarUrls = new ArrayList<>(); - for (File jf : jarFiles) { - try { - jarUrls.add(jf.toURI().toURL()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - URLClassLoader extDecodersClassloader = new URLClassLoader(jarUrls.toArray(new URL[jarUrls.size()]), this.getClass().getClassLoader()); - ServiceLoader srvLoader = ServiceLoader.load(DecoderModule.class, extDecodersClassloader); - for (DecoderModule decoderModule : srvLoader) { - System.out.println("Loaded external decoder module " + decoderModule.getDescription() + " version " + decoderModule.getVersion()); - decoderModules.add(decoderModule); - } - } - - private void registerBuiltinDecoders() { - decoderModules.add(new RehldsDecodersModule()); - } - - public static void main(String args[]) { - RunConfig cfg; - try { - cfg = parseArgs(args); - } catch (IllegalArgumentException e) { - System.out.println(e.getMessage()); - return; - } - - new FlightRecorder(cfg).run(); - } - - private static RunConfig parseArgs(String args[]) { - RunConfig cfg = new RunConfig(); - for (int i = 0; i < args.length; i++) { - String a = args[i]; - - if ("--dump-file".equals(a)) { - if (i + 1 >= args.length) { - throw new IllegalArgumentException("--dump-file should be followed by file name"); - } - i++; - cfg.dumpFile = new File(args[i]); - continue; - } - - if ("--out-file".equals(a)) { - if (i + 1 >= args.length) { - throw new IllegalArgumentException("--out-file should be followed by file name"); - } - i++; - cfg.outFile = new File(args[i]); - continue; - } - - throw new IllegalArgumentException("Invalid command line parameter: '" + a + "'"); - } - - return cfg; - } - -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/main/RunConfig.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/main/RunConfig.java deleted file mode 100644 index 191dd33..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/main/RunConfig.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.rehlds.flightrec.main; - -import java.io.File; - -public class RunConfig { - public File dumpFile; - public File outFile; -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/textlogwriter/TextLogWriter.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/textlogwriter/TextLogWriter.java deleted file mode 100644 index 31effe8..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/textlogwriter/TextLogWriter.java +++ /dev/null @@ -1,185 +0,0 @@ -package org.rehlds.flightrec.textlogwriter; - -import org.rehlds.flightrec.api.*; -import org.rehlds.flightrec.logtree.LogTreeNode; -import org.rehlds.flightrec.logtree.LogTreeNodeComplex; -import org.rehlds.flightrec.logtree.LogTreeNodeLeaf; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class TextLogWriter { - Writer writer; - List decoderModules; - - int indent; - HashMap indents = new HashMap<>(); - Map decodersByMsgType = new HashMap<>(); - - public TextLogWriter(Writer writer, List decoderModules) { - this.writer = writer; - this.decoderModules = decoderModules; - } - - MessageDecoder lookupDecoder(FlightrecMessageType msgType) { - for (DecoderModule dm : decoderModules) { - MessageDecoder d = dm.lookupDecoder(msgType); - if (d != null) { - return d; - } - } - - return null; - } - - MessageDecoder getDecoder(FlightrecMessage message) { - FlightrecMessageType msgType = message.messageType; - if (!decodersByMsgType.containsKey(msgType)) { - decodersByMsgType.put(msgType, lookupDecoder(msgType)); - } - - return decodersByMsgType.get(msgType); - } - - DecodedExtraData tryDecode(FlightrecMessage message) { - MessageDecoder decoder = getDecoder(message); - if (decoder == null) { - return null; - } - return decoder.decode(message); - } - - String escapeString(String s) { - return s.replace("\"", "\\\"") - .replace("'", "\\'") - .replace("\n", "\\n") - .replace("\r", "\\r"); - } - - String generateIndent() { - String res = indents.get(indent); - if (res != null) { - return res; - } - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < indent; i++) { - sb.append(" "); - } - - res = sb.toString(); - indents.put(indent, res); - return res; - } - - void writeExtraData(StringBuilder sb, DecodedExtraData extraData) { - boolean first = true; - for (ImmutablePair kv : extraData.data) { - if (first) { - first = false; - } else { - sb.append(", "); - } - sb.append(kv.first).append(": '").append(escapeString(kv.second)).append("'"); - } - } - - String prepareMessageText(FlightrecMessage msg) { - StringBuilder sb = new StringBuilder(); - sb.append(generateIndent()); - - switch (msg.entranceKind) { - case ENTRANCE_ENTER: - sb.append(">>"); - break; - - case ENTRANCE_LEAVE: - sb.append("<<"); - break; - - case ENTRANCE_UNUSED: - sb.append("--"); - break; - - default: - throw new RuntimeException("Invalid entrance kind " + msg.entranceKind); - } - - FlightrecMessageType msgType = msg.messageType; - sb.append(" ").append(msgType.module).append(".").append(msgType.message).append(":").append(msgType.version).append(" "); - - DecodedExtraData extraData = tryDecode(msg); - if (extraData != null) { - writeExtraData(sb, extraData); - } else { - sb.append("undecoded["); - boolean firstByte = true; - for (int i = msg.rawDataPos; i < msg.rawDataLen + msg.rawDataPos; i++) { - if (firstByte) { - firstByte = false; - } else { - sb.append(" "); - } - sb.append(String.format("%02X", msg.rawData[i] & 0xFF)); - } - sb.append("]"); - } - - sb.append("\n"); - return sb.toString(); - } - - void writeMessage(FlightrecMessage msg) throws IOException { - String text = prepareMessageText(msg); - writer.write(text); - } - - void writeLeafNode(LogTreeNodeLeaf node) throws IOException { - writeMessage(node.msg); - } - - void writeComplexNode(LogTreeNodeComplex node) throws IOException { - if (node.enterMsg != null) { - writeMessage(node.enterMsg); - } else { - writer.write(generateIndent() + ">> [Unknown]\n"); - } - - indent++; - writeNodes(node.getChildren()); - indent--; - - if (node.leaveMsg != null) { - writeMessage(node.leaveMsg); - } else { - writer.write(generateIndent() + "<< [Unknown]\n"); - } - } - - void writeNodes(List nodes) throws IOException { - for (LogTreeNode node : nodes) { - if (node instanceof LogTreeNodeComplex) { - writeComplexNode((LogTreeNodeComplex) node); - } else if (node instanceof LogTreeNodeLeaf) { - writeLeafNode((LogTreeNodeLeaf) node); - } else { - throw new RuntimeException("Invalid node class " + node.getClass().getName()); - } - } - } - - - public static void decodeAndWrite(LogTreeNodeComplex rootNode, File outFile, List decoderModules) { - try (FileWriter fw = new FileWriter(outFile)) { - TextLogWriter logWriter = new TextLogWriter(fw, decoderModules); - logWriter.writeNodes(rootNode.getChildren()); - } catch (IOException e) { - throw new RuntimeException("Failed to open/write file '" + outFile + "': " + e.getMessage(), e); - } - } -} diff --git a/flightrec/decoder/src/main/java/org/rehlds/flightrec/util/JarUtils.java b/flightrec/decoder/src/main/java/org/rehlds/flightrec/util/JarUtils.java deleted file mode 100644 index 41d062a..0000000 --- a/flightrec/decoder/src/main/java/org/rehlds/flightrec/util/JarUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.rehlds.flightrec.util; - -import java.io.File; -import java.net.URL; - -public class JarUtils { - public static File getJarFileOfClass(Class c) { - String classFileName = c.getName().replace('.', '/') + ".class"; - ClassLoader classLoader = c.getClassLoader(); - if (classLoader == null) { - classLoader = JarUtils.class.getClassLoader(); - } - URL url = classLoader.getResource(classFileName); - if (url == null) { - return null; - } - - String strUrl = url.toString(); - if (!strUrl.startsWith("jar:file:/")) { - return null; - } - - int jarSeparator = strUrl.indexOf('!'); - if (jarSeparator == -1) { - return null; - } - - String jarFilePath = strUrl.substring("jar:file:/".length(), jarSeparator); - return new File(jarFilePath); - } -} diff --git a/flightrec/decoder/src/test/groovy/org/rehlds/flightrec/logtree/FlightLogTreeBuilderTest.groovy b/flightrec/decoder/src/test/groovy/org/rehlds/flightrec/logtree/FlightLogTreeBuilderTest.groovy deleted file mode 100644 index 40edd56..0000000 --- a/flightrec/decoder/src/test/groovy/org/rehlds/flightrec/logtree/FlightLogTreeBuilderTest.groovy +++ /dev/null @@ -1,181 +0,0 @@ -package org.rehlds.flightrec.logtree - -import org.junit.Test -import org.rehlds.flightrec.api.EntranceKind -import org.rehlds.flightrec.api.FlightrecMessage -import org.rehlds.flightrec.api.FlightrecMessageType - -class FlightLogTreeBuilderTest { - static final FlightrecMessageType hierarchyMsgType1 = new FlightrecMessageType('test', 'hmsg1', 1, true); - static final FlightrecMessageType hierarchyMsgType2 = new FlightrecMessageType('test', 'hmsg1', 1, true); - static final FlightrecMessageType flatMsgType1 = new FlightrecMessageType('test', 'flatmsg1', 1, true); - static final FlightrecMessageType flatMsgType2 = new FlightrecMessageType('test', 'flatmsg2', 1, true); - - static FlightrecMessage enterMsg(FlightrecMessageType type) { - return new FlightrecMessage(type, EntranceKind.ENTRANCE_ENTER, null, 0, 0); - } - - static FlightrecMessage leaveMsg(FlightrecMessageType type) { - return new FlightrecMessage(type, EntranceKind.ENTRANCE_LEAVE, null, 0, 0); - } - - static FlightrecMessage flatMsg(FlightrecMessageType type) { - return new FlightrecMessage(type, EntranceKind.ENTRANCE_UNUSED, null, 0, 0); - } - - @Test - void 'decode 2 flat messages'() { - def messages = [flatMsg(flatMsgType1), flatMsg(flatMsgType2)] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 2 - assert rootNode.children[0].msg == messages[0]; - assert rootNode.children[1].msg == messages[1]; - - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - } - - @Test - void 'decode 2 empty hierarchy msgs'() { - def messages = [ - enterMsg(hierarchyMsgType1), leaveMsg(hierarchyMsgType1), - enterMsg(hierarchyMsgType2), leaveMsg(hierarchyMsgType2) - ] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 2 - - rootNode.children[0].enterMsg == messages[0] - rootNode.children[0].leaveMsg == messages[1] - assert rootNode.children[0].children.empty - - rootNode.children[1].enterMsg == messages[2] - rootNode.children[1].leaveMsg == messages[3] - assert rootNode.children[1].children.empty - - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - } - - @Test - void 'decode 2 hierarchy messages with flat payload'() { - def messages = [ - enterMsg(hierarchyMsgType1), flatMsg(flatMsgType1), leaveMsg(hierarchyMsgType1), - enterMsg(hierarchyMsgType2), flatMsg(flatMsgType2), leaveMsg(hierarchyMsgType2) - ] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 2 - - rootNode.children[0].enterMsg == messages[0] - rootNode.children[0].leaveMsg == messages[2] - assert rootNode.children[0].children.size() == 1 - assert rootNode.children[0].children[0].msg == messages[1] - - rootNode.children[1].enterMsg == messages[3] - rootNode.children[1].leaveMsg == messages[5] - assert rootNode.children[1].children.size() == 1 - assert rootNode.children[1].children[0].msg == messages[4] - - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - } - - @Test - void 'decode hierarchical message with mixed payload'() { - def messages = [ - flatMsg(flatMsgType2), - enterMsg(hierarchyMsgType1), - flatMsg(flatMsgType1), - enterMsg(hierarchyMsgType2), - flatMsg(flatMsgType2), - leaveMsg(hierarchyMsgType2), - flatMsg(flatMsgType2), - leaveMsg(hierarchyMsgType1), - flatMsg(flatMsgType1) - ] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 3 - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - - assert rootNode.children[0].msg == messages[0] - assert rootNode.children[2].msg == messages[8] - - assert rootNode.children[1].enterMsg == messages[1] - assert rootNode.children[1].leaveMsg == messages[7] - assert rootNode.children[1].children.size() == 3 - - assert rootNode.children[1].children[0].msg == messages[2] - assert rootNode.children[1].children[2].msg == messages[6] - - assert rootNode.children[1].children[1].enterMsg == messages[3] - assert rootNode.children[1].children[1].leaveMsg == messages[5] - assert rootNode.children[1].children[1].children.size() == 1 - - assert rootNode.children[1].children[1].children[0].msg == messages[4] - } - - @Test - void 'decode hierarchical msg with flat payload and missing start'() { - def messages = [ - flatMsg(flatMsgType1), - leaveMsg(hierarchyMsgType1), - flatMsg(flatMsgType2) - ] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 2 - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - - assert rootNode.children[0].enterMsg == null - assert rootNode.children[0].leaveMsg == messages[1] - assert rootNode.children[0].children.size() == 1 - assert rootNode.children[0].children[0].msg == messages[0] - - assert rootNode.children[1].msg == messages[2] - } - - @Test - void 'decode empty hierarchical msg with missing start'() { - def messages = [ - leaveMsg(hierarchyMsgType1), - flatMsg(flatMsgType2) - ] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 2 - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - - assert rootNode.children[0].enterMsg == null - assert rootNode.children[0].leaveMsg == messages[0] - assert rootNode.children[0].children.empty - - assert rootNode.children[1].msg == messages[1] - } - - @Test - void 'decode hierarchical msg with flat payload and missing end'() { - def messages = [ - flatMsg(flatMsgType1), - enterMsg(hierarchyMsgType1), - flatMsg(flatMsgType2) - ] - def rootNode = FlightLogTreeBuilder.buildTree(messages) - - assert rootNode.children.size() == 2 - assert rootNode.enterMsg == null - assert rootNode.leaveMsg == null - - assert rootNode.children[0].msg == messages[0] - - assert rootNode.children[1].enterMsg == messages[1] - assert rootNode.children[1].leaveMsg == null - assert rootNode.children[1].children.size() == 1 - assert rootNode.children[1].children[0].msg == messages[2] - } -} diff --git a/flightrec/decoder/src/test/java/com/google/cloud/Crc32cTest.java b/flightrec/decoder/src/test/java/com/google/cloud/Crc32cTest.java deleted file mode 100644 index 51328da..0000000 --- a/flightrec/decoder/src/test/java/com/google/cloud/Crc32cTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.google.cloud; - -import org.junit.Test; - -import static org.junit.Assert.*; - -public class Crc32cTest { - - static class TestData { - public String src; - public long hash; - - TestData(String src, long hash) { - this.src = src; - this.hash = hash; - } - } - - @Test - public void testCrc32c() { - TestData testData[] = { - new TestData("a", 0x93AD1061L), - new TestData("ab", 0x13C35EE4L), - new TestData("abc", 0x562F9CCDL), - new TestData("abcd", 0xDAAF41F6L), - new TestData("abcde", 0x8122A0A2L), - new TestData("abcdef", 0x0496937BL), - new TestData("abcdefg", 0x5D199E2CL), - new TestData("abcdefgh", 0x86BC933DL), - new TestData("abcdefghi", 0x9639F15FL), - new TestData("abcdefghij", 0x0584645CL), - }; - - for (TestData t : testData) { - Crc32c crc32c = new Crc32c(); - crc32c.update(t.src.getBytes()); - long cksum = crc32c.getValue(); - - assertEquals(t.hash, cksum); - } - } - -} \ No newline at end of file diff --git a/flightrec/decoder_api/build.gradle b/flightrec/decoder_api/build.gradle deleted file mode 100644 index 3ec5e22..0000000 --- a/flightrec/decoder_api/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -apply plugin: 'java' -apply plugin: 'maven-publish' - -group = 'org.rehlds.flightrec' -version = rootProject.version - -sourceCompatibility = '1.7' -targetCompatibility = '1.7' - -repositories { - mavenCentral() -} - -dependencies { - testCompile "junit:junit:4.12" -} - -publishing { - publications { - maven(MavenPublication) { - version project.version - artifactId 'decoder-api' - artifact jar - - pom.withXml { - asNode().children().last() + { - resolveStrategy = DELEGATE_FIRST - name 'decoder-api' - description project.description - //url github - //scm { - // url "${github}.git" - // connection "scm:git:${github}.git" - //} - /* - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - developers { - developer { - id 'dreamstalker' - name 'dreamstalker' - } - } - */ - } - } - } - } -} - -publishing { - repositories { - maven { - if (project.version.contains('dev')) { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" - } else { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" - } - credentials { - username rootProject.repoCreds.getProperty('username') - password rootProject.repoCreds.getProperty('password') - } - } - } -} - -tasks.withType(AbstractCompile) { - options.encoding = 'UTF-8' -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecodedExtraData.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecodedExtraData.java deleted file mode 100644 index a5564a5..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecodedExtraData.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.rehlds.flightrec.api; - -public class DecodedExtraData { - public ImmutablePair[] data; - - public DecodedExtraData(ImmutablePair[] data) { - this.data = data; - } - - public static final DecodedExtraData EMPTY = new DecodedExtraData(new ImmutablePair[0]); - - public static DecodedExtraData create(String... args) { - if ((args.length % 2) == 1) { - throw new RuntimeException("DecodedExtraData.create: number of arguments must be even"); - } - - int numPairs = args.length / 2; - DecodedExtraData res = new DecodedExtraData(new ImmutablePair[numPairs]); - - for (int i = 0; i < numPairs; i++) { - res.data[i] = new ImmutablePair<>(args[i * 2], args[i * 2 + 1]); - } - - return res; - } - - -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecoderModule.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecoderModule.java deleted file mode 100644 index 3ed144a..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/DecoderModule.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.rehlds.flightrec.api; - -public interface DecoderModule { - public MessageDecoder lookupDecoder(FlightrecMessageType msgType); - public String getDescription(); - public String getVersion(); -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/EntranceKind.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/EntranceKind.java deleted file mode 100644 index 9f96aa2..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/EntranceKind.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.rehlds.flightrec.api; - -public enum EntranceKind { - ENTRANCE_ENTER, - ENTRANCE_LEAVE, - ENTRANCE_UNUSED, -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessage.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessage.java deleted file mode 100644 index 6d3011d..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessage.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.rehlds.flightrec.api; - -import org.rehlds.flightrec.api.util.UtilByteBuffer; -import org.rehlds.flightrec.api.util.UtilSizeBuf; - -public class FlightrecMessage { - public final FlightrecMessageType messageType; - public final EntranceKind entranceKind; - - public final byte[] rawData; - public final int rawDataPos; - public final int rawDataLen; - - DecodedExtraData decodedData; - - public FlightrecMessage(FlightrecMessageType messageType, EntranceKind entranceKind, byte[] rawData, int rawDataOffset, int rawDataLen) { - this.messageType = messageType; - this.entranceKind = entranceKind; - this.rawData = rawData; - this.rawDataPos = rawDataOffset; - this.rawDataLen = rawDataLen; - } - - public UtilSizeBuf getDataSizebuf() { - return new UtilSizeBuf("msg: '" + messageType + "' @" + rawDataPos, new UtilByteBuffer(rawData), rawDataPos, rawDataLen); - } - - public boolean isEnterMessage() { - return (entranceKind == EntranceKind.ENTRANCE_ENTER); - } - - public boolean isLeaveMessage() { - return (entranceKind == EntranceKind.ENTRANCE_LEAVE); - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageDef.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageDef.java deleted file mode 100644 index 4c40a48..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageDef.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.rehlds.flightrec.api; - -public class FlightrecMessageDef { - public final FlightrecMessageType msgType; - public final int opcode; - - public FlightrecMessageDef(String module, String message, long version, boolean inout, int opcode) { - msgType = new FlightrecMessageType(module, message, version, inout); - this.opcode = opcode; - } - - @Override - public String toString() { - return "FlightrecMessageDef{" + - "module='" + msgType.module + '\'' + - ", message='" + msgType.message + '\'' + - ", version=" + msgType.version + - ", inout=" + msgType.inout + - ", opcode=" + opcode + - '}'; - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageType.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageType.java deleted file mode 100644 index 102cc49..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/FlightrecMessageType.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.rehlds.flightrec.api; - -public class FlightrecMessageType { - public final String module; - public final String message; - public final long version; - public final boolean inout; - - public FlightrecMessageType(String module, String message, long version, boolean inout) { - this.module = module; - this.message = message; - this.version = version; - this.inout = inout; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - FlightrecMessageType that = (FlightrecMessageType) o; - - if (inout != that.inout) return false; - if (version != that.version) return false; - if (!message.equals(that.message)) return false; - if (!module.equals(that.module)) return false; - - return true; - } - - @Override - public int hashCode() { - int result = module.hashCode(); - result = 31 * result + message.hashCode(); - result = 31 * result + (int) (version ^ (version >>> 32)); - result = 31 * result + (inout ? 1 : 0); - return result; - } - - @Override - public String toString() { - return "FlightrecMessageType{" + - "module='" + module + '\'' + - ", message='" + message + '\'' + - ", version=" + version + - ", inout=" + inout + - '}'; - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/ImmutablePair.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/ImmutablePair.java deleted file mode 100644 index ed6f7ef..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/ImmutablePair.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.rehlds.flightrec.api; - -public class ImmutablePair { - public final T first; - public final U second; - - public ImmutablePair(T first, U second) { - this.first = first; - this.second = second; - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/MessageDecoder.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/MessageDecoder.java deleted file mode 100644 index 69d3f51..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/MessageDecoder.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.rehlds.flightrec.api; - -public interface MessageDecoder { - FlightrecMessageType getMessageType(); - DecodedExtraData decode(FlightrecMessage msg); -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/SimpleDecoderModule.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/SimpleDecoderModule.java deleted file mode 100644 index a1c3ead..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/SimpleDecoderModule.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.rehlds.flightrec.api; - -import java.util.HashMap; -import java.util.Map; - -public class SimpleDecoderModule implements DecoderModule { - Map decoders = new HashMap<>(); - - public final String description; - public final String version; - - public SimpleDecoderModule(String description, String version) { - this.description = description; - this.version = version; - } - - @Override - public MessageDecoder lookupDecoder(FlightrecMessageType msgType) { - return decoders.get(msgType); - } - - @Override - public String getDescription() { - return description; - } - - @Override - public String getVersion() { - return version; - } - - public void registerDecoder(MessageDecoder msgDecoder) { - decoders.put(msgDecoder.getMessageType(), msgDecoder); - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/Globals.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/Globals.java deleted file mode 100644 index ba583b7..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/Globals.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.rehlds.flightrec.api.util; - -import java.nio.charset.Charset; - -public class Globals { - public static final Charset UTF8 = Charset.forName("UTF-8"); - -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/SizebufOverflowException.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/SizebufOverflowException.java deleted file mode 100644 index ad4ec97..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/SizebufOverflowException.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.rehlds.flightrec.api.util; - -public class SizebufOverflowException extends RuntimeException { - public final String sizebufName; - - public SizebufOverflowException(String sizebufName) { - super(sizebufName + " overflowed"); - this.sizebufName = sizebufName; - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilByteBuffer.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilByteBuffer.java deleted file mode 100644 index aa76d21..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilByteBuffer.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.rehlds.flightrec.api.util; - -public class UtilByteBuffer { - byte data[]; - - public UtilByteBuffer(byte[] data) { - this.data = data; - } - - public byte[] getData() { - return data; - } - - public UtilByteBuffer cutLeft(int newStart) { - byte[] newData = new byte[data.length - newStart]; - System.arraycopy(data, newStart, newData, 0, data.length - newStart); - return new UtilByteBuffer(newData); - } - - public int getDataLength() { - return data.length; - } - - public int readUInt8(int pos) { - return data[pos] & 0xFF; - } - - public boolean readBool(int pos) { - return data[pos] != 0; - } - - public int readUInt16(int pos) { - return (data[pos] & 0xFF) | ((data[pos + 1] & 0xFF) << 8); - } - - public long readUInt32(int pos) { - return (data[pos] & 0xFF) | ((data[pos + 1] & 0xFF) << 8) | ((data[pos + 2] & 0xFF) << 16) | ((long)(data[pos + 3] & 0xFF) << 24); - } - - public int readInt32(int pos) { - return (data[pos] & 0xFF) | ((data[pos + 1] & 0xFF) << 8) | ((data[pos + 2] & 0xFF) << 16) | ((data[pos + 3] & 0xFF) << 24); - } - - public long readInt64(int pos) { - long lowBits = readUInt32(pos); - long highBits = readUInt32(pos + 4); - - return lowBits | (highBits << 32); - } - - public double readDouble(int pos) { - long bits = readInt64(pos); - return Double.longBitsToDouble(bits); - } - - public float readFloat(int pos) { - int bits = readInt32(pos); - return Float.intBitsToFloat(bits); - } - - public String readString(int pos) { - return readString(pos, data.length - pos, true); - } - - public String readString(int pos, int maxSize, boolean errorOnMaxSizeHit) { - int iMax = Math.min(data.length, pos + maxSize); - for (int i = pos; i < iMax; i++) { - if (data[i] == 0) { - return new String(data, pos, i - pos, Globals.UTF8); - } - } - - if (errorOnMaxSizeHit) { - return null; - } - - return new String(data, pos, iMax - pos, Globals.UTF8); - } -} diff --git a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilSizeBuf.java b/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilSizeBuf.java deleted file mode 100644 index d8e52a7..0000000 --- a/flightrec/decoder_api/src/main/java/org/rehlds/flightrec/api/util/UtilSizeBuf.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.rehlds.flightrec.api.util; - -public class UtilSizeBuf { - String name; - UtilByteBuffer buf; - int startPos; - int maxSize; - int curPos; - - public UtilSizeBuf(String name, UtilByteBuffer buf, int startPos, int maxSize) { - this.name = name; - this.buf = buf; - this.startPos = startPos; - this.maxSize = maxSize; - curPos = 0; - } - - public UtilSizeBuf(String name, UtilByteBuffer buf) { - this(name, buf, 0, buf.getDataLength()); - } - - public void init(int startPos, int maxSize) { - this.startPos = startPos; - this.maxSize = maxSize; - curPos = 0; - } - - public void reset() { - this.curPos = 0; - } - - public int tell() { - return curPos; - } - - public int getAbsoluteCurrentPos() { - return curPos + startPos; - } - - public void skip(int count) { - if (curPos + count > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - curPos += count; - } - - public int readUInt8() { - if (curPos + 1 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos++; - return buf.readUInt8(pos + this.startPos); - } - - public boolean readBool() { - if (curPos + 1 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos++; - return buf.readBool(pos + this.startPos); - } - - public int readUInt16() { - if (curPos + 2 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos += 2; - return buf.readUInt16(pos + this.startPos); - } - - public long readUInt32() { - if (curPos + 4 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos += 4; - return buf.readUInt32(pos + this.startPos); - } - - public int readInt32() { - if (curPos + 4 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos += 4; - return buf.readInt32(pos + this.startPos); - } - - public long readInt64() { - if (curPos + 8 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos += 8; - return buf.readInt64(pos + this.startPos); - } - - public double readDouble() { - if (curPos + 8 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos += 8; - return buf.readDouble(pos + this.startPos); - } - - public float readFloat() { - if (curPos + 4 > maxSize) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - int pos = curPos; - curPos += 4; - return buf.readFloat(pos + this.startPos); - } - - public String readString() { - String s = buf.readString(curPos + this.startPos); - if (s == null) { - curPos = maxSize; - throw new SizebufOverflowException(name); - } - - curPos += s.getBytes(Globals.UTF8).length + 1; - return s; - } - - public int getStartPos() { - return startPos; - } - - public int getMaxSize() { - return maxSize; - } - - public byte[] getBuffer() { - return buf.getData(); - } -} diff --git a/flightrec/decoder_api/src/test/java/org/rehlds/flightrec/util/UtilByteBufferTest.java b/flightrec/decoder_api/src/test/java/org/rehlds/flightrec/util/UtilByteBufferTest.java deleted file mode 100644 index 22ed565..0000000 --- a/flightrec/decoder_api/src/test/java/org/rehlds/flightrec/util/UtilByteBufferTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.rehlds.flightrec.util; - -import org.junit.Test; -import org.rehlds.flightrec.api.util.UtilByteBuffer; - -import static org.junit.Assert.*; - -public class UtilByteBufferTest { - - @Test - public void testReadUInt8() throws Exception { - byte data[] = { 0x10, 0x00, 0x7F, (byte)0x80, (byte)0xFF }; - UtilByteBuffer bb = new UtilByteBuffer(data); - - assertEquals(0x10, bb.readUInt8(0)); - assertEquals(0x00, bb.readUInt8(1)); - assertEquals(0x7F, bb.readUInt8(2)); - assertEquals(0x80, bb.readUInt8(3)); - assertEquals(0xFF, bb.readUInt8(4)); - } - - @Test - public void testReadUInt16() throws Exception { - byte data[] = { 0x10, 0x00, 0x7F, (byte)0x80, (byte)0xFF, 0x00 }; - UtilByteBuffer bb = new UtilByteBuffer(data); - - assertEquals(0x10, bb.readUInt16(0)); - assertEquals(0x7F00, bb.readUInt16(1)); - assertEquals(0x807F, bb.readUInt16(2)); - assertEquals(0xFF80, bb.readUInt16(3)); - assertEquals(0x00FF, bb.readUInt16(4)); - } - - @Test - public void testReadUInt32() throws Exception { - byte data[] = { 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, (byte)0xFF, 0x00, 0x00, 0x00 }; - UtilByteBuffer bb = new UtilByteBuffer(data); - assertEquals(0x10000000, bb.readUInt32(0)); - assertEquals(0x100000, bb.readUInt32(1)); - assertEquals(0x1000, bb.readUInt32(2)); - assertEquals(0x10, bb.readUInt32(3)); - assertEquals(0x0, bb.readUInt32(4)); - assertEquals(0x7F000000, bb.readUInt32(5)); - assertEquals(0x7F0000, bb.readUInt32(6)); - assertEquals(0x7F00, bb.readUInt32(7)); - assertEquals(0x7F, bb.readUInt32(8)); - assertEquals(0xFF000000L, bb.readUInt32(9)); - assertEquals(0xFF0000, bb.readUInt32(10)); - assertEquals(0xFF00, bb.readUInt32(11)); - assertEquals(0xFF, bb.readUInt32(12)); - } - - @Test - public void testReadInt32() throws Exception { - byte data[] = { 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, (byte)0xFF, 0x00, 0x00, 0x00 }; - UtilByteBuffer bb = new UtilByteBuffer(data); - assertEquals(0x10000000, bb.readInt32(0)); - assertEquals(0x100000, bb.readInt32(1)); - assertEquals(0x1000, bb.readInt32(2)); - assertEquals(0x10, bb.readInt32(3)); - - assertEquals(0x0, bb.readInt32(4)); - - assertEquals(0x7F000000, bb.readInt32(5)); - assertEquals(0x7F0000, bb.readInt32(6)); - assertEquals(0x7F00, bb.readInt32(7)); - assertEquals(0x7F, bb.readInt32(8)); - - assertEquals((int)0xFF000000, bb.readInt32(9)); - assertEquals(0xFF0000, bb.readInt32(10)); - assertEquals(0xFF00, bb.readInt32(11)); - assertEquals(0xFF, bb.readInt32(12)); - } - - @Test - public void testReadInt64() throws Exception { - byte data[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - UtilByteBuffer bb = new UtilByteBuffer(data); - assertEquals(0x1000000000000000L, bb.readInt64(0)); - assertEquals(0x10000000000000L, bb.readInt64(1)); - assertEquals(0x100000000000L, bb.readInt64(2)); - assertEquals(0x1000000000L, bb.readInt64(3)); - assertEquals(0x10000000L, bb.readInt64(4)); - assertEquals(0x100000L, bb.readInt64(5)); - assertEquals(0x1000L, bb.readInt64(6)); - assertEquals(0x10L, bb.readInt64(7)); - - assertEquals(0x00L, bb.readInt64(8)); - - assertEquals(0x7F00000000000000L, bb.readInt64(9)); - assertEquals(0x7F000000000000L, bb.readInt64(10)); - assertEquals(0x7F0000000000L, bb.readInt64(11)); - assertEquals(0x7F00000000L, bb.readInt64(12)); - assertEquals(0x7F000000L, bb.readInt64(13)); - assertEquals(0x7F0000L, bb.readInt64(14)); - assertEquals(0x7F00L, bb.readInt64(15)); - assertEquals(0x7FL, bb.readInt64(16)); - - assertEquals(0xFF00000000000000L, bb.readInt64(17)); - assertEquals(0xFF000000000000L, bb.readInt64(18)); - assertEquals(0xFF0000000000L, bb.readInt64(19)); - assertEquals(0xFF00000000L, bb.readInt64(20)); - assertEquals(0xFF000000L, bb.readInt64(21)); - assertEquals(0xFF0000L, bb.readInt64(22)); - assertEquals(0xFF00L, bb.readInt64(23)); - assertEquals(0xFFL, bb.readInt64(24)); - } - - @Test - public void testReadString() throws Exception { - byte data[] = { 0x00, 0x41, 0x00, 0x41, 0x42, 0x00, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x69, 0x74, (byte)0xC3, (byte)0xA9, 0x00, 0x41, 0x42 }; - UtilByteBuffer bb = new UtilByteBuffer(data); - - assertEquals("", bb.readString(0)); - assertEquals("A", bb.readString(1)); - assertEquals("", bb.readString(2)); - assertEquals("AB", bb.readString(3)); - assertEquals("Publicité", bb.readString(6)); - assertNull(bb.readString(17)); - - assertEquals("Public", bb.readString(6, 6, false)); - assertNull(bb.readString(6, 6, true)); - - assertEquals("AB", bb.readString(17, 2, false)); - assertNull(bb.readString(17, 2, true)); - } -} \ No newline at end of file diff --git a/getucrtinfo.bat b/getucrtinfo.bat deleted file mode 100644 index 35911fa..0000000 --- a/getucrtinfo.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -call "%VS140COMNTOOLS%vcvarsqueryregistry.bat" -echo %UniversalCRTSdkDir% -echo %UCRTVersion% diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 41b3fb9..0000000 --- a/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -majorVersion=3 -minorVersion=8 -maintenanceVersion=0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 175c642d9d335ec83dba0b6fa44b04fc18d7768b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52279 zcmaI7W0WRA)-GDMZR0K5wrzCTwr$(CZC96VcGcAu~J1Q|6A8f@r&pg8*zr?wBx_1KpkGKAP(Z4l}8G9rcUTCi!;xG@C5u7%|d5IPXk^9tFB*g#83RrO}WBJLFqqd8vkp70S& z`_#W4LKBG${=_m8_G#ltpYp9FH|%PyT~J56l->e2Y-8zc>tnqDWLMK+QG|rLM$u5h z(0N{p{*W2-_pgot5_Vz~?~29Pkx`K3!C4yw_;sl=+e1AHB)DKB@%fY!hRl<|35#Pv z5QfJN!MoDo`~HWPM|MJ2(f*>q;jfDS=O6!%mj9{2|D~3H%~8eE*~QdW(aHX=vRo`p zo&SzJJcV3cEKKcOER79a?4AChgi;k-dlVrgKMX+l*up`jL2c^Bs+a0LGM4s>iJ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z<_I4<1uJ4mJOis?6ZusQw}F{A2jXG1Gs-iy8hK{P#QY zZxPfVQ#}s8`jg7Y@;^}hCA9xbT#w^d{v-*u`41%j9?kM`j~<8n`$^Vo|8Hc!Zbv`H zd>m}*CuW-KzhQpAA%8*t^~W!}dyiQjM>YD%lI;E)%m1ML9^>dS=HrM8KQV3J{*L+I z<10Mod3?(MCy#i*Z#=&%kNi>ZM&o; \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index aec9973..0000000 --- a/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/publish.gradle b/publish.gradle deleted file mode 100644 index 995e92f..0000000 --- a/publish.gradle +++ /dev/null @@ -1,186 +0,0 @@ -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.apache.commons.io.FilenameUtils - -void _copyFileToDir(String from, String to) { - if (!project.file(from).exists()) { - println 'WARNING: Could not find: ' + from; - return; - } - - if (!project.file(to).exists()) { - project.file(to).mkdirs(); - } - - def dst = new File(project.file(to), FilenameUtils.getName(from)) - GradleCppUtils.copyFile(project.file(from), dst, false) -} - -void _copyFile(String from, String to) { - if (!project.file(from).exists()) { - println 'WARNING: Could not find: ' + from; - return; - } - - GradleCppUtils.copyFile(project.file(from), project.file(to), false) -} - -task publishPrepareFiles { - dependsOn ':flightrec/decoder:uberjar' - doLast { - def pubRootDir = project.file('publish/publishRoot') - if (pubRootDir.exists()) { - if (!pubRootDir.deleteDir()) { - throw new RuntimeException("Failed to delete ${pubRootDir}") - } - } - - pubRootDir.mkdirs() - project.file('publish/publishRoot/bin/win32/valve/dlls').mkdirs() - project.file('publish/publishRoot/bin/linux32/valve/dlls').mkdirs() - - // bugfixed binaries - _copyFile('publish/releaseRehldsFixes/swds.dll', 'publish/publishRoot/bin/win32/swds.dll') - _copyFile('publish/releaseRehldsFixes/engine_i486.so', 'publish/publishRoot/bin/linux32/engine_i486.so') - - // dedicated binaries - _copyFile('publish/hlds.exe', 'publish/publishRoot/bin/win32/hlds.exe') - _copyFile('publish/hlds_linux', 'publish/publishRoot/bin/linux32/hlds_linux') - - // HLTV binaries - _copyFile('publish/hltv.exe', 'publish/publishRoot/bin/win32/hltv.exe') - _copyFile('publish/hltv', 'publish/publishRoot/bin/linux32/hltv') - - _copyFile('publish/core.dll', 'publish/publishRoot/bin/win32/core.dll') - _copyFile('publish/core.so', 'publish/publishRoot/bin/linux32/core.so') - - _copyFile('publish/proxy.dll', 'publish/publishRoot/bin/win32/proxy.dll') - _copyFile('publish/proxy.so', 'publish/publishRoot/bin/linux32/proxy.so') - - _copyFile('publish/demoplayer.dll', 'publish/publishRoot/bin/win32/demoplayer.dll') - _copyFile('publish/demoplayer.so', 'publish/publishRoot/bin/linux32/demoplayer.so') - - _copyFile('publish/director.dll', 'publish/publishRoot/bin/win32/valve/dlls/director.dll') - _copyFile('publish/director.so', 'publish/publishRoot/bin/linux32/valve/dlls/director.so') - - // FileSystem binaries - _copyFile('publish/filesystem_stdio.dll', 'publish/publishRoot/bin/win32/filesystem_stdio.dll') - _copyFile('publish/filesystem_stdio.so', 'publish/publishRoot/bin/linux32/filesystem_stdio.so') - - // hlsdk - project.file('publish/publishRoot/hlsdk').mkdirs() - copy { - from 'rehlds/common' - into 'publish/publishRoot/hlsdk/common' - } - copy { - from 'rehlds/dlls' - into 'publish/publishRoot/hlsdk/dlls' - } - copy { - from 'rehlds/pm_shared' - into 'publish/publishRoot/hlsdk/pm_shared' - } - copy { - from 'rehlds/public' - into 'publish/publishRoot/hlsdk/public' - exclude '**/rehlds/*' - } - copy { - from 'rehlds/public/rehlds' - into 'publish/publishRoot/hlsdk/engine' - } - - // flightrecorder - def flightRecJarTask = project(':flightrec/decoder').tasks.getByName('uberjar') - println flightRecJarTask - println flightRecJarTask.class.name - File flightRecJarFile = flightRecJarTask.archivePath - project.file('publish/publishRoot/flighrec').mkdirs() - GradleCppUtils.copyFile(flightRecJarFile, project.file('publish/publishRoot/flighrec/decoder.jar'), false) - copy { - from new File(project(':flightrec/decoder').projectDir, 'pub') - into 'publish/publishRoot/flighrec' - } - } -} - -task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') { - baseName = "rehlds-dist-${project.version}" - destinationDir file('publish') - from 'publish/publishRoot' -} - -publishing { - publications { - maven(MavenPublication) { - version project.version - artifact publishPackage - - pom.withXml { - asNode().children().last() + { - resolveStrategy = DELEGATE_FIRST - name project.name - description project.description - properties { - commitDate project.ext.rehldsVersionInfo.commitDate - commitSHA project.ext.rehldsVersionInfo.commitSHA - } - - //url github - //scm { - // url "${github}.git" - // connection "scm:git:${github}.git" - //} - /* - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - developers { - developer { - id 'dreamstalker' - name 'dreamstalker' - } - } - */ - } - } - } - } -} - -Properties repoCreds = new Properties() -project.ext.repoCreds = repoCreds -if (file('repo_creds.properties').exists()) { - println 'Loading maven repo credentials' - file('repo_creds.properties').withReader('UTF-8', { Reader r -> - repoCreds.load(r) - }) -} - -publishing { - repositories { - maven { - if (project.version.contains('dev')) { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/" - } else { - url "http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/" - } - credentials { - username repoCreds.getProperty('username') - password repoCreds.getProperty('password') - } - } - } -} - -task doPublish { - dependsOn 'publishPackage' - if (repoCreds.getProperty('username') && repoCreds.getProperty('password')) { - dependsOn 'publish' - dependsOn ':flightrec/decoder_api:publish' - } -} diff --git a/rehlds/HLTV/Console/build.gradle b/rehlds/HLTV/Console/build.gradle deleted file mode 100644 index 7d07df5..0000000 --- a/rehlds/HLTV/Console/build.gradle +++ /dev/null @@ -1,173 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeExecutableSpec -import org.gradle.nativeplatform.NativeExecutableBinarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: 'windows-resources' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -List getRcCompileTasks(NativeBinarySpec binary) -{ - def linkTask = GradleCppUtils.getLinkTask(binary) - def res = linkTask.taskDependencies.getDependencies(linkTask).findAll { Task t -> t instanceof WindowsResourceCompile } - return res as List -} - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/..', '/../..', '/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds'); - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'LAUNCHER_FIXES', '_CONSOLE' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'hltv_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS'); - - cfg.linkerOptions.args('/SUBSYSTEM:WINDOWS,5.01'); - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-' - cfg.extraLibs "user32.lib" - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'hltv_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - ]); - - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.linkerOptions.args '-no-pie' - cfg.compilerOptions.args '-fno-rtti', '-fno-exceptions' - cfg.extraLibs 'dl' - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - hltv(NativeExecutableSpec) { - targetPlatform 'x86' - baseName 'hltv' - - sources { - hltv_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - } - } - hltv_common(CppSourceSet) { - source { - srcDirs "../../common", "../common" - - // common - include "BaseSystemModule.cpp" - include "ObjectList.cpp" - include "TokenLine.cpp" - include "textconsole.cpp" - include "minidump.cpp" - if (GradleCppUtils.windows) { - include "TextConsoleWin32.cpp" - } - else { - include "TextConsoleUnix.cpp" - } - - // HLTV common - include "random.cpp" - include "common.cpp" - } - } - hltv_engine(CppSourceSet) { - source { - srcDir "../../engine" - include "mem.cpp" - } - } - hltv_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - } - } - - rc { - source { - srcDir "msvc" - include "hltv.rc" - } - exportedHeaders { - srcDirs "msvc" - } - } - } - - binaries.all { - NativeExecutableBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFixes { - dependsOn binaries.withType(NativeExecutableBinarySpec).matching { NativeExecutableBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(NativeExecutableBinarySpec).matching { NativeExecutableBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} diff --git a/rehlds/HLTV/Console/msvc/PreBuild.bat b/rehlds/HLTV/Console/msvc/PreBuild.bat index c9f7989..8c11185 100644 --- a/rehlds/HLTV/Console/msvc/PreBuild.bat +++ b/rehlds/HLTV/Console/msvc/PreBuild.bat @@ -77,14 +77,6 @@ IF EXIST "%srcdir%\version.h" ( IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k ) ) -) ELSE ( - FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do ( - IF NOT [%%j] == [] ( - IF %%i==majorVersion set version_major=%%j - IF %%i==minorVersion set version_minor=%%j - IF %%i==maintenanceVersion set version_maintenance=%%j - ) - ) ) :: diff --git a/rehlds/HLTV/Core/build.gradle b/rehlds/HLTV/Core/build.gradle deleted file mode 100644 index 0f3c129..0000000 --- a/rehlds/HLTV/Core/build.gradle +++ /dev/null @@ -1,186 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -project.ext.dep_bzip2 = project(':dep/bzip2') - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/..', '/../..', '/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared'); - cfg.projectInclude(dep_bzip2, '/include') - - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'HLTV_FIXES', 'CORE_MODULE' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'core_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF' - cfg.extraLibs "ws2_32.lib", "psapi.lib" - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'core_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.compilerOptions.args '-fno-exceptions' - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - core(NativeLibrarySpec) { - targetPlatform 'x86' - baseName 'core' - - sources { - core_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - } - - lib project: ':dep/bzip2', library: 'bzip2', linkage: 'static' - } - - core_common(CppSourceSet) { - source { - srcDirs "../../common", "../common" - - // common - include "BaseSystemModule.cpp" - include "ObjectDictionary.cpp" - include "ObjectList.cpp" - include "TokenLine.cpp" - - // HLTV common - include "BitBuffer.cpp" - include "byteorder.cpp" - include "common.cpp" - include "DemoFile.cpp" - include "DirectorCmd.cpp" - include "InfoString.cpp" - include "mathlib.cpp" - include "md5.cpp" - include "munge.cpp" - include "NetAddress.cpp" - include "NetChannel.cpp" - include "random.cpp" - } - } - - core_engine(CppSourceSet) { - source { - srcDir "../../engine" - include "mem.cpp" - } - } - - core_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - - lib project: ':dep/bzip2', library: 'bzip2', linkage: 'static' - } - } - } - - binaries.all { - NativeBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -build.finalizedBy(buildFinalize); -buildFixes.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -// prevent static lib building -binaries.withType(StaticLibraryBinarySpec) { binary -> - buildable = false -} diff --git a/rehlds/HLTV/DemoPlayer/build.gradle b/rehlds/HLTV/DemoPlayer/build.gradle deleted file mode 100644 index 65629d2..0000000 --- a/rehlds/HLTV/DemoPlayer/build.gradle +++ /dev/null @@ -1,171 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/..', '/../..', '/src', '/../common', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared'); - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'HLTV_FIXES', 'DEMOPLAYER_MODULE' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'demoplayer_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF' - cfg.extraLibs "psapi.lib" - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'demoplayer_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.compilerOptions.args '-fno-exceptions' - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - demoplayer(NativeLibrarySpec) { - targetPlatform 'x86' - baseName 'demoplayer' - - sources { - demoplayer_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - } - } - - demoplayer_common(CppSourceSet) { - source { - srcDirs "/../../common", "/../common" - - // common - include "BaseSystemModule.cpp" - include "ObjectDictionary.cpp" - include "ObjectList.cpp" - include "TokenLine.cpp" - - // HLTV common - include "BitBuffer.cpp" - include "byteorder.cpp" - include "common.cpp" - include "DirectorCmd.cpp" - include "mathlib.cpp" - } - } - - demoplayer_engine(CppSourceSet) { - source { - srcDir "../../engine" - include "mem.cpp" - } - } - - demoplayer_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - } - } - } - - binaries.all { - NativeBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -build.finalizedBy(buildFinalize); -buildFixes.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -// prevent static lib building -binaries.withType(StaticLibraryBinarySpec) { binary -> - buildable = false -} diff --git a/rehlds/HLTV/Director/build.gradle b/rehlds/HLTV/Director/build.gradle deleted file mode 100644 index 213fbbd..0000000 --- a/rehlds/HLTV/Director/build.gradle +++ /dev/null @@ -1,171 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/..', '/../..', '/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared'); - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'HLTV_FIXES', 'DIRECTOR_MODULE' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'director_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF' - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'director_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++0x' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.compilerOptions.args '-fno-exceptions' - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - director(NativeLibrarySpec) { - targetPlatform 'x86' - baseName 'director' - - sources { - director_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - } - } - - director_common(CppSourceSet) { - source { - srcDirs "../../common", "../common" - - // common - include "BaseSystemModule.cpp" - include "ObjectDictionary.cpp" - include "ObjectList.cpp" - include "TokenLine.cpp" - - // HLTV common - include "BitBuffer.cpp" - include "byteorder.cpp" - include "common.cpp" - include "DirectorCmd.cpp" - include "mathlib.cpp" - include "random.cpp" - } - } - - director_engine(CppSourceSet) { - source { - srcDir "../../engine" - include "mem.cpp" - } - } - - director_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - } - } - } - - binaries.all { - NativeBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -build.finalizedBy(buildFinalize); -buildFixes.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -// prevent static lib building -binaries.withType(StaticLibraryBinarySpec) { binary -> - buildable = false -} diff --git a/rehlds/HLTV/Proxy/build.gradle b/rehlds/HLTV/Proxy/build.gradle deleted file mode 100644 index 92e2deb..0000000 --- a/rehlds/HLTV/Proxy/build.gradle +++ /dev/null @@ -1,198 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -project.ext.dep_bzip2 = project(':dep/bzip2') - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/..', '/../..', '/src', '/../Director/src', '/../../common', '/../../engine', '/../../public', '/../../public/rehlds', '/../../pm_shared'); - cfg.projectInclude(dep_bzip2, '/include') - - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'HLTV', 'HLTV_FIXES', 'PROXY_MODULE' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'proxy_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF' - cfg.projectLibpath(project, '/../../lib') - cfg.extraLibs "steam_api.lib", "psapi.lib", "ws2_32.lib" - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'proxy_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.compilerOptions.args '-fno-exceptions' - cfg.projectLibpath(project, '/../../lib/linux32') - cfg.extraLibs "steam_api" - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - proxy(NativeLibrarySpec) { - targetPlatform 'x86' - baseName 'proxy' - - sources { - proxy_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - } - - lib project: ':dep/bzip2', library: 'bzip2', linkage: 'static' - } - - proxy_common(CppSourceSet) { - source { - srcDirs "../../common", "../common" - - // common - include "BaseSystemModule.cpp" - include "ObjectDictionary.cpp" - include "ObjectList.cpp" - include "TokenLine.cpp" - - // HLTV common - include "BaseClient.cpp" - include "BitBuffer.cpp" - include "byteorder.cpp" - include "common.cpp" - include "DemoFile.cpp" - include "DirectorCmd.cpp" - include "InfoString.cpp" - include "mathlib.cpp" - include "md5.cpp" - include "munge.cpp" - include "NetAddress.cpp" - include "NetChannel.cpp" - include "random.cpp" - } - } - - proxy_engine(CppSourceSet) { - source { - srcDir "../../engine" - include "mem.cpp" - } - } - - proxy_director(CppSourceSet) { - source { - srcDir "../Director/src" - include "Director.cpp" - } - } - - proxy_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - - lib project: ':dep/bzip2', library: 'bzip2', linkage: 'static' - } - } - } - - binaries.all { - NativeBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -build.finalizedBy(buildFinalize); -buildFixes.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -// prevent static lib building -binaries.withType(StaticLibraryBinarySpec) { binary -> - buildable = false -} diff --git a/rehlds/HLTV/README.md b/rehlds/HLTV/README.md index 48da8c5..f7b7814 100644 --- a/rehlds/HLTV/README.md +++ b/rehlds/HLTV/README.md @@ -1,15 +1,5 @@ ## Half-Life TV for Goldsrc based games HLTV Launcher -### Building -On Windows: -
    gradlew --max-workers=1 clean rehlds/HLTV:build
    - -On Linux (ICC): -
    ./gradlew --max-workers=1 clean rehlds/HLTV:build
    - -On Linux (GCC): -
    ./gradlew --max-workers=1 -PuseGcc clean rehlds/HLTV:build
    - Compiled binaries will be placed in each project rehlds/HLTV/**/binaries/ directory ### Overview diff --git a/rehlds/HLTV/build.gradle b/rehlds/HLTV/build.gradle deleted file mode 100644 index 8f08d31..0000000 --- a/rehlds/HLTV/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -evaluationDependsOn(':rehlds/HLTV/Console'); -evaluationDependsOn(':rehlds/HLTV/Core'); -evaluationDependsOn(':rehlds/HLTV/DemoPlayer'); -evaluationDependsOn(':rehlds/HLTV/Director'); -evaluationDependsOn(':rehlds/HLTV/Proxy'); - -task build { - dependsOn project(':rehlds/HLTV/Console').tasks.build, - project(':rehlds/HLTV/Core').tasks.build, - project(':rehlds/HLTV/DemoPlayer').tasks.build, - project(':rehlds/HLTV/Director').tasks.build, - project(':rehlds/HLTV/Proxy').tasks.build -} diff --git a/rehlds/build.gradle b/rehlds/build.gradle deleted file mode 100644 index e36ea4d..0000000 --- a/rehlds/build.gradle +++ /dev/null @@ -1,425 +0,0 @@ -import gradlecpp.RehldsPlayTestPlugin -import gradlecpp.RehldsPlayTestTask -import gradlecpp.VelocityUtils - -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.doomedsociety.gradlecpp.LazyNativeDepSet -import org.doomedsociety.gradlecpp.cfg.ToolchainConfig -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet -import org.doomedsociety.gradlecpp.msvc.FloatingPointModel -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.gradle.language.cpp.CppSourceSet -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeExecutableSpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.SharedLibraryBinarySpec -import rehlds.testdemo.RehldsDemoRunner -import versioning.RehldsVersionInfo -import org.apache.commons.io.FilenameUtils - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin -apply plugin: RehldsPlayTestPlugin -apply plugin: gradlecpp.CppUnitTestPlugin - -repositories { - maven { - url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-releases/' - } -} - -configurations { - rehlds_tests -} - -dependencies { - rehlds_tests 'rehlds.testdemos:hl-phys-single1:1.1' - rehlds_tests 'rehlds.testdemos:crossfire-1-multiplayer-1:1.1' - rehlds_tests 'rehlds.testdemos:cstrike-muliplayer-1:1.1' - rehlds_tests 'rehlds.testdemos:shooting-hl-1:1.1' -} - -project.ext.dep_bzip2 = project(':dep/bzip2') -project.ext.dep_cppunitlite = project(':dep/cppunitlite') - -void createIntergrationTestTask(NativeBinarySpec b) { - boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') - - if (!(b instanceof SharedLibraryBinarySpec)) return - if (!GradleCppUtils.windows) return - if (rehldsFixes) return - - def libLinkTask = GradleCppUtils.getLinkTask(b) - String unitTestTask = b.hasProperty('cppUnitTestTask') ? b.cppUnitTestTask : null - - def depFiles = [] - depFiles.addAll(libLinkTask.outputs.files.files) - - def demoItgTestTask = project.tasks.create(b.namingScheme.getTaskName('demoItgTest'), RehldsPlayTestTask) - demoItgTestTask.with { - rehldsImageRoot = new File(project.projectDir, '_rehldsTestImg') - rehldsTestLogs = new File(this.project.buildDir, "_rehldsTestLogs/${b.name}") - testDemos = project.configurations.rehlds_tests - testFor = b - - //inputs/outputs for up-to-date check - inputs.files depFiles - inputs.files testDemos.files - outputs.dir rehldsTestLogs - - //dependencies on library and test executable - dependsOn libLinkTask - if (unitTestTask) { - dependsOn unitTestTask - } - - postExtractAction { - def binaryOutFile = GradleCppUtils.getBinaryOutputFile(b) - GradleCppUtils.copyFile(binaryOutFile, new File(rehldsImageRoot, binaryOutFile.name), true) - } - } - - b.buildTask.dependsOn demoItgTestTask -} - -void setupUnitTests(NativeBinarySpec bin) { - boolean unitTestExecutable = bin.component.name.endsWith('_tests') - if (!unitTestExecutable) return - - GradleCppUtils.getLinkTask(bin).doLast { - String srcPath = '' + projectDir + (GradleCppUtils.windows ? '/lib/steam_api.dll' : '/lib/linux32/libsteam_api.so') - String dstPath = bin.executableFile.parent + (GradleCppUtils.windows ? '/steam_api.dll' : '/libsteam_api.so') - GradleCppUtils.copyFile(srcPath, dstPath, true) - } -} - -void postEvaluate(NativeBinarySpec b) { - - // attach generateAppVersion task to all 'compile source' tasks - GradleCppUtils.getCompileTasks(b).each { Task t -> - t.dependsOn project.generateAppVersion - } - - setupUnitTests(b) - createIntergrationTestTask(b) -} - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - boolean unitTestExecutable = b.component.name.endsWith('_tests') - boolean swdsLib = b.name.toLowerCase().contains('swds') - boolean rehldsFixes = b.flavor.name.contains('rehldsFixes') - boolean release = b.buildType.name.toLowerCase() == 'release'; - - ToolchainConfig cfg = rootProject.createToolchainConfig(b) - cfg.projectInclude(project, '', '/public/rehlds', '/engine', '/common', '/pm_shared', '/rehlds', '/testsuite', '/hookers', '/public') - cfg.projectInclude(dep_bzip2, '/include') - - if (unitTestExecutable) { - cfg.projectInclude(dep_cppunitlite, '/include') - b.lib LazyNativeDepSet.create(dep_cppunitlite, 'cppunitlite', b.buildType.name, true) - } - b.lib LazyNativeDepSet.create(dep_bzip2, 'bzip2', b.buildType.name, true) - - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'SWDS', 'REHLDS_SELF', 'REHLDS_OPT_PEDANTIC', 'REHLDS_API' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'rehlds_pch' - ) - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - if (!rehldsFixes) { - cfg.compilerOptions.floatingPointModel = FloatingPointModel.PRECISE - cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED - } else { - cfg.compilerOptions.args '/Oi', '/GF', '/GR-', '/GS-' - } - if (swdsLib) { - cfg.linkerOptions.randomizedBaseAddress = false - cfg.linkerOptions.baseAddress = '0x4970000' - } - cfg.projectLibpath(project, '/lib') - cfg.extraLibs 'steam_api.lib', 'psapi.lib', 'ws2_32.lib', 'kernel32.lib', 'user32.lib', 'advapi32.lib', 'libacof32.lib' - } else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'rehlds_pch' - ) - } - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_strdup': 'strdup', - '_unlink': 'unlink', - '_vsnprintf': 'vsnprintf', - '_vsnwprintf' : 'vswprintf', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - cfg.compilerOptions.args '-ffunction-sections', '-fdata-sections' // Remove unused code and data - cfg.compilerOptions.args '-fno-rtti', '-fno-exceptions' - - cfg.linkerOptions.args '-Wl,--version-script=../version_script.lds', '-Wl,--gc-sections' - - cfg.projectLibpath(project, '/lib/linux32') - cfg.extraLibs 'rt', 'dl', 'm', 'steam_api', 'aelf32' - } - - if (unitTestExecutable) { - cfg.singleDefines 'REHLDS_UNIT_TESTS', 'REHLDS_SSE', 'REHLDS_JIT' - } - - if (rehldsFixes) { - cfg.singleDefines 'REHLDS_FIXES', 'REHLDS_SSE', 'REHLDS_JIT', 'REHLDS_CHECKS', 'HAVE_OPT_STRTOOLS' - } - - if (!release) { - cfg.singleDefines 'REHLDS_FLIGHT_REC' - } - - ToolchainConfigUtils.apply(project, cfg, b) - - GradleCppUtils.onTasksCreated(project, 'postEvaluate', { - postEvaluate(b) - }) -} - -class RehldsSrc { - static void rehlds_src(def h) { - h.rehlds_engine(CppSourceSet) { - source { - srcDirs "engine", "rehlds", "version" - if (GradleCppUtils.windows) srcDirs "testsuite" - - include "**/*.cpp" - exclude "precompiled.cpp" - } - } - h.rehlds_public(CppSourceSet) { - source { - srcDirs "public" - include "registry.cpp", "steamid.cpp", "utlbuffer.cpp", "tier0/dbg.cpp" - } - } - h.rehlds_memory(CppSourceSet) { - source { - srcDirs "hookers" - include "memory.cpp" - } - } - h.rehlds_common(CppSourceSet) { - source { - srcDirs "common" - include "BaseSystemModule.cpp", "ObjectList.cpp", "TokenLine.cpp" - } - } - } - - static void rehlds_pch(def h) { - h.rehlds_pch(CppSourceSet) { - source { - srcDirs "rehlds" - include "precompiled.cpp" - } - } - } - - static void rehlds_swds_main_src(def h) { - h.rehlds_swds_main_src(CppSourceSet) { - source { - srcDir "hookers" - include "engine/main_swds.cpp" - } - } - } - - static void rehlds_tests_src(def h) { - h.rehlds_tests_src(CppSourceSet) { - source { - srcDir "unittests" - include "**/*.cpp" - } - } - } -} - -model { - buildTypes { - debug - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - flavors { - rehldsNofixes - rehldsFixes - } - - components { - rehlds_swds_engine(NativeLibrarySpec) { - targetPlatform 'x86' - baseName GradleCppUtils.windows ? 'swds' : 'engine_i486' - - sources { - RehldsSrc.rehlds_pch(it) - RehldsSrc.rehlds_src(it) - RehldsSrc.rehlds_swds_main_src(it) - } - - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - - rehlds_swds_engine_tests(NativeExecutableSpec) { - targetPlatform 'x86' - sources { - RehldsSrc.rehlds_pch(it) - RehldsSrc.rehlds_src(it) - RehldsSrc.rehlds_tests_src(it) - } - - binaries.all { NativeBinarySpec b -> project.setupToolchain(b) } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { - SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'rehldsFixes' && blib.component.name == 'rehlds_swds_engine' - } -} - -task buildEngine { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { - SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'rehldsFixes' && blib.component.name == 'rehlds_swds_engine' - } -} - -buildFixes.finalizedBy(buildFinalize); -buildEngine.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -gradle.taskGraph.whenReady { graph -> - if (!graph.hasTask(buildFixes) && !graph.hasTask(buildEngine)) { - return; - } - - // skip all tasks with the matched substrings in the name like "test" - def tasks = graph.getAllTasks(); - tasks.findAll { it.name.toLowerCase().contains("test") }.each { task -> - task.enabled = false; - } -} - -task prepareDevEnvTests { - def rehldsTests = new File(project.projectDir, '_dev/testDemos') - - inputs.files configurations.rehlds_tests.files - outputs.dir rehldsTests - - doLast { - rehldsTests.mkdirs() - configurations.rehlds_tests.files.each { File f -> - def t = zipTree(f) - copy { - into new File(rehldsTests, FilenameUtils.getBaseName(f.absolutePath)) - from t - } - } - } -} - -task prepareDevEnvEngine << { - ['_dev/rehlds', '_dev/rehlds_swds'].each { engineDir -> - def rehldsImage = new File(project.projectDir, engineDir) - rehldsImage.mkdirs() - def demoRunner = new RehldsDemoRunner(project.configurations.rehlds_playtest_image.getFiles(), rehldsImage, null) - demoRunner.prepareEngine() - } -} - -task prepareDevEnv { - dependsOn prepareDevEnvEngine, prepareDevEnvTests -} - -tasks.clean.doLast { - project.file('version/appversion.h').delete() -} - -task generateAppVersion { - RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo - - def tplFile = project.file('version/appversion.vm') - def renderedFile = project.file('version/appversion.h') - - // check to up-to-date - inputs.file tplFile - inputs.file project.file('gradle.properties') - outputs.file renderedFile - - // this will ensure that this task is redone when the versions change - inputs.property('version', rootProject.version) - inputs.property('commitDate', verInfo.asCommitDate()) - - println "##teamcity[buildNumber '" + verInfo.asMavenVersion(false) + "']"; - - doLast { - - def templateCtx = [ - verInfo : verInfo - ] - - def content = VelocityUtils.renderTemplate(tplFile, templateCtx) - renderedFile.delete() - renderedFile.write(content, 'utf-8') - - println 'The current ReHLDS maven version is ' + rootProject.version + ', url: (' + verInfo.commitURL + '' + verInfo.commitSHA + ')'; - } -} diff --git a/rehlds/dedicated/README.md b/rehlds/dedicated/README.md index 63a472a..86a4d6c 100644 --- a/rehlds/dedicated/README.md +++ b/rehlds/dedicated/README.md @@ -2,15 +2,3 @@ ## What is this? Dedicated Server Launcher for Goldsrc based games - -### Building -On Windows: -
    gradlew --max-workers=1 clean rehlds/dedicated:build
    - -On Linux (ICC): -
    ./gradlew --max-workers=1 clean rehlds/dedicated:build
    - -On Linux (GCC): -
    ./gradlew --max-workers=1 -PuseGcc clean rehlds/dedicated:build
    - -Compiled binaries will be placed in the rehlds/dedicated/build/binaries/ directory diff --git a/rehlds/dedicated/build.gradle b/rehlds/dedicated/build.gradle deleted file mode 100644 index d5092e4..0000000 --- a/rehlds/dedicated/build.gradle +++ /dev/null @@ -1,173 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeExecutableSpec -import org.gradle.nativeplatform.NativeExecutableBinarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: 'windows-resources' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -List getRcCompileTasks(NativeBinarySpec binary) -{ - def linkTask = GradleCppUtils.getLinkTask(binary) - def res = linkTask.taskDependencies.getDependencies(linkTask).findAll { Task t -> t instanceof WindowsResourceCompile } - return res as List -} - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/src', '/../engine', '/../common', '/../public', '/../public/rehlds', '/../'); - - cfg.singleDefines 'USE_BREAKPAD_HANDLER', 'DEDICATED', 'LAUNCHER_FIXES', '_CONSOLE' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'dedicated_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS'); - - cfg.linkerOptions.args('/SUBSYSTEM:WINDOWS,5.01'); - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF', '/GR-'; - cfg.extraLibs "ws2_32.lib", "winmm.lib", "user32.lib", "advapi32.lib", "shell32.lib" - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'dedicated_pch' - ); - } - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.linkerOptions.args '-no-pie' - cfg.compilerOptions.args '-fno-rtti', '-fno-exceptions' - cfg.extraLibs 'dl' - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - dedicated(NativeExecutableSpec) { - targetPlatform 'x86' - baseName GradleCppUtils.windows ? 'hlds' : 'hlds_linux' - - sources { - dedicated_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - if (GradleCppUtils.windows) { - exclude "sys_linux.cpp" - } else { - exclude "sys_window.cpp", "conproc.cpp" - } - } - exportedHeaders { - srcDirs "vgui" - } - } - dedicated_common(CppSourceSet) { - source { - srcDir "../common" - include "ObjectList.cpp" - include "SteamAppStartUp.cpp" - include "textconsole.cpp" - include "commandline.cpp" - include "minidump.cpp" - if (GradleCppUtils.windows) { - include "TextConsoleWin32.cpp" - } - else { - include "TextConsoleUnix.cpp" - } - } - } - dedicated_engine(CppSourceSet) { - source { - srcDir "../engine" - include "mem.cpp" - } - } - dedicated_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - } - } - rc { - source { - srcDir "msvc" - include "dedicated.rc" - } - exportedHeaders { - srcDirs "msvc" - } - } - } - - binaries.all { - NativeExecutableBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFixes { - dependsOn binaries.withType(NativeExecutableBinarySpec).matching { NativeExecutableBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(NativeExecutableBinarySpec).matching { NativeExecutableBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} diff --git a/rehlds/filesystem/FileSystem_Stdio/build.gradle b/rehlds/filesystem/FileSystem_Stdio/build.gradle deleted file mode 100644 index 93910cc..0000000 --- a/rehlds/filesystem/FileSystem_Stdio/build.gradle +++ /dev/null @@ -1,158 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.ToolchainConfigUtils -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.doomedsociety.gradlecpp.toolchain.icc.IccCompilerPlugin -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.GradleCppUtils -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeLibrarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply plugin: 'cpp' -apply plugin: IccCompilerPlugin -apply plugin: GccCompilerPlugin - -void setupToolchain(NativeBinarySpec b) { - boolean useGcc = project.hasProperty("useGcc") - def cfg = rootProject.createToolchainConfig(b); - cfg.projectInclude(project, '/../..', '/src', '/../../common', '/../../public', '/../../public/rehlds'); - cfg.singleDefines 'USE_BREAKPAD_HANDLER' - - if (cfg instanceof MsvcToolchainConfig) { - cfg.compilerOptions.pchConfig = new MsvcToolchainConfig.PrecompiledHeadersConfig( - enabled: true, - pchHeader: 'precompiled.h', - pchSourceSet: 'filesystem_pch' - ); - - cfg.singleDefines('_CRT_SECURE_NO_WARNINGS') - cfg.compilerOptions.args '/Ob2', '/Oi', '/GF' - } - else if (cfg instanceof GccToolchainConfig) { - if (!useGcc) { - cfg.compilerOptions.pchConfig = new GccToolchainConfig.PrecompilerHeaderOptions( - enabled: true, - pchSourceSet: 'filesystem_pch' - ); - } - - cfg.compilerOptions.languageStandard = 'c++11' - cfg.defines([ - '_strdup': 'strdup', - '_stricmp': 'strcasecmp', - '_strnicmp': 'strncasecmp', - '_vsnprintf': 'vsnprintf', - '_snprintf': 'snprintf', - '_unlink': 'unlink', - ]); - - if (useGcc) { - // Produce code optimized for the most common IA32/AMD64/EM64T processors. - // As new processors are deployed in the marketplace, the behavior of this option will change. - cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3', '-flto' - } else { - cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp' - } - - cfg.compilerOptions.args '-fno-exceptions' - cfg.compilerOptions.interProceduralOptimizations = false; - cfg.linkerOptions.interProceduralOptimizations = false; - - def funcToWrap = [ - "freopen", "fopen", "fopen64", "open", "open64", "creat", "access", - "stat", "lstat", "scandir", "opendir", "__xstat", "__lxstat", "__xstat64", "__lxstat64", - "chmod", "chown", "lchown", "symlink", "link", "mknod", "mount", "unlink", - "mkfifo", "rename", "utime", "utimes", "mkdir", "rmdir" - ]; - - funcToWrap.each { - cfg.linkerOptions.args "-Wl,-wrap," + it - } - } - - ToolchainConfigUtils.apply(project, cfg, b); -} - -model { - buildTypes { - release - } - - platforms { - x86 { - architecture "x86" - } - } - - toolChains { - visualCpp(VisualCpp) { - } - if (project.hasProperty("useGcc")) { - gcc(Gcc) - } else { - icc(Icc) - } - } - - components { - filesystem(NativeLibrarySpec) { - targetPlatform 'x86' - baseName 'filesystem_stdio' - - sources { - filesystem_main(CppSourceSet) { - source { - srcDir "src" - include "**/*.cpp" - exclude "precompiled.cpp" - } - } - - filesystem_pch(CppSourceSet) { - source { - srcDir "src" - include "precompiled.cpp" - } - } - } - - binaries.all { - NativeBinarySpec b -> project.setupToolchain(b) - } - } - } -} - -task buildFinalize << { - if (GradleCppUtils.windows) { - return; - } - - binaries.withType(SharedLibraryBinarySpec) { - def sharedBinary = it.getSharedLibraryFile(); - if (sharedBinary.exists()) { - sharedBinary.renameTo(new File(sharedBinary.getParent() + "/" + sharedBinary.getName().replaceFirst("^lib", ""))); - } - } -} - -task buildFixes { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -task buildRelease { - dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib -> - blib.buildable && blib.buildType.name == 'release' - } -} - -build.finalizedBy(buildFinalize); -buildFixes.finalizedBy(buildFinalize); -buildRelease.finalizedBy(buildFinalize); - -// prevent static lib building -binaries.withType(StaticLibraryBinarySpec) { binary -> - buildable = false -} diff --git a/rehlds/filesystem/build.gradle b/rehlds/filesystem/build.gradle deleted file mode 100644 index 3c2d092..0000000 --- a/rehlds/filesystem/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -evaluationDependsOn(':rehlds/filesystem/FileSystem_Stdio'); - -task build { - dependsOn project(':rehlds/filesystem/FileSystem_Stdio').tasks.build -} diff --git a/rehlds/msvc/PreBuild.bat b/rehlds/msvc/PreBuild.bat index 03f6b34..eb93af6 100644 --- a/rehlds/msvc/PreBuild.bat +++ b/rehlds/msvc/PreBuild.bat @@ -77,14 +77,6 @@ IF EXIST "%srcdir%\version.h" ( IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k ) ) -) ELSE ( - FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do ( - IF NOT [%%j] == [] ( - IF %%i==majorVersion set version_major=%%j - IF %%i==minorVersion set version_minor=%%j - IF %%i==maintenanceVersion set version_maintenance=%%j - ) - ) ) :: diff --git a/rehlds/version/appversion.sh b/rehlds/version/appversion.sh index caf5ede..ffafce2 100755 --- a/rehlds/version/appversion.sh +++ b/rehlds/version/appversion.sh @@ -4,7 +4,7 @@ init() { SOURCE_DIR=$@ GIT_DIR=$SOURCE_DIR - VERSION_FILE=$SOURCE_DIR/gradle.properties + VERSION_FILE=$SOURCE_DIR/rehlds/version/version.h APPVERSION_FILE=$SOURCE_DIR/rehlds/version/appversion.h if test -z "`git --version`"; then @@ -25,17 +25,17 @@ init() fi # Get major, minor and maintenance information from gradle.properties - MAJOR=$(sed -nr -e '/majorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + MAJOR=$(cat $VERSION_FILE | grep -wi 'VERSION_MAJOR' | sed -e 's/.*VERSION_MAJOR.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g') if [ $? -ne 0 -o "$MAJOR" = "" ]; then MAJOR=0 fi - MINOR=$(sed -nr -e '/minorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + MINOR=$(cat $VERSION_FILE | grep -wi 'VERSION_MINOR' | sed -e 's/.*VERSION_MINOR.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g') if [ $? -ne 0 -o "$MINOR" = "" ]; then MINOR=0 fi - MAINTENANCE=$(sed -nr -e '/maintenanceVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r') + MAINTENANCE=$(cat $VERSION_FILE | grep -i 'VERSION_MAINTENANCE' | sed -e 's/.*VERSION_MAINTENANCE.*[^0-9]\([0-9][0-9]*\).*/\1/i' -e 's/\r//g') if [ $? -ne 0 -o "$MAINTENANCE" = "" ]; then MAINTENANCE=0 fi diff --git a/rehlds/version/appversion.vm b/rehlds/version/appversion.vm deleted file mode 100644 index 6fe6c2e..0000000 --- a/rehlds/version/appversion.vm +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __APPVERSION_H__ -\#define __APPVERSION_H__ - -// -// This file is generated automatically. -// Don't edit it. -// - -// Version defines -\#define APP_VERSION "$verInfo.asMavenVersion()" - -\#define APP_COMMIT_DATE "$verInfo.asCommitDate()" -\#define APP_COMMIT_TIME "$verInfo.asCommitTime()" - -\#define APP_COMMIT_SHA "$verInfo.commitSHA" -\#define APP_COMMIT_URL "$verInfo.commitURL" - -#endif //__APPVERSION_H__ diff --git a/rehlds/version/version.cpp b/rehlds/version/version.cpp deleted file mode 100644 index c5a6b06..0000000 --- a/rehlds/version/version.cpp +++ /dev/null @@ -1,10 +0,0 @@ -/* -* Version declaration dependency file -* -*/ - -// -// This file needed just to add the dependency and appversion.h -// -#include "precompiled.h" - diff --git a/rehlds/version/version.h b/rehlds/version/version.h new file mode 100644 index 0000000..d209933 --- /dev/null +++ b/rehlds/version/version.h @@ -0,0 +1,10 @@ +/* +* Version declaration dependency file +* +*/ + +#pragma once + +#define VERSION_MAJOR 3 +#define VERSION_MINOR 8 +#define VERSION_MAINTENANCE 0 diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index acdb2b7..0000000 --- a/settings.gradle +++ /dev/null @@ -1,8 +0,0 @@ -rootProject.name = 'rehlds' -include 'dep/cppunitlite' -include 'dep/bzip2' -include 'rehlds' -include 'rehlds/dedicated' -include 'rehlds/filesystem/FileSystem_Stdio' -include 'rehlds/HLTV', 'rehlds/HLTV/Core', 'rehlds/HLTV/Proxy', 'rehlds/HLTV/Console', 'rehlds/HLTV/Director', 'rehlds/HLTV/DemoPlayer' -include 'flightrec/decoder_api', 'flightrec/decoder' diff --git a/shared.gradle b/shared.gradle deleted file mode 100644 index ec81f33..0000000 --- a/shared.gradle +++ /dev/null @@ -1,36 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.toolchain.icc.Icc -import org.gradle.nativeplatform.NativeBinarySpec -import org.gradle.nativeplatform.NativeExecutableBinarySpec -import org.gradle.nativeplatform.SharedLibraryBinarySpec -import org.gradle.nativeplatform.StaticLibraryBinarySpec -import org.gradle.nativeplatform.toolchain.VisualCpp - -apply from: 'shared_msvc.gradle' -apply from: 'shared_icc.gradle' -apply from: 'shared_gcc.gradle' - -rootProject.ext.createToolchainConfig = { NativeBinarySpec bin -> - BinaryKind binaryKind - if (bin instanceof NativeExecutableBinarySpec) { - binaryKind = BinaryKind.EXECUTABLE - } else if (bin instanceof SharedLibraryBinarySpec) { - binaryKind = BinaryKind.SHARED_LIBRARY - } else if (bin instanceof StaticLibraryBinarySpec) { - binaryKind = BinaryKind.STATIC_LIBRARY - } else { - throw new RuntimeException("Unknown executable kind ${bin.class.name}") - } - - boolean releaseBuild = bin.buildType.name.toLowerCase() == 'release' - - if (bin.toolChain instanceof VisualCpp) { - return rootProject.createMsvcConfig(releaseBuild, binaryKind) - } else if (bin.toolChain instanceof Icc) { - return rootProject.createIccConfig(releaseBuild, binaryKind) - } else if (bin.toolChain instanceof Gcc) { - return rootProject.createGccConfig(releaseBuild, binaryKind) - } else { - throw new RuntimeException("Unknown native toolchain: ${bin.toolChain.class.name}") - } -} diff --git a/shared_gcc.gradle b/shared_gcc.gradle deleted file mode 100644 index 2c1d1f4..0000000 --- a/shared_gcc.gradle +++ /dev/null @@ -1,71 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.gcc.OptimizationLevel - -rootProject.ext.createGccConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - //interProceduralOptimizations: true, - - noBuiltIn: true, - - //intelExtensions: false, - //asmBlocks: true, - - positionIndependentCode: false, - - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - //interProceduralOptimizations: true, - stripSymbolTable: false, - staticLibGcc: false, - //staticIntel: true, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } else { - //debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - //interProceduralOptimizations: false, - - noBuiltIn: true, - //intelExtensions: false, - //asmBlocks: true, - - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - //interProceduralOptimizations: false, - stripSymbolTable: false, - staticLibGcc: false, - //staticIntel: true, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } - - cfg.singleDefines('LINUX', '_LINUX') - return cfg -} diff --git a/shared_icc.gradle b/shared_icc.gradle deleted file mode 100644 index aa8a7d7..0000000 --- a/shared_icc.gradle +++ /dev/null @@ -1,75 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.gcc.GccToolchainConfig -import org.doomedsociety.gradlecpp.gcc.OptimizationLevel - -rootProject.ext.createIccConfig = { boolean release, BinaryKind binKind -> - GccToolchainConfig cfg - if (release) { - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.LEVEL_3, - stackProtector: false, - interProceduralOptimizations: true, - - noBuiltIn: true, - - intelExtensions: false, - asmBlocks: true, - - positionIndependentCode: false, - - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: true, - stripSymbolTable: false, - staticLibGcc: false, - staticIntel: true, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } else { - //debug - cfg = new GccToolchainConfig( - compilerOptions: new GccToolchainConfig.CompilerOptions( - optimizationLevel: OptimizationLevel.DISABLE, - stackProtector: true, - interProceduralOptimizations: false, - - noBuiltIn: true, - intelExtensions: false, - asmBlocks: true, - - extraDefines: [ - '_GLIBCXX_USE_CXX11_ABI': 0, - ] - ), - - linkerOptions: new GccToolchainConfig.LinkerOptions( - interProceduralOptimizations: false, - stripSymbolTable: false, - staticLibGcc: false, - staticIntel: true, - staticLibStdCpp: false, - ), - - librarianOptions: new GccToolchainConfig.LibrarianOptions( - - ) - ) - } - - // ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations - // https://software.intel.com/en-us/node/522979#GUID-99936BBA-1508-4E9F-AC09-FA98613CE2F5 - - cfg.compilerOptions.args('-fp-model=precise'); - cfg.singleDefines('LINUX', '_LINUX') - return cfg -} diff --git a/shared_msvc.gradle b/shared_msvc.gradle deleted file mode 100644 index bf8f548..0000000 --- a/shared_msvc.gradle +++ /dev/null @@ -1,140 +0,0 @@ -import org.doomedsociety.gradlecpp.cfg.BinaryKind -import org.doomedsociety.gradlecpp.msvc.CallingConvention -import org.doomedsociety.gradlecpp.msvc.CodeGenerationKind -import org.doomedsociety.gradlecpp.msvc.CppExceptions -import org.doomedsociety.gradlecpp.msvc.DebugInfoFormat -import org.doomedsociety.gradlecpp.msvc.EnhancedInstructionsSet -import org.doomedsociety.gradlecpp.msvc.ErrorReporting -import org.doomedsociety.gradlecpp.msvc.FloatingPointModel -import org.doomedsociety.gradlecpp.msvc.LinkTimeCodeGenKind -import org.doomedsociety.gradlecpp.msvc.MsvcToolchainConfig -import org.doomedsociety.gradlecpp.msvc.OptimizationLevel -import org.doomedsociety.gradlecpp.msvc.RuntimeChecks -import org.doomedsociety.gradlecpp.msvc.WarningLevel - -rootProject.ext.createMsvcConfig = { boolean release, BinaryKind binKind -> - MsvcToolchainConfig cfg - if (release) { - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED, - optimizationLevel: OptimizationLevel.FULL_OPTIMIZATION, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, - - enableMinimalRebuild: false, - omitFramePointers: false, - wholeProgramOptimization: true, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, - - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - 'NDEBUG': null, - ] - ), - - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - - enableIncrementalLinking: false, - eliminateUnusedRefs: true, - enableCOMDATFolding: true, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), - - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), - - generatePdb: true - ) - } else { - //debug - cfg = new MsvcToolchainConfig( - compilerOptions: new MsvcToolchainConfig.CompilerOptions( - codeGeneration: CodeGenerationKind.MULTITHREADED_DEBUG, - optimizationLevel: OptimizationLevel.DISABLED, - debugInfoFormat: DebugInfoFormat.PROGRAM_DATABASE, - runtimeChecks: RuntimeChecks.DEFAULT, - cppExceptions: CppExceptions.ENABLED_WITH_SEH, - warningLevel: WarningLevel.LEVEL_3, - callingConvention: CallingConvention.CDECL, - enhancedInstructionsSet: EnhancedInstructionsSet.SSE2, - floatingPointModel: FloatingPointModel.FAST, - - enableMinimalRebuild: true, - omitFramePointers: false, - wholeProgramOptimization: false, - enabledFunctionLevelLinking: true, - enableSecurityCheck: true, - analyzeCode: false, - sdlChecks: false, - treatWarningsAsErrors: false, - treatWchartAsBuiltin: true, - forceConformanceInForLoopScope: true, - - extraDefines: [ - 'WIN32': null, - '_MBCS': null, - '_DEBUG': null, - ] - ), - - linkerOptions: new MsvcToolchainConfig.LinkerOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.DEFAULT, - errorReportingMode: ErrorReporting.NO_ERROR_REPORT, - - enableIncrementalLinking: true, - eliminateUnusedRefs: false, - enableCOMDATFolding: false, - generateDebugInfo: true, - dataExecutionPrevention: true, - randomizedBaseAddress: true - ), - - librarianOptions: new MsvcToolchainConfig.LibrarianOptions( - linkTimeCodeGenKind: LinkTimeCodeGenKind.USE_LTCG - ), - - generatePdb: true - ) - - if (binKind == BinaryKind.STATIC_LIBRARY) { - cfg.compilerConfig.extraDefines['_LIB'] = null - } - } - - // Detect and setup UCRT paths - def ucrtInfo = "getucrtinfo.bat".execute().text - def m = ucrtInfo =~ /^(.*)\r\n(.*)?$/ - if (!m.find()) { - return cfg - } - def kitPath = m.group(1) - def ucrtVersion = m.group(2) - def ucrtCheckFile = new File("${kitPath}Include/${ucrtVersion}/ucrt/stdio.h"); - if (!ucrtCheckFile.exists()) { - return cfg - } - - cfg.compilerOptions.args "/FS", "/I${kitPath}Include/${ucrtVersion}/ucrt"; - cfg.linkerOptions.args("/LIBPATH:${kitPath}Lib/${ucrtVersion}/ucrt/x86"); - - return cfg -} - From e9a39d73f2c7e1d0d242ccc81d370a6cb888e04f Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 8 Apr 2021 17:49:58 +0700 Subject: [PATCH 31/61] CMakeLists.txt missing libm.so linking --- rehlds/HLTV/Core/CMakeLists.txt | 4 ++-- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 4 ++-- rehlds/HLTV/Director/CMakeLists.txt | 2 +- rehlds/HLTV/Proxy/CMakeLists.txt | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index e1b3be4..e6a002a 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -22,7 +22,7 @@ if ($ENV{CXX} MATCHES "icpc") if (NOT DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. @@ -121,7 +121,7 @@ if (NOT TARGET bzip2) endif() add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS}) -target_link_libraries(core dl bzip2) +target_link_libraries(core dl m bzip2) set_target_properties(core PROPERTIES LIBRARY_OUTPUT_NAME core PREFIX "" diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index 85dccd2..5b45b97 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -22,7 +22,7 @@ if ($ENV{CXX} MATCHES "icpc") if (NOT DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. @@ -91,7 +91,7 @@ add_definitions( ) add_library(demoplayer SHARED ${DEMOPLAYER_SRCS} ${COMMON_SRCS}) -target_link_libraries(demoplayer dl) +target_link_libraries(demoplayer dl m) set_target_properties(demoplayer PROPERTIES LIBRARY_OUTPUT_NAME demoplayer PREFIX "" diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index 6bd896c..2946fe0 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -22,7 +22,7 @@ if ($ENV{CXX} MATCHES "icpc") if (NOT DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 63f6126..fe62aed 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -133,6 +133,7 @@ endif() add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS}) target_link_libraries(proxy dl m bzip2 steam_api) set_target_properties(proxy PROPERTIES + LIBRARY_OUTPUT_NAME proxy PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" From 7cfea77b93fcd65fd6a704f3521c4a5c9580799f Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 9 Apr 2021 06:00:30 +0700 Subject: [PATCH 32/61] workflows/build.yml: add testing HLDS demo --- .github/workflows/build.yml | 129 ++++++++++++--- msvc/ReHLDS.sln | 80 +++------ rehlds/HLTV/Console/msvc/PreBuild.bat | 6 - rehlds/dedicated/msvc/PreBuild.bat | 206 ++++++++++++++++++++++++ rehlds/dedicated/msvc/dedicated.vcxproj | 4 +- rehlds/msvc/PreBuild.bat | 6 - rehlds/msvc/ReHLDS.vcxproj | 26 ++- rehlds/unittests/TestRunner.cpp | 8 +- 8 files changed, 360 insertions(+), 105 deletions(-) create mode 100644 rehlds/dedicated/msvc/PreBuild.bat diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b287c4..02eedd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,13 @@ jobs: windows: name: 'Windows' runs-on: windows-latest + env: solution: 'msvc/ReHLDS.sln' buildPlatform: 'Win32' - buildConfiguration: 'Release' + buildRelease: 'Release' + buildReleasePlay: 'Release Play' + buildTest: 'Test Fixes' steps: - name: Checkout @@ -39,29 +42,41 @@ jobs: vs-version: '16.8' - name: Build ReHLDS - run: - msbuild ${{ env.solution }} /t:Clean,Build -p:Configuration="${{ env.buildConfiguration }}" /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + run: | + msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + + - name: Build and Testing + run: | + msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTest }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + .\"msvc\Test Fixes\swds.exe" + If ($LASTEXITCODE -ne 0 -And + $LASTEXITCODE -ne 3) + {[Environment]::Exit(1)} + shell: "pwsh" - name: Move files run: | mkdir publish\debug + mkdir publish\tests mkdir publish\bin\win32\valve\dlls - move msvc\${{ env.buildConfiguration }}\hlds.exe publish\bin\win32\hlds.exe - move msvc\${{ env.buildConfiguration }}\hltv.exe publish\bin\win32\hltv.exe - move msvc\${{ env.buildConfiguration }}\swds.dll publish\bin\win32\swds.dll - move msvc\${{ env.buildConfiguration }}\core.dll publish\bin\win32\core.dll - move msvc\${{ env.buildConfiguration }}\proxy.dll publish\bin\win32\proxy.dll - move msvc\${{ env.buildConfiguration }}\demoplayer.dll publish\bin\win32\demoplayer.dll - move msvc\${{ env.buildConfiguration }}\filesystem_stdio.dll publish\bin\win32\filesystem_stdio.dll - move msvc\${{ env.buildConfiguration }}\director.dll publish\bin\win32\valve\dlls\director.dll - move msvc\${{ env.buildConfiguration }}\hlds.pdb publish\debug\hlds.pdb - move msvc\${{ env.buildConfiguration }}\hltv.pdb publish\debug\hltv.pdb - move msvc\${{ env.buildConfiguration }}\swds.pdb publish\debug\swds.pdb - move msvc\${{ env.buildConfiguration }}\core.pdb publish\debug\core.pdb - move msvc\${{ env.buildConfiguration }}\proxy.pdb publish\debug\proxy.pdb - move msvc\${{ env.buildConfiguration }}\demoplayer.pdb publish\debug\demoplayer.pdb - move msvc\${{ env.buildConfiguration }}\filesystem_stdio.pdb publish\debug\filesystem_stdio.pdb - move msvc\${{ env.buildConfiguration }}\director.pdb publish\debug\director.pdb + move "msvc\${{ env.buildReleasePlay }}\swds.dll" publish\tests\swds.dll + move msvc\${{ env.buildRelease }}\hlds.exe publish\bin\win32\hlds.exe + move msvc\${{ env.buildRelease }}\hltv.exe publish\bin\win32\hltv.exe + move msvc\${{ env.buildRelease }}\swds.dll publish\bin\win32\swds.dll + move msvc\${{ env.buildRelease }}\core.dll publish\bin\win32\core.dll + move msvc\${{ env.buildRelease }}\proxy.dll publish\bin\win32\proxy.dll + move msvc\${{ env.buildRelease }}\demoplayer.dll publish\bin\win32\demoplayer.dll + move msvc\${{ env.buildRelease }}\filesystem_stdio.dll publish\bin\win32\filesystem_stdio.dll + move msvc\${{ env.buildRelease }}\director.dll publish\bin\win32\valve\dlls\director.dll + move msvc\${{ env.buildRelease }}\hlds.pdb publish\debug\hlds.pdb + move msvc\${{ env.buildRelease }}\hltv.pdb publish\debug\hltv.pdb + move msvc\${{ env.buildRelease }}\swds.pdb publish\debug\swds.pdb + move msvc\${{ env.buildRelease }}\core.pdb publish\debug\core.pdb + move msvc\${{ env.buildRelease }}\proxy.pdb publish\debug\proxy.pdb + move msvc\${{ env.buildRelease }}\demoplayer.pdb publish\debug\demoplayer.pdb + move msvc\${{ env.buildRelease }}\filesystem_stdio.pdb publish\debug\filesystem_stdio.pdb + move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb - name: Deploy artifacts uses: actions/upload-artifact@v2 @@ -69,6 +84,79 @@ jobs: name: win32 path: publish/* + testdemos: + name: 'Test demos' + runs-on: ubuntu-latest + container: s1lentq/testdemos:latest + needs: [windows] + + env: + WINEDEBUG: -all + WINEDLLOVERRIDES: mshtml= + + defaults: + run: + shell: bash + working-directory: ../../../opt/HLDS + + steps: + - name: Deploying windows artifacts + uses: actions/download-artifact@v2 + with: + name: win32 + + - name: Play demos + run: | + chown root ~ + cp -r deps/rehlds/* . + mv $GITHUB_WORKSPACE/tests/swds.dll . + + descs=( + "Half-Life: Physics singleplayer" + "Half-Life: Multiplayer on crossfire map" + "Half-Life: Shooting with several weapons" + "CS: Multiplayer" + ) + + demos=( + "rehlds-phys-single1" + "crossfire-1-multiplayer-1" + "shooting-hl-1" + "cstrike-muliplayer-1" + ) + + retVal=0 + for i in "${!demos[@]}"; do + params=$(cat "testdemos/${demos[i]}.params") + + echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[0m" + echo -e " - \e[0;33mParameters $params\e[0m" + + wine hlds.exe --rehlds-enable-all-hooks --rehlds-test-play "testdemos/${demos[i]}.bin" $params &> result.log || retVal=$? + + if [ $retVal -ne 777 ] && [ $retVal -ne 9 ]; then + # Print with catchy messages + while read line; do + echo -e " \e[0;33m$line" + done <<< $(cat result.log | sed '0,/demo failed/I!d;/wine:/d;/./,$!d') + + echo " 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸" + while read line; do + echo -e " \e[1;31m$line"; + done < rehlds_demo_error.txt + echo -e " \e[30;41mExit code: $retVal\e[0m" + echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;31m Failed âŒ" + exit 6 # Test demo failed + else + # Print result HLDS console + while read line; do + echo -e " \e[0;33m$line" + done <<< $(cat result.log | sed '/wine:/d;/./,$!d') + echo -e " \e[30;43mExit code: $retVal\e[0m" + echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;32m Succeed ✔" + fi + done + linux: name: 'Linux' runs-on: ubuntu-latest @@ -138,9 +226,10 @@ jobs: rm -f appversion.h publish: - needs: [windows, linux] name: 'Publish' runs-on: ubuntu-latest + needs: [windows, testdemos, linux] + steps: - name: Deploying linux artifacts uses: actions/download-artifact@v2 diff --git a/msvc/ReHLDS.sln b/msvc/ReHLDS.sln index 6a01e76..9b4dc41 100644 --- a/msvc/ReHLDS.sln +++ b/msvc/ReHLDS.sln @@ -13,14 +13,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppunitlite", "..\dep\cppun EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\dep\bzip2\msvc\bzip2.vcxproj", "{792DF067-9904-4579-99B9-46C17277ADE3}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gradle", "gradle", "{FFC337A9-D58C-4D62-B8BB-A54DD4E4DF41}" - ProjectSection(SolutionItems) = preProject - ..\build.gradle = ..\build.gradle - ..\gradle.properties = ..\gradle.properties - ..\settings.gradle = ..\settings.gradle - ..\shared.gradle = ..\shared.gradle - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dedicated", "..\rehlds\dedicated\msvc\dedicated.vcxproj", "{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D2516ABB-21F2-4393-8CC9-2BD2D3316CD6}" @@ -70,10 +62,10 @@ Global {CEB94F7C-E459-4673-AABB-36E2074396C0}.Release Play|Win32.Build.0 = Release|Win32 {CEB94F7C-E459-4673-AABB-36E2074396C0}.Release|Win32.ActiveCfg = Release|Win32 {CEB94F7C-E459-4673-AABB-36E2074396C0}.Release|Win32.Build.0 = Release|Win32 - {CEB94F7C-E459-4673-AABB-36E2074396C0}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {CEB94F7C-E459-4673-AABB-36E2074396C0}.Test Fixes|Win32.Build.0 = Release|Win32 - {CEB94F7C-E459-4673-AABB-36E2074396C0}.Tests|Win32.ActiveCfg = Release|Win32 - {CEB94F7C-E459-4673-AABB-36E2074396C0}.Tests|Win32.Build.0 = Release|Win32 + {CEB94F7C-E459-4673-AABB-36E2074396C0}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {CEB94F7C-E459-4673-AABB-36E2074396C0}.Test Fixes|Win32.Build.0 = Debug|Win32 + {CEB94F7C-E459-4673-AABB-36E2074396C0}.Tests|Win32.ActiveCfg = Debug|Win32 + {CEB94F7C-E459-4673-AABB-36E2074396C0}.Tests|Win32.Build.0 = Debug|Win32 {792DF067-9904-4579-99B9-46C17277ADE3}.Debug Play|Win32.ActiveCfg = Debug|Win32 {792DF067-9904-4579-99B9-46C17277ADE3}.Debug Play|Win32.Build.0 = Debug|Win32 {792DF067-9904-4579-99B9-46C17277ADE3}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -82,94 +74,66 @@ Global {792DF067-9904-4579-99B9-46C17277ADE3}.Release Play|Win32.Build.0 = Release|Win32 {792DF067-9904-4579-99B9-46C17277ADE3}.Release|Win32.ActiveCfg = Release|Win32 {792DF067-9904-4579-99B9-46C17277ADE3}.Release|Win32.Build.0 = Release|Win32 - {792DF067-9904-4579-99B9-46C17277ADE3}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {792DF067-9904-4579-99B9-46C17277ADE3}.Test Fixes|Win32.Build.0 = Release|Win32 - {792DF067-9904-4579-99B9-46C17277ADE3}.Tests|Win32.ActiveCfg = Release|Win32 - {792DF067-9904-4579-99B9-46C17277ADE3}.Tests|Win32.Build.0 = Release|Win32 + {792DF067-9904-4579-99B9-46C17277ADE3}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {792DF067-9904-4579-99B9-46C17277ADE3}.Test Fixes|Win32.Build.0 = Debug|Win32 + {792DF067-9904-4579-99B9-46C17277ADE3}.Tests|Win32.ActiveCfg = Debug|Win32 + {792DF067-9904-4579-99B9-46C17277ADE3}.Tests|Win32.Build.0 = Debug|Win32 {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Debug Play|Win32.Build.0 = Debug|Win32 {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Debug|Win32.ActiveCfg = Debug|Win32 {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Debug|Win32.Build.0 = Debug|Win32 {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Play|Win32.ActiveCfg = Release|Win32 - {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release Play|Win32.Build.0 = Release|Win32 {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release|Win32.ActiveCfg = Release|Win32 {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Release|Win32.Build.0 = Release|Win32 - {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Test Fixes|Win32.Build.0 = Release|Win32 - {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Tests|Win32.ActiveCfg = Release|Win32 - {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Tests|Win32.Build.0 = Release|Win32 + {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {D49883F3-5C5C-4B9F-B9C7-B31518F228D4}.Tests|Win32.ActiveCfg = Debug|Win32 {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Debug Play|Win32.Build.0 = Debug|Win32 {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Debug|Win32.ActiveCfg = Debug|Win32 {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Debug|Win32.Build.0 = Debug|Win32 {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Play|Win32.ActiveCfg = Release|Win32 - {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release Play|Win32.Build.0 = Release|Win32 {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release|Win32.ActiveCfg = Release|Win32 {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Release|Win32.Build.0 = Release|Win32 - {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Test Fixes|Win32.Build.0 = Release|Win32 - {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Tests|Win32.ActiveCfg = Release|Win32 - {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Tests|Win32.Build.0 = Release|Win32 + {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {D5CAB879-D54F-456F-8592-31D549CFD1D8}.Tests|Win32.ActiveCfg = Debug|Win32 {52F752EA-73D1-422D-B805-17EF1FB20E09}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {52F752EA-73D1-422D-B805-17EF1FB20E09}.Debug Play|Win32.Build.0 = Debug|Win32 {52F752EA-73D1-422D-B805-17EF1FB20E09}.Debug|Win32.ActiveCfg = Debug|Win32 {52F752EA-73D1-422D-B805-17EF1FB20E09}.Debug|Win32.Build.0 = Debug|Win32 {52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Play|Win32.ActiveCfg = Release|Win32 - {52F752EA-73D1-422D-B805-17EF1FB20E09}.Release Play|Win32.Build.0 = Release|Win32 {52F752EA-73D1-422D-B805-17EF1FB20E09}.Release|Win32.ActiveCfg = Release|Win32 {52F752EA-73D1-422D-B805-17EF1FB20E09}.Release|Win32.Build.0 = Release|Win32 - {52F752EA-73D1-422D-B805-17EF1FB20E09}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {52F752EA-73D1-422D-B805-17EF1FB20E09}.Test Fixes|Win32.Build.0 = Release|Win32 - {52F752EA-73D1-422D-B805-17EF1FB20E09}.Tests|Win32.ActiveCfg = Release|Win32 - {52F752EA-73D1-422D-B805-17EF1FB20E09}.Tests|Win32.Build.0 = Release|Win32 + {52F752EA-73D1-422D-B805-17EF1FB20E09}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {52F752EA-73D1-422D-B805-17EF1FB20E09}.Tests|Win32.ActiveCfg = Debug|Win32 {05292761-0847-4A68-BA10-9D384DC0D3EE}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {05292761-0847-4A68-BA10-9D384DC0D3EE}.Debug Play|Win32.Build.0 = Debug|Win32 {05292761-0847-4A68-BA10-9D384DC0D3EE}.Debug|Win32.ActiveCfg = Debug|Win32 {05292761-0847-4A68-BA10-9D384DC0D3EE}.Debug|Win32.Build.0 = Debug|Win32 {05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Play|Win32.ActiveCfg = Release|Win32 - {05292761-0847-4A68-BA10-9D384DC0D3EE}.Release Play|Win32.Build.0 = Release|Win32 {05292761-0847-4A68-BA10-9D384DC0D3EE}.Release|Win32.ActiveCfg = Release|Win32 {05292761-0847-4A68-BA10-9D384DC0D3EE}.Release|Win32.Build.0 = Release|Win32 - {05292761-0847-4A68-BA10-9D384DC0D3EE}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {05292761-0847-4A68-BA10-9D384DC0D3EE}.Test Fixes|Win32.Build.0 = Release|Win32 - {05292761-0847-4A68-BA10-9D384DC0D3EE}.Tests|Win32.ActiveCfg = Release|Win32 - {05292761-0847-4A68-BA10-9D384DC0D3EE}.Tests|Win32.Build.0 = Release|Win32 + {05292761-0847-4A68-BA10-9D384DC0D3EE}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {05292761-0847-4A68-BA10-9D384DC0D3EE}.Tests|Win32.ActiveCfg = Debug|Win32 {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Debug Play|Win32.Build.0 = Debug|Win32 {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Debug|Win32.ActiveCfg = Debug|Win32 {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Debug|Win32.Build.0 = Debug|Win32 {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Play|Win32.ActiveCfg = Release|Win32 - {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release Play|Win32.Build.0 = Release|Win32 {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release|Win32.ActiveCfg = Release|Win32 {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Release|Win32.Build.0 = Release|Win32 - {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Test Fixes|Win32.Build.0 = Release|Win32 - {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Tests|Win32.ActiveCfg = Release|Win32 - {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Tests|Win32.Build.0 = Release|Win32 + {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {04D0594C-57F5-4277-AF1B-EAE90AED0C3C}.Tests|Win32.ActiveCfg = Debug|Win32 {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Debug Play|Win32.Build.0 = Debug|Win32 {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Debug|Win32.ActiveCfg = Debug|Win32 {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Debug|Win32.Build.0 = Debug|Win32 {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Play|Win32.ActiveCfg = Release|Win32 - {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release Play|Win32.Build.0 = Release|Win32 {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release|Win32.ActiveCfg = Release|Win32 {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Release|Win32.Build.0 = Release|Win32 - {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Test Fixes|Win32.Build.0 = Release|Win32 - {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Tests|Win32.ActiveCfg = Release|Win32 - {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Tests|Win32.Build.0 = Release|Win32 + {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {ADDFF069-D39D-4A1B-87C9-85A62B980547}.Tests|Win32.ActiveCfg = Debug|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Debug Play|Win32.ActiveCfg = Debug|Win32 - {A428392F-52FB-489E-87D8-623528C7F4F9}.Debug Play|Win32.Build.0 = Debug|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Debug|Win32.ActiveCfg = Debug|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Debug|Win32.Build.0 = Debug|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Release Play|Win32.ActiveCfg = Release|Win32 - {A428392F-52FB-489E-87D8-623528C7F4F9}.Release Play|Win32.Build.0 = Release|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Release|Win32.ActiveCfg = Release|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Release|Win32.Build.0 = Release|Win32 - {A428392F-52FB-489E-87D8-623528C7F4F9}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {A428392F-52FB-489E-87D8-623528C7F4F9}.Test Fixes|Win32.Build.0 = Release|Win32 - {A428392F-52FB-489E-87D8-623528C7F4F9}.Tests|Win32.ActiveCfg = Release|Win32 - {A428392F-52FB-489E-87D8-623528C7F4F9}.Tests|Win32.Build.0 = Release|Win32 + {A428392F-52FB-489E-87D8-623528C7F4F9}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {A428392F-52FB-489E-87D8-623528C7F4F9}.Tests|Win32.ActiveCfg = Debug|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/rehlds/HLTV/Console/msvc/PreBuild.bat b/rehlds/HLTV/Console/msvc/PreBuild.bat index 8c11185..8226913 100644 --- a/rehlds/HLTV/Console/msvc/PreBuild.bat +++ b/rehlds/HLTV/Console/msvc/PreBuild.bat @@ -202,11 +202,5 @@ echo.>>"%srcdir%\appversion.h" echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" echo.>>"%srcdir%\appversion.h" -:: -:: Do update of version.cpp file last modify time to force it recompile -:: -copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" -endlocal - :_exit exit /B 0 diff --git a/rehlds/dedicated/msvc/PreBuild.bat b/rehlds/dedicated/msvc/PreBuild.bat new file mode 100644 index 0000000..cb4aff8 --- /dev/null +++ b/rehlds/dedicated/msvc/PreBuild.bat @@ -0,0 +1,206 @@ +@setlocal enableextensions enabledelayedexpansion +@echo off +:: +:: Pre-build auto-versioning script +:: + +set srcdir=%~1 +set repodir=%~2 + +set old_version= +set version_major=0 +set version_minor=0 +set version_maintenance=0 +set version_modifed= + +set commitSHA= +set commitURL= +set commitCount=0 +set branch_name=master + +for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" +set "YYYY=%dt:~0,4%" +set "MM=%dt:~4,2%" +set "DD=%dt:~6,2%" +set "hour=%dt:~8,2%" +set "min=%dt:~10,2%" +set "sec=%dt:~12,2%" + +:: +:: Remove leading zero from MM (e.g 09 > 9) +:: +for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I + +:: +:: Index into array to get month name +:: +for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I" + +:: +:: Check for git.exe presence +:: +CALL git.exe describe >NUL 2>&1 +set errlvl="%ERRORLEVEL%" + +:: +:: Read old appversion.h, if present +:: +IF EXIST "%srcdir%\appversion.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( + IF %%i==#define ( + IF %%j==APP_VERSION ( + :: Remove quotes + set v=%%k + set old_version=!v:"=! + ) + ) + ) +) + +IF %errlvl% == "1" ( + echo can't locate git.exe - auto-versioning step won't be performed + + :: if we haven't appversion.h, we need to create it + IF NOT "%old_version%" == "" ( + set commitCount=0 + ) +) + +:: +:: Read major, minor and maintenance version components from Version.h +:: +IF EXIST "%srcdir%\version.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( + IF %%i==#define ( + IF %%j==VERSION_MAJOR set version_major=%%k + IF %%j==VERSION_MINOR set version_minor=%%k + IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k + ) + ) +) + +:: +:: Read revision and release date from it +:: +IF NOT %errlvl% == "1" ( + :: Get current branch + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO ( + set branch_name=%%i + ) + + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO ( + IF NOT [%%i] == [] ( + set commitCount=%%i + ) + ) +) + +:: +:: Get remote url repository +:: +IF NOT %errlvl% == "1" ( + + set branch_remote=origin + :: Get remote name by current branch + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( + set branch_remote=%%i + ) + :: Get remote url + FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( + set commitURL=%%i + ) + :: Get commit id + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO ( + set shafull=%%i + set commitSHA=!shafull:~0,+7! + ) + + IF [!commitURL!] == [] ( + + FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( + set commitURL=%%i + ) + + :: strip .git + if "x!commitURL:~-4!"=="x.git" ( + set commitURL=!commitURL:~0,-4! + ) + + :: append extra string + If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( + set commitURL=!commitURL!/commits/ + ) ELSE ( + set commitURL=!commitURL!/commit/ + ) + + ) ELSE ( + :: strip .git + if "x!commitURL:~-4!"=="x.git" ( + set commitURL=!commitURL:~0,-4! + ) + :: replace : to / + set commitURL=!commitURL::=/! + + :: append extra string + If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( + set commitURL=https://!commitURL!/commits/ + ) ELSE ( + set commitURL=https://!commitURL!/commit/ + ) + ) +) + +:: +:: Detect local modifications +:: +set localChanged=0 +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( + set localChanged=1 + ) +) + +IF [%localChanged%]==[1] ( + set version_modifed=+m +) + +:: +:: Now form full version string like 1.0.0.1 +:: + +set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed% + +:: +:: Update appversion.h if version has changed or modifications/mixed revisions detected +:: +IF NOT "%new_version%"=="%old_version%" goto _update +goto _exit + +:_update +echo Updating appversion.h, new version is "%new_version%", the old one was %old_version% + +echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" +echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo // This file is generated automatically.>>"%srcdir%\appversion.h" +echo // Don't edit it.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // Version defines>>"%srcdir%\appversion.h" +echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h" + +echo.>>"%srcdir%\appversion.h" +echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h" +echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h" + +echo.>>"%srcdir%\appversion.h" +echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h" +echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +:_exit +exit /B 0 diff --git a/rehlds/dedicated/msvc/dedicated.vcxproj b/rehlds/dedicated/msvc/dedicated.vcxproj index a05bc81..34c9a39 100644 --- a/rehlds/dedicated/msvc/dedicated.vcxproj +++ b/rehlds/dedicated/msvc/dedicated.vcxproj @@ -71,7 +71,7 @@ ws2_32.lib;winmm.lib;%(AdditionalDependencies) - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\version\" "$(ProjectDir)..\..\") Setup version from Git revision @@ -116,7 +116,7 @@ ws2_32.lib;winmm.lib;%(AdditionalDependencies) - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") + IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\version\" "$(ProjectDir)..\..\") Setup version from Git revision diff --git a/rehlds/msvc/PreBuild.bat b/rehlds/msvc/PreBuild.bat index eb93af6..61dd70d 100644 --- a/rehlds/msvc/PreBuild.bat +++ b/rehlds/msvc/PreBuild.bat @@ -202,11 +202,5 @@ echo.>>"%srcdir%\appversion.h" echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" echo.>>"%srcdir%\appversion.h" -:: -:: Do update of version.cpp file last modify time to force it recompile -:: -copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" -endlocal - :_exit exit /B 0 diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index 5742693..2ae61ae 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -176,9 +176,17 @@ true true - + + true + true + true + true + true + true + true + true true @@ -553,21 +561,27 @@ swds + true swds + true - filesystem_stdio + swds + true - filesystem_stdio + swds + true swds + false swds + false @@ -655,7 +669,7 @@ Level3 Disabled true - REHLDS_API;REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;HAVE_OPT_STRTOOLS;REHLDS_SELF;REHLDS_UNIT_TESTS;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) + REHLDS_API;REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;HAVE_OPT_STRTOOLS;REHLDS_SELF;REHLDS_UNIT_TESTS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) MultiThreadedDebug Use precompiled.h @@ -691,7 +705,7 @@ Level3 Disabled true - REHLDS_API;REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_FIXES;HAVE_OPT_STRTOOLS;REHLDS_SELF;REHLDS_UNIT_TESTS;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) + REHLDS_API;REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_FIXES;HAVE_OPT_STRTOOLS;REHLDS_SELF;REHLDS_SSE;REHLDS_JIT;REHLDS_UNIT_TESTS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) MultiThreadedDebug Use precompiled.h @@ -728,7 +742,7 @@ true true true - REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;REHLDS_CHECKS;HAVE_OPT_STRTOOLS;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + REHLDS_FLIGHT_REC;REHLDS_OPT_PEDANTIC;REHLDS_SELF;USE_BREAKPAD_HANDLER;DEDICATED;SWDS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded /arch:IA32 %(AdditionalOptions) Use diff --git a/rehlds/unittests/TestRunner.cpp b/rehlds/unittests/TestRunner.cpp index cb9fa86..965daaf 100644 --- a/rehlds/unittests/TestRunner.cpp +++ b/rehlds/unittests/TestRunner.cpp @@ -6,11 +6,5 @@ int main(int argc, char* argv[]) { printf("TestRunner: main()\n"); GradleAdapter a; - int res = a.testsEntryPoint(argc, argv); - -#ifdef _BUILD_FROM_IDE - system("PAUSE"); -#endif - - return res; + return a.testsEntryPoint(argc, argv); } From 7bd3d73b799879b9d7be2ef6bd39f1b564fb0bb3 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 12 Apr 2021 03:39:09 +0700 Subject: [PATCH 33/61] workflows/build.yml: add unittests for linux CMakeLists.txt minor refactoring --- .github/workflows/build.yml | 57 ++++-- .gitignore | 1 + CMakeLists.txt | 9 +- dep/cppunitlite/CMakeLists.txt | 25 +++ .../{GradleAdapter.h => MainAdapter.h} | 2 +- dep/cppunitlite/include/cppunitlite/Test.h | 6 +- dep/cppunitlite/msvc/cppunitlite.vcxproj | 4 +- .../msvc/cppunitlite.vcxproj.filters | 4 +- .../{GradleAdapter.cpp => MainAdapter.cpp} | 12 +- dep/cppunitlite/src/Test.cpp | 6 +- rehlds/CMakeLists.txt | 178 ++++++++++++------ rehlds/HLTV/Console/CMakeLists.txt | 86 +++++---- rehlds/HLTV/Core/CMakeLists.txt | 77 +++++--- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 70 ++++--- rehlds/HLTV/Director/CMakeLists.txt | 74 +++++--- rehlds/HLTV/Proxy/CMakeLists.txt | 86 +++++---- rehlds/dedicated/CMakeLists.txt | 78 ++++---- .../FileSystem_Stdio/CMakeLists.txt | 68 ++++--- rehlds/unittests/TestRunner.cpp | 4 +- rehlds/unittests/delta_tests.cpp | 2 +- rehlds/unittests/info_tests.cpp | 4 +- 21 files changed, 527 insertions(+), 326 deletions(-) create mode 100644 dep/cppunitlite/CMakeLists.txt rename dep/cppunitlite/include/cppunitlite/{GradleAdapter.h => MainAdapter.h} (88%) rename dep/cppunitlite/src/{GradleAdapter.cpp => MainAdapter.cpp} (86%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02eedd9..8d9693b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: with: nuget-api-key: ${{ secrets.NuGetAPIKey }} nuget-version: '5.x' + - run: nuget restore '${{ env.solution }}' - name: Setup MSBuild @@ -41,12 +42,7 @@ jobs: with: vs-version: '16.8' - - name: Build ReHLDS - run: | - msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false - msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false - - - name: Build and Testing + - name: Build and Run unittests run: | msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTest }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false .\"msvc\Test Fixes\swds.exe" @@ -55,6 +51,11 @@ jobs: {[Environment]::Exit(1)} shell: "pwsh" + - name: Build + run: | + msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false + - name: Move files run: | mkdir publish\debug @@ -112,17 +113,17 @@ jobs: mv $GITHUB_WORKSPACE/tests/swds.dll . descs=( + "CS: Multiplayer" "Half-Life: Physics singleplayer" "Half-Life: Multiplayer on crossfire map" "Half-Life: Shooting with several weapons" - "CS: Multiplayer" ) demos=( + "cstrike-muliplayer-1" "rehlds-phys-single1" "crossfire-1-multiplayer-1" "shooting-hl-1" - "cstrike-muliplayer-1" ) retVal=0 @@ -168,6 +169,30 @@ jobs: with: fetch-depth: 0 + - name: Build and Run unittests + run: | + rm -rf build && CC=icc CXX=icpc cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8 + retVal=0 + export LD_LIBRARY_PATH="rehlds/lib/linux32:$LD_LIBRARY_PATH" + ./build/rehlds/engine_i486 2> /dev/null > result.log || retVal=$? + while read line; do + if [[ ${line} == *"Warning in test"* ]] ; then + echo -e "\e[2;38m$line" + elif [[ ${line} == *"Failure in test"* ]] ; then + echo -e "\e[1;31m$line" + else + echo -e "\e[0;33m$line" + fi + done <<< $(cat result.log) + + if [ $retVal -ne 0 ] && [ $retVal -ne 3 ]; then + echo -e "\e[30;41mExit code: $retVal\e[0m" + exit 1 # Unittest failed + else + echo -e "\e[30;43mExit code: $retVal\e[0m" + fi + shell: bash + - name: Build using Intel C++ Compiler run: | rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8 @@ -244,14 +269,14 @@ jobs: - name: Reading appversion.h run: | if [ -e appversion.h ]; then - APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g') - if [ $? -ne 0 ]; then - APP_VERSION="" - else - # Remove quotes - APP_VERSION=$(echo $APP_VERSION | xargs) - echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV - fi + APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g') + if [ $? -ne 0 ]; then + APP_VERSION="" + else + # Remove quotes + APP_VERSION=$(echo $APP_VERSION | xargs) + echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV + fi fi rm -f appversion.h diff --git a/.gitignore b/.gitignore index 78329c9..62b7799 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.bat *.log *.lnk +*.aps **/msvc/Debug* **/msvc/Release* **/msvc/Tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 3607bbd..bf5cea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ add_custom_target(appversion DEPENDS ) add_subdirectory(rehlds) -add_subdirectory(rehlds/dedicated) -add_subdirectory(rehlds/filesystem) -add_subdirectory(rehlds/HLTV) + +if (NOT CMAKE_BUILD_TYPE MATCHES Unittests) + add_subdirectory(rehlds/dedicated) + add_subdirectory(rehlds/filesystem) + add_subdirectory(rehlds/HLTV) +endif() diff --git a/dep/cppunitlite/CMakeLists.txt b/dep/cppunitlite/CMakeLists.txt new file mode 100644 index 0000000..10047e7 --- /dev/null +++ b/dep/cppunitlite/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.1) +project(cppunitlite CXX) + +add_library(cppunitlite STATIC) + +target_sources(cppunitlite PRIVATE + src/Test.cpp + src/TestResult.cpp + src/TestRegistry.cpp + src/Assertions.cpp + src/MainAdapter.cpp +) + +target_include_directories(cppunitlite PRIVATE + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/include" +) + +target_compile_definitions(cppunitlite PRIVATE + _GLIBCXX_USE_CXX11_ABI=0 +) + +target_compile_options(cppunitlite PRIVATE + -m32 +) diff --git a/dep/cppunitlite/include/cppunitlite/GradleAdapter.h b/dep/cppunitlite/include/cppunitlite/MainAdapter.h similarity index 88% rename from dep/cppunitlite/include/cppunitlite/GradleAdapter.h rename to dep/cppunitlite/include/cppunitlite/MainAdapter.h index 739fdaf..85ba4bf 100644 --- a/dep/cppunitlite/include/cppunitlite/GradleAdapter.h +++ b/dep/cppunitlite/include/cppunitlite/MainAdapter.h @@ -1,6 +1,6 @@ #pragma once -class GradleAdapter { +class MainAdapter { public: int writeAllTestsInfoToFile(const char* fname); int runTest(const char* groupName, const char* testName); diff --git a/dep/cppunitlite/include/cppunitlite/Test.h b/dep/cppunitlite/include/cppunitlite/Test.h index 2f153d2..f6f977e 100644 --- a/dep/cppunitlite/include/cppunitlite/Test.h +++ b/dep/cppunitlite/include/cppunitlite/Test.h @@ -20,7 +20,7 @@ public: void setNext(Test *test); Test *getNext () const; void run(TestResult& result); - + const char* getName() { return name_.c_str(); } @@ -28,7 +28,7 @@ public: const char* getGroup() { return group_.c_str(); } - + int getTimeout() { return timeout_; } @@ -47,7 +47,7 @@ protected: { public: testGroup##testName##Test () : Test (#testName , #testGroup , testTimeout) {} \ void runInternal (); } \ testGroup##testName##Instance; \ - void testGroup##testName##Test::runInternal() + void testGroup##testName##Test::runInternal() diff --git a/dep/cppunitlite/msvc/cppunitlite.vcxproj b/dep/cppunitlite/msvc/cppunitlite.vcxproj index 09143e8..45afe06 100644 --- a/dep/cppunitlite/msvc/cppunitlite.vcxproj +++ b/dep/cppunitlite/msvc/cppunitlite.vcxproj @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + diff --git a/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters b/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters index 47c9cd0..7ef1fd0 100644 --- a/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters +++ b/dep/cppunitlite/msvc/cppunitlite.vcxproj.filters @@ -27,7 +27,7 @@ include - + include @@ -44,7 +44,7 @@ src - + src diff --git a/dep/cppunitlite/src/GradleAdapter.cpp b/dep/cppunitlite/src/MainAdapter.cpp similarity index 86% rename from dep/cppunitlite/src/GradleAdapter.cpp rename to dep/cppunitlite/src/MainAdapter.cpp index 42917b9..440553c 100644 --- a/dep/cppunitlite/src/GradleAdapter.cpp +++ b/dep/cppunitlite/src/MainAdapter.cpp @@ -2,11 +2,11 @@ #include #include -#include "cppunitlite/GradleAdapter.h" +#include "cppunitlite/MainAdapter.h" #include "cppunitlite/Test.h" #include "cppunitlite/TestRegistry.h" -int GradleAdapter::writeAllTestsInfoToFile(const char* fname) { +int MainAdapter::writeAllTestsInfoToFile(const char* fname) { FILE* outFile = fopen(fname, "w"); if (outFile == NULL) { return 1; @@ -33,7 +33,7 @@ int GradleAdapter::writeAllTestsInfoToFile(const char* fname) { return 0; } -int GradleAdapter::runTest(const char* groupName, const char* testName) { +int MainAdapter::runTest(const char* groupName, const char* testName) { Test* curTest = TestRegistry::getFirstTest(); while (curTest != NULL) { if (!strcmp(groupName, curTest->getGroup()) && !strcmp(testName, curTest->getName())) { @@ -61,7 +61,7 @@ int GradleAdapter::runTest(const char* groupName, const char* testName) { } } -int GradleAdapter::runGroup(const char* groupName) { +int MainAdapter::runGroup(const char* groupName) { Test* curTest = TestRegistry::getFirstTest(); int ranTests = 0; int warnTest = 0; @@ -101,7 +101,7 @@ int GradleAdapter::runGroup(const char* groupName) { return 0; } -int GradleAdapter::runAllTests() { +int MainAdapter::runAllTests() { Test* curTest = TestRegistry::getFirstTest(); int ranTests = 0; int warnTest = 0; @@ -131,7 +131,7 @@ int GradleAdapter::runAllTests() { return 0; } -int GradleAdapter::testsEntryPoint(int argc, char* argv[]) { +int MainAdapter::testsEntryPoint(int argc, char* argv[]) { if (argc < 2 || !strcmp(argv[1], "-all")) { return runAllTests(); } diff --git a/dep/cppunitlite/src/Test.cpp b/dep/cppunitlite/src/Test.cpp index 216aec8..8ad852f 100644 --- a/dep/cppunitlite/src/Test.cpp +++ b/dep/cppunitlite/src/Test.cpp @@ -5,10 +5,11 @@ #include "cppunitlite/Failure.h" #include +#include #include -Test::Test (const char* testName, const char* testGroup, int timeout) +Test::Test (const char* testName, const char* testGroup, int timeout) : name_ (testName), group_ (testGroup), timeout_(timeout) { next_ = NULL; @@ -23,13 +24,14 @@ Test *Test::getNext() const void Test::setNext(Test *test) -{ +{ next_ = test; } void Test::run(TestResult &result) { try { runInternal(); + std::cout << "Test::run() > " << group_ << "::" << name_ << " Passed" << std::endl; } catch (TestFailException &e) { result.addFailure(Failure(e, name_)); } catch (std::exception &e) { diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index d0583a5..2b35798 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -25,39 +25,45 @@ option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-exceptions") +# Avoid -rdynamic -fPIC options +set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") + +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-rtti -fno-exceptions") # Remove noxref code and data -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") +set(COMPILE_FLAGS "${COMPILE_FLAGS} -ffunction-sections -fdata-sections") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") +if ("$ENV{CXX}" MATCHES "icpc") # -fp-model=precise # ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations # https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html#fp-model-fp_GUID-99936BBA-1508-4E9F-AC09-FA98613CE2F5 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -fp-model=precise\ -fasm-blocks\ -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${LINK_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unknown-pragmas -Wno-invalid-offsetof\ @@ -66,31 +72,26 @@ else() -Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes") # Check if not Clang compiler - if (NOT $ENV{CXX} MATCHES "clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt -Wno-unused-but-set-variable") + if (NOT "$ENV{CXX}" MATCHES "clang") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fno-plt -Wno-unused-but-set-variable") # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess") endif() endif() endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() if (NOT DEBUG) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ + set(LINK_FLAGS "${LINK_FLAGS} \ -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"") endif() -if (USE_STATIC_LIBSTDC) - add_definitions(-DBUILD_STATIC_LIBSTDC) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++") -endif() - set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/engine" @@ -98,12 +99,17 @@ set(PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/pm_shared" "${PROJECT_SOURCE_DIR}/rehlds" "${PROJECT_SOURCE_DIR}/testsuite" + "${PROJECT_SOURCE_DIR}/unittests" ) set(PROJECT_BZIP2_DIR "${PROJECT_SOURCE_DIR}/../dep/bzip2/include" ) +set(PROJECT_CPPUNITLITE_DIR + "${PROJECT_SOURCE_DIR}/../dep/cppunitlite/include" +) + set(PROJECT_PUBLIC_DIR "${PROJECT_SOURCE_DIR}/public" "${PROJECT_SOURCE_DIR}/public/rehlds" @@ -179,6 +185,21 @@ set(ENGINE_SRCS rehlds/rehlds_security.cpp ) +set(UNITTESTS_SRCS + unittests/common_tests.cpp + unittests/crc32c_tests.cpp + unittests/delta_tests.cpp + unittests/info_tests.cpp + unittests/mathlib_tests.cpp + unittests/rehlds_tests_shared.cpp + unittests/rehlds_tests_shared.h + unittests/security_tests.cpp + unittests/struct_offsets_tests.cpp + unittests/TestRunner.cpp + unittests/tmessage_tests.cpp + unittests/unicode_tests.cpp +) + set(COMMON_SRCS "common/BaseSystemModule.cpp" "common/ObjectList.cpp" @@ -192,56 +213,91 @@ set(PUBLIC_SRCS "public/utlbuffer.cpp" ) -include_directories( - ${PROJECT_SRC_DIR} - ${PROJECT_BZIP2_DIR} - ${PROJECT_PUBLIC_DIR} -) +if (CMAKE_BUILD_TYPE MATCHES Unittests) + if (NOT TARGET cppunitlite) + add_subdirectory(../dep/cppunitlite cppunitlite) + endif() -add_definitions( - -DSWDS - -DREHLDS_JIT - -DREHLDS_SSE - -DREHLDS_FIXES - -DREHLDS_CHECKS - -DREHLDS_API - -DREHLDS_SELF - -DREHLDS_OPT_PEDANTIC - -DHAVE_OPT_STRTOOLS - -DUSE_BREAKPAD_HANDLER - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_unlink=unlink - -D_vsnprintf=vsnprintf - -D_vsnwprintf=vswprintf -) - -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ - -Wl,-rpath,'$ORIGIN/.' \ - -L${PROJECT_SOURCE_DIR}/lib/linux32") + set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic") + add_executable(engine ${appversion.sh}) + target_link_libraries(engine PRIVATE cppunitlite) +else() + add_library(engine SHARED ${appversion.sh}) +endif() if (NOT TARGET bzip2) - add_subdirectory(../dep/bzip2 lib) + add_subdirectory(../dep/bzip2 bzip2) endif() if (NOT TARGET appversion) add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/..") endif() -add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS}) add_dependencies(engine appversion) -set_target_properties(engine PROPERTIES - LIBRARY_OUTPUT_NAME engine_i486 - PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" - POSITION_INDEPENDENT_CODE OFF +target_include_directories(engine PRIVATE + ${PROJECT_SRC_DIR} + ${PROJECT_BZIP2_DIR} + ${PROJECT_CPPUNITLITE_DIR} + ${PROJECT_PUBLIC_DIR} ) -target_link_libraries(engine dl rt m aelf32 bzip2 steam_api) +target_compile_definitions(engine PRIVATE + SWDS + REHLDS_JIT + REHLDS_SSE + REHLDS_FIXES + REHLDS_CHECKS + REHLDS_API + REHLDS_SELF + REHLDS_OPT_PEDANTIC + HAVE_OPT_STRTOOLS + USE_BREAKPAD_HANDLER + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _unlink=unlink + _vsnprintf=vsnprintf + _vsnwprintf=vswprintf + + $<$: + REHLDS_UNIT_TESTS REHLDS_SSE REHLDS_JIT> +) + +target_sources(engine PRIVATE + ${ENGINE_SRCS} + ${COMMON_SRCS} + ${PUBLIC_SRCS} + + $<$: + ${UNITTESTS_SRCS}> +) + +target_link_libraries(engine PRIVATE + dl + rt + m + aelf32 + bzip2 + steam_api +) + +if (USE_STATIC_LIBSTDC) + target_compile_definitions(engine PRIVATE BUILD_STATIC_LIBSTDC) + set(LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++") +endif() + +set(LINK_FLAGS "${LINK_FLAGS} \ + -Wl,-rpath,'$ORIGIN/.' \ + -L${PROJECT_SOURCE_DIR}/lib/linux32") + +set_target_properties(engine PROPERTIES + OUTPUT_NAME engine_i486 + PREFIX "" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} + POSITION_INDEPENDENT_CODE OFF +) diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt index d2ad58f..48b637a 100644 --- a/rehlds/HLTV/Console/CMakeLists.txt +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -6,45 +6,48 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +# Avoid -rdynamic -fPIC options set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie -Wl,--no-export-dynamic") +set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic") # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${COMPILE_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") # Check if not Clang compiler AND GCC >= 8.3 - if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -77,37 +80,44 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -include_directories( - ${PROJECT_SRC_DIR} - ${PROJECT_PUBLIC_DIR} -) - -add_definitions( - -DLAUNCHER_FIXES - -D_CONSOLE - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_vsnprintf=vsnprintf - -D_snprintf=snprintf -) - if (NOT TARGET appversion) add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../../..") endif() -add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS}) +add_executable(hltv ${appversion.sh}) add_dependencies(hltv appversion) -target_link_libraries(hltv dl) +target_include_directories(hltv PRIVATE + ${PROJECT_SRC_DIR} + ${PROJECT_PUBLIC_DIR} +) + +target_compile_definitions(hltv PRIVATE + LAUNCHER_FIXES + _CONSOLE + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _vsnprintf=vsnprintf + _snprintf=snprintf +) + +target_sources(hltv PRIVATE + ${HLTV_SRCS} + ${COMMON_SRCS} +) + +target_link_libraries(hltv PRIVATE + dl +) + set_target_properties(hltv PROPERTIES - LIBRARY_OUTPUT_NAME hltv + OUTPUT_NAME hltv PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index e6a002a..f964ff6 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -5,47 +5,52 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Avoid -fPIC option set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${LINK_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\ + set(COMPILE_FLAGS "${COMPILE_FLAGS} -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") # Check Clang compiler - if ($ENV{CXX} MATCHES "clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") + if ("$ENV{CXX}" MATCHES "clang") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-private-field") else() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -96,36 +101,46 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -include_directories( +add_library(core SHARED) + +target_include_directories(core PRIVATE ${PROJECT_SRC_DIR} ${PROJECT_BZIP2_DIR} ${PROJECT_PUBLIC_DIR} ) -add_definitions( - -DHLTV - -DHLTV_FIXES - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_vsnprintf=vsnprintf - -D_snprintf=snprintf +target_compile_definitions(core PRIVATE + HLTV + HLTV_FIXES + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _vsnprintf=vsnprintf + _snprintf=snprintf +) + +target_sources(core PRIVATE + ${CORE_SRCS} + ${COMMON_SRCS} +) + +target_link_libraries(core PRIVATE + dl + m + bzip2 ) if (NOT TARGET bzip2) add_subdirectory(../../../dep/bzip2 lib) endif() -add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS}) -target_link_libraries(core dl m bzip2) set_target_properties(core PROPERTIES - LIBRARY_OUTPUT_NAME core + OUTPUT_NAME core PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index 5b45b97..cd752a9 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -5,29 +5,34 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Avoid -fPIC option set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${LINK_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ @@ -36,7 +41,7 @@ endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -71,31 +76,40 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -include_directories( +add_library(demoplayer SHARED) + +target_include_directories(demoplayer PRIVATE ${PROJECT_SRC_DIR} ${PROJECT_PUBLIC_DIR} ) -add_definitions( - -DHLTV - -DHLTV_FIXES - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_vsnprintf=vsnprintf - -D_snprintf=snprintf +target_compile_definitions(demoplayer PRIVATE + HLTV + HLTV_FIXES + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _vsnprintf=vsnprintf + _snprintf=snprintf +) + +target_sources(demoplayer PRIVATE + ${DEMOPLAYER_SRCS} + ${COMMON_SRCS} +) + +target_link_libraries(demoplayer PRIVATE + dl + m ) -add_library(demoplayer SHARED ${DEMOPLAYER_SRCS} ${COMMON_SRCS}) -target_link_libraries(demoplayer dl m) set_target_properties(demoplayer PROPERTIES - LIBRARY_OUTPUT_NAME demoplayer + OUTPUT_NAME demoplayer PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index 2946fe0..978deeb 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -5,29 +5,34 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Avoid -fPIC option set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${LINK_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas\ @@ -36,7 +41,7 @@ endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -72,36 +77,45 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -include_directories( +add_library(director SHARED) + +target_include_directories(director PRIVATE ${PROJECT_SRC_DIR} ${PROJECT_PUBLIC_DIR} ) -add_definitions( - -DHLTV - -DHLTV_FIXES - -DDIRECTOR_MODULE - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_vsnprintf=vsnprintf - -D_snprintf=snprintf +target_compile_definitions(director PRIVATE + HLTV + HLTV_FIXES + DIRECTOR_MODULE + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _vsnprintf=vsnprintf + _snprintf=snprintf ) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ +target_sources(director PRIVATE + ${DIRECTOR_SRCS} + ${COMMON_SRCS} +) + +target_link_libraries(director PRIVATE + dl + m +) + +set(LINK_FLAGS "${LINK_FLAGS} \ -Wl,-rpath,'$ORIGIN/.' \ -L${PROJECT_SOURCE_DIR}/../../lib/linux32") -add_library(director SHARED ${DIRECTOR_SRCS} ${COMMON_SRCS}) -target_link_libraries(director dl m) set_target_properties(director PROPERTIES - LIBRARY_OUTPUT_NAME director + OUTPUT_NAME director PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index fe62aed..82c25fc 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -5,50 +5,55 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Avoid -fPIC option set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${LINK_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3 -flto\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-write-strings -Wno-strict-aliasing") # Check Clang compiler - if ($ENV{CXX} MATCHES "clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") + if ("$ENV{CXX}" MATCHES "clang") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-private-field") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fno-plt") # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -102,40 +107,51 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -include_directories( +add_library(proxy SHARED) + +target_include_directories(proxy PRIVATE ${PROJECT_SRC_DIR} ${PROJECT_BZIP2_DIR} ${PROJECT_PUBLIC_DIR} ) -add_definitions( - -DHLTV - -DHLTV_FIXES - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_vsnprintf=vsnprintf - -D_snprintf=snprintf +target_compile_definitions(proxy PRIVATE + HLTV + HLTV_FIXES + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _vsnprintf=vsnprintf + _snprintf=snprintf ) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ - -Wl,-rpath,'$ORIGIN/.' \ - -L${PROJECT_SOURCE_DIR}/../../lib/linux32") +target_sources(proxy PRIVATE + ${PROXY_SRCS} + ${COMMON_SRCS} +) + +target_link_libraries(proxy PRIVATE + dl + m + bzip2 + steam_api +) if (NOT TARGET bzip2) add_subdirectory(../../../dep/bzip2 lib) endif() -add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS}) -target_link_libraries(proxy dl m bzip2 steam_api) +set(LINK_FLAGS "${LINK_FLAGS} \ + -Wl,-rpath,'$ORIGIN/.' \ + -L${PROJECT_SOURCE_DIR}/../../lib/linux32") + set_target_properties(proxy PROPERTIES - LIBRARY_OUTPUT_NAME proxy + OUTPUT_NAME proxy PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) diff --git a/rehlds/dedicated/CMakeLists.txt b/rehlds/dedicated/CMakeLists.txt index 5c6675d..6751db1 100644 --- a/rehlds/dedicated/CMakeLists.txt +++ b/rehlds/dedicated/CMakeLists.txt @@ -6,45 +6,48 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +# Avoid -rdynamic -fPIC options set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() -set(CMAKE_EXE_LINKER_FLAGS "-no-pie -Wl,--no-export-dynamic") +set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic") # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") if (NOT DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo") + set(LINK_FLAGS "${COMPILE_FLAGS} -ipo") endif() else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unused-result") # Check if not Clang compiler AND GCC >= 8.3 - if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") + if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation") endif() endif() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -78,36 +81,43 @@ set(COMMON_SRCS "../engine/mem.cpp" ) -include_directories( +if (NOT TARGET appversion) + add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") +endif() + +add_executable(hlds ${appversion.sh}) +add_dependencies(hlds appversion) + +target_include_directories(hlds PRIVATE ${PROJECT_SRC_DIR} ${PROJECT_PUBLIC_DIR} ) -add_definitions( - -DLAUNCHER_FIXES - -D_CONSOLE - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_strdup=strdup - -D_vsnprintf=vsnprintf +target_compile_definitions(hlds PRIVATE + LAUNCHER_FIXES + _CONSOLE + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _stricmp=strcasecmp + _strnicmp=strncasecmp + _strdup=strdup + _vsnprintf=vsnprintf ) -if (NOT TARGET appversion) - add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") -endif() +target_sources(hlds PRIVATE + ${DEDICATED_SRCS} + ${COMMON_SRCS} +) -add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS}) -add_dependencies(hlds appversion) +target_link_libraries(hlds PRIVATE + dl +) -target_link_libraries(hlds dl) set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt index 05302be..5dc50c0 100644 --- a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -5,32 +5,37 @@ option(DEBUG "Build with debug information." OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Avoid -fPIC option set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions") +set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE") +set(LINK_FLAGS "-m32") + +set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions") if (DEBUG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector") endif() # Check Intel C++ compiler -if ($ENV{CXX} MATCHES "icpc") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions") +if ("$ENV{CXX}" MATCHES "icpc") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") + set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions") else() # Produce code optimized for the most common IA32/AMD64/EM64T processors. # As new processors are deployed in the marketplace, the behavior of this option will change. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + set(COMPILE_FLAGS "${COMPILE_FLAGS} \ -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-result -Wno-unused-function\ -Wno-write-strings -Wno-sign-compare") # Check if not Clang compiler AND GCC >= 8.3 - if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess") + if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess") endif() endif() @@ -43,12 +48,12 @@ set(WRAP_FUNCS_LIST ) foreach(f ${WRAP_FUNCS_LIST}) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-wrap,${f}") + set(LINK_FLAGS "${LINK_FLAGS} -Wl,-wrap,${f}") endforeach() # GCC >= 8.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none") + set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none") endif() set(PROJECT_SRC_DIR @@ -71,32 +76,37 @@ set(FILESYSTEM_STDIO_SRCS "src/public_amalgamation.cpp" ) -include_directories( +add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS}) + +target_include_directories(filesystem_stdio PRIVATE ${PROJECT_SRC_DIR} ${PROJECT_PUBLIC_DIR} ) -add_definitions( - -D_LINUX - -DLINUX - -D_GLIBCXX_USE_CXX11_ABI=0 - -U_FORTIFY_SOURCE - -D_strdup=strdup - -D_stricmp=strcasecmp - -D_strnicmp=strncasecmp - -D_vsnprintf=vsnprintf - -D_snprintf=snprintf - -D_unlink=unlink +target_compile_definitions(filesystem_stdio PRIVATE + _LINUX + LINUX + _GLIBCXX_USE_CXX11_ABI=0 + _strdup=strdup + _stricmp=strcasecmp + _strnicmp=strncasecmp + _vsnprintf=vsnprintf + _snprintf=snprintf + _unlink=unlink ) -add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS}) +target_sources(filesystem_stdio PRIVATE + ${FILESYSTEM_STDIO_SRCS} +) + +target_link_libraries(filesystem_stdio PRIVATE + dl +) set_target_properties(filesystem_stdio PROPERTIES - LIBRARY_OUTPUT_NAME filesystem_stdio + OUTPUT_NAME filesystem_stdio PREFIX "" - COMPILE_FLAGS "-m32" - LINK_FLAGS "-m32" + COMPILE_FLAGS ${COMPILE_FLAGS} + LINK_FLAGS ${LINK_FLAGS} POSITION_INDEPENDENT_CODE OFF ) - -target_link_libraries(filesystem_stdio dl) diff --git a/rehlds/unittests/TestRunner.cpp b/rehlds/unittests/TestRunner.cpp index 965daaf..cffaeff 100644 --- a/rehlds/unittests/TestRunner.cpp +++ b/rehlds/unittests/TestRunner.cpp @@ -1,10 +1,10 @@ #include "precompiled.h" #include "rehlds_tests_shared.h" -#include "cppunitlite/GradleAdapter.h" +#include "cppunitlite/MainAdapter.h" int main(int argc, char* argv[]) { printf("TestRunner: main()\n"); - GradleAdapter a; + MainAdapter a; return a.testsEntryPoint(argc, argv); } diff --git a/rehlds/unittests/delta_tests.cpp b/rehlds/unittests/delta_tests.cpp index efa8f14..efc7998 100644 --- a/rehlds/unittests/delta_tests.cpp +++ b/rehlds/unittests/delta_tests.cpp @@ -177,7 +177,7 @@ NOINLINE void _GetBitmaskAndBytecount(delta_t* delta, int* bits, int* bytecount, NOINLINE delta_t* _CreateTestDeltaDesc() { static delta_description_t _fields[32]; - delta_test_struct_t d; d; // "use" d variable + delta_test_struct_t d = {}; UNUSED(d); _InitDeltaField(&_fields[0], 0x00, DT_BYTE, "b_00", offsetof(delta_test_struct_t, b_00), 1, 8, 1.0f, 1.0f); _InitDeltaField(&_fields[1], 0x01, DT_BYTE, "b_01", offsetof(delta_test_struct_t, b_01), 1, 8, 1.0f, 1.0f); diff --git a/rehlds/unittests/info_tests.cpp b/rehlds/unittests/info_tests.cpp index 8e176c8..bd8dc0c 100644 --- a/rehlds/unittests/info_tests.cpp +++ b/rehlds/unittests/info_tests.cpp @@ -67,13 +67,13 @@ TEST(SetValueForStarKey, Info, 1000) { "\\cl_updaterate\\100\\topcolor\\60\\name\\abcdefghijklmnop\\*sid\\12332432525345\\_vgui_menus\\1\\model\\urban\\somelargeuselesskey\\12312321321323123123123213123123123123123123123123123123123123123dasdsad\\_cl_autowepswitch\\1", }, - { + { "\\cl_updaterate\\100\\topcolor\\60\\name\\abcdefghijklmnop\\*sid\\12332432525345\\_vgui_menus\\1\\model\\urban\\somelargeuselesskey\\12312321321323123123123213123123123123123123123123123123123123123dasdsad\\_cl_autowepswitch\\1", "*team", "12345678901234567890123456789012345678", "\\cl_updaterate\\100\\topcolor\\60\\name\\abcdefghijklmnop\\*sid\\12332432525345\\_vgui_menus\\1\\model\\urban\\_cl_autowepswitch\\1\\*team\\12345678901234567890123456789012345678", }, - + { "\\cl_updaterate\\100\\topcolor\\60\\name\\abcdefghijklmnop\\*sid\\12332432525345\\_vgui_menus\\1\\model\\urban\\somelargeuselesskey\\12312321321323123123123213123123123123123123123123123123123123123dasdsad\\_cl_autowepswitch\\1", "*team", From 1d15946cff9ae5bb9a3a3210730e1f15382e5ca1 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 13 Apr 2021 04:35:26 +0700 Subject: [PATCH 34/61] build.sh fix jobs option parsing glibc_test.sh: reworked pattern --- .github/workflows/build.yml | 2 +- build.sh | 8 ++++---- rehlds/version/glibc_test.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d9693b..8c84908 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -192,7 +192,7 @@ jobs: echo -e "\e[30;43mExit code: $retVal\e[0m" fi shell: bash - + - name: Build using Intel C++ Compiler run: | rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8 diff --git a/build.sh b/build.sh index b891edd..5b06df8 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ for i in "$@" do case $i in -j=*|--jobs=*) - jobs="${i#*=}" + jobs="-j${i#*=}" shift ;; -c=*|--compiler=*) @@ -33,7 +33,7 @@ esac rm -rf build mkdir build -pushd build +pushd build &> /dev/null CC=$CC CXX=$CXX cmake ${args[@]} .. -make -j${jobs} -popd +make ${jobs} +popd > /dev/null diff --git a/rehlds/version/glibc_test.sh b/rehlds/version/glibc_test.sh index 8463a90..74d41d2 100755 --- a/rehlds/version/glibc_test.sh +++ b/rehlds/version/glibc_test.sh @@ -22,7 +22,7 @@ main() elif [ "$version" = "PRIVATE" ]; then version="PRV" # ensure numeric - elif [[ $version =~ ^[0-9]+$ ]]; then + elif [[ $version =~ ^([0-9]+\.){0,2}(\*|[0-9]+)$ ]]; then check_version_greater $version ${threshold_version[$k]} if [[ $? -eq 1 ]]; then echo -e "\033[0;31mAssertion failed:\033[0m Binary \033[0;32m${f}\033[0m has ${k}_\033[0;33m$version\033[0m greater than max version ${k}_\033[0;33m${threshold_version[$k]}\033[0m" From 13e2db3423fc243d104346c1233c2e86cbcccad2 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 13 Apr 2021 05:39:29 +0700 Subject: [PATCH 35/61] build.sh add help [skip ci] --- build.sh | 89 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/build.sh b/build.sh index 5b06df8..876b458 100755 --- a/build.sh +++ b/build.sh @@ -1,39 +1,60 @@ #!/bin/bash -CC=gcc -CXX=g++ +main() +{ + CC=gcc + CXX=g++ -n=0 -args=() -for i in "$@" -do -case $i in - -j=*|--jobs=*) - jobs="-j${i#*=}" - shift - ;; - -c=*|--compiler=*) - C="${i#*=}" - shift - ;; - *) - args[$n]="$i" - ((++n)) - ;; -esac -done + if [[ "$*" =~ "--help" ]]; then + help + exit 0; + fi -case "$C" in - ("intel"|"icc") CC=icc CXX=icpc ;; - ("gcc") CC=gcc CXX=g++ ;; - ("clang") CC=clang CXX=clang++ ;; - *) - ;; -esac + n=0 + args=() + for i in "$@" + do + case $i in + -j=*|--jobs=*) + jobs="-j${i#*=}" + shift + ;; + -c=*|--compiler=*) + C="${i#*=}" + shift + ;; + *) + args[$n]="$i" + ((++n)) + ;; + esac + done -rm -rf build -mkdir build -pushd build &> /dev/null -CC=$CC CXX=$CXX cmake ${args[@]} .. -make ${jobs} -popd > /dev/null + case "$C" in + ("intel"|"icc") CC=icc CXX=icpc ;; + ("gcc"|"g++") CC=gcc CXX=g++ ;; + ("clang|llvm") CC=clang CXX=clang++ ;; + *) + ;; + esac + + rm -rf build + mkdir build + pushd build &> /dev/null + CC=$CC CXX=$CXX cmake ${args[@]} .. + make ${jobs} + popd > /dev/null +} + +help() +{ + printf "Usage: ./build.sh \n\n" + printf " -c= | --compiler= - Select preferred C/C++ compiler to build\n" + printf " -j= | --jobs= - Specifies the number of jobs (commands) to run simultaneously (For faster building)\n\n" +} + +# Initialize +main $* + +# Exit normally +exit 0 From 41f635869a6d84f23c87b75b9934c77529418f00 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 16 Apr 2021 00:35:45 +0700 Subject: [PATCH 36/61] Remove hookers stuff --- rehlds/HLTV/Core/msvc/Core.vcxproj | 20 - rehlds/HLTV/Core/msvc/Core.vcxproj.filters | 18 - rehlds/HLTV/Core/src/Delta.cpp | 4 - rehlds/HLTV/Core/src/Delta.h | 6 - rehlds/HLTV/Core/src/Network.cpp | 2 - rehlds/HLTV/Core/src/Server.cpp | 2 - rehlds/HLTV/Core/src/World.cpp | 2 - rehlds/HLTV/Core/src/World.h | 8 +- rehlds/HLTV/Core/src/precompiled.h | 3 - .../HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj | 12 - .../msvc/DemoPlayer.vcxproj.filters | 12 - rehlds/HLTV/DemoPlayer/src/DemoPlayer.h | 2 - rehlds/HLTV/DemoPlayer/src/precompiled.h | 3 - rehlds/HLTV/Proxy/msvc/Proxy.vcxproj | 12 - rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters | 12 - rehlds/HLTV/Proxy/src/Proxy.cpp | 2 - rehlds/HLTV/Proxy/src/precompiled.h | 3 - .../msvc/filesystem_stdio.vcxproj | 12 - .../msvc/filesystem_stdio.vcxproj.filters | 12 - .../FileSystem_Stdio/src/FileSystem_Stdio.cpp | 2 - .../FileSystem_Stdio/src/precompiled.h | 3 - rehlds/hookers/HLTV/Core/DeltaEx.cpp | 1533 ----------------- rehlds/hookers/HLTV/Core/DeltaEx.h | 163 -- rehlds/hookers/HLTV/Core/hooklist.cpp | 617 ------- rehlds/hookers/HLTV/Core/hooklist.h | 18 - rehlds/hookers/HLTV/Core/main.cpp | 102 -- rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp | 152 -- rehlds/hookers/HLTV/DemoPlayer/hooklist.h | 11 - rehlds/hookers/HLTV/DemoPlayer/main.cpp | 55 - rehlds/hookers/HLTV/Proxy/hooklist.cpp | 649 ------- rehlds/hookers/HLTV/Proxy/hooklist.h | 11 - rehlds/hookers/HLTV/Proxy/main.cpp | 55 - rehlds/hookers/filesystem/hooklist.cpp | 182 -- rehlds/hookers/filesystem/hooklist.h | 42 - rehlds/hookers/filesystem/main.cpp | 86 - rehlds/hookers/helper.h | 163 -- rehlds/hookers/hooker.cpp | 207 --- rehlds/hookers/hooker.h | 25 - rehlds/msvc/ReHLDS.vcxproj | 30 +- rehlds/msvc/ReHLDS.vcxproj.filters | 16 +- rehlds/public/rehlds/custom.h | 6 - rehlds/rehlds/precompiled.h | 2 - rehlds/{hookers => testsuite}/memory.cpp | 0 rehlds/{hookers => testsuite}/memory.h | 0 rehlds/testsuite/testsuite.h | 2 +- 45 files changed, 14 insertions(+), 4265 deletions(-) delete mode 100644 rehlds/hookers/HLTV/Core/DeltaEx.cpp delete mode 100644 rehlds/hookers/HLTV/Core/DeltaEx.h delete mode 100644 rehlds/hookers/HLTV/Core/hooklist.cpp delete mode 100644 rehlds/hookers/HLTV/Core/hooklist.h delete mode 100644 rehlds/hookers/HLTV/Core/main.cpp delete mode 100644 rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp delete mode 100644 rehlds/hookers/HLTV/DemoPlayer/hooklist.h delete mode 100644 rehlds/hookers/HLTV/DemoPlayer/main.cpp delete mode 100644 rehlds/hookers/HLTV/Proxy/hooklist.cpp delete mode 100644 rehlds/hookers/HLTV/Proxy/hooklist.h delete mode 100644 rehlds/hookers/HLTV/Proxy/main.cpp delete mode 100644 rehlds/hookers/filesystem/hooklist.cpp delete mode 100644 rehlds/hookers/filesystem/hooklist.h delete mode 100644 rehlds/hookers/filesystem/main.cpp delete mode 100644 rehlds/hookers/helper.h delete mode 100644 rehlds/hookers/hooker.cpp delete mode 100644 rehlds/hookers/hooker.h rename rehlds/{hookers => testsuite}/memory.cpp (100%) rename rehlds/{hookers => testsuite}/memory.h (100%) diff --git a/rehlds/HLTV/Core/msvc/Core.vcxproj b/rehlds/HLTV/Core/msvc/Core.vcxproj index 0ae9902..b40addc 100644 --- a/rehlds/HLTV/Core/msvc/Core.vcxproj +++ b/rehlds/HLTV/Core/msvc/Core.vcxproj @@ -128,18 +128,6 @@ - - true - true - - - true - true - - - true - true - @@ -202,14 +190,6 @@ - - true - true - - - true - true - diff --git a/rehlds/HLTV/Core/msvc/Core.vcxproj.filters b/rehlds/HLTV/Core/msvc/Core.vcxproj.filters index 1a7689c..13f76ef 100644 --- a/rehlds/HLTV/Core/msvc/Core.vcxproj.filters +++ b/rehlds/HLTV/Core/msvc/Core.vcxproj.filters @@ -10,9 +10,6 @@ {664fe3c6-46ae-4fa5-bf0c-f70873228f5e} - - {fb482bcd-a131-4e66-be87-c7b0ffe6a4cf} - {0997bc0d-a67f-47eb-abc1-3c7ebb128beb} @@ -78,12 +75,6 @@ src - - src\hookers - - - src\hookers - common @@ -99,9 +90,6 @@ HLTV\common - - src\hookers - engine @@ -164,9 +152,6 @@ src - - src\hookers - common @@ -182,9 +167,6 @@ HLTV\common - - src\hookers - engine diff --git a/rehlds/HLTV/Core/src/Delta.cpp b/rehlds/HLTV/Core/src/Delta.cpp index 54b96c2..fc66263 100644 --- a/rehlds/HLTV/Core/src/Delta.cpp +++ b/rehlds/HLTV/Core/src/Delta.cpp @@ -28,8 +28,6 @@ #include "precompiled.h" -#ifndef HOOK_HLTV - delta_t *Delta::m_EntityDelta = nullptr; delta_t *Delta::m_PlayerDelta = nullptr; delta_t *Delta::m_ClientDelta = nullptr; @@ -1510,5 +1508,3 @@ void Delta::SetLargeTimeBufferSize(bool bigBuffers) { m_LargeTime_Buffers = bigBuffers; } - -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/Delta.h b/rehlds/HLTV/Core/src/Delta.h index 17a540a..56fb3e4 100644 --- a/rehlds/HLTV/Core/src/Delta.h +++ b/rehlds/HLTV/Core/src/Delta.h @@ -95,10 +95,6 @@ typedef struct delta_s delta_description_t *pdd; } delta_t; -#include "hookers/HLTV/Core/DeltaEx.h" - -#ifndef HOOK_HLTV - class Delta { public: void Init(IBaseSystem *system); @@ -204,5 +200,3 @@ private: double m_Time; bool m_LargeTime_Buffers; }; - -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/Network.cpp b/rehlds/HLTV/Core/src/Network.cpp index cf087d1..d089d2e 100644 --- a/rehlds/HLTV/Core/src/Network.cpp +++ b/rehlds/HLTV/Core/src/Network.cpp @@ -449,6 +449,4 @@ IBaseInterface *CreateNetwork() return (IBaseInterface *)pNetwork; } -#ifndef HOOK_HLTV EXPOSE_INTERFACE_FN(CreateNetwork, Network, NETWORK_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/Server.cpp b/rehlds/HLTV/Core/src/Server.cpp index 05c0cf1..a2dc5d1 100644 --- a/rehlds/HLTV/Core/src/Server.cpp +++ b/rehlds/HLTV/Core/src/Server.cpp @@ -2411,6 +2411,4 @@ IBaseInterface *CreateServer() return (IBaseInterface *)pServer; } -#ifndef HOOK_HLTV EXPOSE_INTERFACE_FN(CreateServer, Server, SERVER_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/World.cpp b/rehlds/HLTV/Core/src/World.cpp index 5d8f1fd..b355420 100644 --- a/rehlds/HLTV/Core/src/World.cpp +++ b/rehlds/HLTV/Core/src/World.cpp @@ -2338,7 +2338,6 @@ IBaseInterface *CreateWorld() return (IBaseInterface *)pWorld; } -#ifndef HOOK_HLTV bool World::IsDeltaEncoder() const { if (Delta::m_CustomentityDelta @@ -2379,4 +2378,3 @@ delta_t *World::GetWeaponDelta() const { } EXPOSE_INTERFACE_FN(CreateWorld, World, WORLD_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/World.h b/rehlds/HLTV/Core/src/World.h index 09e98dd..b84b99a 100644 --- a/rehlds/HLTV/Core/src/World.h +++ b/rehlds/HLTV/Core/src/World.h @@ -252,7 +252,7 @@ protected: int m_MaxInstanced_BaseLine; -#if defined(HLTV_FIXES) && !defined(HOOK_HLTV) +#if defined(HLTV_FIXES) char m_Lightstyles[MAX_LIGHTSTYLES][64]; #else char m_Lightstyles[MAX_LIGHTSTYLES][65]; @@ -303,13 +303,7 @@ protected: char m_HostName[255]; NetAddress m_GameServerAddress; - -#ifdef HOOK_HLTV - static DeltaWrapper m_Delta; -#else Delta m_Delta; -#endif // HOOK_HLTV - }; extern char g_DownloadURL[128]; diff --git a/rehlds/HLTV/Core/src/precompiled.h b/rehlds/HLTV/Core/src/precompiled.h index c331350..6c5c428 100644 --- a/rehlds/HLTV/Core/src/precompiled.h +++ b/rehlds/HLTV/Core/src/precompiled.h @@ -10,9 +10,6 @@ #include "mem.h" #include "common.h" -// Hooks stuff -#include "hookers/HLTV/Core/hooklist.h" - #include "common/md5.h" #include "common/random.h" #include "common/byteorder.h" diff --git a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj index 45a7a94..118d3c2 100644 --- a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj +++ b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj @@ -16,14 +16,6 @@ - - true - true - - - true - true - @@ -42,10 +34,6 @@ - - true - true - diff --git a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters index 9d7f4cd..267f18a 100644 --- a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters +++ b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters @@ -10,9 +10,6 @@ {ca1c7722-8e65-480d-9e3c-34f7f2524372} - - {1f62aa80-c3f7-4f97-a93e-5b67b153a751} - {8712d29d-6fec-42fb-9f6e-5618302f3203} @@ -45,12 +42,6 @@ HLTV\common - - src\hookers - - - src\hookers - common @@ -89,9 +80,6 @@ HLTV\common - - src\hookers - common diff --git a/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h b/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h index c1eea62..1c41706 100644 --- a/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h +++ b/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h @@ -172,7 +172,6 @@ private: unsigned int m_Outgoing_sequence; }; -#ifndef HOOK_HLTV // Use this to expose a singleton interface. This creates the global variable for you automatically. #define EXPOSE_SINGLE_INTERFACE2(className, interfaceName, versionName) \ static className __g_##className##_singleton;\ @@ -180,4 +179,3 @@ private: static InterfaceReg __g_Create##className##interfaceName##_reg(__Create##className##interfaceName##_interface, versionName); EXPOSE_SINGLE_INTERFACE2(DemoPlayer, IDemoPlayer, DEMOPLAYER_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/DemoPlayer/src/precompiled.h b/rehlds/HLTV/DemoPlayer/src/precompiled.h index 440fa0e..b2203a8 100644 --- a/rehlds/HLTV/DemoPlayer/src/precompiled.h +++ b/rehlds/HLTV/DemoPlayer/src/precompiled.h @@ -18,6 +18,3 @@ #include "common/DemoFile.h" #include "DemoPlayer.h" - -// Hooks stuff -#include "hookers/HLTV/DemoPlayer/hooklist.h" diff --git a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj index 44bb4d8..0690222 100644 --- a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj +++ b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj @@ -36,14 +36,6 @@ - - true - true - - - true - true - Use Use @@ -213,10 +205,6 @@ - - true - true - diff --git a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters index 5f80d89..71264ae 100644 --- a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters +++ b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters @@ -10,9 +10,6 @@ {feda00f0-7c09-4c63-b5a1-e4fbcdfc6b69} - - {199d99ef-8924-48fc-8c8a-2859f8d40c82} - {1777708a-8593-40c0-8caa-9154180854dc} @@ -84,12 +81,6 @@ HLTV\common - - src\hookers - - - src\hookers - src @@ -173,9 +164,6 @@ HLTV\common - - src\hookers - common diff --git a/rehlds/HLTV/Proxy/src/Proxy.cpp b/rehlds/HLTV/Proxy/src/Proxy.cpp index c4d4aa6..c876415 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.cpp +++ b/rehlds/HLTV/Proxy/src/Proxy.cpp @@ -83,9 +83,7 @@ Proxy::LocalCommandID_s Proxy::m_LocalCmdReg[] = { { "chatdelay", CMD_ID_CHATDELAY, &Proxy::CMD_ChatDelay }, }; -#ifndef HOOK_HLTV EXPOSE_SINGLE_INTERFACE(Proxy, IProxy, PROXY_INTERFACE_VERSION); -#endif // HOOK_HLTV bool Proxy::Init(IBaseSystem *system, int serial, char *name) { diff --git a/rehlds/HLTV/Proxy/src/precompiled.h b/rehlds/HLTV/Proxy/src/precompiled.h index a3065cf..a6ee104 100644 --- a/rehlds/HLTV/Proxy/src/precompiled.h +++ b/rehlds/HLTV/Proxy/src/precompiled.h @@ -18,9 +18,6 @@ #include "common/net_internal.h" #include "common/mathlib_internal.h" -// Hooks stuff -#include "hookers/HLTV/Proxy/hooklist.h" - #include "common/DirectorCmd.h" #include "common/NetAddress.h" #include "common/NetChannel.h" diff --git a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj index 77a1ecb..a340ff8 100644 --- a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj +++ b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj @@ -130,14 +130,6 @@ - - true - true - - - true - true - @@ -156,10 +148,6 @@ - - true - true - diff --git a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters index 5f4abdf..c4646a0 100644 --- a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters +++ b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters @@ -4,9 +4,6 @@ {3f7611e3-cf43-4956-a8a1-b6efbcf1a63d} - - {cacc7b07-9ac2-42d5-bba3-14c061a19d11} - @@ -30,12 +27,6 @@ src - - hookers - - - hookers - @@ -50,9 +41,6 @@ src - - hookers - src diff --git a/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp b/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp index 78d1188..9fde285 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp +++ b/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp @@ -227,6 +227,4 @@ bool CFileSystem_Stdio::IsAppReadyForOfflinePlay(int appID) return true; } -#ifndef HOOK_FILESYSTEM EXPOSE_SINGLE_INTERFACE(CFileSystem_Stdio, IFileSystem, FILESYSTEM_INTERFACE_VERSION); -#endif // HOOK_FILESYSTEM diff --git a/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h b/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h index 323af5e..db84c63 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h +++ b/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h @@ -33,8 +33,5 @@ #include "interface.h" #include "strtools.h" -// Hooks stuff -#include "hookers/filesystem/hooklist.h" - // FileSystem stuff #include "FileSystem_Stdio.h" diff --git a/rehlds/hookers/HLTV/Core/DeltaEx.cpp b/rehlds/hookers/HLTV/Core/DeltaEx.cpp deleted file mode 100644 index 3c2c58c..0000000 --- a/rehlds/hookers/HLTV/Core/DeltaEx.cpp +++ /dev/null @@ -1,1533 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#ifdef HOOK_HLTV - -DeltaWrapper World::m_Delta; - -delta_definition_list_t *g_defs; -delta_encoder_t *g_encoders; -delta_registry_t *g_deltaregistry; - -double g_delta_Time; -bool g_large_Time_Buffers; - -delta_t *g_pentitydelta; -delta_t *g_pplayerdelta; -delta_t *g_pcustomentitydelta; -delta_t *g_pclientdelta; -delta_t *g_pweapondelta; -delta_t *g_peventdelta; - -#define DELTA_D_DEF(member) #member, offsetof(delta_description_s, member) -#define DELTA_DEF(structname, member) { #member, offsetof(structname, member) } - -delta_definition_t g_DeltaDataDefinition[] = -{ - DELTA_DEF(delta_description_s, fieldType), - DELTA_DEF(delta_description_s, fieldName), - DELTA_DEF(delta_description_s, fieldOffset), - DELTA_DEF(delta_description_s, fieldSize), - DELTA_DEF(delta_description_s, significant_bits), - DELTA_DEF(delta_description_s, premultiply), - DELTA_DEF(delta_description_s, postmultiply), - DELTA_DEF(delta_description_s, flags) -}; - -delta_description_t g_MetaDescription[] = -{ - { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} }, - { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} }, - { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} }, - { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} }, - { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} }, - { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, - { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} } -}; - -namespace Delta { - delta_t g_MetaDelta[] = - { - { 0, ARRAYSIZE(g_MetaDescription), "", NULL, g_MetaDescription }, - }; - -}; // namespace Delta - -delta_definition_t g_EventDataDefinition[] = -{ - DELTA_DEF(event_args_s, entindex), - DELTA_DEF(event_args_s, origin[0]), - DELTA_DEF(event_args_s, origin[1]), - DELTA_DEF(event_args_s, origin[2]), - DELTA_DEF(event_args_s, angles[0]), - DELTA_DEF(event_args_s, angles[1]), - DELTA_DEF(event_args_s, angles[2]), - DELTA_DEF(event_args_s, fparam1), - DELTA_DEF(event_args_s, fparam2), - DELTA_DEF(event_args_s, iparam1), - DELTA_DEF(event_args_s, iparam2), - DELTA_DEF(event_args_s, bparam1), - DELTA_DEF(event_args_s, bparam2), - DELTA_DEF(event_args_s, ducking) -}; - -delta_definition_t g_EntityDataDefinition[] = -{ - DELTA_DEF(entity_state_s, startpos[0]), - DELTA_DEF(entity_state_s, startpos[1]), - DELTA_DEF(entity_state_s, startpos[2]), - DELTA_DEF(entity_state_s, endpos[0]), - DELTA_DEF(entity_state_s, endpos[1]), - DELTA_DEF(entity_state_s, endpos[2]), - DELTA_DEF(entity_state_s, impacttime), - DELTA_DEF(entity_state_s, starttime), - DELTA_DEF(entity_state_s, origin[0]), - DELTA_DEF(entity_state_s, origin[1]), - DELTA_DEF(entity_state_s, origin[2]), - DELTA_DEF(entity_state_s, angles[0]), - DELTA_DEF(entity_state_s, angles[1]), - DELTA_DEF(entity_state_s, angles[2]), - DELTA_DEF(entity_state_s, modelindex), - DELTA_DEF(entity_state_s, frame), - DELTA_DEF(entity_state_s, movetype), - DELTA_DEF(entity_state_s, colormap), - DELTA_DEF(entity_state_s, skin), - DELTA_DEF(entity_state_s, solid), - DELTA_DEF(entity_state_s, scale), - DELTA_DEF(entity_state_s, effects), - DELTA_DEF(entity_state_s, sequence), - DELTA_DEF(entity_state_s, animtime), - DELTA_DEF(entity_state_s, framerate), - DELTA_DEF(entity_state_s, controller[0]), - DELTA_DEF(entity_state_s, controller[1]), - DELTA_DEF(entity_state_s, controller[2]), - DELTA_DEF(entity_state_s, controller[3]), - DELTA_DEF(entity_state_s, blending[0]), - DELTA_DEF(entity_state_s, blending[1]), - DELTA_DEF(entity_state_s, body), - DELTA_DEF(entity_state_s, owner), - DELTA_DEF(entity_state_s, rendermode), - DELTA_DEF(entity_state_s, renderamt), - DELTA_DEF(entity_state_s, renderfx), - DELTA_DEF(entity_state_s, rendercolor.r), - DELTA_DEF(entity_state_s, rendercolor.g), - DELTA_DEF(entity_state_s, rendercolor.b), - DELTA_DEF(entity_state_s, weaponmodel), - DELTA_DEF(entity_state_s, gaitsequence), - DELTA_DEF(entity_state_s, mins[0]), - DELTA_DEF(entity_state_s, mins[1]), - DELTA_DEF(entity_state_s, mins[2]), - DELTA_DEF(entity_state_s, maxs[0]), - DELTA_DEF(entity_state_s, maxs[1]), - DELTA_DEF(entity_state_s, maxs[2]), - DELTA_DEF(entity_state_s, aiment), - DELTA_DEF(entity_state_s, basevelocity[0]), - DELTA_DEF(entity_state_s, basevelocity[1]), - DELTA_DEF(entity_state_s, basevelocity[2]), - DELTA_DEF(entity_state_s, friction), - DELTA_DEF(entity_state_s, gravity), - DELTA_DEF(entity_state_s, spectator), - DELTA_DEF(entity_state_s, velocity[0]), - DELTA_DEF(entity_state_s, velocity[1]), - DELTA_DEF(entity_state_s, velocity[2]), - DELTA_DEF(entity_state_s, team), - DELTA_DEF(entity_state_s, playerclass), - DELTA_DEF(entity_state_s, health), - DELTA_DEF(entity_state_s, usehull), - DELTA_DEF(entity_state_s, oldbuttons), - DELTA_DEF(entity_state_s, onground), - DELTA_DEF(entity_state_s, iStepLeft), - DELTA_DEF(entity_state_s, flFallVelocity), - DELTA_DEF(entity_state_s, weaponanim), - DELTA_DEF(entity_state_s, eflags), - DELTA_DEF(entity_state_s, iuser1), - DELTA_DEF(entity_state_s, iuser2), - DELTA_DEF(entity_state_s, iuser3), - DELTA_DEF(entity_state_s, iuser4), - DELTA_DEF(entity_state_s, fuser1), - DELTA_DEF(entity_state_s, fuser2), - DELTA_DEF(entity_state_s, fuser3), - DELTA_DEF(entity_state_s, fuser4), - DELTA_DEF(entity_state_s, vuser1[0]), - DELTA_DEF(entity_state_s, vuser1[1]), - DELTA_DEF(entity_state_s, vuser1[2]), - DELTA_DEF(entity_state_s, vuser2[0]), - DELTA_DEF(entity_state_s, vuser2[1]), - DELTA_DEF(entity_state_s, vuser2[2]), - DELTA_DEF(entity_state_s, vuser3[0]), - DELTA_DEF(entity_state_s, vuser3[1]), - DELTA_DEF(entity_state_s, vuser3[2]), - DELTA_DEF(entity_state_s, vuser4[0]), - DELTA_DEF(entity_state_s, vuser4[1]), - DELTA_DEF(entity_state_s, vuser4[2]) -}; - -delta_definition_t g_UsercmdDataDefinition[] = -{ - DELTA_DEF(usercmd_s, lerp_msec), - DELTA_DEF(usercmd_s, msec), - DELTA_DEF(usercmd_s, lightlevel), - DELTA_DEF(usercmd_s, viewangles[0]), - DELTA_DEF(usercmd_s, viewangles[1]), - DELTA_DEF(usercmd_s, viewangles[2]), - DELTA_DEF(usercmd_s, buttons), - DELTA_DEF(usercmd_s, forwardmove), - DELTA_DEF(usercmd_s, sidemove), - DELTA_DEF(usercmd_s, upmove), - DELTA_DEF(usercmd_s, impulse), - DELTA_DEF(usercmd_s, weaponselect), - DELTA_DEF(usercmd_s, impact_index), - DELTA_DEF(usercmd_s, impact_position[0]), - DELTA_DEF(usercmd_s, impact_position[1]), - DELTA_DEF(usercmd_s, impact_position[2]) -}; - -delta_definition_t g_WeaponDataDefinition[] = -{ - DELTA_DEF(weapon_data_s, m_iId), - DELTA_DEF(weapon_data_s, m_iClip), - DELTA_DEF(weapon_data_s, m_flNextPrimaryAttack), - DELTA_DEF(weapon_data_s, m_flNextSecondaryAttack), - DELTA_DEF(weapon_data_s, m_flTimeWeaponIdle), - DELTA_DEF(weapon_data_s, m_fInReload), - DELTA_DEF(weapon_data_s, m_fInSpecialReload), - DELTA_DEF(weapon_data_s, m_flNextReload), - DELTA_DEF(weapon_data_s, m_flPumpTime), - DELTA_DEF(weapon_data_s, m_fReloadTime), - DELTA_DEF(weapon_data_s, m_fAimedDamage), - DELTA_DEF(weapon_data_s, m_fNextAimBonus), - DELTA_DEF(weapon_data_s, m_fInZoom), - DELTA_DEF(weapon_data_s, m_iWeaponState), - DELTA_DEF(weapon_data_s, iuser1), - DELTA_DEF(weapon_data_s, iuser2), - DELTA_DEF(weapon_data_s, iuser3), - DELTA_DEF(weapon_data_s, iuser4), - DELTA_DEF(weapon_data_s, fuser1), - DELTA_DEF(weapon_data_s, fuser2), - DELTA_DEF(weapon_data_s, fuser3), - DELTA_DEF(weapon_data_s, fuser4) -}; - -delta_definition_t g_ClientDataDefinition[] = -{ - DELTA_DEF(clientdata_s, origin[0]), - DELTA_DEF(clientdata_s, origin[1]), - DELTA_DEF(clientdata_s, origin[2]), - DELTA_DEF(clientdata_s, velocity[0]), - DELTA_DEF(clientdata_s, velocity[1]), - DELTA_DEF(clientdata_s, velocity[2]), - DELTA_DEF(clientdata_s, viewmodel), - DELTA_DEF(clientdata_s, punchangle[0]), - DELTA_DEF(clientdata_s, punchangle[1]), - DELTA_DEF(clientdata_s, punchangle[2]), - DELTA_DEF(clientdata_s, flags), - DELTA_DEF(clientdata_s, waterlevel), - DELTA_DEF(clientdata_s, watertype), - DELTA_DEF(clientdata_s, view_ofs[0]), - DELTA_DEF(clientdata_s, view_ofs[1]), - DELTA_DEF(clientdata_s, view_ofs[2]), - DELTA_DEF(clientdata_s, health), - DELTA_DEF(clientdata_s, bInDuck), - DELTA_DEF(clientdata_s, weapons), - DELTA_DEF(clientdata_s, flTimeStepSound), - DELTA_DEF(clientdata_s, flDuckTime), - DELTA_DEF(clientdata_s, flSwimTime), - DELTA_DEF(clientdata_s, waterjumptime), - DELTA_DEF(clientdata_s, maxspeed), - DELTA_DEF(clientdata_s, m_iId), - DELTA_DEF(clientdata_s, ammo_nails), - DELTA_DEF(clientdata_s, ammo_shells), - DELTA_DEF(clientdata_s, ammo_cells), - DELTA_DEF(clientdata_s, ammo_rockets), - DELTA_DEF(clientdata_s, m_flNextAttack), - DELTA_DEF(clientdata_s, physinfo), - DELTA_DEF(clientdata_s, fov), - DELTA_DEF(clientdata_s, weaponanim), - DELTA_DEF(clientdata_s, tfstate), - DELTA_DEF(clientdata_s, pushmsec), - DELTA_DEF(clientdata_s, deadflag), - DELTA_DEF(clientdata_s, iuser1), - DELTA_DEF(clientdata_s, iuser2), - DELTA_DEF(clientdata_s, iuser3), - DELTA_DEF(clientdata_s, iuser4), - DELTA_DEF(clientdata_s, fuser1), - DELTA_DEF(clientdata_s, fuser2), - DELTA_DEF(clientdata_s, fuser3), - DELTA_DEF(clientdata_s, fuser4), - DELTA_DEF(clientdata_s, vuser1[0]), - DELTA_DEF(clientdata_s, vuser1[1]), - DELTA_DEF(clientdata_s, vuser1[2]), - DELTA_DEF(clientdata_s, vuser2[0]), - DELTA_DEF(clientdata_s, vuser2[1]), - DELTA_DEF(clientdata_s, vuser2[2]), - DELTA_DEF(clientdata_s, vuser3[0]), - DELTA_DEF(clientdata_s, vuser3[1]), - DELTA_DEF(clientdata_s, vuser3[2]), - DELTA_DEF(clientdata_s, vuser4[0]), - DELTA_DEF(clientdata_s, vuser4[1]), - DELTA_DEF(clientdata_s, vuser4[2]) -}; - -delta_description_t *DELTA_FindField(delta_t *pFields, const char *pszField) -{ - for (int i = 0; i < pFields->fieldCount; i++) - { - if (Q_stricmp(pFields->pdd[i].fieldName, pszField) == 0) { - return &pFields->pdd[i]; - } - } - - return nullptr; -} - -int DELTA_FindFieldIndex(delta_t *pFields, const char *fieldname) -{ - for (int i = 0; i < pFields->fieldCount; i++) - { - if (Q_stricmp(pFields->pdd[i].fieldName, fieldname) == 0) { - return i; - } - } - - return -1; -} - -void DELTA_SetField(delta_t *pFields, const char *fieldname) -{ - delta_description_t *pTest = DELTA_FindField(pFields, fieldname); - if (pTest) { - pTest->flags |= FDT_MARK; - } -} - -void DELTA_UnsetField(delta_t *pFields, const char *fieldname) -{ - delta_description_t *pTest = DELTA_FindField(pFields, fieldname); - if (pTest) { - pTest->flags &= ~FDT_MARK; - } -} - -void DELTA_SetFieldByIndex(delta_t *pFields, int fieldNumber) -{ - pFields->pdd[fieldNumber].flags |= FDT_MARK; -} - -void DELTA_UnsetFieldByIndex(delta_t *pFields, int fieldNumber) -{ - pFields->pdd[fieldNumber].flags &= ~FDT_MARK; -} - -void DELTA_ClearFlags(delta_t *pFields) -{ - for (int i = 0; i < pFields->fieldCount; i++) { - pFields->pdd[i].flags = 0; - } -} - -int DELTA_CountSendFields(delta_t *pFields) -{ - int i, c; - for (i = 0, c = 0; i < pFields->fieldCount; i++) - { - auto pitem = &pFields->pdd[i]; - if (pitem->flags & FDT_MARK) { - pitem->stats.sendcount++; - c++; - } - } - - return c; -} - -void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFields) -{ - int i; - char *st1, *st2; - delta_description_t *pTest; - int fieldType; - int fieldCount = pFields->fieldCount; - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - fieldType = pTest->fieldType & ~DT_SIGNED; - switch (fieldType) - { - case DT_BYTE: - if (from[pTest->fieldOffset] != to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_SHORT: - if (*(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_FLOAT: - case DT_INTEGER: - case DT_ANGLE: - if (*(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_TIMEWINDOW_8: - case DT_TIMEWINDOW_BIG: - if (*(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_STRING: - st1 = (char *)&from[pTest->fieldOffset]; - st2 = (char *)&to[pTest->fieldOffset]; - - // Not sure why it is case insensitive, but it looks so - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) { - pTest->flags |= FDT_MARK; - } - break; - default: - break; - } - } - - if (pFields->conditionalencode) { - pFields->conditionalencode(pFields, from, to); - } -} - -void DELTA_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount) -{ - int i; - int lastbit = -1; - int fieldCount = pFields->fieldCount; - - Q_memset(bits, 0, 8); - - for (i = fieldCount - 1; i >= 0; i--) - { - if (pFields->pdd[i].flags & FDT_MARK) - { - if (lastbit == -1) { - lastbit = i; - } - - bits[i > 31 ? 1 : 0] |= 1 << (i & 0x1f); - } - } - - // fix for bad bytecount when no fields are marked - if (lastbit == -1) { - *bytecount = 0; - return; - } - - *bytecount = (lastbit >> 3) + 1; -} - -void DELTA_WriteMarkedFields(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields) -{ - int i; - delta_description_t *pTest; - int fieldSign; - int fieldType; - - float f2; - int fieldCount = pFields->fieldCount; - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - if (!(pTest->flags & FDT_MARK)) - continue; - - fieldSign = pTest->fieldType & DT_SIGNED; - fieldType = pTest->fieldType & ~DT_SIGNED; - switch (fieldType) - { - case DT_BYTE: - if (fieldSign) - { - int8 si8 = *(int8 *)&to[pTest->fieldOffset]; - si8 = (int8)((double)si8 * pTest->premultiply); - stream->WriteSBits(si8, pTest->significant_bits); - } - else - { - uint8 i8 = *(uint8 *)&to[pTest->fieldOffset]; - i8 = (uint8)((double)i8 * pTest->premultiply); - stream->WriteBits(i8, pTest->significant_bits); - } - break; - case DT_SHORT: - if (fieldSign) - { - int16 si16 = *(int16 *)&to[pTest->fieldOffset]; - si16 = (int16)((double)si16 * pTest->premultiply); - stream->WriteSBits(si16, pTest->significant_bits); - } - else - { - uint16 i16 = *(uint16 *)&to[pTest->fieldOffset]; - i16 = (uint16)((double)i16 * pTest->premultiply); - stream->WriteBits(i16, pTest->significant_bits); - } - break; - case DT_FLOAT: - { - double val = (double)(*(float *)&to[pTest->fieldOffset]) * pTest->premultiply; - if (fieldSign) - { - stream->WriteSBits((int32)val, pTest->significant_bits); - } - else - { - stream->WriteBits((uint32)val, pTest->significant_bits); - } - break; - } - case DT_INTEGER: - { - if (fieldSign) - { - int32 signedInt = *(int32 *)&to[pTest->fieldOffset]; - if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) { - signedInt = (int32)((double)signedInt * pTest->premultiply); - } - - stream->WriteSBits(signedInt, pTest->significant_bits); - } - else - { - uint32 unsignedInt = *(uint32 *)&to[pTest->fieldOffset]; - if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) { - unsignedInt = (uint32)((double)unsignedInt * pTest->premultiply); - } - - stream->WriteBits(unsignedInt, pTest->significant_bits); - } - break; - } - case DT_ANGLE: - f2 = *(float *)&to[pTest->fieldOffset]; - stream->WriteBitAngle(f2, pTest->significant_bits); - break; - case DT_TIMEWINDOW_8: - { - f2 = *(float *)&to[pTest->fieldOffset]; - if (g_large_Time_Buffers) { - stream->WriteFloat(f2); - } else { - int32 twVal = (int)(g_delta_Time * 100.0) - (int)(f2 * 100.0); - stream->WriteSBits(twVal, 8); - } - break; - } - case DT_TIMEWINDOW_BIG: - { - f2 = *(float *)&to[pTest->fieldOffset]; - if (g_large_Time_Buffers) { - stream->WriteFloat(f2); - } else { - int32 twVal = (int)(g_delta_Time * pTest->premultiply) - (int)(f2 * pTest->premultiply); - stream->WriteSBits((int32)twVal, pTest->significant_bits); - } - break; - } - case DT_STRING: - stream->WriteBitString((const char *)&to[pTest->fieldOffset]); - break; - default: - break; - } - } -} - -int DELTA_CheckDelta(unsigned char *from, unsigned char *to, delta_t *pFields) -{ - DELTA_ClearFlags(pFields); - DELTA_MarkSendFields(from, to, pFields); - - return DELTA_CountSendFields(pFields); -} - -void DELTA_WriteHeader(BitBuffer *stream, deltacallback_t *header) -{ - int delta = header->num - header->numbase; - if (header->full) - { - if (delta == 1) - { - stream->WriteBit(1); - } - else - { - stream->WriteBit(0); - if (delta <= 0 || delta >= 64) - { - stream->WriteBit(1); - stream->WriteBits(header->num, 11); - } - else - { - stream->WriteBit(0); - stream->WriteBits(delta, 6); - } - } - } - else - { - stream->WriteBit(header->remove != 0); - if (delta <= 0 || delta >= 64) - { - stream->WriteBit(1); - stream->WriteBits(header->num, 11); - } - else - { - stream->WriteBit(0); - stream->WriteBits(delta, 6); - } - } - - header->numbase = header->num; - if (!header->remove) - { - stream->WriteBit(header->custom != 0); - if (header->instanced_baseline) - { - if (header->newbl) - { - stream->WriteBit(1); - stream->WriteBits(header->newblindex, 6); - } - else - { - stream->WriteBit(0); - } - } - if (header->full && !header->newbl) - { - if (header->offset) - { - stream->WriteBit(1); - stream->WriteBits(header->offset, 6); - } - else - { - stream->WriteBit(0); - } - } - } -} - -qboolean DELTA_WriteDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, bool force, delta_t *pFields, deltacallback_t *header) -{ - int i; - int bytecount; - int bits[2]; - - if (!DELTA_CheckDelta(from, to, pFields) && !force) { - return FALSE; - } - - DELTA_SetSendFlagBits(pFields, bits, &bytecount); - - if (header) { - DELTA_WriteHeader(stream, header); - } - - stream->WriteBits(bytecount, 3); - for (i = 0; i < bytecount; i++) { - stream->WriteBits(((byte *)bits)[i], 8); - } - - DELTA_WriteMarkedFields(stream, from, to, pFields); - return TRUE; -} - -int DELTA_ParseDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields) -{ - delta_description_t *pTest; - int i; - int bits[2]; // this is a limit with 64 fields max in delta - int nbytes; - int bitfieldnumber; - int fieldCount = pFields->fieldCount; - int fieldType; - int fieldSign; - - double d2; - float t; - int addt; - char *st2; - char c; - int startbit; - - startbit = stream->CurrentBit(); - Q_memset(bits, 0, sizeof(bits)); - - nbytes = stream->ReadBits(3); - for (i = 0; i < nbytes; i++) { - ((byte *)bits)[i] = stream->ReadBits(8); - } - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - fieldType = pTest->fieldType & ~DT_SIGNED; - - bitfieldnumber = (1 << (i & 0x1F)); - if (!(bitfieldnumber & bits[i > 31])) - { - // Field was not sent to us, just transfer info from the "from" - switch (fieldType) - { - case DT_BYTE: - to[pTest->fieldOffset] = from[pTest->fieldOffset]; - break; - case DT_SHORT: - *(uint16 *)&to[pTest->fieldOffset] = *(uint16 *)&from[pTest->fieldOffset]; - break; - case DT_FLOAT: - case DT_INTEGER: - case DT_ANGLE: - case DT_TIMEWINDOW_8: - case DT_TIMEWINDOW_BIG: - *(uint32 *)&to[pTest->fieldOffset] = *(uint32 *)&from[pTest->fieldOffset]; - break; - case DT_STRING: - Q_strcpy((char *)&to[pTest->fieldOffset], (char *)&from[pTest->fieldOffset]); - break; - default: - break; - } - continue; - } - - pTest->stats.receivedcount++; - fieldSign = pTest->fieldType & DT_SIGNED; - - switch (fieldType) - { - case DT_BYTE: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(int8 *)&to[pTest->fieldOffset] = (int8)d2; - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(uint8 *)&to[pTest->fieldOffset] = (uint8)d2; - } - break; - case DT_SHORT: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(int16 *)&to[pTest->fieldOffset] = (int16)d2; - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(uint16 *)&to[pTest->fieldOffset] = (uint16)d2; - } - break; - case DT_FLOAT: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - } - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(float *)&to[pTest->fieldOffset] = (float)d2; - break; - case DT_INTEGER: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(int32 *)&to[pTest->fieldOffset] = (int32)d2; - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(uint32 *)&to[pTest->fieldOffset] = (uint32)d2; - } - break; - case DT_ANGLE: - *(float *)&to[pTest->fieldOffset] = stream->ReadBitAngle(pTest->significant_bits); - break; - case DT_TIMEWINDOW_8: - if (g_large_Time_Buffers) { - t = stream->ReadFloat(); - } - else { - addt = stream->ReadSBits(8); - t = (float)((g_delta_Time * 100.0 - addt) / 100.0); - } - *(float *)&to[pTest->fieldOffset] = t; - break; - case DT_TIMEWINDOW_BIG: - if (g_large_Time_Buffers) { - t = stream->ReadFloat(); - } - else { - addt = stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - t = (float)((g_delta_Time * pTest->premultiply - addt) / pTest->premultiply); - } - else { - t = (float)(g_delta_Time - addt); - } - } - - *(float *)&to[pTest->fieldOffset] = t; - break; - case DT_STRING: - st2 = (char *)&to[pTest->fieldOffset]; - do - { - c = stream->ReadBits(8); - *st2++ = c; - } while (c); - break; - default: - break; - } - } - - return stream->CurrentBit() - startbit; -} - -int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) -{ - int i; - char *st1, *st2; - delta_description_t *pTest; - int fieldType; - int fieldCount = pFields->fieldCount; - int length = 0; - bool different; - int neededBits = 0; - int highestBit = -1; - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - different = false; - fieldType = pTest->fieldType & ~DT_SIGNED; - - switch (fieldType) - { - case DT_BYTE: - different = from[pTest->fieldOffset] != to[pTest->fieldOffset]; - break; - case DT_SHORT: - different = *(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset]; - break; - case DT_FLOAT: - case DT_INTEGER: - case DT_ANGLE: - different = *(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]; - break; - // don't use multiplier when checking, to increase performance - // check values binary like it does in jit - case DT_TIMEWINDOW_8: - case DT_TIMEWINDOW_BIG: - different = (*(int32 *)&from[pTest->fieldOffset]) != (*(int32 *)&to[pTest->fieldOffset]); - break; - case DT_STRING: - st1 = (char *)&from[pTest->fieldOffset]; - st2 = (char *)&to[pTest->fieldOffset]; - - // Not sure why it is case insensitive, but it looks so - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) - { - different = true; - length = Q_strlen(st2) * 8; - pTest->flags |= FDT_MARK; - } - break; - default: - break; - } - - if (different) - { - highestBit = i; - neededBits += (fieldType == DT_STRING) ? length + 8 : pTest->significant_bits; - } - } - - if (highestBit != -1) { - neededBits += highestBit / 8 * 8 + 8; - } - - return neededBits; -} - -void DELTA_AddEncoder(char *name, encoder_t conditionalencode) -{ - delta_encoder_t *delta = (delta_encoder_t *)Mem_ZeroMalloc(sizeof(delta_encoder_t)); - delta->name = Q_strdup(name); - delta->conditionalencode = conditionalencode; - delta->next = g_encoders; - g_encoders = delta; -} - -void DELTA_ClearEncoders() -{ - delta_encoder_t *n, *p = g_encoders; - while (p) - { - n = p->next; - Mem_Free(p->name); - Mem_Free(p); - p = n; - } - - g_encoders = nullptr; -} - -encoder_t DELTA_LookupEncoder(char *name) -{ - delta_encoder_t *p = g_encoders; - while (p) - { - if (Q_stricmp(name, p->name) == 0) { - return p->conditionalencode; - } - - p = p->next; - } - - return nullptr; -} - -int DELTA_CountLinks(delta_link_t *plinks) -{ - delta_link_t *p = plinks; - - int c; - for (c = 0; p; c++) { - p = p->next; - } - - return c; -} - -void DELTA_ReverseLinks(delta_link_t **plinks) -{ - delta_link_t *n, *p = *plinks; - delta_link_t *newlist = nullptr; - - while (p) - { - n = p->next; - p->next = newlist; - newlist = p; - p = n; - } - - *plinks = newlist; -} - -void DELTA_ClearLinks(delta_link_t **plinks) -{ - delta_link_t *n, *p = *plinks; - while (p) - { - n = p->next; - Mem_Free(p); - p = n; - } - *plinks = 0; -} - -delta_t *DELTA_BuildFromLinks(delta_link_t **pplinks) -{ - delta_description_t *pdesc, *pcur; - delta_t *pdelta; - delta_link_t *p; - int count; - - pdelta = (delta_t *)Mem_ZeroMalloc(sizeof(delta_t)); - DELTA_ReverseLinks(pplinks); - count = DELTA_CountLinks(*pplinks); - - if (count > DELTA_MAX_FIELDS) { - return nullptr; - } - - pdesc = (delta_description_t *)Mem_ZeroMalloc(sizeof(delta_description_t) * count); - - for (p = *pplinks, pcur = pdesc; p; p = p->next, pcur++) - { - Q_memcpy(pcur, p->delta, sizeof(delta_description_t)); - Mem_Free(p->delta); - p->delta = nullptr; - } - - DELTA_ClearLinks(pplinks); - - pdelta->dynamic = 1; - pdelta->fieldCount = count; - pdelta->pdd = pdesc; - - return pdelta; -} - -int DELTA_FindOffset(int count, delta_definition_t *pdef, char *fieldname) -{ - for (int i = 0; i < count; i++) - { - if (Q_stricmp(fieldname, pdef[i].fieldName) == 0) { - return pdef[i].fieldOffset; - } - } - - return 0; -} - -bool DELTA_ParseType(delta_description_t *pdelta, char **pstream) -{ - // Read the stream till we hit the end - while (*pstream = COM_Parse(*pstream), com_token[0] != 0) - { - if (!Q_stricmp(com_token, ",")) - return true; // end of type description - - if (!Q_stricmp(com_token, "|")) - continue; // skip | token - - // Determine field type - if (!Q_stricmp(com_token, "DT_SIGNED")) - pdelta->fieldType |= DT_SIGNED; - else if (!Q_stricmp(com_token, "DT_BYTE")) - pdelta->fieldType |= DT_BYTE; - else if (!Q_stricmp(com_token, "DT_SHORT")) - pdelta->fieldType |= DT_SHORT; - else if (!Q_stricmp(com_token, "DT_FLOAT")) - pdelta->fieldType |= DT_FLOAT; - else if (!Q_stricmp(com_token, "DT_INTEGER")) - pdelta->fieldType |= DT_INTEGER; - else if (!Q_stricmp(com_token, "DT_ANGLE")) - pdelta->fieldType |= DT_ANGLE; - else if (!Q_stricmp(com_token, "DT_TIMEWINDOW_8")) - pdelta->fieldType |= DT_TIMEWINDOW_8; - else if (!Q_stricmp(com_token, "DT_TIMEWINDOW_BIG")) - pdelta->fieldType |= DT_TIMEWINDOW_BIG; - else if (!Q_stricmp(com_token, "DT_STRING")) - pdelta->fieldType |= DT_STRING; - else - { - return false; - } - } - - // We are hit the end of the stream - return false; -} - -bool DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link_t *pField, char **pstream) -{ - bool readpost = false; - if (Q_stricmp(com_token, "DEFINE_DELTA")) - { - if (Q_stricmp(com_token, "DEFINE_DELTA_POST") != 0) { - return false; - } - - readpost = true; - } - - *pstream = COM_Parse(*pstream); - if (Q_stricmp(com_token, "(")) - { - return false; - } - - *pstream = COM_Parse(*pstream); - if (com_token[0] == '\0') - { - return false; - } - - Q_strlcpy(pField->delta->fieldName, com_token); - - pField->delta->fieldOffset = DELTA_FindOffset(count, pdefinition, com_token); - - *pstream = COM_Parse(*pstream); - if (!DELTA_ParseType(pField->delta, pstream)) { - return false; - } - - *pstream = COM_Parse(*pstream); - pField->delta->fieldSize = 1; - pField->delta->significant_bits = Q_atoi(com_token); - *pstream = COM_Parse(*pstream); - *pstream = COM_Parse(*pstream); - pField->delta->premultiply = (float)Q_atof(com_token); - - if (readpost) - { - *pstream = COM_Parse(*pstream); - *pstream = COM_Parse(*pstream); - pField->delta->postmultiply = (float)Q_atof(com_token); - } - else - { - pField->delta->postmultiply = 1.0; - } - - *pstream = COM_Parse(*pstream); - if (Q_stricmp(com_token, ")")) - { - return false; - } - - *pstream = COM_Parse(*pstream); - if (Q_stricmp(com_token, ",")) { - COM_UngetToken(); - } - - return true; -} - -void DELTA_FreeDescription(delta_t **ppdesc) -{ - if (ppdesc && *ppdesc) - { - if ((*ppdesc)->dynamic) { - Mem_Free((*ppdesc)->pdd); - } - - Mem_Free(*ppdesc); - *ppdesc = nullptr; - } -} - -void DELTA_AddDefinition(char *name, delta_definition_t *pdef, int numelements) -{ - delta_definition_list_t *p = g_defs; - while (p) - { - if (Q_stricmp(name, p->ptypename) == 0) { - break; - } - - p = p->next; - } - - if (!p) - { - p = (delta_definition_list_t *)Mem_ZeroMalloc(sizeof(delta_definition_list_t)); - p->ptypename = Q_strdup(name); - p->next = g_defs; - g_defs = p; - } - - p->pdefinition = pdef; - p->numelements = numelements; -} - -void DELTA_ClearDefinitions() -{ - delta_definition_list_t *n, *p = g_defs; - while (p) - { - n = p->next; - Mem_Free(p->ptypename); - Mem_Free(p); - p = n; - } - - g_defs = nullptr; -} - -delta_definition_t *DELTA_FindDefinition(char *name, int *count) -{ - *count = 0; - - delta_definition_list_t *p = g_defs; - while (p) - { - if (!Q_stricmp(name, p->ptypename)) - { - *count = p->numelements; - return p->pdefinition; - } - - p = p->next; - } - - return nullptr; -} - -void DELTA_SkipDescription(char **pstream) -{ - *pstream = COM_Parse(*pstream); - do - { - *pstream = COM_Parse(*pstream); - if (com_token[0] == '\0') { - return; - } - } - while (Q_stricmp(com_token, "}")); -} - -bool DELTA_ParseOneField(char **ppstream, delta_link_t **pplist, int count, delta_definition_t *pdefinition) -{ - delta_link_t *newlink; - delta_link_t link; - - while (true) - { - if (!Q_stricmp(com_token, "}")) - { - COM_UngetToken(); - break; - } - - *ppstream = COM_Parse(*ppstream); - if (com_token[0] == '\0') { - break; - } - - Q_memset(&link, 0, sizeof(link)); - link.delta = (delta_description_t *)Mem_ZeroMalloc(sizeof(delta_description_t)); - if (!DELTA_ParseField(count, pdefinition, &link, ppstream)) { - return false; - } - - newlink = (delta_link_t *)Mem_ZeroMalloc(sizeof(delta_link_t)); - newlink->delta = link.delta; - newlink->next = *pplist; - *pplist = newlink; - } - - return true; -} - -bool DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) -{ - delta_link_t *links = nullptr; - delta_definition_t *pdefinition; - char encoder[32] = ""; - char source[32]; - int count = 0; - - if (!ppdesc) { - return false; - } - - *ppdesc = nullptr; - - if (!pstream) { - return false; - } - - while (true) - { - // Parse delta name - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - break; - } - - if (Q_stricmp(com_token, name)) - { - DELTA_SkipDescription(&pstream); - } - else - { - pdefinition = DELTA_FindDefinition(com_token, &count); - if (!pdefinition) { - return false; - } - - // Parse source of conditional encoder - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - return false; - } - - if (Q_stricmp(com_token, "none")) - { - Q_strlcpy(source, com_token); - - // Parse custom encoder function name - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - return false; - } - - Q_strlcpy(encoder, com_token); - } - - // Parse fields - while (true) - { - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - break; - } - - if (!Q_stricmp(com_token, "}")) { - break; - } - - if (Q_stricmp(com_token, "{")) { - return false; - } - - if (!DELTA_ParseOneField(&pstream, &links, count, pdefinition)) { - return false; - } - } - } - } - - *ppdesc = DELTA_BuildFromLinks(&links); - - if (encoder[0]) - { - Q_strlcpy((*ppdesc)->conditionalencodename, encoder1); - (*ppdesc)->conditionalencode = nullptr; - } - - return true; -} - -bool DELTA_Load(char *name, delta_t **ppdesc, char *pszFile) -{ - return false; -} - -void DELTA_RegisterDescription(char *name) -{ - delta_registry_t *p = (delta_registry_t *)Mem_ZeroMalloc(sizeof(delta_registry_t)); - p->next = g_deltaregistry; - g_deltaregistry = p; - p->name = Q_strdup(name); - p->pdesc = 0; -} - -void DELTA_ClearRegistrations() -{ - delta_registry_t *n, *p = g_deltaregistry; - while (p) - { - n = p->next; - Mem_Free(p->name); - - if (p->pdesc) { - DELTA_FreeDescription(&p->pdesc); - } - - Mem_Free(p); - p = n; - } - - g_deltaregistry = nullptr; -} - -delta_t **DELTA_LookupRegistration(char *name) -{ - delta_registry_t *delta = g_deltaregistry; - while (delta) - { - if (Q_stricmp(delta->name, name) == 0) { - return &delta->pdesc; - } - - delta = delta->next; - } - - return nullptr; -} - -void DELTA_ClearStats(delta_t *p) -{ - if (!p) { - return; - } - - for (int i = 0; i < p->fieldCount; i++) - { - p->pdd[i].stats.sendcount = 0; - p->pdd[i].stats.receivedcount = 0; - } -} - -void DELTA_Init() -{ - g_defs = nullptr; - g_encoders = nullptr; - g_deltaregistry = nullptr; - - DELTA_AddDefinition("clientdata_t", g_ClientDataDefinition, ARRAYSIZE(g_ClientDataDefinition)); - DELTA_AddDefinition("weapon_data_t", g_WeaponDataDefinition, ARRAYSIZE(g_WeaponDataDefinition)); - DELTA_AddDefinition("usercmd_t", g_UsercmdDataDefinition, ARRAYSIZE(g_UsercmdDataDefinition)); - DELTA_AddDefinition("entity_state_t", g_EntityDataDefinition, ARRAYSIZE(g_EntityDataDefinition)); - DELTA_AddDefinition("entity_state_player_t", g_EntityDataDefinition, ARRAYSIZE(g_EntityDataDefinition)); - DELTA_AddDefinition("custom_entity_state_t", g_EntityDataDefinition, ARRAYSIZE(g_EntityDataDefinition)); - DELTA_AddDefinition("event_t", g_EventDataDefinition, ARRAYSIZE(g_EventDataDefinition)); - - DELTA_RegisterDescription("clientdata_t"); - DELTA_RegisterDescription("entity_state_t"); - DELTA_RegisterDescription("entity_state_player_t"); - DELTA_RegisterDescription("custom_entity_state_t"); - DELTA_RegisterDescription("usercmd_t"); - DELTA_RegisterDescription("weapon_data_t"); - DELTA_RegisterDescription("event_t"); - - g_large_Time_Buffers = false; -} - -void DELTA_UpdateDescriptions() -{ - g_pplayerdelta = *DELTA_LookupRegistration("entity_state_player_t"); - g_pentitydelta = *DELTA_LookupRegistration("entity_state_t"); - g_pcustomentitydelta = *DELTA_LookupRegistration("custom_entity_state_t"); - g_pclientdelta = *DELTA_LookupRegistration("clientdata_t"); - g_pweapondelta = *DELTA_LookupRegistration("weapon_data_t"); - g_peventdelta = *DELTA_LookupRegistration("event_t"); -} - -void DELTA_Shutdown() -{ - DELTA_ClearEncoders(); - DELTA_ClearDefinitions(); - DELTA_ClearRegistrations(); -} - -void DELTA_SetTime(double time) -{ - g_delta_Time = time; -} - -void DELTA_SetLargeTimeBufferSize(bool bigBuffers) -{ - g_large_Time_Buffers = bigBuffers; -} - -bool World::IsDeltaEncoder() const -{ - if (g_pcustomentitydelta - && g_pentitydelta - && g_pplayerdelta) { - return true; - } - - return false; -} - -delta_t *World::GetDeltaEncoder(int index, bool custom) -{ - if (custom) { - return (delta_t *)g_pcustomentitydelta; - } - else if (IsPlayerIndex(index)) { - return (delta_t *)g_pplayerdelta; - } - - return (delta_t *)g_pentitydelta; -} - -delta_t *World::GetEventDelta() const { - return g_peventdelta; -} - -delta_t *World::GetClientDelta() const { - return g_pclientdelta; -} - -delta_t *World::GetEntityDelta() const { - return g_pentitydelta; -} - -delta_t *World::GetWeaponDelta() const { - return g_pweapondelta; -} - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/DeltaEx.h b/rehlds/hookers/HLTV/Core/DeltaEx.h deleted file mode 100644 index 06db8ed..0000000 --- a/rehlds/hookers/HLTV/Core/DeltaEx.h +++ /dev/null @@ -1,163 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#pragma once - -#ifdef HOOK_HLTV - -#include "event_args.h" - -#define g_defs (*pg_defs) -#define g_encoders (*pg_encoders) -#define g_deltaregistry (*pg_deltaregistry) - -#define g_pplayerdelta (*pg_pplayerdelta) -#define g_pentitydelta (*pg_pentitydelta) -#define g_pcustomentitydelta (*pg_pcustomentitydelta) -#define g_pclientdelta (*pg_pclientdelta) -#define g_pweapondelta (*pg_pweapondelta) -#define g_peventdelta (*pg_peventdelta) - -#define g_delta_Time (*pg_delta_Time) -#define g_large_Time_Buffers (*pg_large_Time_Buffers) - -typedef struct delta_link_s -{ - struct delta_link_s *next; - delta_description_t *delta; -} delta_link_t; - -typedef struct delta_definition_s -{ - char *fieldName; - size_t fieldOffset; -} delta_definition_t; - -typedef struct delta_definition_list_s -{ - struct delta_definition_list_s *next; - char *ptypename; - int numelements; - delta_definition_t *pdefinition; -} delta_definition_list_t; - -typedef struct delta_registry_s -{ - struct delta_registry_s *next; - char *name; - delta_t *pdesc; -} delta_registry_t; - -namespace Delta { - #define m_MetaDelta g_MetaDelta - extern delta_t g_MetaDelta[]; -}; - -#define m_EntityDelta g_pentitydelta -#define m_PlayerDelta g_pplayerdelta -#define m_CustomentityDelta g_pcustomentitydelta - -#define m_ClientDelta g_pclientdelta -#define m_WeaponDelta g_pweapondelta -#define m_EventDelta g_peventdelta - -extern delta_definition_list_t *g_defs; -extern delta_encoder_t *g_encoders; -extern delta_registry_t *g_deltaregistry; - -extern delta_t *g_pentitydelta; -extern delta_t *g_pplayerdelta; -extern delta_t *g_pcustomentitydelta; -extern delta_t *g_pclientdelta; -extern delta_t *g_pweapondelta; -extern delta_t *g_peventdelta; - -extern double g_delta_Time; -extern bool g_large_Time_Buffers; - -delta_description_t *DELTA_FindField(delta_t *pFields, const char *pszField); -int DELTA_FindFieldIndex(delta_t *pFields, const char *fieldname); -void DELTA_SetField(delta_t *pFields, const char *fieldname); -void DELTA_UnsetField(delta_t *pFields, const char *fieldname); -void DELTA_SetFieldByIndex(delta_t *pFields, int fieldNumber); -void DELTA_UnsetFieldByIndex(delta_t *pFields, int fieldNumber); -void DELTA_ClearFlags(delta_t *pFields); -int DELTA_CountSendFields(delta_t *pFields); -void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount); -void DELTA_WriteMarkedFields(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields); -int DELTA_CheckDelta(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_WriteHeader(BitBuffer *stream, deltacallback_t *header); -qboolean DELTA_WriteDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, bool force, delta_t *pFields, deltacallback_t *header = nullptr); -int DELTA_ParseDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields); -int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_AddEncoder(char *name, encoder_t conditionalencode); -void DELTA_ClearEncoders(); -encoder_t DELTA_LookupEncoder(char *name); -int DELTA_CountLinks(delta_link_t *plinks); -void DELTA_ReverseLinks(delta_link_t **plinks); -void DELTA_ClearLinks(delta_link_t **plinks); -delta_t *DELTA_BuildFromLinks(delta_link_t **pplinks); -int DELTA_FindOffset(int count, delta_definition_t *pdef, char *fieldname); -bool DELTA_ParseType(delta_description_t *pdelta, char **pstream); -bool DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link_t *pField, char **pstream); -void DELTA_FreeDescription(delta_t **ppdesc); -void DELTA_AddDefinition(char *name, delta_definition_t *pdef, int numelements); -void DELTA_ClearDefinitions(); -delta_definition_t *DELTA_FindDefinition(char *name, int *count); -void DELTA_SkipDescription(char **pstream); -bool DELTA_ParseOneField(char **ppstream, delta_link_t **pplist, int count, delta_definition_t *pdefinition); -bool DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream); -bool DELTA_Load(char *name, delta_t **ppdesc, char *pszFile); -void DELTA_RegisterDescription(char *name); -void DELTA_ClearRegistrations(); -delta_t **DELTA_LookupRegistration(char *name); -void DELTA_ClearStats(delta_t *p); -void DELTA_Init(); -void DELTA_UpdateDescriptions(); -void DELTA_Shutdown(); -void DELTA_SetTime(double time); -void DELTA_SetLargeTimeBufferSize(bool bigBuffers); - -class DeltaWrapper { -public: - void Init(IBaseSystem *system) { DELTA_Init(); } - void Shutdown() { DELTA_Shutdown(); } - void UpdateDescriptions() { DELTA_UpdateDescriptions(); } - void WriteHeader(BitBuffer *stream, deltacallback_t *header) { DELTA_WriteHeader(stream, header); } - bool WriteDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, bool force, delta_t *pFields, deltacallback_t *header = nullptr) { return DELTA_WriteDelta(stream, from, to, force, pFields, header) ? true : false; } - int ParseDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields) { return DELTA_ParseDelta(stream, from, to, pFields); } - void SetTime(double time) { DELTA_SetTime(time); } - void SetLargeTimeBufferSize(bool bigBuffers) { DELTA_SetLargeTimeBufferSize(bigBuffers); } - int TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { return DELTA_TestDelta(from, to, pFields); } - delta_t **LookupRegistration(char *name) { return DELTA_LookupRegistration(name); } - void FreeDescription(delta_t **ppdesc) { DELTA_FreeDescription(ppdesc); } - delta_registry_t *GetRegistry() const { return g_deltaregistry; } -}; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/hooklist.cpp b/rehlds/hookers/HLTV/Core/hooklist.cpp deleted file mode 100644 index d306a03..0000000 --- a/rehlds/hookers/HLTV/Core/hooklist.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#ifdef HOOK_HLTV - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define World_region -//#define Server_region -//#define Network_region -//#define NetSocket_region -//#define BSPModel_region -//#define Delta_region -//#define ObjectDictionary_region -//#define ObjectList_region -//#define BitBuffer_region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - - HOOK_DEF(0x01D21F5F, malloc_wrapper), - HOOK_DEF(0x01D21E4E, free_wrapper), - HOOK_DEF(0x01D30145, strdup_wrapper), - HOOK_DEF(0x01D21F71, __nh_malloc_wrapper), - - HOOK_DEF(0x01D043C0, Mem_ZeroMalloc), - //HOOK_DEF(0x0, Mem_Malloc), - //HOOK_DEF(0x0, Mem_Realloc), - //HOOK_DEF(0x0, Mem_Calloc), - //HOOK_DEF(0x0, Mem_Strdup), - //HOOK_DEF(0x0, Mem_Free), - - //HOOK_DEF(0x0, realloc_wrapper), - //HOOK_DEF(0x0, calloc_wrapper), - -#endif // Mem_region - -#ifndef World_region - - // World virtual functions - HOOK_VIRTUAL_DEF(0x01D14DA0, World::Init), - HOOK_VIRTUAL_DEF(0x01D15470, World::RunFrame), - HOOK_VIRTUAL_DEF(0x01D154F0, World::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D15490, World::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D15500, World::RegisterListener), - HOOK_VIRTUAL_DEF(0x01D15530, World::RemoveListener), - HOOK_VIRTUAL_DEF(0x01D15570, World::GetSystem), - HOOK_VIRTUAL_DEF(0x01D15580, World::GetSerial), - HOOK_VIRTUAL_DEF(0x01D17380, World::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D17370, World::GetType), - HOOK_VIRTUAL_DEF(0x01D15590, World::GetName), - HOOK_VIRTUAL_DEF(0x01D155C0, World::GetState), - HOOK_VIRTUAL_DEF(0x01D15620, World::GetVersion), - HOOK_VIRTUAL_DEF(0x01D14F70, World::ShutDown), - HOOK_VIRTUAL_DEF(0x01D175D0, World::GetTime), - HOOK_VIRTUAL_DEF(0x01D186A0, World::GetGameServerAddress), - HOOK_VIRTUAL_DEF(0x01D186B0, World::GetLevelName), - HOOK_VIRTUAL_DEF(0x01D186F0, World::GetGameDir), - HOOK_VIRTUAL_DEF(0x01D16470, World::GetFrameByTime), - HOOK_VIRTUAL_DEF(0x01D16420, World::GetFrameBySeqNr), - HOOK_VIRTUAL_DEF(0x01D16450, World::GetLastFrame), - HOOK_VIRTUAL_DEF(0x01D16460, World::GetFirstFrame), - HOOK_VIRTUAL_DEF(0x01D18700, World::GetServerCount), - HOOK_VIRTUAL_DEF(0x01D18670, World::GetSlotNumber), - HOOK_VIRTUAL_DEF(0x01D18710, World::GetMaxClients), - HOOK_VIRTUAL_DEF(0x01D15840, World::GetNumPlayers), - HOOK_VIRTUAL_DEF(0x01D186C0, World::GetWorldModel), - HOOK_VIRTUAL_DEF(0x01D18350, World::GetServerInfoString), - HOOK_VIRTUAL_DEF(0x01D18360, World::GetPlayerInfoString), - HOOK_VIRTUAL_DEF(0x01D15450, World::GetUserMsg), - HOOK_VIRTUAL_DEF(0x01D15A60, World::GetHostName), - HOOK_VIRTUAL_DEF(0x01D189A0, World::GetServerInfo), - HOOK_VIRTUAL_DEF(0x01D15510, World::IsPlayerIndex), - HOOK_VIRTUAL_DEF(0x01D18660, World::IsVoiceEnabled), - HOOK_VIRTUAL_DEF(0x01D15870, World::IsActive), - HOOK_VIRTUAL_DEF(0x01D18190, World::IsPaused), - HOOK_VIRTUAL_DEF(0x01D181A0, World::IsComplete), - HOOK_VIRTUAL_DEF(0x01D18D20, World::IsHLTV), - HOOK_VIRTUAL_DEF(0x01D15010, World::Reset), - HOOK_VIRTUAL_DEF(0x01D158A0, World::SetServerInfoString), - HOOK_VIRTUAL_DEF(0x01D18C30, World::UpdateServerInfo), - HOOK_VIRTUAL_DEF(0x01D18150, World::SetPaused), - HOOK_VIRTUAL_DEF(0x01D15630, World::SetTime), - HOOK_VIRTUAL_DEF(0x01D181B0, World::SetBufferSize), - HOOK_VIRTUAL_DEF(0x01D18690, World::SetVoiceEnabled), - HOOK_VIRTUAL_DEF(0x01D18130, World::SetMoveVars), - HOOK_VIRTUAL_DEF(0x01D18320, World::SetCDInfo), - HOOK_VIRTUAL_DEF(0x01D18D10, World::SetHLTV), - HOOK_VIRTUAL_DEF(0x01D183B0, World::SetExtraInfo), - HOOK_VIRTUAL_DEF(0x01D18680, World::SetViewEntity), - HOOK_VIRTUAL_DEF(0x01D18340, World::SetGameServerAddress), - HOOK_VIRTUAL_DEF(0x01D15680, World::SetHostName), - HOOK_VIRTUAL_DEF(0x01D15760, World::NewGame), - HOOK_VIRTUAL_DEF(0x01D17490, World::FinishGame), - HOOK_VIRTUAL_DEF(0x01D18720, World::SaveAsDemo), - HOOK_VIRTUAL_DEF(0x01D174C0, World::StopGame), - HOOK_VIRTUAL_DEF(0x01D17560, World::FindUserMsgByName), - HOOK_VIRTUAL_DEF(0x01D181F0, World::ParseDeltaDescription), - HOOK_VIRTUAL_DEF(0x01D18420, World::ParseBaseline), - HOOK_VIRTUAL_DEF(0x01D183F0, World::ParseEvent), - HOOK_VIRTUAL_DEF(0x01D16990, World::ParseClientData), - HOOK_VIRTUAL_DEF(0x01D18070, World::SetServerInfo, void(int, CRC32_t, unsigned char *, int, int, int, char *, char *, char *)), - HOOK_VIRTUAL_DEF(0x01D17470, World::SetServerInfo, void(serverinfo_t *)), - HOOK_VIRTUAL_DEF(0x01D16740, World::GetUncompressedFrame, bool(unsigned int, frame_t *)), - HOOK_VIRTUAL_DEF(0x01D17A60, World::UncompressEntitiesFromStream, bool(frame_t *, BitBuffer *)), - HOOK_VIRTUAL_DEF(0x01D175E0, World::UncompressEntitiesFromStream, bool(frame_t *, BitBuffer *, unsigned int)), - HOOK_VIRTUAL_DEF(0x01D167F0, World::GetClientData, bool(frame_t *, clientdata_t *)), - HOOK_VIRTUAL_DEF(0x01D167B0, World::GetClientData, bool(unsigned int, clientdata_t *)), - HOOK_VIRTUAL_DEF(0x01D160A0, World::AddFrame), - HOOK_VIRTUAL_DEF(0x01D153B0, World::AddResource), - HOOK_VIRTUAL_DEF(0x01D156E0, World::AddLightStyle), - HOOK_VIRTUAL_DEF(0x01D17520, World::AddSignonData), - HOOK_VIRTUAL_DEF(0x01D15130, World::AddUserMessage), - HOOK_VIRTUAL_DEF(0x01D154A0, World::AddBaselineEntity), - HOOK_VIRTUAL_DEF(0x01D155D0, World::AddInstancedBaselineEntity), - HOOK_VIRTUAL_DEF(0x01D151F0, World::UpdatePlayer), - HOOK_VIRTUAL_DEF(0x01D164C0, World::WriteFrame), - HOOK_VIRTUAL_DEF(0x01D17CB0, World::WriteNewData), - HOOK_VIRTUAL_DEF(0x01D16030, World::WriteClientUpdate), - HOOK_VIRTUAL_DEF(0x01D15D20, World::WriteMovevars), - HOOK_VIRTUAL_DEF(0x01D174F0, World::WriteSigonData), - HOOK_VIRTUAL_DEF(0x01D15A20, World::WriteLightStyles), - HOOK_VIRTUAL_DEF(0x01D17D80, World::RemoveFrames), - HOOK_VIRTUAL_DEF(0x01D17ED0, World::DuplicateFrames), - HOOK_VIRTUAL_DEF(0x01D17EF0, World::MoveFrames), - HOOK_VIRTUAL_DEF(0x01D17F10, World::RevertFrames), - - // World non-virtual functions - HOOK_DEF(0x01D16BA0, World::CompressFrame), - HOOK_DEF(0x01D16A80, World::ParseDeltaHeader), - HOOK_DEF(0x01D150D0, World::SetMaxClients), - HOOK_DEF(0x01D17D30, World::GetBufferedGameTime), - HOOK_DEF(0x01D15800, World::ConnectionComplete), - HOOK_DEF(0x01D15F00, World::WriteResources), - HOOK_DEF(0x01D15C60, World::WriteDeltaDescriptions), - HOOK_DEF(0x01D15EB0, World::WriteRegisteredUserMessages), - HOOK_DEF(0x01D158B0, World::WriteBaseline), - HOOK_DEF(0x01D15A80, World::WriteServerinfo), - HOOK_DEF(0x01D170E0, World::WritePacketEntities), - HOOK_DEF(0x01D189B0, World::WriteDeltaEntities), - HOOK_DEF(0x01D15790, World::SetState), - HOOK_DEF(0x01D15100, World::ClearUserMessages), - HOOK_DEF(0x01D17430, World::ClearServerInfo), - HOOK_DEF(0x01D15410, World::ClearResources), - HOOK_DEF(0x01D155A0, World::ClearInstancedBaseline), - HOOK_DEF(0x01D15540, World::ClearBaseline), - HOOK_DEF(0x01D156C0, World::ClearLightStyles), - HOOK_DEF(0x01D15880, World::ClearPlayers), - HOOK_DEF(0x01D17F30, World::ClearFrames), - HOOK_DEF(0x01D16E80, World::ClearEntityCache), - HOOK_DEF(0x01D16F30, World::GetFrameFromCache), - HOOK_DEF(0x01D17010, World::GetDeltaFromCache), - HOOK_DEF(0x01D17F90, World::CheckFrameBufferSize), - HOOK_DEF(0x01D18000, World::ReorderFrameTimes), - HOOK_DEF(0x01D16D20, World::FindBestBaseline), - HOOK_DEF(0x01D18A60, World::RearrangeFrame), - HOOK_DEF(0x01D16880, World::GetUncompressedFrame, bool(frame_t *deltaFrame, frame_t *frame)), - - //HOOK_DEF(0x01D17D00, World::SetName), // NOXREF - //HOOK_DEF(0x0, World::SetDirector), // NOXREF - //HOOK_DEF(0x0, World::SetTimeScale), // NOXREF - //HOOK_DEF(0x0, World::SetGameGroupAddress), // NOXREF - //HOOK_DEF(0x0, World::GetDirector), // NOXREF - //HOOK_DEF(0x0, World::WriteCustomDecals), // NOXREF - -#endif // World_region - -#ifndef Server_region - - // IServer virtual functions - HOOK_VIRTUAL_DEF(0x01D106B0, Server::Init), - HOOK_VIRTUAL_DEF(0x01D10C10, Server::RunFrame), - HOOK_VIRTUAL_DEF(0x01D10A90, Server::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D13870, Server::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D137F0, Server::GetType), - HOOK_VIRTUAL_DEF(0x01D10B80, Server::ShutDown), - HOOK_VIRTUAL_DEF(0x01D14220, Server::Connect), - HOOK_VIRTUAL_DEF(0x01D142F0, Server::LoadDemo), - HOOK_VIRTUAL_DEF(0x01D13E40, Server::Reconnect), - HOOK_VIRTUAL_DEF(0x01D13EA0, Server::Disconnect), - HOOK_VIRTUAL_DEF(0x01D14620, Server::Retry), - HOOK_VIRTUAL_DEF(0x01D14680, Server::StopRetry), - HOOK_VIRTUAL_DEF(0x01D14430, Server::SendStringCommand), - HOOK_VIRTUAL_DEF(0x01D14470, Server::SendHLTVCommand), - HOOK_VIRTUAL_DEF(0x01D140C0, Server::IsConnected), - HOOK_VIRTUAL_DEF(0x01D140D0, Server::IsDemoFile), - HOOK_VIRTUAL_DEF(0x01D140E0, Server::IsGameServer), - HOOK_VIRTUAL_DEF(0x01D140F0, Server::IsRelayProxy), - HOOK_VIRTUAL_DEF(0x01D11260, Server::IsVoiceBlocking), - HOOK_VIRTUAL_DEF(0x01D13A70, Server::SetProxy), - HOOK_VIRTUAL_DEF(0x01D13A90, Server::SetDirector), - HOOK_VIRTUAL_DEF(0x01D137A0, Server::SetPlayerName), - HOOK_VIRTUAL_DEF(0x01D146B0, Server::SetDelayReconnect), - HOOK_VIRTUAL_DEF(0x01D14690, Server::SetAutoRetry), - HOOK_VIRTUAL_DEF(0x01D11270, Server::SetVoiceBlocking), - HOOK_VIRTUAL_DEF(0x01D11280, Server::SetRate), - HOOK_VIRTUAL_DEF(0x01D112D0, Server::SetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D14390, Server::SetUserInfo), - HOOK_VIRTUAL_DEF(0x01D13770, Server::SetProtocol), - HOOK_VIRTUAL_DEF(0x01D109C0, Server::SetGameDirectory), - HOOK_VIRTUAL_DEF(0x01D13730, Server::GetRate), - HOOK_VIRTUAL_DEF(0x01D13740, Server::GetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D13720, Server::GetServerInfoString), - HOOK_VIRTUAL_DEF(0x01D137D0, Server::GetPlayerName), - - // Server virtual functions - HOOK_VIRTUAL_DEF(0x01D145A0, Server::GetTime), - HOOK_VIRTUAL_DEF(0x01D13800, Server::GetWorld), - HOOK_VIRTUAL_DEF(0x01D13830, Server::GetDemoFileName), - HOOK_VIRTUAL_DEF(0x01D13810, Server::GetAddress), - HOOK_VIRTUAL_DEF(0x01D13750, Server::GetAutoRetry), - HOOK_VIRTUAL_DEF(0x01D13850, Server::GetHostName), - HOOK_VIRTUAL_DEF(0x01D13860, Server::GetPacketLoss), - HOOK_VIRTUAL_DEF(0x01D13760, Server::GetProtocol), - - // Server non-virtual functions - HOOK_DEF(0x01D14190, Server::CheckAutoRetry), - HOOK_DEF(0x01D145B0, Server::CheckConnection), - HOOK_DEF(0x01D141F0, Server::ScheduleAutoRetry), - HOOK_DEF(0x01D11750, Server::AcceptConnection), - HOOK_DEF(0x01D116C0, Server::AcceptBadPassword), - HOOK_DEF(0x01D11700, Server::AcceptRejection), - HOOK_DEF(0x01D117D0, Server::AcceptRedirect), - HOOK_DEF(0x01D11460, Server::SendConnectPacket), - HOOK_DEF(0x01D132F0, Server::SendServerCommands), - HOOK_DEF(0x01D11320, Server::SetState), - HOOK_DEF(0x01D10AB0, Server::Challenge), - HOOK_DEF(0x01D146C0, Server::Reset), - HOOK_DEF(0x01D11170, Server::AcceptChallenge), - HOOK_DEF(0x01D14050, Server::SendUserVar), - HOOK_DEF(0x01D10F70, Server::ProcessMessage), - HOOK_DEF(0x01D147B0, Server::ProcessEntityUpdate), - HOOK_DEF(0x01D10DA0, Server::ProcessConnectionlessMessage), - HOOK_DEF(0x01D12EF0, Server::ClearFrame), - HOOK_DEF(0x01D139E0, Server::ParseHLTV), - HOOK_DEF(0x01D13AA0, Server::ParseDirector), - HOOK_DEF(0x01D12CA0, Server::ParseFileTransferFailed), - HOOK_DEF(0x01D13B80, Server::ParseInfo), - HOOK_DEF(0x01D136E0, Server::ParseParticle), - HOOK_DEF(0x01D136B0, Server::ParseRoomType), - HOOK_DEF(0x01D13610, Server::ParseSpawnStaticSound), - HOOK_DEF(0x01D13580, Server::ParseEventReliable), - HOOK_DEF(0x01D13510, Server::ParsePings), - HOOK_DEF(0x01D12CE0, Server::ParseSignonNum), - HOOK_DEF(0x01D12FB0, Server::ParseUserMessage), - HOOK_DEF(0x01D134E0, Server::ParseStopSound), - HOOK_DEF(0x01D13410, Server::ParseEvent), - HOOK_DEF(0x01D13340, Server::ParseSound), - HOOK_DEF(0x01D13240, Server::ParseDeltaPacketEntities), - HOOK_DEF(0x01D131A0, Server::ParsePacketEntities), - HOOK_DEF(0x01D12DF0, Server::ParseCustomization), - HOOK_DEF(0x01D12010, Server::ParseCrosshairAngle), - HOOK_DEF(0x01D12050, Server::ParseSoundFade), - HOOK_DEF(0x01D12C10, Server::ParseDisconnect), - HOOK_DEF(0x01D12C00, Server::ParseChoke), - HOOK_DEF(0x01D12AC0, Server::ParseSetAngle), - HOOK_DEF(0x01D12B60, Server::ParseAddAngle), - HOOK_DEF(0x01D12A40, Server::ParseLightStyle), - HOOK_DEF(0x01D12A20, Server::ParseTime), - HOOK_DEF(0x01D129F0, Server::ParseVersion), - HOOK_DEF(0x01D129D0, Server::ParseBaseline), - HOOK_DEF(0x01D12860, Server::ParseTempEntity), - HOOK_DEF(0x01D12650, Server::ParseResourceList), - HOOK_DEF(0x01D12590, Server::ParseUpdateUserInfo), - HOOK_DEF(0x01D12150, Server::ParseStuffText), - HOOK_DEF(0x01D120C0, Server::ParseNewUserMsg), - HOOK_DEF(0x01D11F80, Server::ParseResourceRequest), - HOOK_DEF(0x01D11F00, Server::ParseSetView), - HOOK_DEF(0x01D11E90, Server::ParseCDTrack), - HOOK_DEF(0x01D11EC0, Server::ParseRestore), - HOOK_DEF(0x01D11CC0, Server::ParseMoveVars), - HOOK_DEF(0x01D11C60, Server::ParseDeltaDescription), - HOOK_DEF(0x01D119F0, Server::ParseServerinfo), - HOOK_DEF(0x01D119D0, Server::ParseBad), - HOOK_DEF(0x01D119C0, Server::ParseNop), - HOOK_DEF(0x01D11850, Server::ParsePrint), - HOOK_DEF(0x01D11880, Server::ParseVoiceInit), - HOOK_DEF(0x01D11940, Server::ParseVoiceData), - HOOK_DEF(0x01D144F0, Server::ParseTimeScale), - HOOK_DEF(0x01D144C0, Server::ParseSendExtraInfo), - HOOK_DEF(0x01D14100, Server::ParseCenterPrint), - HOOK_DEF(0x01D143D0, Server::ParseSetPause), - HOOK_DEF(0x01D14020, Server::ParseCutscene), - HOOK_DEF(0x01D12140, Server::ParseWeaponAnim), - HOOK_DEF(0x01D11C80, Server::ParseDecalName), - HOOK_DEF(0x01D13FF0, Server::ParseFinale), - HOOK_DEF(0x01D13FC0, Server::ParseIntermission), - HOOK_DEF(0x01D13F50, Server::ParseClientData), - HOOK_DEF(0x01D14570, Server::ParseResourceLocation), - HOOK_DEF(0x01D14820, Server::ParseSendCvarValue), - HOOK_DEF(0x01D14830, Server::ParseSendCvarValue2), - //HOOK_DEF(0x01D14740, Server::GetCmdName), // NOXREF - -#endif // Server_region - -#ifndef Network_region - - // Network virtual functions - HOOK_VIRTUAL_DEF(0x01D0E040, Network::Init), - HOOK_VIRTUAL_DEF(0x01D0E480, Network::RunFrame), - HOOK_VIRTUAL_DEF(0x01D0E5B0, Network::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D0E210, Network::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D0E5C0, Network::RegisterListener), - HOOK_VIRTUAL_DEF(0x01D0E670, Network::RemoveListener), - HOOK_VIRTUAL_DEF(0x01D0E680, Network::GetSystem), - HOOK_VIRTUAL_DEF(0x01D0E690, Network::GetSerial), - HOOK_VIRTUAL_DEF(0x01D0E4D0, Network::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D0E3B0, Network::GetType), - HOOK_VIRTUAL_DEF(0x01D0E6B0, Network::GetName), - HOOK_VIRTUAL_DEF(0x01D0E810, Network::GetState), - HOOK_VIRTUAL_DEF(0x01D0E820, Network::GetVersion), - HOOK_VIRTUAL_DEF(0x01D0E250, Network::ShutDown), - HOOK_VIRTUAL_DEF(0x01D0E2E0, Network::CreateSocket), - HOOK_VIRTUAL_DEF(0x01D0E3A0, Network::RemoveSocket), - HOOK_VIRTUAL_DEF(0x01D0E4C0, Network::GetLocalAddress), - HOOK_VIRTUAL_DEF(0x01D0E6C0, Network::ResolveAddress), - HOOK_VIRTUAL_DEF(0x01D0E530, Network::GetFlowStats), - HOOK_VIRTUAL_DEF(0x01D0E6A0, Network::GetLastErrorCode), - HOOK_VIRTUAL_DEF(0x01D0E830, Network::GetErrorText), - HOOK_VIRTUAL_DEF(0x01D0E2E0, Network::CreateSocket), - HOOK_VIRTUAL_DEF(0x01D0E3A0, Network::RemoveSocket), - HOOK_VIRTUAL_DEF(0x01D0E4C0, Network::GetLocalAddress), - HOOK_VIRTUAL_DEF(0x01D0E6C0, Network::ResolveAddress), - HOOK_VIRTUAL_DEF(0x01D0E530, Network::GetFlowStats), - HOOK_VIRTUAL_DEF(0x01D0E6A0, Network::GetLastErrorCode), - HOOK_VIRTUAL_DEF(0x01D0E830, Network::GetErrorText), - - // Network non-virtual functions - HOOK_DEF(0x01D0EAE0, Network::UpdateStats), - HOOK_DEF(0x01D0E440, Network::GetSocket), - HOOK_DEF(0x01D0E400, Network::SendData), - HOOK_DEF(0x01D0E3C0, Network::ReceiveData), - -#endif // Network_region - -#ifndef NetSocket_region - - // Network virtual functions - HOOK_VIRTUAL_DEF(0x01D0D940, NetSocket::ReceivePacket), - HOOK_VIRTUAL_DEF(0x01D0D950, NetSocket::FreePacket), - HOOK_VIRTUAL_DEF(0x01D0D980, NetSocket::AddPacket), - HOOK_VIRTUAL_DEF(0x01D0D000, NetSocket::AddChannel), - HOOK_VIRTUAL_DEF(0x01D0D010, NetSocket::RemoveChannel), - HOOK_VIRTUAL_DEF(0x01D0D310, NetSocket::GetNetwork), - HOOK_VIRTUAL_DEF(0x01D0D8D0, NetSocket::OutOfBandPrintf), - HOOK_VIRTUAL_DEF(0x01D0DA30, NetSocket::Flush), - HOOK_VIRTUAL_DEF(0x01D0D8A0, NetSocket::GetFlowStats), - HOOK_VIRTUAL_DEF(0x01D0D610, NetSocket::LeaveGroup), - HOOK_VIRTUAL_DEF(0x01D0D570, NetSocket::JoinGroup), - HOOK_VIRTUAL_DEF(0x01D0D500, NetSocket::Close), - HOOK_VIRTUAL_DEF(0x01D0DCB0, NetSocket::GetPort), - - HOOK_VIRTUAL_DEF(0x01D0D160, NetSocket::SendPacket, bool(NetPacket *)), - HOOK_VIRTUAL_DEF(0x01D0D190, NetSocket::SendPacket, bool(NetAddress *, const void *, int)), - - // Network non-virtual functions - HOOK_DEF(0x01D0DAC0, NetSocket::Create), - HOOK_DEF(0x01D0DCC0, NetSocket::UpdateStats), - HOOK_DEF(0x01D0D6B0, NetSocket::DrainChannels), - HOOK_DEF(0x01D0D020, NetSocket::DispatchIncoming), - HOOK_DEF(0x01D0D330, NetSocket::ReceivePacketIntern), - HOOK_DEF(0x01D0DD50, NetSocket::SendLong), - HOOK_DEF(0x01D0DE70, NetSocket::SendShort), - HOOK_DEF(0x01D0D730, NetSocket::GetLong), - -#endif // NetSocket_region - -#ifndef Delta_region - - HOOK_DEF(0x01D06740, DELTA_Init), - HOOK_DEF(0x01D06810, DELTA_UpdateDescriptions), - HOOK_DEF(0x01D06880, DELTA_Shutdown), - HOOK_DEF(0x01D06890, DELTA_SetTime), - HOOK_DEF(0x01D068B0, DELTA_SetLargeTimeBufferSize), - HOOK_DEF(0x01D04AF0, DELTA_FindField), - HOOK_DEF(0x01D04C10, DELTA_ClearFlags), - HOOK_DEF(0x01D04C40, DELTA_CountSendFields), - HOOK_DEF(0x01D04C80, DELTA_MarkSendFields), - HOOK_DEF(0x01D04E80, DELTA_SetSendFlagBits), - HOOK_DEF(0x01D04EF0, DELTA_WriteMarkedFields), - HOOK_DEF(0x01D052A0, DELTA_WriteHeader), - HOOK_DEF(0x01D053C0, DELTA_WriteDelta), - HOOK_DEF(0x01D05470, DELTA_ParseDelta), - HOOK_DEF(0x01D05A30, DELTA_TestDelta), - HOOK_DEF(0x01D05CA0, DELTA_AddEncoder), - HOOK_DEF(0x01D05CE0, DELTA_ClearEncoders), - HOOK_DEF(0x01D05D60, DELTA_CountLinks), - HOOK_DEF(0x01D05D80, DELTA_ReverseLinks), - HOOK_DEF(0x01D05DA0, DELTA_ClearLinks), - HOOK_DEF(0x01D05DD0, DELTA_BuildFromLinks), - HOOK_DEF(0x01D05E80, DELTA_FindOffset), - HOOK_DEF(0x01D05EC0, DELTA_ParseType), - HOOK_DEF(0x01D06050, DELTA_ParseField), - HOOK_DEF(0x01D06200, DELTA_FreeDescription), - HOOK_DEF(0x01D06240, DELTA_AddDefinition), - HOOK_DEF(0x01D062A0, DELTA_ClearDefinitions), - HOOK_DEF(0x01D062E0, DELTA_FindDefinition), - HOOK_DEF(0x01D06330, DELTA_SkipDescription), - HOOK_DEF(0x01D06380, DELTA_ParseOneField), - HOOK_DEF(0x01D06640, DELTA_RegisterDescription), - HOOK_DEF(0x01D06670, DELTA_ClearRegistrations), - HOOK_DEF(0x01D066C0, DELTA_LookupRegistration), - - //HOOK_DEF(0x01D06700, DELTA_ClearStats), // NOXREF - //HOOK_DEF(0x01D06430, DELTA_ParseDescription), // NOXREF - //HOOK_DEF(0x01D06630, DELTA_Load), // NOXREF - //HOOK_DEF(0x01D04B40, DELTA_FindFieldIndex), // NOXREF - //HOOK_DEF(0x01D04B90, DELTA_SetField), // NOXREF - //HOOK_DEF(0x01D04BB0, DELTA_UnsetField), // NOXREF - //HOOK_DEF(0x01D04BD0, DELTA_SetFieldByIndex), // NOXREF - //HOOK_DEF(0x01D04BF0, DELTA_UnsetFieldByIndex), // NOXREF - //HOOK_DEF(0x01D05270, DELTA_CheckDelta), // NOXREF - //HOOK_DEF(0x01D05D20, DELTA_LookupEncoder), // NOXREF - -#endif // Delta_region - -#ifndef ObjectDictionary_region - - HOOK_DEF(0x01D0ECA0, MethodThunk::Constructor), - HOOK_DEF(0x01D0ECE0, MethodThunk::Destructor), - - HOOK_VIRTUAL_DEF(0x01D0F220, ObjectDictionary::Init, void()), - HOOK_VIRTUAL_DEF(0x01D0F290, ObjectDictionary::Add, bool(void *)), - HOOK_VIRTUAL_DEF(0x01D0F050, ObjectDictionary::Remove), - HOOK_VIRTUAL_DEF(0x01D0ED10, ObjectDictionary::Clear), - HOOK_VIRTUAL_DEF(0x01D0F310, ObjectDictionary::GetFirst), - HOOK_VIRTUAL_DEF(0x01D0F5B0, ObjectDictionary::GetNext), - HOOK_VIRTUAL_DEF(0x01D0F2A0, ObjectDictionary::CountElements), - HOOK_VIRTUAL_DEF(0x01D0F2C0, ObjectDictionary::Contains), - HOOK_VIRTUAL_DEF(0x01D0F2B0, ObjectDictionary::IsEmpty), - - HOOK_DEF(0x01D0F250, ObjectDictionary::Init, void(int)), // NOXREF - HOOK_DEF(0x01D0ED90, ObjectDictionary::Add, bool(void *, float)), - HOOK_DEF(0x01D0F4D0, ObjectDictionary::AddToCache, void(ObjectDictionary::entry_t *, float)), - HOOK_DEF(0x01D0F490, ObjectDictionary::AddToCache, void(ObjectDictionary::entry_t *)), - HOOK_DEF(0x01D0F340, ObjectDictionary::ChangeKey), - HOOK_DEF(0x01D0F0D0, ObjectDictionary::RemoveKey), - HOOK_DEF(0x01D0F590, ObjectDictionary::FindClosestKey), - HOOK_DEF(0x01D0F5D0, ObjectDictionary::FindExactKey), - HOOK_DEF(0x01D0F320, ObjectDictionary::GetLast), - HOOK_DEF(0x01D0F510, ObjectDictionary::FindKeyInCache), - HOOK_DEF(0x01D0F550, ObjectDictionary::FindObjectInCache), - HOOK_DEF(0x01D0EF60, ObjectDictionary::ClearCache), - HOOK_DEF(0x01D0F130, ObjectDictionary::CheckSize), - HOOK_DEF(0x01D0EF80, ObjectDictionary::RemoveIndex), - HOOK_DEF(0x01D0F010, ObjectDictionary::RemoveIndexRange), - HOOK_DEF(0x01D0EE60, ObjectDictionary::FindClosestAsIndex), - //HOOK_DEF(0x0, ObjectDictionary::RemoveRange), // NOXREF - //HOOK_DEF(0x01D0F440, ObjectDictionary::UnsafeChangeKey), // NOXREF - //HOOK_DEF(0x01D0F090, ObjectDictionary::RemoveSingle), // NOXREF - -#endif // ObjectDictionary_region - -#ifndef ObjectList_region - - HOOK_DEF(0x01D0F610, MethodThunk::Constructor), - HOOK_DEF(0x01D0F650, MethodThunk::Destructor), - - HOOK_VIRTUAL_DEF(0x01D0F8D0, ObjectList::Init), - HOOK_VIRTUAL_DEF(0x01D0F920, ObjectList::Add), - HOOK_VIRTUAL_DEF(0x01D0F850, ObjectList::Remove), - HOOK_VIRTUAL_DEF(0x01D0F800, ObjectList::Clear), - HOOK_VIRTUAL_DEF(0x01D0F8E0, ObjectList::GetFirst), - HOOK_VIRTUAL_DEF(0x01D0F900, ObjectList::GetNext), - HOOK_VIRTUAL_DEF(0x01D0F7C0, ObjectList::CountElements), - HOOK_VIRTUAL_DEF(0x01D0F7D0, ObjectList::Contains), - HOOK_VIRTUAL_DEF(0x01D0F7B0, ObjectList::IsEmpty), - - HOOK_DEF(0x01D0F760, ObjectList::RemoveTail), - HOOK_DEF(0x01D0F6C0, ObjectList::RemoveHead), - HOOK_DEF(0x01D0F710, ObjectList::AddTail), - HOOK_DEF(0x01D0F670, ObjectList::AddHead), - -#endif // ObjectList_region - -#ifndef BitBuffer_region - - HOOK_DEF(0x01D015A0, MethodThunk::Destructor), - HOOK_DEF(0x01D01530, (MethodThunk::Constructor), void()), - HOOK_DEF(0x01D015B0, (MethodThunk::Constructor), void(unsigned int)), - HOOK_DEF(0x01D01570, (MethodThunk::Constructor), void(void *, unsigned int)), - - HOOK_DEF(0x01D015E0, BitBuffer::Resize), - HOOK_DEF(0x01D01630, BitBuffer::Clear), - HOOK_DEF(0x01D01670, BitBuffer::Reset), - HOOK_DEF(0x01D01690, BitBuffer::Free), - HOOK_DEF(0x01D01840, BitBuffer::PeekBits), - HOOK_DEF(0x01D01EF0, BitBuffer::CurrentSize), - HOOK_DEF(0x01D02300, BitBuffer::FastClear), - HOOK_DEF(0x01D02350, BitBuffer::ConcatBuffer), - HOOK_DEF(0x01D02210, BitBuffer::SkipBytes), - HOOK_DEF(0x01D01660, BitBuffer::CurrentBit), - HOOK_DEF(0x01D01F10, BitBuffer::SpaceLeft), - HOOK_DEF(0x01D01F20, BitBuffer::AlignByte), - HOOK_DEF(0x01D02090, BitBuffer::StartBitMode), - HOOK_DEF(0x01D020A0, BitBuffer::EndBitMode), - HOOK_DEF(0x01D020E0, BitBuffer::SetBuffer), - HOOK_DEF(0x01D02240, BitBuffer::SkipBits), - HOOK_DEF(0x01D022D0, BitBuffer::SkipString), - - // Read - HOOK_DEF(0x01D016D0, BitBuffer::ReadBits), - HOOK_DEF(0x01D017B0, BitBuffer::ReadBit), - HOOK_DEF(0x01D01870, BitBuffer::ReadChar), - HOOK_DEF(0x01D01880, BitBuffer::ReadByte), - HOOK_DEF(0x01D01890, BitBuffer::ReadShort), - HOOK_DEF(0x01D018A0, BitBuffer::ReadWord), - HOOK_DEF(0x01D018B0, BitBuffer::ReadLong), - HOOK_DEF(0x01D018C0, BitBuffer::ReadFloat), - HOOK_DEF(0x01D018E0, BitBuffer::ReadBuf), - HOOK_DEF(0x01D019C0, BitBuffer::ReadString), - HOOK_DEF(0x01D01A00, BitBuffer::ReadStringLine), // NOXREF - HOOK_DEF(0x01D02020, BitBuffer::ReadBitString), - HOOK_DEF(0x01D020B0, BitBuffer::ReadBitData), - HOOK_DEF(0x01D02110, BitBuffer::ReadBitVec3Coord), - HOOK_DEF(0x01D02170, BitBuffer::ReadBitCoord), - HOOK_DEF(0x01D021F0, BitBuffer::ReadCoord), - HOOK_DEF(0x01D01A40, BitBuffer::ReadAngle), // NOXREF - HOOK_DEF(0x01D01A60, BitBuffer::ReadHiresAngle), // NOXREF - HOOK_DEF(0x01D01F40, BitBuffer::ReadSBits), - HOOK_DEF(0x01D01F70, BitBuffer::ReadBitAngle), - - // Write - HOOK_DEF(0x01D01D90, BitBuffer::WriteBuf, void(const void *, int)), - HOOK_DEF(0x01D01990, BitBuffer::WriteBuf, void(BitBuffer *, int)), - - HOOK_DEF(0x01D01A80, BitBuffer::WriteBit), - HOOK_DEF(0x01D01B50, BitBuffer::WriteBits), - HOOK_DEF(0x01D01C70, BitBuffer::WriteSBits), - HOOK_DEF(0x01D01CD0, BitBuffer::WriteChar), - HOOK_DEF(0x01D01CE0, BitBuffer::WriteByte), - HOOK_DEF(0x01D01CF0, BitBuffer::WriteShort), - HOOK_DEF(0x01D01D00, BitBuffer::WriteWord), - HOOK_DEF(0x01D01D10, BitBuffer::WriteLong), - HOOK_DEF(0x01D01D20, BitBuffer::WriteFloat), - HOOK_DEF(0x01D01D50, BitBuffer::WriteString), - HOOK_DEF(0x01D02370, BitBuffer::WriteCoord), - HOOK_DEF(0x01D01E60, BitBuffer::WriteBitData), - HOOK_DEF(0x01D01E90, BitBuffer::WriteAngle), // NOXREF - HOOK_DEF(0x01D01EC0, BitBuffer::WriteHiresAngle), // NOXREF - HOOK_DEF(0x01D01FB0, BitBuffer::WriteBitAngle), - HOOK_DEF(0x01D02050, BitBuffer::WriteBitString), - -#endif // BitBuffer_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - - GLOBALVAR_LINK(0x01D45708, "_ZL6g_defs", pg_defs), - GLOBALVAR_LINK(0x01D4570C, "_ZL10g_encoders", pg_encoders), - GLOBALVAR_LINK(0x01D45710, "g_deltaregistry", pg_deltaregistry), - GLOBALVAR_LINK(0x01D456F0, "g_pplayerdelta", pg_pplayerdelta), - GLOBALVAR_LINK(0x01D456F4, "g_pentitydelta", pg_pentitydelta), - GLOBALVAR_LINK(0x01D456F8, "g_pcustomentitydelta", pg_pcustomentitydelta), - GLOBALVAR_LINK(0x01D456FC, "g_pclientdelta", pg_pclientdelta), - GLOBALVAR_LINK(0x01D45700, "g_pweapondelta", pg_pweapondelta), - GLOBALVAR_LINK(0x01D45704, "g_peventdelta", pg_peventdelta), - GLOBALVAR_LINK(0x01D456E8, "g_delta_Time", pg_delta_Time), - GLOBALVAR_LINK(0x01D456E0, "g_large_Time_Buffers", pg_large_Time_Buffers), - GLOBALVAR_LINK(0x01D46870, "g_DownloadURL", pg_DownloadURL), - - GLOBALVAR_LINK(0x01D442C8, "com_token", pcom_token), - GLOBALVAR_LINK(0x01D456C8, "s_com_token_unget", ps_com_token_unget), - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/hooklist.h b/rehlds/hookers/HLTV/Core/hooklist.h deleted file mode 100644 index fcdf32b..0000000 --- a/rehlds/hookers/HLTV/Core/hooklist.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#ifdef HOOK_HLTV - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -#define rehlds_syserror HLTV_SysError - -#define com_token (*pcom_token) -#define s_com_token_unget (*ps_com_token_unget) -#define g_DownloadURL (*pg_DownloadURL) - -extern char com_token[COM_TOKEN_LEN]; -extern qboolean s_com_token_unget; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/main.cpp b/rehlds/hookers/HLTV/Core/main.cpp deleted file mode 100644 index 7c4b3a8..0000000 --- a/rehlds/hookers/HLTV/Core/main.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "precompiled.h" - -#if defined(HOOK_HLTV) -#define ORIGINAL_CORE_DLL_NAME "core2.dll" - -CSysModule *g_pOriginalCoreModule = NULL; -CreateInterfaceFn g_OriginalCoreFactory = NULL; -ISystemModule *g_pOriginalServer = NULL; -ISystemModule *g_pOriginalWorld = NULL; -ISystemModule *g_pOriginalNetwork = NULL; - -IBaseInterface *CreateCoreInterface() -{ - if (g_pOriginalServer) { - return g_pOriginalServer; - } - - if (g_pOriginalCoreModule) - { - g_OriginalCoreFactory = Sys_GetFactory(g_pOriginalCoreModule); - if (g_OriginalCoreFactory) - { - int returnCode = 0; - g_pOriginalServer = reinterpret_cast(g_OriginalCoreFactory(SERVER_INTERFACE_VERSION, &returnCode)); - return g_pOriginalServer; - } - } - - return NULL; -} - -IBaseInterface *CreateWorldInterface() -{ - if (g_pOriginalWorld) { - return g_pOriginalWorld; - } - - if (g_pOriginalCoreModule) - { - g_OriginalCoreFactory = Sys_GetFactory(g_pOriginalCoreModule); - if (g_OriginalCoreFactory) - { - int returnCode = 0; - g_pOriginalWorld = reinterpret_cast(g_OriginalCoreFactory(WORLD_INTERFACE_VERSION, &returnCode)); - return g_pOriginalWorld; - } - } - - return NULL; -} - -IBaseInterface *CreateNetworkInterface() -{ - if (g_pOriginalNetwork) { - return g_pOriginalNetwork; - } - - if (g_pOriginalCoreModule) - { - g_OriginalCoreFactory = Sys_GetFactory(g_pOriginalCoreModule); - if (g_OriginalCoreFactory) - { - int returnCode = 0; - g_pOriginalNetwork = reinterpret_cast(g_OriginalCoreFactory(NETWORK_INTERFACE_VERSION, &returnCode)); - return g_pOriginalNetwork; - } - } - - return NULL; -} - -InterfaceReg iface_Server = InterfaceReg(CreateCoreInterface, SERVER_INTERFACE_VERSION); -InterfaceReg iface_World = InterfaceReg(CreateWorldInterface, WORLD_INTERFACE_VERSION); -InterfaceReg iface_Network= InterfaceReg(CreateNetworkInterface, NETWORK_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalCoreModule = Sys_LoadModule(ORIGINAL_CORE_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_CORE_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hltv.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalCoreModule) - { - Sys_UnloadModule(g_pOriginalCoreModule); - g_pOriginalCoreModule = NULL; - g_OriginalCoreFactory = NULL; - - g_pOriginalServer = NULL; - g_pOriginalWorld = NULL; - g_pOriginalNetwork = NULL; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_HLTV) diff --git a/rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp b/rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp deleted file mode 100644 index ad0011e..0000000 --- a/rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - - HOOK_DEF(0x01D07C0F, malloc_wrapper), - HOOK_DEF(0x01D07AFE, free_wrapper), - HOOK_DEF(0x01D14F4D, strdup_wrapper), - HOOK_DEF(0x01D07C21, __nh_malloc_wrapper), - - HOOK_DEF(0x01D02510, Mem_ZeroMalloc), - //HOOK_DEF(0x0, Mem_Malloc), - //HOOK_DEF(0x0, Mem_Realloc), - //HOOK_DEF(0x0, Mem_Calloc), - //HOOK_DEF(0x0, Mem_Strdup), - //HOOK_DEF(0x0, Mem_Free), - - //HOOK_DEF(0x0, realloc_wrapper), - //HOOK_DEF(0x0, calloc_wrapper), - -#endif // Mem_region - -#ifndef DemoPlayer_Region - - // BaseSystemModule virtual function - //HOOK_VIRTUAL_DEF(0x01D032A0, DemoPlayer::RegisterListener), - //HOOK_VIRTUAL_DEF(0x01D03360, DemoPlayer::RemoveListener), - //HOOK_VIRTUAL_DEF(0x1D033700, DemoPlayer::GetSystem), - //HOOK_VIRTUAL_DEF(0x01D03380, DemoPlayer::GetSerial), - //HOOK_VIRTUAL_DEF(0x01D03390, DemoPlayer::GetName), - //HOOK_VIRTUAL_DEF(0x01D033A0, DemoPlayer::GetState), - //HOOK_VIRTUAL_DEF(0x01D033F0, DemoPlayer::GetVersion), - - // DemoPlayer virtual function - HOOK_VIRTUAL_DEF(0x01D03670, DemoPlayer::Init), - HOOK_VIRTUAL_DEF(0x01D04180, DemoPlayer::RunFrame), - HOOK_VIRTUAL_DEF(0x01D042E0, DemoPlayer::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D02FA0, DemoPlayer::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D02F70, DemoPlayer::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D02F60, DemoPlayer::GetType), - HOOK_VIRTUAL_DEF(0x01D04490, DemoPlayer::ShutDown), - HOOK_VIRTUAL_DEF(0x01D04400, DemoPlayer::NewGame), - HOOK_VIRTUAL_DEF(0x01D03410, DemoPlayer::GetModName), - HOOK_VIRTUAL_DEF(0x01D03420, DemoPlayer::WriteCommands), - HOOK_VIRTUAL_DEF(0x01D03570, DemoPlayer::AddCommand), - HOOK_VIRTUAL_DEF(0x01D035F0, DemoPlayer::RemoveCommand), - HOOK_VIRTUAL_DEF(0x01D04640, DemoPlayer::GetLastCommand), - HOOK_VIRTUAL_DEF(0x01D03660, DemoPlayer::GetCommands), - HOOK_VIRTUAL_DEF(0x01D03900, DemoPlayer::SetWorldTime), - HOOK_VIRTUAL_DEF(0x01D03940, DemoPlayer::SetTimeScale), - HOOK_VIRTUAL_DEF(0x01D039B0, DemoPlayer::SetPaused), - HOOK_VIRTUAL_DEF(0x01D039C0, DemoPlayer::SetEditMode), - HOOK_VIRTUAL_DEF(0x01D03A20, DemoPlayer::SetMasterMode), - HOOK_VIRTUAL_DEF(0x01D03A40, DemoPlayer::IsPaused), - HOOK_VIRTUAL_DEF(0x01D02F30, DemoPlayer::IsLoading), - HOOK_VIRTUAL_DEF(0x01D02F50, DemoPlayer::IsActive), - HOOK_VIRTUAL_DEF(0x01D039D0, DemoPlayer::IsEditMode), - HOOK_VIRTUAL_DEF(0x01D03A30, DemoPlayer::IsMasterMode), - HOOK_VIRTUAL_DEF(0x01D04560, DemoPlayer::RemoveFrames), - HOOK_VIRTUAL_DEF(0x01D04570, DemoPlayer::ExecuteDirectorCmd), - HOOK_VIRTUAL_DEF(0x01D02ED0, DemoPlayer::GetWorldTime), - HOOK_VIRTUAL_DEF(0x01D02EE0, DemoPlayer::GetStartTime), - HOOK_VIRTUAL_DEF(0x01D02F00, DemoPlayer::GetEndTime), - HOOK_VIRTUAL_DEF(0x01D03400, DemoPlayer::GetTimeScale), - HOOK_VIRTUAL_DEF(0x01D02F80, DemoPlayer::GetWorld), - HOOK_VIRTUAL_DEF(0x01D04630, DemoPlayer::GetFileName), - HOOK_VIRTUAL_DEF(0x01D02E60, DemoPlayer::SaveGame), - HOOK_VIRTUAL_DEF(0x01D04650, DemoPlayer::LoadGame), - HOOK_VIRTUAL_DEF(0x01D039E0, DemoPlayer::Stop), - HOOK_VIRTUAL_DEF(0x01D03A10, DemoPlayer::ForceHLTV), - HOOK_VIRTUAL_DEF(0x01D03A50, DemoPlayer::GetDemoViewInfo), - HOOK_VIRTUAL_DEF(0x01D03F90, DemoPlayer::ReadDemoMessage), - HOOK_VIRTUAL_DEF(0x01D04130, DemoPlayer::ReadNetchanState), - HOOK_VIRTUAL_DEF(0x01D02F90, DemoPlayer::GetDirector), // NOXREF - - // DemoPlayer non-virtual function - //HOOK_DEF(0x01D02F20, DemoPlayer::GetPlayerTime), // NOXREF - //HOOK_DEF(0x01D04500, DemoPlayer::FormatTime), // NOXREF - HOOK_DEF(0x01D041B0, DemoPlayer::RunClocks), - HOOK_DEF(0x01D046F0, DemoPlayer::WriteDatagram), - HOOK_DEF(0x01D03D30, DemoPlayer::WriteSpawn), - HOOK_DEF(0x01D03F50, DemoPlayer::ReindexCommands), - HOOK_DEF(0x01D03DC0, DemoPlayer::WriteCameraPath), - HOOK_DEF(0x01D04840, DemoPlayer::ExecuteDemoFileCommands), - HOOK_DEF(0x01D03030, DemoPlayer::CMD_Jump), - HOOK_DEF(0x01D030E0, DemoPlayer::CMD_ForceHLTV), - HOOK_DEF(0x01D031F0, DemoPlayer::CMD_Pause), - HOOK_DEF(0x01D032B0, DemoPlayer::CMD_Speed), - HOOK_DEF(0x01D033B0, DemoPlayer::CMD_Start), - HOOK_DEF(0x01D03170, DemoPlayer::CMD_Save), - -#endif // DemoPlayer_Region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; diff --git a/rehlds/hookers/HLTV/DemoPlayer/hooklist.h b/rehlds/hookers/HLTV/DemoPlayer/hooklist.h deleted file mode 100644 index d030ec9..0000000 --- a/rehlds/hookers/HLTV/DemoPlayer/hooklist.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef HOOK_HLTV - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -#define rehlds_syserror HLTV_SysError - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/DemoPlayer/main.cpp b/rehlds/hookers/HLTV/DemoPlayer/main.cpp deleted file mode 100644 index 0837c3c..0000000 --- a/rehlds/hookers/HLTV/DemoPlayer/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "precompiled.h" - -#if defined(HOOK_HLTV) -#define ORIGINAL_DEMOPLAYER_DLL_NAME "DemoPlayer2.dll" - -CSysModule *g_pOriginalDemoPlayerModule = NULL; -CreateInterfaceFn g_OriginalDemoPlayerFactory = NULL; -ISystemModule *g_pOriginalDemoPlayer = NULL; - -IBaseInterface *CreateDemoPlayerInterface() -{ - if (g_pOriginalDemoPlayer) { - return g_pOriginalDemoPlayer; - } - - if (g_pOriginalDemoPlayerModule) - { - g_OriginalDemoPlayerFactory = Sys_GetFactory(g_pOriginalDemoPlayerModule); - if (g_OriginalDemoPlayerFactory) - { - int returnCode = 0; - g_pOriginalDemoPlayer = reinterpret_cast(g_OriginalDemoPlayerFactory(DEMOPLAYER_INTERFACE_VERSION, &returnCode)); - return g_pOriginalDemoPlayer; - } - } - - return NULL; -} - -InterfaceReg iface = InterfaceReg(CreateDemoPlayerInterface, DEMOPLAYER_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalDemoPlayerModule = Sys_LoadModule(ORIGINAL_DEMOPLAYER_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_DEMOPLAYER_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hltv.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalDemoPlayerModule) - { - Sys_UnloadModule(g_pOriginalDemoPlayerModule); - g_pOriginalDemoPlayerModule = NULL; - g_OriginalDemoPlayerFactory = NULL; - g_pOriginalDemoPlayer = NULL; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_HLTV) diff --git a/rehlds/hookers/HLTV/Proxy/hooklist.cpp b/rehlds/hookers/HLTV/Proxy/hooklist.cpp deleted file mode 100644 index b4a2e59..0000000 --- a/rehlds/hookers/HLTV/Proxy/hooklist.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#ifdef HOOK_HLTV - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define Proxy_region -//#define BaseClient_region -//#define ProxyClient_region -//#define FakeClient_region -//#define DemoFile_region -//#define DemoClient_region -//#define Director_region -//#define DirectorCmd_region -//#define Status_region -//#define InfoString_region -//#define BitBuffer_region -//#define NetChannel_region -//#define Master_region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - - HOOK_DEF(0x01D20F3F, malloc_wrapper), - HOOK_DEF(0x01D20E2E, free_wrapper), - HOOK_DEF(0x01D3078C, strdup_wrapper), - HOOK_DEF(0x01D20F51, __nh_malloc_wrapper), - - HOOK_DEF(0x01D03EF0, Mem_ZeroMalloc), - //HOOK_DEF(0x0, Mem_Malloc), - //HOOK_DEF(0x0, Mem_Realloc), - //HOOK_DEF(0x0, Mem_Calloc), - //HOOK_DEF(0x0, Mem_Strdup), - //HOOK_DEF(0x0, Mem_Free), - - //HOOK_DEF(0x0, realloc_wrapper), - //HOOK_DEF(0x0, calloc_wrapper), - -#endif // Mem_region - -#ifndef Proxy_region - - // virtual functions - BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D16010, Proxy::Init), - HOOK_VIRTUAL_DEF(0x01D16020, Proxy::RunFrame), - HOOK_VIRTUAL_DEF(0x01D16030, Proxy::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D16040, Proxy::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D16090, Proxy::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D160A0, Proxy::GetType), - HOOK_VIRTUAL_DEF(0x01D160E0, Proxy::ShutDown), - - // virtual functions - Proxy - HOOK_VIRTUAL_DEF(0x01D115D0, Proxy::Reset), - HOOK_VIRTUAL_DEF(0x01D11620, Proxy::Broadcast), - HOOK_VIRTUAL_DEF(0x01D14FE0, Proxy::IncreaseCheering), - HOOK_VIRTUAL_DEF(0x01D11600, Proxy::ParseStatusMsg), - HOOK_VIRTUAL_DEF(0x01D11610, Proxy::ParseStatusReport), - HOOK_VIRTUAL_DEF(0x01D12FF0, Proxy::ProcessConnectionlessMessage), - HOOK_VIRTUAL_DEF(0x01D14780, Proxy::ChatCommentator), - HOOK_VIRTUAL_DEF(0x01D137B0, Proxy::ChatSpectator), - HOOK_VIRTUAL_DEF(0x01D11370, Proxy::CountLocalClients), - HOOK_VIRTUAL_DEF(0x01D143B0, Proxy::AddResource), - HOOK_VIRTUAL_DEF(0x01D11570, Proxy::IsLanOnly), - HOOK_VIRTUAL_DEF(0x01D13A00, Proxy::IsMaster), - HOOK_VIRTUAL_DEF(0x01D11580, Proxy::IsActive), - HOOK_VIRTUAL_DEF(0x01D114F0, Proxy::IsPublicGame), - HOOK_VIRTUAL_DEF(0x01D11500, Proxy::IsPasswordProtected), - HOOK_VIRTUAL_DEF(0x01D11510, Proxy::IsStressed), - HOOK_VIRTUAL_DEF(0x01D154A0, Proxy::SetDelay), - HOOK_VIRTUAL_DEF(0x01D15540, Proxy::SetClientTime), - HOOK_VIRTUAL_DEF(0x01D15580, Proxy::SetClientTimeScale), - HOOK_VIRTUAL_DEF(0x01D15430, Proxy::SetMaxRate), - HOOK_VIRTUAL_DEF(0x01D118D0, Proxy::SetMaxLoss), - HOOK_VIRTUAL_DEF(0x01D15470, Proxy::SetMaxUpdateRate), - HOOK_VIRTUAL_DEF(0x01D11870, Proxy::SetMaxClients), - HOOK_VIRTUAL_DEF(0x01D11930, Proxy::SetRegion), - HOOK_VIRTUAL_DEF(0x01D14FA0, Proxy::GetDelay), - HOOK_VIRTUAL_DEF(0x01D14FC0, Proxy::GetSpectatorTime), - HOOK_VIRTUAL_DEF(0x01D14FD0, Proxy::GetProxyTime), - HOOK_VIRTUAL_DEF(0x01D11920, Proxy::GetMaxClients), - HOOK_VIRTUAL_DEF(0x01D10EF0, Proxy::GetWorld), - HOOK_VIRTUAL_DEF(0x01D10F00, Proxy::GetServer), - HOOK_VIRTUAL_DEF(0x01D10F10, Proxy::GetDirector), - HOOK_VIRTUAL_DEF(0x01D10F20, Proxy::GetSocket), - HOOK_VIRTUAL_DEF(0x01D10F30, Proxy::GetChatMode), - HOOK_VIRTUAL_DEF(0x01D113C0, Proxy::GetStatistics), - HOOK_VIRTUAL_DEF(0x01D113D0, Proxy::GetMaxRate), - HOOK_VIRTUAL_DEF(0x01D113E0, Proxy::GetMaxUpdateRate), - HOOK_VIRTUAL_DEF(0x01D14420, Proxy::GetResource), - HOOK_VIRTUAL_DEF(0x01D11550, Proxy::GetDispatchMode), - HOOK_VIRTUAL_DEF(0x01D115A0, Proxy::GetRegion), - HOOK_VIRTUAL_DEF(0x01D10EE0, Proxy::GetClients), - HOOK_VIRTUAL_DEF(0x01D113F0, Proxy::WriteSignonData), - - // non-virtual functions - Proxy - HOOK_DEF(0x01D12BD0, Proxy::ReplyServiceChallenge), - HOOK_DEF(0x01D115B0, Proxy::ReplyListen), - HOOK_DEF(0x01D10900, Proxy::ReplyConnect), - HOOK_DEF(0x01D10890, Proxy::ReplyRules), - HOOK_DEF(0x01D10820, Proxy::ReplyPlayers), - HOOK_DEF(0x01D10770, Proxy::ReplyInfo), - HOOK_DEF(0x01D10720, Proxy::ReplyInfoString), - HOOK_DEF(0x01D106D0, Proxy::ReplyChallenge), - HOOK_DEF(0x01D105F0, Proxy::ReplyPing), - HOOK_DEF(0x01D12F50, Proxy::ExecuteRcon), - HOOK_DEF(0x01D13B70, Proxy::ReconnectClients), - HOOK_DEF(0x01D129A0, Proxy::SendRcon), - HOOK_DEF(0x01D10DD0, Proxy::RejectConnection), - HOOK_DEF(0x01D10F40, Proxy::UpdateStatusLine), - HOOK_DEF(0x01D14220, Proxy::DispatchClient), - HOOK_DEF(0x01D13FA0, Proxy::IsValidPassword), - HOOK_DEF(0x01D13E50, Proxy::WriteHUDMsg), - HOOK_DEF(0x01D150D0, Proxy::ExecuteLoopCommands), - HOOK_DEF(0x01D12A30, Proxy::GetChallengeNumber), - HOOK_DEF(0x01D12B60, Proxy::CheckChallenge), - HOOK_DEF(0x01D15150, Proxy::CreateServerInfoString), - HOOK_DEF(0x01D13A10, Proxy::CheckDirectorModule), - HOOK_DEF(0x01D158B0, Proxy::RunClocks), - HOOK_DEF(0x01D156B0, Proxy::NewGameStarted), - HOOK_DEF(0x01D12CC0, Proxy::NewServerConnection), - HOOK_DEF(0x01D15620, Proxy::BroadcastPaused), - HOOK_DEF(0x01D12E80, Proxy::BroadcastRetryMessage), - HOOK_DEF(0x01D12EE0, Proxy::StopBroadcast), - HOOK_DEF(0x01D15A10, Proxy::DisconnectClients), - HOOK_DEF(0x01D14350, Proxy::FreeResource), - HOOK_DEF(0x01D14380, Proxy::ClearResources), - HOOK_DEF(0x01D142C0, Proxy::LoadResourceFromFile), - HOOK_DEF(0x01D14800, Proxy::IsBanned), - HOOK_DEF(0x01D15A60, Proxy::UpdateInfoMessages), - - HOOK_DEF(0x01D12860, Proxy::CMD_Rcon), - HOOK_DEF(0x01D11EF0, Proxy::CMD_ServerCmd), - HOOK_DEF(0x01D11F90, Proxy::CMD_ClientCmd), - HOOK_DEF(0x01D127D0, Proxy::CMD_RconPassword), - HOOK_DEF(0x01D12700, Proxy::CMD_RconAddress), - HOOK_DEF(0x01D11700, Proxy::CMD_Say), - HOOK_DEF(0x01D11C10, Proxy::CMD_Msg), - HOOK_DEF(0x01D10D40, Proxy::CMD_Clients), - HOOK_DEF(0x01D13920, Proxy::CMD_Kick), - HOOK_DEF(0x01D13650, Proxy::CMD_ChatMode), - HOOK_DEF(0x01D13DA0, Proxy::CMD_PublicGame), - HOOK_DEF(0x01D13BB0, Proxy::CMD_OffLineText), - HOOK_DEF(0x01D14550, Proxy::CMD_AdminPassword), - HOOK_DEF(0x01D14470, Proxy::CMD_SignOnCommands), - HOOK_DEF(0x01D13EE0, Proxy::CMD_SpectatorPassword), - HOOK_DEF(0x01D140B0, Proxy::CMD_DispatchMode), - HOOK_DEF(0x01D14F00, Proxy::CMD_CheeringThreshold), - HOOK_DEF(0x01D10610, Proxy::CMD_Ping), - HOOK_DEF(0x01D12C00, Proxy::CMD_ProxyPassword), - HOOK_DEF(0x01D11E50, Proxy::CMD_MaxRate), - HOOK_DEF(0x01D12570, Proxy::CMD_LoopCmd), - HOOK_DEF(0x01D117C0, Proxy::CMD_MaxClients), - HOOK_DEF(0x01D14610, Proxy::CMD_LocalMsg), - HOOK_DEF(0x01D11A50, Proxy::CMD_Connect), - HOOK_DEF(0x01D139F0, Proxy::CMD_Disconnect), - HOOK_DEF(0x01D14180, Proxy::CMD_PlayDemo), - HOOK_DEF(0x01D11940, Proxy::CMD_Delay), - HOOK_DEF(0x01D119E0, Proxy::CMD_Stop), - HOOK_DEF(0x01D12480, Proxy::CMD_Record), - HOOK_DEF(0x01D12530, Proxy::CMD_StopRecording), - HOOK_DEF(0x01D123C0, Proxy::CMD_BlockVoice), - HOOK_DEF(0x01D11B20, Proxy::CMD_Name), - HOOK_DEF(0x01D120B0, Proxy::CMD_Rate), - HOOK_DEF(0x01D12300, Proxy::CMD_Updaterate), - HOOK_DEF(0x01D12220, Proxy::CMD_HostName), - HOOK_DEF(0x01D13CC0, Proxy::CMD_AddResource), - HOOK_DEF(0x01D13C60, Proxy::CMD_Resources), - HOOK_DEF(0x01D14DD0, Proxy::CMD_BannerFile), - HOOK_DEF(0x01D14AF0, Proxy::CMD_Bann), - HOOK_DEF(0x01D14850, Proxy::CMD_AddFakeClients), - HOOK_DEF(0x01D14CD0, Proxy::CMD_Retry), - HOOK_DEF(0x01D14D00, Proxy::CMD_AutoRetry), - HOOK_DEF(0x01D14C40, Proxy::CMD_ServerPassword), - HOOK_DEF(0x01D11040, Proxy::CMD_Status), - HOOK_DEF(0x01D13710, Proxy::CMD_MaxQueries), - HOOK_DEF(0x01D12170, Proxy::CMD_Players), - HOOK_DEF(0x01D14C00, Proxy::CMD_ClearBanns), - HOOK_DEF(0x01D149B0, Proxy::CMD_MaxLoss), - HOOK_DEF(0x01D11D80, Proxy::CMD_Protocol), - HOOK_DEF(0x01D14A50, Proxy::CMD_Region), - - //HOOK_DEF(0x01D12E70, Proxy::GetModVersion), // NOXREF - //HOOK_DEF(0x0, Proxy::CMD_InformPlayers), // NOXREF - //HOOK_DEF(0x0, Proxy::CMD_MaxUpdateRate), // NOXREF - -#endif // Proxy_region - -#ifndef ProxyClient_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D16C50, ProxyClient::Init), - HOOK_VIRTUAL_DEF(0x01D16D20, ProxyClient::ShutDown), - - // BaseClient - HOOK_VIRTUAL_DEF(0x01D16A40, ProxyClient::HasChatEnabled), - HOOK_VIRTUAL_DEF(0x01D16B30, ProxyClient::DownloadFile), - HOOK_VIRTUAL_DEF(0x01D16920, ProxyClient::SendDatagram), - HOOK_VIRTUAL_DEF(0x01D168E0, ProxyClient::ReplySpawn), - HOOK_VIRTUAL_DEF(0x01D16770, ProxyClient::UpdateUserInfo), - HOOK_VIRTUAL_DEF(0x01D16A50, ProxyClient::ParseVoiceData), - HOOK_VIRTUAL_DEF(0x01D16310, ProxyClient::ProcessStringCmd), - HOOK_VIRTUAL_DEF(0x01D16850, ProxyClient::ParseHLTV), - -#endif // ProxyClient_region - -#ifndef FakeClient_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D09300, FakeClient::Init), - HOOK_VIRTUAL_DEF(0x01D09310, FakeClient::RunFrame), - HOOK_VIRTUAL_DEF(0x01D09320, FakeClient::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D09380, FakeClient::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D09390, FakeClient::GetType), - HOOK_VIRTUAL_DEF(0x01D093D0, FakeClient::ShutDown), - - // FakeClient - HOOK_DEF(0x01D08EA0, FakeClient::SetRate), - HOOK_DEF(0x01D08EB0, FakeClient::Connect), - HOOK_DEF(0x01D08EE0, FakeClient::Retry), // NOXREF - HOOK_DEF(0x01D08EF0, FakeClient::Say), // NOXREF - HOOK_DEF(0x01D08F50, FakeClient::Disconnect), // NOXREF - -#endif // FakeClient_region - -#ifndef BaseClient_region - - // IClient - HOOK_VIRTUAL_DEF(0x01D01670, BaseClient::Connect), - HOOK_VIRTUAL_DEF(0x01D02790, BaseClient::Send), - HOOK_VIRTUAL_DEF(0x01D01830, BaseClient::Disconnect), - HOOK_VIRTUAL_DEF(0x01D023F0, BaseClient::Reconnect), - HOOK_VIRTUAL_DEF(0x01D023C0, BaseClient::SetWorld), - HOOK_VIRTUAL_DEF(0x01D027D0, BaseClient::GetClientType), - HOOK_VIRTUAL_DEF(0x01D01810, BaseClient::GetClientName), - HOOK_VIRTUAL_DEF(0x01D01820, BaseClient::GetUserInfo), - HOOK_VIRTUAL_DEF(0x01D027C0, BaseClient::GetAddress), - HOOK_VIRTUAL_DEF(0x01D02420, BaseClient::IsActive), - HOOK_VIRTUAL_DEF(0x01D026F0, BaseClient::IsHearingVoices), - HOOK_VIRTUAL_DEF(0x01D02730, BaseClient::HasChatEnabled), - HOOK_VIRTUAL_DEF(0x01D02760, BaseClient::DownloadFailed), - HOOK_VIRTUAL_DEF(0x01D02740, BaseClient::DownloadFile), - HOOK_VIRTUAL_DEF(0x01D025C0, BaseClient::UpdateVoiceMask), - HOOK_VIRTUAL_DEF(0x01D02580, BaseClient::QueryVoiceEnabled), - HOOK_VIRTUAL_DEF(0x01D02470, BaseClient::SetName), - HOOK_VIRTUAL_DEF(0x01D02100, BaseClient::WriteSpawn), - HOOK_VIRTUAL_DEF(0x01D02180, BaseClient::WriteDatagram), - HOOK_VIRTUAL_DEF(0x01D027F0, BaseClient::SendDatagram), - HOOK_VIRTUAL_DEF(0x01D02820, BaseClient::Reset), - HOOK_VIRTUAL_DEF(0x01D02020, BaseClient::SetState), - HOOK_VIRTUAL_DEF(0x01D01F20, BaseClient::ReplyNew), - HOOK_VIRTUAL_DEF(0x01D01E50, BaseClient::ReplySpawn), - HOOK_VIRTUAL_DEF(0x01D01F90, BaseClient::ReplyFullUpdate), - HOOK_VIRTUAL_DEF(0x01D01E10, BaseClient::PrintfToClient), - HOOK_VIRTUAL_DEF(0x01D01D00, BaseClient::UpdateUserInfo), - HOOK_VIRTUAL_DEF(0x01D01900, BaseClient::ParseStringCmd), - HOOK_VIRTUAL_DEF(0x01D018C0, BaseClient::ParseNop), - HOOK_VIRTUAL_DEF(0x01D018D0, BaseClient::ParseBad), - HOOK_VIRTUAL_DEF(0x01D02450, BaseClient::ParseMove), - HOOK_VIRTUAL_DEF(0x01D02430, BaseClient::ParseVoiceData), - HOOK_VIRTUAL_DEF(0x01D02530, BaseClient::ParseHLTV), - HOOK_VIRTUAL_DEF(0x01D022E0, BaseClient::ParseDelta), - HOOK_VIRTUAL_DEF(0x01D02540, BaseClient::ParseCvarValue), - HOOK_VIRTUAL_DEF(0x01D02550, BaseClient::ParseCvarValue2), - HOOK_VIRTUAL_DEF(0x01D01740, BaseClient::ProcessMessage), - HOOK_VIRTUAL_DEF(0x01D01920, BaseClient::ProcessStringCmd), - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D02950, BaseClient::Init), - HOOK_VIRTUAL_DEF(0x01D02960, BaseClient::RunFrame), - HOOK_VIRTUAL_DEF(0x01D02330, BaseClient::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D16CE0, BaseClient::GetType), - HOOK_VIRTUAL_DEF(0x01D02A20, BaseClient::ShutDown), - -#endif // BaseClient_region - -#ifndef BitBuffer_region - - HOOK_DEF(0x01D02F80, MethodThunk::Destructor), - HOOK_DEF(0x01D02F10, (MethodThunk::Constructor), void()), - HOOK_DEF(0x01D02F90, (MethodThunk::Constructor), void(unsigned int)), - HOOK_DEF(0x01D02F50, (MethodThunk::Constructor), void(void *, unsigned int)), - - HOOK_DEF(0x01D02FC0, BitBuffer::Resize), - HOOK_DEF(0x01D03010, BitBuffer::Clear), - HOOK_DEF(0x01D03050, BitBuffer::Reset), - HOOK_DEF(0x01D03070, BitBuffer::Free), - HOOK_DEF(0x01D03220, BitBuffer::PeekBits), - HOOK_DEF(0x01D038D0, BitBuffer::CurrentSize), - HOOK_DEF(0x01D03CE0, BitBuffer::FastClear), - HOOK_DEF(0x01D03D30, BitBuffer::ConcatBuffer), - HOOK_DEF(0x01D03BF0, BitBuffer::SkipBytes), - HOOK_DEF(0x01D03040, BitBuffer::CurrentBit), // NOXREF - HOOK_DEF(0x01D038F0, BitBuffer::SpaceLeft), // NOXREF - HOOK_DEF(0x01D03900, BitBuffer::AlignByte), // NOXREF - HOOK_DEF(0x01D03A70, BitBuffer::StartBitMode), // NOXREF - HOOK_DEF(0x01D03A80, BitBuffer::EndBitMode), // NOXREF - HOOK_DEF(0x01D03AC0, BitBuffer::SetBuffer), // NOXREF - HOOK_DEF(0x01D03C20, BitBuffer::SkipBits), // NOXREF - HOOK_DEF(0x01D03CB0, BitBuffer::SkipString), // NOXREF - - // Read - HOOK_DEF(0x01D030B0, BitBuffer::ReadBits), - HOOK_DEF(0x01D03190, BitBuffer::ReadBit), - HOOK_DEF(0x01D03250, BitBuffer::ReadChar), - HOOK_DEF(0x01D03260, BitBuffer::ReadByte), - HOOK_DEF(0x01D03270, BitBuffer::ReadShort), - HOOK_DEF(0x01D03280, BitBuffer::ReadWord), - HOOK_DEF(0x01D03290, BitBuffer::ReadLong), - HOOK_DEF(0x01D032A0, BitBuffer::ReadFloat), - HOOK_DEF(0x01D032C0, BitBuffer::ReadBuf), - HOOK_DEF(0x01D033A0, BitBuffer::ReadString), - HOOK_DEF(0x01D033E0, BitBuffer::ReadStringLine), - HOOK_DEF(0x01D03A00, BitBuffer::ReadBitString), - HOOK_DEF(0x01D03A90, BitBuffer::ReadBitData), - HOOK_DEF(0x01D03AF0, BitBuffer::ReadBitVec3Coord), - HOOK_DEF(0x01D03B50, BitBuffer::ReadBitCoord), - HOOK_DEF(0x01D03BD0, BitBuffer::ReadCoord), - HOOK_DEF(0x01D03420, BitBuffer::ReadAngle), // NOXREF - HOOK_DEF(0x01D03440, BitBuffer::ReadHiresAngle), // NOXREF - HOOK_DEF(0x01D03920, BitBuffer::ReadSBits), // NOXREF - HOOK_DEF(0x01D03950, BitBuffer::ReadBitAngle), // NOXREF - - // Write - HOOK_DEF(0x01D03770, BitBuffer::WriteBuf, void(const void *, int)), - HOOK_DEF(0x01D03370, BitBuffer::WriteBuf, void(BitBuffer *, int)), - - HOOK_DEF(0x01D03460, BitBuffer::WriteBit), - HOOK_DEF(0x01D03530, BitBuffer::WriteBits), - HOOK_DEF(0x01D03650, BitBuffer::WriteSBits), // NOXREF - HOOK_DEF(0x01D036B0, BitBuffer::WriteChar), - HOOK_DEF(0x01D036C0, BitBuffer::WriteByte), - HOOK_DEF(0x01D036D0, BitBuffer::WriteShort), - HOOK_DEF(0x01D036E0, BitBuffer::WriteWord), - HOOK_DEF(0x01D036F0, BitBuffer::WriteLong), - HOOK_DEF(0x01D03700, BitBuffer::WriteFloat), - HOOK_DEF(0x01D03730, BitBuffer::WriteString), - HOOK_DEF(0x01D03D50, BitBuffer::WriteCoord), - HOOK_DEF(0x01D03840, BitBuffer::WriteBitData), // NOXREF - HOOK_DEF(0x01D03870, BitBuffer::WriteAngle), // NOXREF - HOOK_DEF(0x01D038A0, BitBuffer::WriteHiresAngle), // NOXREF - HOOK_DEF(0x01D03990, BitBuffer::WriteBitAngle), // NOXREF - HOOK_DEF(0x01D03A30, BitBuffer::WriteBitString), // NOXREF - -#endif // BitBuffer_region - -#ifndef NetChannel_region - - // virtual functions - HOOK_VIRTUAL_DEF(0x01D0C7E0, NetChannel::Create), - HOOK_VIRTUAL_DEF(0x01D0DC20, NetChannel::GetTargetAddress), - HOOK_VIRTUAL_DEF(0x01D0C8C0, NetChannel::Close), - HOOK_VIRTUAL_DEF(0x01D0C6E0, NetChannel::Clear), - HOOK_VIRTUAL_DEF(0x01D0C650, NetChannel::Reset), - HOOK_VIRTUAL_DEF(0x01D0DC40, NetChannel::IsConnected), - HOOK_VIRTUAL_DEF(0x01D0C8F0, NetChannel::IsReadyToSend), - HOOK_VIRTUAL_DEF(0x01D0DD60, NetChannel::IsCrashed), - HOOK_VIRTUAL_DEF(0x01D0DC70, NetChannel::IsTimedOut), - HOOK_VIRTUAL_DEF(0x01D0DC30, NetChannel::IsFakeChannel), - HOOK_VIRTUAL_DEF(0x01D0DC10, NetChannel::KeepAlive), - HOOK_VIRTUAL_DEF(0x01D0DB90, NetChannel::SetRate), - - HOOK_VIRTUAL_DEF(0x01D0D9F0, NetChannel::SetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D0DC50, NetChannel::SetTimeOut), - HOOK_VIRTUAL_DEF(0x01D0DC00, NetChannel::SetKeepAlive), - HOOK_VIRTUAL_DEF(0x01D0DCB0, NetChannel::GetIdleTime), - HOOK_VIRTUAL_DEF(0x01D0DCC0, NetChannel::GetRate), - HOOK_VIRTUAL_DEF(0x01D0DCD0, NetChannel::GetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D0DCE0, NetChannel::GetLoss), - - HOOK_VIRTUAL_DEF(0x01D0C9E0, NetChannel::TransmitOutgoing), - HOOK_VIRTUAL_DEF(0x01D0D130, NetChannel::ProcessIncoming), - HOOK_VIRTUAL_DEF(0x01D0DCF0, NetChannel::FakeAcknowledgement), - HOOK_VIRTUAL_DEF(0x01D0C480, NetChannel::OutOfBandPrintf), - - // non-virtual functions - HOOK_DEF(0x01D0C400, NetChannel::UnlinkFragment), - HOOK_DEF(0x01D0C530, NetChannel::ClearFragbufs), - HOOK_DEF(0x01D0C560, NetChannel::ClearFragments), - HOOK_DEF(0x01D0C5D0, NetChannel::FlushIncoming), - HOOK_DEF(0x01D0C910, NetChannel::UpdateFlow), - HOOK_DEF(0x01D0D030, NetChannel::FindBufferById), - HOOK_DEF(0x01D0D090, NetChannel::CheckForCompletion), - HOOK_DEF(0x01D0D620, NetChannel::FragSend), - HOOK_DEF(0x01D0D670, NetChannel::AddBufferToList), - HOOK_DEF(0x01D0D6C0, NetChannel::CreateFragmentsFromBuffer), - HOOK_DEF(0x01D0DD20, NetChannel::CreateFragmentsFromFile), - HOOK_DEF(0x01D0D970, NetChannel::AddFragbufToTail), - HOOK_DEF(0x01D0D9B0, NetChannel::GetPacket), - HOOK_DEF(0x01D0D9C0, NetChannel::FreePacket), - HOOK_DEF(0x01D0DA30, NetChannel::CopyNormalFragments), - HOOK_DEF(0x01D0DBD0, NetChannel::GetFlowStats), - HOOK_DEF(0x01D0DBC0, NetChannel::SetConnected), // NOXREF - HOOK_DEF(0x01D0DD70, NetChannel::CopyFileFragments), // NOXREF - -#endif // NetChannel_region - -#ifndef Master_region - - // virtual functions - HOOK_VIRTUAL_DEF(0x01D0A480, Master::Init), - HOOK_VIRTUAL_DEF(0x01D0A490, Master::RunFrame), - HOOK_VIRTUAL_DEF(0x01D0A4B0, Master::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D0A500, Master::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D0A510, Master::GetType), - HOOK_VIRTUAL_DEF(0x01D0A550, Master::ShutDown), - - //HOOK_DEF(0x0, Master::InitializeSteam), // NOXREF - HOOK_DEF(0x01D0A230, Master::CMD_Heartbeat), - HOOK_DEF(0x01D0A260, Master::CMD_NoMaster), - HOOK_DEF(0x01D0A350, Master::CMD_ListMaster), - HOOK_DEF(0x01D0A3E0, Master::SendShutdown), - -#endif // Master_region - -#ifndef DemoFile_region - - HOOK_DEF(0x01D04F60, MethodThunk::Destructor), - HOOK_DEF(0x01D04F10, MethodThunk::Constructor), - - HOOK_DEF(0x01D06380, DemoFile::Init), - HOOK_DEF(0x01D059D0, DemoFile::LoadDemo), - HOOK_DEF(0x01D05D30, DemoFile::StopPlayBack), - HOOK_DEF(0x01D056B0, DemoFile::StartRecording), - HOOK_DEF(0x01D04FC0, DemoFile::CloseFile), - HOOK_DEF(0x01D04F70, DemoFile::Reset), - HOOK_DEF(0x01D06370, DemoFile::SetContinuous), // NOXREF - HOOK_DEF(0x01D06360, DemoFile::IsContinuous), // NOXREF - HOOK_DEF(0x01D059C0, DemoFile::IsPlaying), - HOOK_DEF(0x01D04FB0, DemoFile::IsRecording), - HOOK_DEF(0x01D06350, DemoFile::GetFileName), - HOOK_DEF(0x01D05D60, DemoFile::ReadDemoPacket), - HOOK_DEF(0x01D053B0, DemoFile::WriteDemoMessage), - HOOK_DEF(0x01D05500, DemoFile::WriteUpdateClientData), - HOOK_DEF(0x01D055B0, DemoFile::GetDemoTime), - HOOK_DEF(0x01D06260, DemoFile::ReadSequenceInfo), - HOOK_DEF(0x01D06220, DemoFile::ReadDemoInfo), - HOOK_DEF(0x01D052B0, DemoFile::WriteDemoStartup), - HOOK_DEF(0x01D051C0, DemoFile::WriteSequenceInfo), - HOOK_DEF(0x01D05190, DemoFile::WriteDemoInfo), - HOOK_DEF(0x01D055D0, DemoFile::WriteSignonData), - -#endif // DemoFile_region - -#ifndef DemoClient_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D04E30, DemoClient::Init), - HOOK_VIRTUAL_DEF(0x01D04E40, DemoClient::RunFrame), - HOOK_VIRTUAL_DEF(0x01D04EB0, DemoClient::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D04EC0, DemoClient::GetType), - HOOK_VIRTUAL_DEF(0x01D04F00, DemoClient::ShutDown), - - // IClient - HOOK_VIRTUAL_DEF(0x01D04810, DemoClient::Connect), - HOOK_VIRTUAL_DEF(0x01D04D30, DemoClient::Send), - HOOK_VIRTUAL_DEF(0x01D04BE0, DemoClient::Disconnect), - HOOK_VIRTUAL_DEF(0x01D04800, DemoClient::Reconnect), - HOOK_VIRTUAL_DEF(0x01D04D90, DemoClient::SetWorld), - HOOK_VIRTUAL_DEF(0x01D047F0, DemoClient::GetClientType), - HOOK_VIRTUAL_DEF(0x01D04D60, DemoClient::GetClientName), - HOOK_VIRTUAL_DEF(0x01D04D70, DemoClient::GetUserInfo), - HOOK_VIRTUAL_DEF(0x01D04CE0, DemoClient::GetAddress), - HOOK_VIRTUAL_DEF(0x01D04BD0, DemoClient::IsActive), - HOOK_VIRTUAL_DEF(0x01D047C0, DemoClient::IsHearingVoices), - HOOK_VIRTUAL_DEF(0x01D047D0, DemoClient::HasChatEnabled), - - HOOK_DEF(0x01D04990, DemoClient::SendDatagram), - HOOK_DEF(0x01D04A30, DemoClient::WriteDatagram), - HOOK_DEF(0x01D04C70, DemoClient::FinishDemo), - HOOK_DEF(0x01D04D80, DemoClient::SetProxy), - HOOK_DEF(0x01D04DA0, DemoClient::SetFileName), - HOOK_DEF(0x01D04DD0, DemoClient::GetDemoFile), - -#endif // DemoClient_region - -#ifndef Director_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D07BC0, Director::Init), - HOOK_VIRTUAL_DEF(0x01D07BD0, Director::RunFrame), - HOOK_VIRTUAL_DEF(0x01D07BE0, Director::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D07BF0, Director::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D07C40, Director::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D07C50, Director::GetType), - HOOK_VIRTUAL_DEF(0x01D07C90, Director::ShutDown), - - // IDirector - HOOK_VIRTUAL_DEF(0x01D068C0, Director::NewGame), - HOOK_VIRTUAL_DEF(0x01D068B0, Director::GetModName), - HOOK_VIRTUAL_DEF(0x01D06E10, Director::WriteCommands), - HOOK_VIRTUAL_DEF(0x01D07A60, Director::AddCommand), - HOOK_VIRTUAL_DEF(0x01D07B50, Director::RemoveCommand), - HOOK_VIRTUAL_DEF(0x01D07B60, Director::GetLastCommand), - HOOK_VIRTUAL_DEF(0x01D07B40, Director::GetCommands), - - // Director - HOOK_DEF(0x01D07910, Director::FindBestEvent), - HOOK_DEF(0x01D07690, Director::ExecuteDirectorCommands), - HOOK_DEF(0x01D07420, Director::RandomizeCommand), - HOOK_DEF(0x01D07280, Director::GetClosestPlayer), - HOOK_DEF(0x01D06EC0, Director::AddEvent), - HOOK_DEF(0x01D06B50, Director::SmoothRank), - HOOK_DEF(0x01D06C40, Director::AnalysePlayer), - HOOK_DEF(0x01D06980, Director::AnalyseFrame), - HOOK_DEF(0x01D073E0, Director::ClearDirectorCommands), - HOOK_DEF(0x01D07110, Director::AddBestMODCut), - HOOK_DEF(0x01D06F00, Director::AddBestGenericCut), - HOOK_DEF(0x01D06EA0, Director::WriteSignonData), - //HOOK_DEF(0x0, Director::WriteProxyStatus), // NOXREF - HOOK_DEF(0x01D07830, Director::CMD_SlowMotion), - -#endif // Director_region - -#ifndef DirectorCmd_region - - HOOK_DEF(0x01D07D00, DirectorCmd::GetEventData), - HOOK_DEF(0x01D07D50, DirectorCmd::GetModeData), - HOOK_DEF(0x01D07D80, DirectorCmd::GetChaseData), - HOOK_DEF(0x01D07DD0, DirectorCmd::GetInEyeData), - HOOK_DEF(0x01D07E00, DirectorCmd::GetMapData), - HOOK_DEF(0x01D07E50, DirectorCmd::GetCameraData), - HOOK_DEF(0x01D07EE0, DirectorCmd::GetCamPathData), - HOOK_DEF(0x01D07F70, DirectorCmd::GetSoundData), - HOOK_DEF(0x01D07FB0, DirectorCmd::GetTime), // NOXREF - HOOK_DEF(0x01D07FC0, DirectorCmd::GetType), - HOOK_DEF(0x01D07FD0, DirectorCmd::GetName), // NOXREF - HOOK_DEF(0x01D07FE0, DirectorCmd::GetTimeScaleData), - HOOK_DEF(0x01D08010, DirectorCmd::GetWayPointsData), - HOOK_DEF(0x01D08040, DirectorCmd::GetMessageData), - HOOK_DEF(0x01D080E0, DirectorCmd::GetStatusData), - HOOK_DEF(0x01D08130, DirectorCmd::GetBannerData), - HOOK_DEF(0x01D08170, DirectorCmd::GetStuffTextData), - HOOK_DEF(0x01D081B0, DirectorCmd::SetEventData), - HOOK_DEF(0x01D081F0, DirectorCmd::SetChaseData), // NOXREF - HOOK_DEF(0x01D08240, DirectorCmd::SetInEyeData), // NOXREF - HOOK_DEF(0x01D08270, DirectorCmd::SetMapData), // NOXREF - HOOK_DEF(0x01D082B0, DirectorCmd::SetStartData), // NOXREF - HOOK_DEF(0x01D082C0, DirectorCmd::SetModeData), // NOXREF - HOOK_DEF(0x01D082F0, DirectorCmd::SetCameraData), // NOXREF - HOOK_DEF(0x01D08370, DirectorCmd::SetCamPathData), // NOXREF - HOOK_DEF(0x01D083F0, DirectorCmd::SetSoundData), - HOOK_DEF(0x01D08440, DirectorCmd::SetTimeScaleData), - HOOK_DEF(0x01D08470, DirectorCmd::SetTime), - HOOK_DEF(0x01D08480, DirectorCmd::SetMessageData), - HOOK_DEF(0x01D08520, DirectorCmd::Copy), // NOXREF - HOOK_DEF(0x01D08570, DirectorCmd::SetStatusData), - HOOK_DEF(0x01D085B0, DirectorCmd::SetBannerData), - HOOK_DEF(0x01D085F0, DirectorCmd::SetStuffTextData), // NOXREF - HOOK_DEF(0x01D08630, DirectorCmd::SetWayPoints), // NOXREF - HOOK_DEF(0x01D08660, DirectorCmd::ReadFromStream), // NOXREF - HOOK_DEF(0x01D088C0, DirectorCmd::WriteToStream), - HOOK_DEF(0x01D08920, DirectorCmd::ToString), // NOXREF - HOOK_DEF(0x01D08D50, DirectorCmd::FromString), // NOXREF - HOOK_DEF(0x01D08D60, DirectorCmd::Clear), - HOOK_DEF(0x01D08D70, DirectorCmd::Resize), - -#endif // DirectorCmd_region - -#ifndef Status_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D178A0, Status::Init), - HOOK_VIRTUAL_DEF(0x01D178B0, Status::RunFrame), - HOOK_VIRTUAL_DEF(0x01D178D0, Status::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D17920, Status::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D17930, Status::GetType), - HOOK_VIRTUAL_DEF(0x01D17970, Status::ShutDown), - -#endif // Status_region - -#ifndef InfoString_region - - HOOK_DEF(0x01D09590, MethodThunk::Destructor), - HOOK_DEF(0x01D094F0, (MethodThunk::Constructor), void()), - HOOK_DEF(0x01D09510, (MethodThunk::Constructor), void(unsigned int)), - HOOK_DEF(0x01D09540, (MethodThunk::Constructor), void(char *)), - HOOK_DEF(0x01D09480, (MethodThunk::Constructor), void(char *, unsigned int)), - - HOOK_DEF(0x01D095B0, InfoString::SetString), - HOOK_DEF(0x01D09600, InfoString::SetMaxSize), - HOOK_DEF(0x01D09660, InfoString::GetMaxSize), - HOOK_DEF(0x01D09670, InfoString::GetCurrentSize), - HOOK_DEF(0x01D09690, InfoString::Clear), - HOOK_DEF(0x01D096B0, InfoString::GetString), - HOOK_DEF(0x01D096C0, InfoString::ValueForKey), - HOOK_DEF(0x01D097B0, InfoString::RemoveKey), - HOOK_DEF(0x01D09880, InfoString::RemovePrefixedKeys), - HOOK_DEF(0x01D09900, InfoString::SetValueForStarKey), - HOOK_DEF(0x01D09AB0, InfoString::SetValueForKey), - -#endif // InfoString_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Proxy/hooklist.h b/rehlds/hookers/HLTV/Proxy/hooklist.h deleted file mode 100644 index d030ec9..0000000 --- a/rehlds/hookers/HLTV/Proxy/hooklist.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef HOOK_HLTV - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -#define rehlds_syserror HLTV_SysError - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Proxy/main.cpp b/rehlds/hookers/HLTV/Proxy/main.cpp deleted file mode 100644 index a1528c3..0000000 --- a/rehlds/hookers/HLTV/Proxy/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "precompiled.h" - -#if defined(HOOK_HLTV) -#define ORIGINAL_PROXY_DLL_NAME "proxy2.dll" - -CSysModule *g_pOriginalProxyModule = NULL; -CreateInterfaceFn g_OriginalProxyFactory = NULL; -ISystemModule *g_pOriginalProxy = NULL; - -IBaseInterface *CreateProxyInterface() -{ - if (g_pOriginalProxy) { - return g_pOriginalProxy; - } - - if (g_pOriginalProxyModule) - { - g_OriginalProxyFactory = Sys_GetFactory(g_pOriginalProxyModule); - if (g_OriginalProxyFactory) - { - int returnCode = 0; - g_pOriginalProxy = reinterpret_cast(g_OriginalProxyFactory(PROXY_INTERFACE_VERSION, &returnCode)); - return g_pOriginalProxy; - } - } - - return NULL; -} - -InterfaceReg iface = InterfaceReg(CreateProxyInterface, PROXY_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalProxyModule = Sys_LoadModule(ORIGINAL_PROXY_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_PROXY_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hltv.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalProxyModule) - { - Sys_UnloadModule(g_pOriginalProxyModule); - g_pOriginalProxyModule = NULL; - g_OriginalProxyFactory = NULL; - g_pOriginalProxy = NULL; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_HLTV) diff --git a/rehlds/hookers/filesystem/hooklist.cpp b/rehlds/hookers/filesystem/hooklist.cpp deleted file mode 100644 index 7fb0b2d..0000000 --- a/rehlds/hookers/filesystem/hooklist.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define BaseFileSystem_region -//#define CUtlSymbol_Region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - -#ifdef _WIN32 - HOOK_SYMBOLDEF(0x01D06F5E, "_malloca", malloc_wrapper), - HOOK_SYMBOLDEF(0x01D067CA, "_free", free_wrapper), - HOOK_SYMBOLDEF(0x01D07098, "realloc", realloc_wrapper), - HOOK_SYMBOLDEF(0x01D06F70, "__nh_malloc", __nh_malloc_wrapper), -#endif //_WIN32 - -#endif // Mem_region - -#ifndef BaseFileSystem_region - - HOOK_DEF(0x01D01080, MethodThunk::Destructor), - HOOK_DEF(0x01D01010, (MethodThunk::Constructor)), - - // virtual functions - CFileSystem_Stdio - HOOK_VIRTUAL_DEF(0x01D05340, CFileSystem_Stdio::Mount), - HOOK_VIRTUAL_DEF(0x01D011C0, CFileSystem_Stdio::Unmount), - HOOK_VIRTUAL_DEF(0x01D05510, CFileSystem_Stdio::GetLocalCopy), - HOOK_VIRTUAL_DEF(0x01D05520, CFileSystem_Stdio::LogLevelLoadStarted), - HOOK_VIRTUAL_DEF(0x01D05530, CFileSystem_Stdio::LogLevelLoadFinished), - HOOK_VIRTUAL_DEF(0x01D05540, CFileSystem_Stdio::HintResourceNeed), - HOOK_VIRTUAL_DEF(0x01D05550, CFileSystem_Stdio::PauseResourcePreloading), - HOOK_VIRTUAL_DEF(0x01D05560, CFileSystem_Stdio::ResumeResourcePreloading), - HOOK_VIRTUAL_DEF(0x01D05570, CFileSystem_Stdio::SetVBuf), - HOOK_VIRTUAL_DEF(0x01D055B0, CFileSystem_Stdio::GetInterfaceVersion), - HOOK_VIRTUAL_DEF(0x01D055D0, CFileSystem_Stdio::WaitForResources), - HOOK_VIRTUAL_DEF(0x01D055E0, CFileSystem_Stdio::GetWaitForResourcesProgress), - HOOK_VIRTUAL_DEF(0x01D05600, CFileSystem_Stdio::CancelWaitForResources), - HOOK_VIRTUAL_DEF(0x01D05610, CFileSystem_Stdio::IsAppReadyForOfflinePlay), - - // virtual functions - BaseFileSystem - HOOK_SYMBOL_VIRTUAL_EX(0x01D01AF0, CFileSystem_Stdio, Open), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01CC0, CFileSystem_Stdio, OpenFromCacheForRead), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01D50, CFileSystem_Stdio, Close), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01DD0, CFileSystem_Stdio, Seek), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01EA0, CFileSystem_Stdio, Tell), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01EF0, CFileSystem_Stdio, Size, size_t (FileHandle_t)), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01F30, CFileSystem_Stdio, Size, size_t (const char *)), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02310, CFileSystem_Stdio, IsOk), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02370, CFileSystem_Stdio, Flush), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02150, CFileSystem_Stdio, EndOfFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D021E0, CFileSystem_Stdio, Read), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02240, CFileSystem_Stdio, Write), - HOOK_SYMBOL_VIRTUAL_EX(0x01D023B0, CFileSystem_Stdio, ReadLine), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02290, CFileSystem_Stdio, FPrintf), - HOOK_SYMBOL_VIRTUAL_EX(0x01D022F0, CFileSystem_Stdio, GetReadBuffer), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02300, CFileSystem_Stdio, ReleaseReadBuffer), - HOOK_SYMBOL_VIRTUAL_EX(0x01D012B0, CFileSystem_Stdio, GetCurrentDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D012B0, CFileSystem_Stdio, GetCurrentDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D011D0, CFileSystem_Stdio, CreateDirHierarchy), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01680, CFileSystem_Stdio, IsDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D024A0, CFileSystem_Stdio, GetLocalPath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02400, CFileSystem_Stdio, RemoveFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D042B0, CFileSystem_Stdio, RemoveAllSearchPaths), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01320, CFileSystem_Stdio, AddSearchPath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D014E0, CFileSystem_Stdio, RemoveSearchPath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01AA0, CFileSystem_Stdio, FileExists), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04000, CFileSystem_Stdio, GetFileTime), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04060, CFileSystem_Stdio, FileTimeToString), - HOOK_SYMBOL_VIRTUAL_EX(0x01D036B0, CFileSystem_Stdio, FindFirst), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03DB0, CFileSystem_Stdio, FindNext), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03DF0, CFileSystem_Stdio, FindIsDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03E10, CFileSystem_Stdio, FindClose), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03EF0, CFileSystem_Stdio, ParseFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04130, CFileSystem_Stdio, FullPathToRelativePath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D012A0, CFileSystem_Stdio, PrintOpenedFiles), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04090, CFileSystem_Stdio, SetWarningFunc), - HOOK_SYMBOL_VIRTUAL_EX(0x01D040A0, CFileSystem_Stdio, SetWarningLevel), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02A20, CFileSystem_Stdio, AddPackFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01300, CFileSystem_Stdio, AddSearchPathNoWrite), - - // non-virtual functions - BaseFileSystem - HOOK_DEF(0x01D02780, CBaseFileSystem::Trace_FOpen), - HOOK_DEF(0x01D028A0, CBaseFileSystem::Trace_FClose), - HOOK_DEF(0x01D029E0, CBaseFileSystem::Trace_DumpUnclosedFiles), - HOOK_DEF(0x01D01340, CBaseFileSystem::AddSearchPathInternal), - HOOK_DEF(0x01D040B0, CBaseFileSystem::Warning), - HOOK_DEF(0x01D04350, CBaseFileSystem::FixSlashes), - HOOK_DEF(0x01D04370, CBaseFileSystem::FixPath), - //HOOK_DEF(0x01D04320, CBaseFileSystem::StripFilename), // NOXREF - HOOK_DEF(0x01D01610, CBaseFileSystem::GetWritePath), - HOOK_DEF(0x01D01790, CBaseFileSystem::FindFile), - HOOK_DEF(0x01D01F70, CBaseFileSystem::FastFindFileSize), - //HOOK_DEF(0x01D034B0, CBaseFileSystem::RemoveAllMapSearchPaths), // NOXREF - HOOK_DEF(0x01D033A0, CBaseFileSystem::AddPackFiles), - HOOK_DEF(0x01D02A40, CBaseFileSystem::AddPackFileFromPath), - HOOK_DEF(0x01D02D20, CBaseFileSystem::PreparePackFile), - HOOK_DEF(0x01D03070, CBaseFileSystem::Prepare64BitPackFile), - HOOK_DEF(0x01D03510, CBaseFileSystem::SearchPakFile), - //HOOK_DEF(0x01D039B0, CBaseFileSystem::FileInSearchPaths), // NOXREF - HOOK_DEF(0x01D03B70, CBaseFileSystem::FindNextFileHelper), - HOOK_DEF(0x01D03890, CBaseFileSystem::FindFirstHelper), - -#endif // BaseFileSystem_region - -#ifndef CUtlSymbol_Region - - //HOOK_DEF(0x01D05AA0, MethodThunk::Destructor), // NOXREF - HOOK_DEF(0x01D05A30, (MethodThunk::Constructor), void(int, int, bool)), - HOOK_DEF(0x01D05C50, CUtlSymbolTable::AddString), - HOOK_DEF(0x01D05B10, CUtlSymbolTable::Find), - HOOK_DEF(0x01D05DA0, CUtlSymbolTable::String), - //HOOK_DEF(0x0, CUtlSymbolTable::RemoveAll), // NOXREF - HOOK_DEF(0x01D05960, CUtlSymbolTable::SymLess), - HOOK_DEF(0x01D059E0, CUtlSymbolTable::SymLessi), - - HOOK_DEF(0x01D05890, (MethodThunk::Constructor), void(const char *)), - HOOK_DEF(0x01D05830, CUtlSymbol::Initialize), // Don't touch it - HOOK_DEF(0x01D05880, CUtlSymbol::CurrTable), // Don't touch it - HOOK_DEF(0x01D058C0, CUtlSymbol::String), - //HOOK_DEF(0x01D058E0, CUtlSymbol::operator==, bool (const char *) const), // NOXREF - -#endif // CUtlSymbol_Region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - - //GLOBALVAR_LINK(0x01D1B020, "CBaseFileSystem::s_pFileSystem", CBaseFileSystem::s_pFileSystem), - GLOBALVAR_LINK(0x01D1B0B8, "g_LessCtx", pg_LessCtx), - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; diff --git a/rehlds/hookers/filesystem/hooklist.h b/rehlds/hookers/filesystem/hooklist.h deleted file mode 100644 index 7b28577..0000000 --- a/rehlds/hookers/filesystem/hooklist.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#pragma once - -#ifdef HOOK_FILESYSTEM - -#define rehlds_syserror FileSystem_SysError -#define g_LessCtx (*pg_LessCtx) - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -extern struct LessCtx_t g_LessCtx; - -#endif // HOOK_FILESYSTEM diff --git a/rehlds/hookers/filesystem/main.cpp b/rehlds/hookers/filesystem/main.cpp deleted file mode 100644 index 4a9fd7c..0000000 --- a/rehlds/hookers/filesystem/main.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#if defined(HOOK_FILESYSTEM) - -const char *ORIGINAL_FILESYSTEM_DLL_NAME = "filesystem_stdio2.dll"; - -CSysModule *g_pOriginalFileSystemModule = nullptr; -CreateInterfaceFn g_OriginalFileSystemFactory = nullptr; -IFileSystem *g_pOriginalFileSystem = nullptr; - -IBaseInterface *CreateFileSystemInterface() -{ - if (g_pOriginalFileSystem) { - return g_pOriginalFileSystem; - } - - if (g_pOriginalFileSystemModule) - { - g_OriginalFileSystemFactory = (CreateInterfaceFn)Sys_GetFactory(g_pOriginalFileSystemModule); - - if (g_OriginalFileSystemFactory) - { - int returnCode = 0; - g_pOriginalFileSystem = (IFileSystem *)g_OriginalFileSystemFactory(FILESYSTEM_INTERFACE_VERSION, &returnCode); - return g_pOriginalFileSystem; - } - } - - return nullptr; -} - -EXPOSE_INTERFACE_FN(CreateFileSystemInterface, IFileSystem, FILESYSTEM_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalFileSystemModule = (CSysModule *)LoadLibrary(ORIGINAL_FILESYSTEM_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_FILESYSTEM_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hlds.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalFileSystemModule) - { - Sys_UnloadModule(g_pOriginalFileSystemModule); - g_pOriginalFileSystemModule = nullptr; - - g_OriginalFileSystemFactory = nullptr; - g_pOriginalFileSystem = nullptr; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_FILESYSTEM) diff --git a/rehlds/hookers/helper.h b/rehlds/hookers/helper.h deleted file mode 100644 index 926d551..0000000 --- a/rehlds/hookers/helper.h +++ /dev/null @@ -1,163 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#if defined(HOOK_HLTV) || defined(HOOK_FILESYSTEM) - -#define private public -#define protected public - -template -class MethodThunk { -public: - void Constructor(TArgs ... args) { - new(this) T(args ...); - } - - void Destructor() { - (*(T *)this).~T(); - } -}; - -namespace MsvcMethod { - namespace Detail { - using Counter = std::size_t(*)(); - - template - std::size_t GetIndex() { - return N; - } - - template - constexpr auto GenerateCounters_Helper(std::index_sequence) { - // There is no make_array (and/or deduction guides), so we need to explicitly define array template params - return std::array { &GetIndex ... }; - } - - template - auto counters = GenerateCounters_Helper(std::make_index_sequence{}); - - struct VIndexGetter {}; - struct ThisGetter { - decltype(auto) GetThis() const { - return this; - } - - decltype(auto) GetThis(...) const { - return this; - } - }; - - template - class Singleton { - public: - static T &GetInstance() { - static T instance = {}; - return instance; - } - }; - - // primary template - template - struct is_variadic_function : std::false_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - - template - constexpr bool is_variadic_function_v = is_variadic_function::value; - - template - constexpr bool is_function_v = std::is_function::value; - } // namespace Detail - - static constexpr auto& counters = Detail::counters<256>; - - template - std::enable_if_t, std::uintptr_t> - GetVirtualIndex(TMethod T::*method) - { - decltype(auto) pcounters = counters.data(); - decltype(auto) vIndexGetter = (Detail::VIndexGetter *)&pcounters; - - using VIndexGetterFunction = std::conditional_t, std::size_t (Detail::VIndexGetter::*)(...) const, std::size_t(Detail::VIndexGetter::*)() const>; - VIndexGetterFunction vIndexGetterFunction; - { - *(std::uintptr_t *)&vIndexGetterFunction = *(std::uintptr_t *)&method; - } - - return (vIndexGetter->*vIndexGetterFunction)(); - } - - template - TMethod &declmethod(TMethod T::*method); - - template - std::enable_if_t, std::uintptr_t> - GetVirtualAddress(TMethod T::*method) - { - using ThisGetterFunction = std::conditional_t, const T *(T::*)(...) const, const T *(T::*)() const>; - ThisGetterFunction thisGetterFunction = *(ThisGetterFunction *)&method; - { - decltype(auto) m = static_cast, const Detail::ThisGetter *(Detail::ThisGetter::*)(...) const, const Detail::ThisGetter *(Detail::ThisGetter::*)() const>>(&Detail::ThisGetter::GetThis); - *(std::uintptr_t *)&thisGetterFunction = *(std::uintptr_t *)&m; - } - - return *(*(std::uintptr_t **)(Detail::Singleton::GetInstance().*thisGetterFunction)() + GetVirtualIndex(method)); - } - - template - std::enable_if_t, std::uintptr_t> - GetAddress(TMethod (T::*method)) { - return (std::uintptr_t &)method; - } - - template - std::enable_if_t, std::uintptr_t> - GetAddress(TMethod (*method)) { - return (std::uintptr_t &)method; - } - -} // namespace MsvcMethod - -#ifdef _MSC_VER - #define GLOBALVAR_LINK(offset, symbol, var, ...) { offset, #symbol, (size_t)&##var, __VA_ARGS__ } - #define HOOK_SYMBOLDEF(offset, symbol, func, ...) { offset, #symbol, MsvcMethod::GetAddress<__VA_ARGS__>(&func) } - #define HOOK_SYMBOL_VIRTUAL_DEF(offset, symbol, func, ...) { offset, #symbol, MsvcMethod::GetVirtualAddress<__VA_ARGS__>(&func) } - #define HOOK_SYMBOL_VIRTUAL_EX(offset, class, func, ...) { offset, #class#func, MsvcMethod::GetVirtualAddress(&class::func))>::type, class>(&class::func) } - - #define HOOK_DEF(offset, func, ...) HOOK_SYMBOLDEF(offset, func, func, __VA_ARGS__) - #define HOOK_VIRTUAL_DEF(offset, func, ...) HOOK_SYMBOL_VIRTUAL_DEF(offset, func, func, __VA_ARGS__) - -#else - #error Hooking stuff is only available using MSVC compiler. -#endif // _MSC_VER - -#endif // #if defined(HOOK_HLTV) || defined(HOOK_FILESYSTEM) diff --git a/rehlds/hookers/hooker.cpp b/rehlds/hookers/hooker.cpp deleted file mode 100644 index 1fce842..0000000 --- a/rehlds/hookers/hooker.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -Module g_Module = { NULL, NULL, NULL, NULL }; - -// Offset where module assumed be loaded to ajust hooks offsets. NULL for the Linux to trigger symbols searching. -#ifdef _WIN32 -const size_t g_BaseOffset = 0x01D00000; -#else -const size_t g_BaseOffset = NULL; -#endif - -void *GetOriginalFuncAddrOrDie(const char *funcName) -{ - for (FunctionHook *cfh = &g_FunctionHooks[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*) cfh->originalAddress; - } - - rehlds_syserror("%s: Could not find function '%s'", __func__, funcName); -} - -void *GetOriginalFuncAddrOrDefault(const char *funcName, void *def) -{ - for (FunctionHook *cfh = &g_FunctionHooks[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*)cfh->originalAddress; - } - - return def; -} - -void *GetFuncRefAddrOrDie(const char *funcName) -{ - for (AddressRef *cfh = &g_FunctionRefs[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*)cfh->originalAddress; - } - - rehlds_syserror("%s: Could not find function '%s'", __func__, funcName); -} - -void *GetFuncRefAddrOrDefault(const char *funcName, void *def) -{ - for (AddressRef *cfh = &g_FunctionRefs[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*)cfh->originalAddress; - } - - return def; -} - -int HookModule(const char *pszAppName, size_t addr) -{ - if (addr == NULL || !FindModuleByAddress(addr, &g_Module)) { - return (FALSE); - } - - // Find all addresses - bool success = true; - - AddressRef *refData = g_DataRefs; - while (refData->symbolName != NULL) - { - if (!GetAddress(&g_Module, (Address*)refData, g_BaseOffset)) - { -#if _DEBUG - printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex); - success = false; -#endif - } - refData++; - } - - AddressRef *refFunc = g_FunctionRefs; - while (refFunc->symbolName != NULL) - { - if (!GetAddress(&g_Module, (Address*)refFunc, g_BaseOffset)) - { -#if _DEBUG - printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex); - success = false; -#endif - } - refFunc++; - } - - FunctionHook *hookFunc = g_FunctionHooks; - while (hookFunc->handlerFunc != NULL) - { - if (!GetAddress(&g_Module, (Address*)hookFunc, g_BaseOffset)) - { -#if _DEBUG - printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex); - success = false; -#endif - } - hookFunc++; - } - - if (!success) - { -#if _DEBUG - printf("%s: failed to hook module!\n", __func__); -#endif - return (FALSE); - } - - refData = g_DataRefs; - while (refData->addressRef != NULL) - { - if (!FindDataRef(&g_Module, refData)) - return (FALSE); - refData++; - } - - refFunc = g_FunctionRefs; - while (refFunc->addressRef != NULL) - { - if (!FindDataRef(&g_Module, refFunc)) - return (FALSE); - refFunc++; - } - - hookFunc = g_FunctionHooks; - while (hookFunc->handlerFunc != NULL) - { - if (!HookFunction(&g_Module, hookFunc)) - return (FALSE); - hookFunc++; - } - - return (TRUE); -} - -#ifdef _WIN32 - -void *malloc_wrapper(size_t size) { - return malloc(size); -} - -void *realloc_wrapper(void *orig, size_t newSize) { - return realloc(orig, newSize); -} - -void free_wrapper(void *mem) { - free(mem); -} - -void *calloc_wrapper(size_t count, size_t size) { - return calloc(count, size); -} - -void *__nh_malloc_wrapper(size_t sz, int unk) { - return malloc(sz); -} - -char *strdup_wrapper(const char *s) { - return _strdup(s); -} - -#endif // _WIN32 - -void logf(const char *fmt, ...) -{ - va_list argptr; - static char string[8192]; - - va_start(argptr, fmt); - _vsnprintf(string, sizeof(string), fmt, argptr); - string[sizeof(string) - 1] = 0; - - FILE *fl = fopen("hooker.log", "a"); - fprintf(fl, "%s\n", string); - fclose(fl); -} diff --git a/rehlds/hookers/hooker.h b/rehlds/hookers/hooker.h deleted file mode 100644 index 8f5eeac..0000000 --- a/rehlds/hookers/hooker.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "osconfig.h" - -extern int HookModule(const char *pszAppName, size_t addr); -extern void *GetOriginalFuncAddrOrDie(const char *funcName); -extern void *GetOriginalFuncAddrOrDefault(const char *funcName, void *def); -extern void *GetFuncRefAddrOrDie(const char *funcName); -extern void *GetFuncRefAddrOrDefault(const char *funcName, void *def); -extern void logf(const char *fmt, ...); - -extern FunctionHook g_FunctionHooks[]; -extern AddressRef g_FunctionRefs[]; -extern AddressRef g_DataRefs[]; - -#ifdef _WIN32 - -void *malloc_wrapper(size_t size); -void *realloc_wrapper(void *orig, size_t newSize); -void free_wrapper(void *mem); -void *calloc_wrapper(size_t count, size_t size); -void *__nh_malloc_wrapper(size_t sz, int unk); -char *strdup_wrapper(const char *s); - -#endif // _WIN32 diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index 2ae61ae..d76110b 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -88,7 +88,6 @@ - true true @@ -143,6 +142,7 @@ + @@ -366,7 +366,6 @@ - @@ -448,26 +447,13 @@ + - - - true - true - true - true - - - true - true - true - true - - {792df067-9904-4579-99b9-46c17277ade3} @@ -589,7 +575,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -626,7 +612,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -665,7 +651,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -701,7 +687,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -736,7 +722,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 MaxSpeed true @@ -780,7 +766,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 MaxSpeed true diff --git a/rehlds/msvc/ReHLDS.vcxproj.filters b/rehlds/msvc/ReHLDS.vcxproj.filters index 81ac2fe..a59f265 100644 --- a/rehlds/msvc/ReHLDS.vcxproj.filters +++ b/rehlds/msvc/ReHLDS.vcxproj.filters @@ -338,8 +338,8 @@ rehlds - - rehlds + + testsuite @@ -1057,16 +1057,8 @@ engine - - rehlds + + testsuite - - - linux - - - linux - -
    \ No newline at end of file diff --git a/rehlds/public/rehlds/custom.h b/rehlds/public/rehlds/custom.h index 2116ed4..1f0089a 100644 --- a/rehlds/public/rehlds/custom.h +++ b/rehlds/public/rehlds/custom.h @@ -63,13 +63,7 @@ typedef struct resourceinfo_s typedef struct resource_s { -#ifdef HOOK_HLTV - // NOTE HLTV: array szFileName declared on 260 cell, - // this changes necessary for compatibility hookers. - char szFileName[MAX_PATH]; -#else char szFileName[MAX_QPATH]; // File name to download/precache. -#endif // HOOK_HLTV resourcetype_t type; // t_sound, t_skin, t_model, t_decal. int nIndex; // For t_decals diff --git a/rehlds/rehlds/precompiled.h b/rehlds/rehlds/precompiled.h index 5127133..de99a03 100644 --- a/rehlds/rehlds/precompiled.h +++ b/rehlds/rehlds/precompiled.h @@ -14,8 +14,6 @@ #include "static_map.h" #include "ed_strpool.h" - -#include "memory.h" #include "strtools.h" // Valve libs stuff diff --git a/rehlds/hookers/memory.cpp b/rehlds/testsuite/memory.cpp similarity index 100% rename from rehlds/hookers/memory.cpp rename to rehlds/testsuite/memory.cpp diff --git a/rehlds/hookers/memory.h b/rehlds/testsuite/memory.h similarity index 100% rename from rehlds/hookers/memory.h rename to rehlds/testsuite/memory.h diff --git a/rehlds/testsuite/testsuite.h b/rehlds/testsuite/testsuite.h index f3a912b..fc20067 100644 --- a/rehlds/testsuite/testsuite.h +++ b/rehlds/testsuite/testsuite.h @@ -15,4 +15,4 @@ const int TESTSUITE_PROTOCOL_VERSION_MAJOR = 0; void TestSuite_Init(const Module* engine, const Module* executable, const AddressRef* funcRefs); -#endif \ No newline at end of file +#endif From a0bdadd67965e97e361828cd8760317caa393900 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 16 Apr 2021 02:32:43 +0700 Subject: [PATCH 37/61] reworked windows appversion --- msvc/ReHLDS.sln | 24 + rehlds/HLTV/Console/msvc/Console.vcxproj | 15 +- rehlds/HLTV/Console/msvc/PreBuild.bat | 206 --------- rehlds/dedicated/msvc/dedicated.vcxproj | 19 +- rehlds/msvc/PreBuild.bat | 206 --------- rehlds/msvc/ReHLDS.vcxproj | 27 +- .../PreBuild.bat => version/appversion.bat} | 414 +++++++++--------- rehlds/version/msvc/version.vcxproj | 54 +++ rehlds/version/msvc/version.vcxproj.filters | 7 + 9 files changed, 308 insertions(+), 664 deletions(-) delete mode 100644 rehlds/HLTV/Console/msvc/PreBuild.bat delete mode 100644 rehlds/msvc/PreBuild.bat rename rehlds/{dedicated/msvc/PreBuild.bat => version/appversion.bat} (95%) create mode 100644 rehlds/version/msvc/version.vcxproj create mode 100644 rehlds/version/msvc/version.vcxproj.filters diff --git a/msvc/ReHLDS.sln b/msvc/ReHLDS.sln index 9b4dc41..4129d4a 100644 --- a/msvc/ReHLDS.sln +++ b/msvc/ReHLDS.sln @@ -7,6 +7,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReHLDS", "..\rehlds\msvc\Re ProjectSection(ProjectDependencies) = postProject {792DF067-9904-4579-99B9-46C17277ADE3} = {792DF067-9904-4579-99B9-46C17277ADE3} {CEB94F7C-E459-4673-AABB-36E2074396C0} = {CEB94F7C-E459-4673-AABB-36E2074396C0} + {6973DCA5-253C-4D84-B51E-187E035EAE06} = {6973DCA5-253C-4D84-B51E-187E035EAE06} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cppunitlite", "..\dep\cppunitlite\msvc\cppunitlite.vcxproj", "{CEB94F7C-E459-4673-AABB-36E2074396C0}" @@ -14,6 +15,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\dep\bzip2\msvc\bzip2.vcxproj", "{792DF067-9904-4579-99B9-46C17277ADE3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dedicated", "..\rehlds\dedicated\msvc\dedicated.vcxproj", "{D49883F3-5C5C-4B9F-B9C7-B31518F228D4}" + ProjectSection(ProjectDependencies) = postProject + {6973DCA5-253C-4D84-B51E-187E035EAE06} = {6973DCA5-253C-4D84-B51E-187E035EAE06} + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D2516ABB-21F2-4393-8CC9-2BD2D3316CD6}" ProjectSection(SolutionItems) = preProject @@ -21,6 +25,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "..\rehlds\HLTV\Console\msvc\Console.vcxproj", "{D5CAB879-D54F-456F-8592-31D549CFD1D8}" + ProjectSection(ProjectDependencies) = postProject + {6973DCA5-253C-4D84-B51E-187E035EAE06} = {6973DCA5-253C-4D84-B51E-187E035EAE06} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "..\rehlds\HLTV\Core\msvc\Core.vcxproj", "{52F752EA-73D1-422D-B805-17EF1FB20E09}" EndProject @@ -32,6 +39,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Proxy", "..\rehlds\HLTV\Pro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filesystem_stdio", "..\rehlds\filesystem\FileSystem_Stdio\msvc\filesystem_stdio.vcxproj", "{A428392F-52FB-489E-87D8-623528C7F4F9}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "version", "..\rehlds\version\msvc\version.vcxproj", "{6973DCA5-253C-4D84-B51E-187E035EAE06}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug Play|Win32 = Debug Play|Win32 @@ -134,8 +143,23 @@ Global {A428392F-52FB-489E-87D8-623528C7F4F9}.Release|Win32.Build.0 = Release|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Test Fixes|Win32.ActiveCfg = Debug|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Tests|Win32.ActiveCfg = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug Play|Win32.ActiveCfg = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug Play|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug|Win32.ActiveCfg = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release Play|Win32.ActiveCfg = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release Play|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release|Win32.ActiveCfg = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Test Fixes|Win32.ActiveCfg = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Test Fixes|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Tests|Win32.ActiveCfg = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Tests|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3225EDB9-2B71-42E4-99DB-ED6E6E2A2EC6} + EndGlobalSection EndGlobal diff --git a/rehlds/HLTV/Console/msvc/Console.vcxproj b/rehlds/HLTV/Console/msvc/Console.vcxproj index 3ecc3b6..ec6f883 100644 --- a/rehlds/HLTV/Console/msvc/Console.vcxproj +++ b/rehlds/HLTV/Console/msvc/Console.vcxproj @@ -83,6 +83,11 @@ + + + {6973dca5-253c-4d84-b51e-187e035eae06} + + {D5CAB879-D54F-456F-8592-31D549CFD1D8} Win32Proj @@ -157,10 +162,6 @@ build.always.run build.always.run - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\..\version\" "$(ProjectDir)..\..\..\") - Setup version from Git revision - @@ -193,12 +194,8 @@ build.always.run build.always.run - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\..\version\" "$(ProjectDir)..\..\..\") - Setup version from Git revision - -
    + \ No newline at end of file diff --git a/rehlds/HLTV/Console/msvc/PreBuild.bat b/rehlds/HLTV/Console/msvc/PreBuild.bat deleted file mode 100644 index 8226913..0000000 --- a/rehlds/HLTV/Console/msvc/PreBuild.bat +++ /dev/null @@ -1,206 +0,0 @@ -@setlocal enableextensions enabledelayedexpansion -@echo on -:: -:: Pre-build auto-versioning script -:: - -set srcdir=%~1 -set repodir=%~2 - -set old_version= -set version_major=0 -set version_minor=0 -set version_maintenance=0 -set version_modifed= - -set commitSHA= -set commitURL= -set commitCount=0 -set branch_name=master - -for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" -set "YYYY=%dt:~0,4%" -set "MM=%dt:~4,2%" -set "DD=%dt:~6,2%" -set "hour=%dt:~8,2%" -set "min=%dt:~10,2%" -set "sec=%dt:~12,2%" - -:: -:: Remove leading zero from MM (e.g 09 > 9) -:: -for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I - -:: -:: Index into array to get month name -:: -for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I" - -:: -:: Check for git.exe presence -:: -CALL git.exe describe >NUL 2>&1 -set errlvl="%ERRORLEVEL%" - -:: -:: Read old appversion.h, if present -:: -IF EXIST "%srcdir%\appversion.h" ( - FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( - IF %%i==#define ( - IF %%j==APP_VERSION ( - :: Remove quotes - set v=%%k - set old_version=!v:"=! - ) - ) - ) -) - -IF %errlvl% == "1" ( - echo can't locate git.exe - auto-versioning step won't be performed - - :: if we haven't appversion.h, we need to create it - IF NOT "%old_version%" == "" ( - set commitCount=0 - ) -) - -:: -:: Read major, minor and maintenance version components from Version.h -:: -IF EXIST "%srcdir%\version.h" ( - FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( - IF %%i==#define ( - IF %%j==VERSION_MAJOR set version_major=%%k - IF %%j==VERSION_MINOR set version_minor=%%k - IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k - ) - ) -) - -:: -:: Read revision and release date from it -:: -IF NOT %errlvl% == "1" ( - :: Get current branch - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO ( - set branch_name=%%i - ) - - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO ( - IF NOT [%%i] == [] ( - set commitCount=%%i - ) - ) -) - -:: -:: Get remote url repository -:: -IF NOT %errlvl% == "1" ( - - set branch_remote=origin - :: Get remote name by current branch - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( - set branch_remote=%%i - ) - :: Get remote url - FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( - set commitURL=%%i - ) - :: Get commit id - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO ( - set shafull=%%i - set commitSHA=!shafull:~0,+7! - ) - - IF [!commitURL!] == [] ( - - FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( - set commitURL=%%i - ) - - :: strip .git - if "x!commitURL:~-4!"=="x.git" ( - set commitURL=!commitURL:~0,-4! - ) - - :: append extra string - If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( - set commitURL=!commitURL!/commits/ - ) ELSE ( - set commitURL=!commitURL!/commit/ - ) - - ) ELSE ( - :: strip .git - if "x!commitURL:~-4!"=="x.git" ( - set commitURL=!commitURL:~0,-4! - ) - :: replace : to / - set commitURL=!commitURL::=/! - - :: append extra string - If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( - set commitURL=https://!commitURL!/commits/ - ) ELSE ( - set commitURL=https://!commitURL!/commit/ - ) - ) -) - -:: -:: Detect local modifications -:: -set localChanged=0 -IF NOT %errlvl% == "1" ( - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( - set localChanged=1 - ) -) - -IF [%localChanged%]==[1] ( - set version_modifed=+m -) - -:: -:: Now form full version string like 1.0.0.1 -:: - -set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed% - -:: -:: Update appversion.h if version has changed or modifications/mixed revisions detected -:: -IF NOT "%new_version%"=="%old_version%" goto _update -goto _exit - -:_update -echo Updating appversion.h, new version is "%new_version%", the old one was %old_version% - -echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" -echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" -echo // >>"%srcdir%\appversion.h" -echo // This file is generated automatically.>>"%srcdir%\appversion.h" -echo // Don't edit it.>>"%srcdir%\appversion.h" -echo // >>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" -echo // Version defines>>"%srcdir%\appversion.h" -echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h" - -echo.>>"%srcdir%\appversion.h" -echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h" -echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h" - -echo.>>"%srcdir%\appversion.h" -echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h" -echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" - -echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" - -:_exit -exit /B 0 diff --git a/rehlds/dedicated/msvc/dedicated.vcxproj b/rehlds/dedicated/msvc/dedicated.vcxproj index 34c9a39..327d295 100644 --- a/rehlds/dedicated/msvc/dedicated.vcxproj +++ b/rehlds/dedicated/msvc/dedicated.vcxproj @@ -70,12 +70,6 @@ true ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\version\" "$(ProjectDir)..\..\") - - - Setup version from Git revision - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") @@ -115,12 +109,6 @@ true ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\version\" "$(ProjectDir)..\..\") - - - Setup version from Git revision - IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") @@ -184,7 +172,12 @@ + + + {6973dca5-253c-4d84-b51e-187e035eae06} + + - + \ No newline at end of file diff --git a/rehlds/msvc/PreBuild.bat b/rehlds/msvc/PreBuild.bat deleted file mode 100644 index 61dd70d..0000000 --- a/rehlds/msvc/PreBuild.bat +++ /dev/null @@ -1,206 +0,0 @@ -@setlocal enableextensions enabledelayedexpansion -@echo off -:: -:: Pre-build auto-versioning script -:: - -set srcdir=%~1 -set repodir=%~2 - -set old_version= -set version_major=0 -set version_minor=0 -set version_maintenance=0 -set version_modifed= - -set commitSHA= -set commitURL= -set commitCount=0 -set branch_name=master - -for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" -set "YYYY=%dt:~0,4%" -set "MM=%dt:~4,2%" -set "DD=%dt:~6,2%" -set "hour=%dt:~8,2%" -set "min=%dt:~10,2%" -set "sec=%dt:~12,2%" - -:: -:: Remove leading zero from MM (e.g 09 > 9) -:: -for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I - -:: -:: Index into array to get month name -:: -for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I" - -:: -:: Check for git.exe presence -:: -CALL git.exe describe >NUL 2>&1 -set errlvl="%ERRORLEVEL%" - -:: -:: Read old appversion.h, if present -:: -IF EXIST "%srcdir%\appversion.h" ( - FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( - IF %%i==#define ( - IF %%j==APP_VERSION ( - :: Remove quotes - set v=%%k - set old_version=!v:"=! - ) - ) - ) -) - -IF %errlvl% == "1" ( - echo can't locate git.exe - auto-versioning step won't be performed - - :: if we haven't appversion.h, we need to create it - IF NOT "%old_version%" == "" ( - set commitCount=0 - ) -) - -:: -:: Read major, minor and maintenance version components from Version.h -:: -IF EXIST "%srcdir%\version.h" ( - FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( - IF %%i==#define ( - IF %%j==VERSION_MAJOR set version_major=%%k - IF %%j==VERSION_MINOR set version_minor=%%k - IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k - ) - ) -) - -:: -:: Read revision and release date from it -:: -IF NOT %errlvl% == "1" ( - :: Get current branch - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO ( - set branch_name=%%i - ) - - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO ( - IF NOT [%%i] == [] ( - set commitCount=%%i - ) - ) -) - -:: -:: Get remote url repository -:: -IF NOT %errlvl% == "1" ( - - set branch_remote=origin - :: Get remote name by current branch - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( - set branch_remote=%%i - ) - :: Get remote url - FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( - set commitURL=%%i - ) - :: Get commit id - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO ( - set shafull=%%i - set commitSHA=!shafull:~0,+7! - ) - - IF [!commitURL!] == [] ( - - FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( - set commitURL=%%i - ) - - :: strip .git - if "x!commitURL:~-4!"=="x.git" ( - set commitURL=!commitURL:~0,-4! - ) - - :: append extra string - If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( - set commitURL=!commitURL!/commits/ - ) ELSE ( - set commitURL=!commitURL!/commit/ - ) - - ) ELSE ( - :: strip .git - if "x!commitURL:~-4!"=="x.git" ( - set commitURL=!commitURL:~0,-4! - ) - :: replace : to / - set commitURL=!commitURL::=/! - - :: append extra string - If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( - set commitURL=https://!commitURL!/commits/ - ) ELSE ( - set commitURL=https://!commitURL!/commit/ - ) - ) -) - -:: -:: Detect local modifications -:: -set localChanged=0 -IF NOT %errlvl% == "1" ( - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( - set localChanged=1 - ) -) - -IF [%localChanged%]==[1] ( - set version_modifed=+m -) - -:: -:: Now form full version string like 1.0.0.1 -:: - -set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed% - -:: -:: Update appversion.h if version has changed or modifications/mixed revisions detected -:: -IF NOT "%new_version%"=="%old_version%" goto _update -goto _exit - -:_update -echo Updating appversion.h, new version is "%new_version%", the old one was %old_version% - -echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" -echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" -echo // >>"%srcdir%\appversion.h" -echo // This file is generated automatically.>>"%srcdir%\appversion.h" -echo // Don't edit it.>>"%srcdir%\appversion.h" -echo // >>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" -echo // Version defines>>"%srcdir%\appversion.h" -echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h" - -echo.>>"%srcdir%\appversion.h" -echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h" -echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h" - -echo.>>"%srcdir%\appversion.h" -echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h" -echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" - -echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" - -:_exit -exit /B 0 diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index d76110b..2078e83 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -461,6 +461,9 @@ {ceb94f7c-e459-4673-aabb-36e2074396c0} + + {6973dca5-253c-4d84-b51e-187e035eae06} + {70A2B904-B7DB-4C48-8DE0-AF567360D572} @@ -570,10 +573,6 @@ false - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 @@ -607,10 +606,6 @@ - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 @@ -646,10 +641,6 @@ - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 @@ -682,10 +673,6 @@ - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 @@ -717,10 +704,6 @@ - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 @@ -761,10 +744,6 @@ - - IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") - Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 diff --git a/rehlds/dedicated/msvc/PreBuild.bat b/rehlds/version/appversion.bat similarity index 95% rename from rehlds/dedicated/msvc/PreBuild.bat rename to rehlds/version/appversion.bat index cb4aff8..b2d4bdb 100644 --- a/rehlds/dedicated/msvc/PreBuild.bat +++ b/rehlds/version/appversion.bat @@ -1,206 +1,208 @@ -@setlocal enableextensions enabledelayedexpansion -@echo off -:: -:: Pre-build auto-versioning script -:: - -set srcdir=%~1 -set repodir=%~2 - -set old_version= -set version_major=0 -set version_minor=0 -set version_maintenance=0 -set version_modifed= - -set commitSHA= -set commitURL= -set commitCount=0 -set branch_name=master - -for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" -set "YYYY=%dt:~0,4%" -set "MM=%dt:~4,2%" -set "DD=%dt:~6,2%" -set "hour=%dt:~8,2%" -set "min=%dt:~10,2%" -set "sec=%dt:~12,2%" - -:: -:: Remove leading zero from MM (e.g 09 > 9) -:: -for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I - -:: -:: Index into array to get month name -:: -for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I" - -:: -:: Check for git.exe presence -:: -CALL git.exe describe >NUL 2>&1 -set errlvl="%ERRORLEVEL%" - -:: -:: Read old appversion.h, if present -:: -IF EXIST "%srcdir%\appversion.h" ( - FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( - IF %%i==#define ( - IF %%j==APP_VERSION ( - :: Remove quotes - set v=%%k - set old_version=!v:"=! - ) - ) - ) -) - -IF %errlvl% == "1" ( - echo can't locate git.exe - auto-versioning step won't be performed - - :: if we haven't appversion.h, we need to create it - IF NOT "%old_version%" == "" ( - set commitCount=0 - ) -) - -:: -:: Read major, minor and maintenance version components from Version.h -:: -IF EXIST "%srcdir%\version.h" ( - FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( - IF %%i==#define ( - IF %%j==VERSION_MAJOR set version_major=%%k - IF %%j==VERSION_MINOR set version_minor=%%k - IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k - ) - ) -) - -:: -:: Read revision and release date from it -:: -IF NOT %errlvl% == "1" ( - :: Get current branch - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO ( - set branch_name=%%i - ) - - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO ( - IF NOT [%%i] == [] ( - set commitCount=%%i - ) - ) -) - -:: -:: Get remote url repository -:: -IF NOT %errlvl% == "1" ( - - set branch_remote=origin - :: Get remote name by current branch - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( - set branch_remote=%%i - ) - :: Get remote url - FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( - set commitURL=%%i - ) - :: Get commit id - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO ( - set shafull=%%i - set commitSHA=!shafull:~0,+7! - ) - - IF [!commitURL!] == [] ( - - FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( - set commitURL=%%i - ) - - :: strip .git - if "x!commitURL:~-4!"=="x.git" ( - set commitURL=!commitURL:~0,-4! - ) - - :: append extra string - If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( - set commitURL=!commitURL!/commits/ - ) ELSE ( - set commitURL=!commitURL!/commit/ - ) - - ) ELSE ( - :: strip .git - if "x!commitURL:~-4!"=="x.git" ( - set commitURL=!commitURL:~0,-4! - ) - :: replace : to / - set commitURL=!commitURL::=/! - - :: append extra string - If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( - set commitURL=https://!commitURL!/commits/ - ) ELSE ( - set commitURL=https://!commitURL!/commit/ - ) - ) -) - -:: -:: Detect local modifications -:: -set localChanged=0 -IF NOT %errlvl% == "1" ( - FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( - set localChanged=1 - ) -) - -IF [%localChanged%]==[1] ( - set version_modifed=+m -) - -:: -:: Now form full version string like 1.0.0.1 -:: - -set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed% - -:: -:: Update appversion.h if version has changed or modifications/mixed revisions detected -:: -IF NOT "%new_version%"=="%old_version%" goto _update -goto _exit - -:_update -echo Updating appversion.h, new version is "%new_version%", the old one was %old_version% - -echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" -echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" -echo // >>"%srcdir%\appversion.h" -echo // This file is generated automatically.>>"%srcdir%\appversion.h" -echo // Don't edit it.>>"%srcdir%\appversion.h" -echo // >>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" -echo // Version defines>>"%srcdir%\appversion.h" -echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h" - -echo.>>"%srcdir%\appversion.h" -echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h" -echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h" - -echo.>>"%srcdir%\appversion.h" -echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h" -echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" - -echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" -echo.>>"%srcdir%\appversion.h" - -:_exit -exit /B 0 +@setlocal enableextensions enabledelayedexpansion +@echo off +:: +:: Pre-build auto-versioning script +:: + +chcp 65001 + +set srcdir=%~1 +set repodir=%~2 + +set old_version= +set version_major=0 +set version_minor=0 +set version_maintenance=0 +set version_modifed= + +set commitSHA= +set commitURL= +set commitCount=0 +set branch_name=master + +for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" +set "YYYY=%dt:~0,4%" +set "MM=%dt:~4,2%" +set "DD=%dt:~6,2%" +set "hour=%dt:~8,2%" +set "min=%dt:~10,2%" +set "sec=%dt:~12,2%" + +:: +:: Remove leading zero from MM (e.g 09 > 9) +:: +for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I + +:: +:: Index into array to get month name +:: +for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I" + +:: +:: Check for git.exe presence +:: +CALL git.exe describe >NUL 2>&1 +set errlvl="%ERRORLEVEL%" + +:: +:: Read old appversion.h, if present +:: +IF EXIST "%srcdir%\appversion.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( + IF %%i==#define ( + IF %%j==APP_VERSION ( + :: Remove quotes + set v=%%k + set old_version=!v:"=! + ) + ) + ) +) + +IF %errlvl% == "1" ( + echo can't locate git.exe - auto-versioning step won't be performed + + :: if we haven't appversion.h, we need to create it + IF NOT "%old_version%" == "" ( + set commitCount=0 + ) +) + +:: +:: Read major, minor and maintenance version components from Version.h +:: +IF EXIST "%srcdir%\version.h" ( + FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do ( + IF %%i==#define ( + IF %%j==VERSION_MAJOR set version_major=%%k + IF %%j==VERSION_MINOR set version_minor=%%k + IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k + ) + ) +) + +:: +:: Read revision and release date from it +:: +IF NOT %errlvl% == "1" ( + :: Get current branch + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO ( + set branch_name=%%i + ) + + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO ( + IF NOT [%%i] == [] ( + set commitCount=%%i + ) + ) +) + +:: +:: Get remote url repository +:: +IF NOT %errlvl% == "1" ( + + set branch_remote=origin + :: Get remote name by current branch + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO ( + set branch_remote=%%i + ) + :: Get remote url + FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( + set commitURL=%%i + ) + :: Get commit id + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO ( + set shafull=%%i + set commitSHA=!shafull:~0,+7! + ) + + IF [!commitURL!] == [] ( + + FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO ( + set commitURL=%%i + ) + + :: strip .git + if "x!commitURL:~-4!"=="x.git" ( + set commitURL=!commitURL:~0,-4! + ) + + :: append extra string + If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( + set commitURL=!commitURL!/commits/ + ) ELSE ( + set commitURL=!commitURL!/commit/ + ) + + ) ELSE ( + :: strip .git + if "x!commitURL:~-4!"=="x.git" ( + set commitURL=!commitURL:~0,-4! + ) + :: replace : to / + set commitURL=!commitURL::=/! + + :: append extra string + If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" ( + set commitURL=https://!commitURL!/commits/ + ) ELSE ( + set commitURL=https://!commitURL!/commit/ + ) + ) +) + +:: +:: Detect local modifications +:: +set localChanged=0 +IF NOT %errlvl% == "1" ( + FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO ( + set localChanged=1 + ) +) + +IF [%localChanged%]==[1] ( + set version_modifed=+m +) + +:: +:: Now form full version string like 1.0.0.1 +:: + +set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed% + +:: +:: Update appversion.h if version has changed or modifications/mixed revisions detected +:: +IF NOT "%new_version%"=="%old_version%" goto _update +goto _exit + +:_update +echo Updating appversion.h, new version is "%new_version%", the old one was %old_version% + +echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" +echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo // This file is generated automatically.>>"%srcdir%\appversion.h" +echo // Don't edit it.>>"%srcdir%\appversion.h" +echo // >>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" +echo // Version defines>>"%srcdir%\appversion.h" +echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h" + +echo.>>"%srcdir%\appversion.h" +echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h" +echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h" + +echo.>>"%srcdir%\appversion.h" +echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h" +echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" +echo.>>"%srcdir%\appversion.h" + +:_exit +exit /B 0 diff --git a/rehlds/version/msvc/version.vcxproj b/rehlds/version/msvc/version.vcxproj new file mode 100644 index 0000000..6eea1c3 --- /dev/null +++ b/rehlds/version/msvc/version.vcxproj @@ -0,0 +1,54 @@ + + + + + Release + Win32 + + + + + + + + {6973DCA5-253C-4D84-B51E-187E035EAE06} + MakeFileProj + version + version + 10.0 + + + + Makefile + false + v120 + v140 + v141 + v142 + + + + + + + + + + + + ECHO Setup version from Git revision +IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\") + + + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + echo ON +del /s $(ProjectDir)..\appversion.h >nul 2>&1 + ECHO Setup version from Git revision +IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\") + + + + + + + \ No newline at end of file diff --git a/rehlds/version/msvc/version.vcxproj.filters b/rehlds/version/msvc/version.vcxproj.filters new file mode 100644 index 0000000..b2ccc8c --- /dev/null +++ b/rehlds/version/msvc/version.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + From 2cd25fa7f8fce0911eaa325450ab5223c2af26f4 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 16 Apr 2021 02:33:32 +0700 Subject: [PATCH 38/61] Update README.md --- README.md | 67 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index eb8fb4f..15b6a41 100644 --- a/README.md +++ b/README.md @@ -15,27 +15,21 @@ You can try play on one of the servers that using rehlds: [Game Tracker](http://
## How can use it? -Rehlds is fully compatible with latest official HLDS downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information. -
Warning! Rehlds is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool. +ReHLDS is fully compatible with latest official HLDS downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information. +
Warning! ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool. -Compiled binaries are available here: [Artifact releases](https://github.com/dreamstalker/rehlds/releases) +## Downloads +* [Release builds](https://github.com/dreamstalker/rehlds/releases) +* [Dev builds](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml) -Rehlds binaries require SSE, SSE2 and SSE3 instruction sets to run and can benefit from SSE4.1 and SSE4.2. +ReHLDS binaries require `SSE`, `SSE2` and `SSE3` instruction sets to run and can benefit from `SSE4.1` and `SSE4.2` -Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' -
    -
  • 'pure' version is designed to work exactly as official hlds engine
  • -
  • 'bugfixed' version contains some fixes and improvements
  • -
- -Warning! Rehlds is not binary compatible with original hlds since it's compiled with compilers other than ones used for original hlds. This means that plugins that do binary code analysis (Orpheu for example) probably will not work with rehlds. +Warning! ReHLDS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original hlds. +This means that plugins that do binary code analysis (Orpheu for example) probably will not work with rehlds. ## Configuring -Bugfixed version of rehlds contains an additional cvars: -
Click to expand -
  • listipcfgfile // File for permanent ip bans. Default: listip.cfg
  • syserror_logfile // File for the system error log. Default: sys_error.log @@ -60,11 +54,9 @@ Bugfixed version of rehlds contains an additional cvars:
  • sv_rehlds_maxclients_from_single_ip // Limit number of connections from the single ip address. Default: 5
  • sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist.
-
## Commands -Bugfixed version of rehlds contains an additional commands
  • rescount // Prints the total count of precached resources in the server console
  • reslist <sound | model | decal | generic | event> // Separately prints the details of the precached resources for sounds, models, decals, generic and events in server console. Useful for managing resources and dealing with the goldsource precache limits. @@ -94,22 +86,47 @@ Use `Visual Studio` to build, open `msvc/ReHLDS.sln` and just select from the so #### Linux +* Optional options using `build.sh --compiler=[gcc] --jobs=[N] -D[option]=[ON or OFF]` (without square brackets) + +
    +-c=|--compiler=[icc|gcc|clang]  - Select preferred C/C++ compiler to build
    +-j=|--jobs=[N]                  - Specifies the number of jobs (commands) to run simultaneously (For faster building)
    +
    +Definitions (-D)
    +DEBUG                           - Enables debugging mode
    +USE_STATIC_LIBSTDC              - Enables static linking library libstdc++
    +
    + +* ICC
    ./build.sh --compiler=intel
    +* LLVM (Clang)
    ./build.sh --compiler=clang
    +* GCC
    ./build.sh --compiler=gcc
    + +##### Checking build environment (Debian / Ubuntu) + +
    +Click to expand +
    • -ICC: -
      ./build.sh --compiler=intel
      +Installing required packages +
      +sudo dpkg --add-architecture i386
      +sudo apt-get update
      +sudo apt-get install -y gcc-multilib g++-multilib
      +sudo apt-get install -y build-essential
      +sudo apt-get install -y libc6-dev libc6-dev-i386
      +
    • -LLVM (Clang): -
      ./build.sh --compiler=clang
      -
    • - -
    • -GCC: -
      ./build.sh --compiler=gcc
      +Select the preferred C/C++ Compiler installation +
      +1) sudo apt-get install -y gcc g++
      +2) sudo apt-get install -y clang
      +
    +
    ## How can I help the project? Just install it on your game server and report problems you faced. From 6a916d766b2f766ed9a45f9f008b3f7b737e3c89 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 17 Apr 2021 18:14:32 +0700 Subject: [PATCH 39/61] Update README.md build.yml [skip ci] --- .github/workflows/build.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c84908..02c1eda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,7 +109,7 @@ jobs: - name: Play demos run: | chown root ~ - cp -r deps/rehlds/* . + rsync -a deps/rehlds/* . mv $GITHUB_WORKSPACE/tests/swds.dll . descs=( diff --git a/README.md b/README.md index 15b6a41..32f395c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ There are several software requirements for building rehlds: #### Windows
    -Visual Studio 2013 and later
    +Visual Studio 2015 (C++14 standard) and later
     
    #### Linux From ebefe19023670548cfcdbc662d09276c22c57776 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 22 Apr 2021 02:25:10 +0700 Subject: [PATCH 40/61] workflows/build.yml: remove nuget info_tests.cpp: fix warning --- .github/workflows/build.yml | 10 ---------- rehlds/unittests/info_tests.cpp | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02c1eda..7f2d8af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,18 +29,8 @@ jobs: with: fetch-depth: 0 - - name: Setup Nuget - uses: nuget/setup-nuget@v1 - with: - nuget-api-key: ${{ secrets.NuGetAPIKey }} - nuget-version: '5.x' - - - run: nuget restore '${{ env.solution }}' - - name: Setup MSBuild uses: microsoft/setup-msbuild@v1.0.2 - with: - vs-version: '16.8' - name: Build and Run unittests run: | diff --git a/rehlds/unittests/info_tests.cpp b/rehlds/unittests/info_tests.cpp index bd8dc0c..87d0479 100644 --- a/rehlds/unittests/info_tests.cpp +++ b/rehlds/unittests/info_tests.cpp @@ -126,7 +126,7 @@ TEST(SetValueForStarKeyResult, Info, 1000) { char localInfo[256]; strcpy(localInfo, d->initialInfo); localInfo[255] = 0; - bool result = Info_SetValueForStarKey(localInfo, d->key, d->value, 256); + bool result = Info_SetValueForStarKey(localInfo, d->key, d->value, 256) ? true : false; CHECK("Invalid info string", d->success == result); } } @@ -301,7 +301,7 @@ TEST(Info_IsKeyImportant, Info, 1000) for (int i = 0; i < ARRAYSIZE(testdata); i++) { testdata_t* d = &testdata[i]; - bool result = Info_IsKeyImportant(d->key); + bool result = Info_IsKeyImportant(d->key) ? true : false; CHECK("wrong result", d->result == result); } From 9a171db348cef5b00ca21021f206338f710c1d55 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 22 Apr 2021 17:23:56 +0700 Subject: [PATCH 41/61] SV_ExecuteClientMessage: Don't handle packets when client has already dropped --- rehlds/engine/sv_user.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index f859302..168828b 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -1803,6 +1803,12 @@ void SV_ExecuteClientMessage(client_t *cl) return; g_RehldsHookchains.m_HandleNetCommand.callChain(SV_HandleClientMessage_api, apiClient, c); + +#ifdef REHLDS_FIXES + // FIXED: Don't handle remaining packets if got dropclient above + if (!cl->connected && !cl->active && !cl->spawned) + break; +#endif // REHLDS_FIXES } } From ee986f7c62e6e9c3b0dddb2c7041e188df9f0645 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 24 Apr 2021 01:13:18 +0700 Subject: [PATCH 42/61] version.vcxproj reworked [skip ci] --- msvc/ReHLDS.sln | 16 +++++++------- rehlds/version/msvc/version.vcxproj | 33 +++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/msvc/ReHLDS.sln b/msvc/ReHLDS.sln index 4129d4a..961494f 100644 --- a/msvc/ReHLDS.sln +++ b/msvc/ReHLDS.sln @@ -143,18 +143,18 @@ Global {A428392F-52FB-489E-87D8-623528C7F4F9}.Release|Win32.Build.0 = Release|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Test Fixes|Win32.ActiveCfg = Debug|Win32 {A428392F-52FB-489E-87D8-623528C7F4F9}.Tests|Win32.ActiveCfg = Debug|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug Play|Win32.ActiveCfg = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug Play|Win32.Build.0 = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug|Win32.ActiveCfg = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug Play|Win32.ActiveCfg = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug Play|Win32.Build.0 = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug|Win32.ActiveCfg = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Debug|Win32.Build.0 = Debug|Win32 {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release Play|Win32.ActiveCfg = Release|Win32 {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release Play|Win32.Build.0 = Release|Win32 {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release|Win32.ActiveCfg = Release|Win32 {6973DCA5-253C-4D84-B51E-187E035EAE06}.Release|Win32.Build.0 = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Test Fixes|Win32.ActiveCfg = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Test Fixes|Win32.Build.0 = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Tests|Win32.ActiveCfg = Release|Win32 - {6973DCA5-253C-4D84-B51E-187E035EAE06}.Tests|Win32.Build.0 = Release|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Test Fixes|Win32.ActiveCfg = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Test Fixes|Win32.Build.0 = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Tests|Win32.ActiveCfg = Debug|Win32 + {6973DCA5-253C-4D84-B51E-187E035EAE06}.Tests|Win32.Build.0 = Debug|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/rehlds/version/msvc/version.vcxproj b/rehlds/version/msvc/version.vcxproj index 6eea1c3..10f353f 100644 --- a/rehlds/version/msvc/version.vcxproj +++ b/rehlds/version/msvc/version.vcxproj @@ -1,6 +1,10 @@  - + + + Debug + Win32 + Release Win32 @@ -15,9 +19,16 @@ MakeFileProj version version - 10.0 + + Makefile + true + v120 + v140 + v141 + v142 + Makefile false @@ -31,10 +42,24 @@ + + + + + ECHO Setup version from Git revision +IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\") + + + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + echo ON +del /s "$(ProjectDir)..\appversion.h" >nul 2>&1 + ECHO Setup version from Git revision +IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\") + ECHO Setup version from Git revision IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\") @@ -42,7 +67,7 @@ IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\v WIN32;NDEBUG;$(NMakePreprocessorDefinitions) echo ON -del /s $(ProjectDir)..\appversion.h >nul 2>&1 +del /s "$(ProjectDir)..\appversion.h" >nul 2>&1 ECHO Setup version from Git revision IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\version\appversion.bat" "$(ProjectDir)..\..\version\" "$(SolutionDir)..\") @@ -51,4 +76,4 @@ IF EXIST "$(ProjectDir)..\..\version\appversion.bat" (CALL "$(ProjectDir)..\..\v - \ No newline at end of file + From 80c40ce0c00dc9526936f8bf70745f1769e5640d Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 3 May 2021 00:35:51 +0700 Subject: [PATCH 43/61] Cmd_Alias_f: fix --- rehlds/engine/cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/engine/cmd.cpp b/rehlds/engine/cmd.cpp index d76deae..7dcf76c 100644 --- a/rehlds/engine/cmd.cpp +++ b/rehlds/engine/cmd.cpp @@ -501,7 +501,7 @@ void Cmd_Alias_f(void) // Gather arguments into one string cmd[0] = 0; c = Cmd_Argc(); - for (i = 2; i <= c; i++) + for (i = 2; i < c; i++) { Q_strncat(cmd, Cmd_Argv(i), MAX_CMD_LINE - 2 - Q_strlen(cmd)); // always have a space for \n or ' ' and \0 From 2f70b6cba59a589d96c2d4e445a59d2f3e9cfc81 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 3 May 2021 00:39:06 +0700 Subject: [PATCH 44/61] SV_FatPVS/SV_FatPAS: Sanity checks, gPVSRowBytes is not used for singleplayer --- rehlds/engine/sv_main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index a34d900..904053a 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -4057,10 +4057,12 @@ void SV_AddToFatPVS(vec_t *org, mnode_t *node) unsigned char* EXT_FUNC SV_FatPVS(float *org) { #ifdef REHLDS_FIXES - fatbytes = gPVSRowBytes; -#else // REHLDS_FIXES - fatbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + if (gPVS) + fatbytes = gPVSRowBytes; + else #endif // REHLDS_FIXES + fatbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + Q_memset(fatpvs, 0, fatbytes); SV_AddToFatPVS(org, g_psv.worldmodel->nodes); return fatpvs; @@ -4112,10 +4114,12 @@ void SV_AddToFatPAS(vec_t *org, mnode_t *node) unsigned char* EXT_FUNC SV_FatPAS(float *org) { #ifdef REHLDS_FIXES - fatpasbytes = gPVSRowBytes; -#else // REHLDS_FIXES - fatpasbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + if (gPAS) + fatpasbytes = gPVSRowBytes; + else #endif // REHLDS_FIXES + fatpasbytes = (g_psv.worldmodel->numleafs + 31) >> 3; + Q_memset(fatpas, 0, fatpasbytes); SV_AddToFatPAS(org, g_psv.worldmodel->nodes); return fatpas; From 8dd3013813b4577036b59a65d9477fd868f3197b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 3 May 2021 00:41:05 +0700 Subject: [PATCH 45/61] SV_CheckBottom: Fix bug NPC movement (mistake reversing engineering) --- rehlds/engine/sv_move.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/engine/sv_move.cpp b/rehlds/engine/sv_move.cpp index 472a135..b327b35 100644 --- a/rehlds/engine/sv_move.cpp +++ b/rehlds/engine/sv_move.cpp @@ -71,7 +71,7 @@ qboolean SV_CheckBottom(edict_t *ent) realcheck: // check it for real... - start[2] = mins[2]; + start[2] = mins[2] + sv_stepsize.value; // the midpoint must be within 16 of the bottom start[0] = stop[0] = (mins[0] + maxs[0]) * 0.5f; From b0488cf08195676639de38ecc0a4329c738425d8 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 3 May 2021 00:50:25 +0700 Subject: [PATCH 46/61] Outdated maps compatibility 'Q1BSP_VERSION' for dedicated server --- rehlds/HLTV/Core/src/BSPModel.cpp | 7 ++++++- rehlds/engine/crc.cpp | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rehlds/HLTV/Core/src/BSPModel.cpp b/rehlds/HLTV/Core/src/BSPModel.cpp index 72ff7a2..15f091d 100644 --- a/rehlds/HLTV/Core/src/BSPModel.cpp +++ b/rehlds/HLTV/Core/src/BSPModel.cpp @@ -724,7 +724,12 @@ bool BSPModel::LoadFromBuffer(unsigned int *buffer, int length, const char *name header = (dheader_t *)buffer; i = _LittleLong(header->version); - if (i != HLBSP_VERSION) { + if ( +#ifdef HLTV_FIXES + i != Q1BSP_VERSION && +#endif + i != HLBSP_VERSION) + { m_System->Errorf("BSPModel::LoadFromBuffer: %s has wrong version number (%i should be %i)\n", m_model.name, i, HLBSP_VERSION); } diff --git a/rehlds/engine/crc.cpp b/rehlds/engine/crc.cpp index 6bb1f32..df6f52b 100644 --- a/rehlds/engine/crc.cpp +++ b/rehlds/engine/crc.cpp @@ -227,7 +227,11 @@ int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName) return 0; } i = LittleLong(header.version); - if (i != HLBSP_VERSION) + if ( +#ifdef REHLDS_FIXES + i != Q1BSP_VERSION && +#endif + i != HLBSP_VERSION) { Con_Printf("Map [%s] has incorrect BSP version (%i should be %i).\n", pszFileName, i, HLBSP_VERSION); FS_Close(fp); From 0c47c1c28b85254b895a71c4f565e0c3a7706b82 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 5 Jun 2021 08:21:48 +0700 Subject: [PATCH 47/61] CMakeLists.txt: Fix build with cmake 3.7.2 [skip ci] --- rehlds/CMakeLists.txt | 5 ++--- rehlds/HLTV/Console/CMakeLists.txt | 3 +-- rehlds/HLTV/Core/CMakeLists.txt | 3 +-- rehlds/HLTV/DemoPlayer/CMakeLists.txt | 3 +-- rehlds/HLTV/Director/CMakeLists.txt | 3 +-- rehlds/HLTV/Proxy/CMakeLists.txt | 3 +-- rehlds/dedicated/CMakeLists.txt | 3 +-- rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt | 6 +----- 8 files changed, 9 insertions(+), 20 deletions(-) diff --git a/rehlds/CMakeLists.txt b/rehlds/CMakeLists.txt index 2b35798..a9b371b 100644 --- a/rehlds/CMakeLists.txt +++ b/rehlds/CMakeLists.txt @@ -219,10 +219,10 @@ if (CMAKE_BUILD_TYPE MATCHES Unittests) endif() set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic") - add_executable(engine ${appversion.sh}) + add_executable(engine ${appversion.sh} ${ENGINE_SRCS}) target_link_libraries(engine PRIVATE cppunitlite) else() - add_library(engine SHARED ${appversion.sh}) + add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS}) endif() if (NOT TARGET bzip2) @@ -268,7 +268,6 @@ target_compile_definitions(engine PRIVATE ) target_sources(engine PRIVATE - ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS} diff --git a/rehlds/HLTV/Console/CMakeLists.txt b/rehlds/HLTV/Console/CMakeLists.txt index 48b637a..fae3e05 100644 --- a/rehlds/HLTV/Console/CMakeLists.txt +++ b/rehlds/HLTV/Console/CMakeLists.txt @@ -84,7 +84,7 @@ if (NOT TARGET appversion) add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../../..") endif() -add_executable(hltv ${appversion.sh}) +add_executable(hltv ${appversion.sh} ${HLTV_SRCS}) add_dependencies(hltv appversion) target_include_directories(hltv PRIVATE @@ -106,7 +106,6 @@ target_compile_definitions(hltv PRIVATE ) target_sources(hltv PRIVATE - ${HLTV_SRCS} ${COMMON_SRCS} ) diff --git a/rehlds/HLTV/Core/CMakeLists.txt b/rehlds/HLTV/Core/CMakeLists.txt index f964ff6..94c45e1 100644 --- a/rehlds/HLTV/Core/CMakeLists.txt +++ b/rehlds/HLTV/Core/CMakeLists.txt @@ -101,7 +101,7 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -add_library(core SHARED) +add_library(core SHARED ${CORE_SRCS}) target_include_directories(core PRIVATE ${PROJECT_SRC_DIR} @@ -123,7 +123,6 @@ target_compile_definitions(core PRIVATE ) target_sources(core PRIVATE - ${CORE_SRCS} ${COMMON_SRCS} ) diff --git a/rehlds/HLTV/DemoPlayer/CMakeLists.txt b/rehlds/HLTV/DemoPlayer/CMakeLists.txt index cd752a9..27feb5e 100644 --- a/rehlds/HLTV/DemoPlayer/CMakeLists.txt +++ b/rehlds/HLTV/DemoPlayer/CMakeLists.txt @@ -76,7 +76,7 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -add_library(demoplayer SHARED) +add_library(demoplayer SHARED ${DEMOPLAYER_SRCS}) target_include_directories(demoplayer PRIVATE ${PROJECT_SRC_DIR} @@ -97,7 +97,6 @@ target_compile_definitions(demoplayer PRIVATE ) target_sources(demoplayer PRIVATE - ${DEMOPLAYER_SRCS} ${COMMON_SRCS} ) diff --git a/rehlds/HLTV/Director/CMakeLists.txt b/rehlds/HLTV/Director/CMakeLists.txt index 978deeb..7f88945 100644 --- a/rehlds/HLTV/Director/CMakeLists.txt +++ b/rehlds/HLTV/Director/CMakeLists.txt @@ -77,7 +77,7 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -add_library(director SHARED) +add_library(director SHARED ${DIRECTOR_SRCS}) target_include_directories(director PRIVATE ${PROJECT_SRC_DIR} @@ -99,7 +99,6 @@ target_compile_definitions(director PRIVATE ) target_sources(director PRIVATE - ${DIRECTOR_SRCS} ${COMMON_SRCS} ) diff --git a/rehlds/HLTV/Proxy/CMakeLists.txt b/rehlds/HLTV/Proxy/CMakeLists.txt index 82c25fc..550e049 100644 --- a/rehlds/HLTV/Proxy/CMakeLists.txt +++ b/rehlds/HLTV/Proxy/CMakeLists.txt @@ -107,7 +107,7 @@ set(COMMON_SRCS "../../engine/mem.cpp" ) -add_library(proxy SHARED) +add_library(proxy SHARED ${PROXY_SRCS}) target_include_directories(proxy PRIVATE ${PROJECT_SRC_DIR} @@ -129,7 +129,6 @@ target_compile_definitions(proxy PRIVATE ) target_sources(proxy PRIVATE - ${PROXY_SRCS} ${COMMON_SRCS} ) diff --git a/rehlds/dedicated/CMakeLists.txt b/rehlds/dedicated/CMakeLists.txt index 6751db1..936734c 100644 --- a/rehlds/dedicated/CMakeLists.txt +++ b/rehlds/dedicated/CMakeLists.txt @@ -85,7 +85,7 @@ if (NOT TARGET appversion) add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") endif() -add_executable(hlds ${appversion.sh}) +add_executable(hlds ${appversion.sh} ${DEDICATED_SRCS}) add_dependencies(hlds appversion) target_include_directories(hlds PRIVATE @@ -106,7 +106,6 @@ target_compile_definitions(hlds PRIVATE ) target_sources(hlds PRIVATE - ${DEDICATED_SRCS} ${COMMON_SRCS} ) diff --git a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt index 5dc50c0..2339aae 100644 --- a/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt +++ b/rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt @@ -31,7 +31,7 @@ else() -mtune=generic -msse3\ -fpermissive -fno-sized-deallocation\ -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-result -Wno-unused-function\ - -Wno-write-strings -Wno-sign-compare") + -Wno-write-strings -Wno-sign-compare -Wno-strict-aliasing") # Check if not Clang compiler AND GCC >= 8.3 if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) @@ -95,10 +95,6 @@ target_compile_definitions(filesystem_stdio PRIVATE _unlink=unlink ) -target_sources(filesystem_stdio PRIVATE - ${FILESYSTEM_STDIO_SRCS} -) - target_link_libraries(filesystem_stdio PRIVATE dl ) From 05c7601f1e20a1b0c9ef50880e901b5e201944ed Mon Sep 17 00:00:00 2001 From: Juice Date: Fri, 11 Jun 2021 20:01:01 +0300 Subject: [PATCH 48/61] Fix crash in ProcessStringCmd (#838) --- rehlds/HLTV/Proxy/src/ProxyClient.cpp | 5 +++++ rehlds/HLTV/common/BaseClient.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/rehlds/HLTV/Proxy/src/ProxyClient.cpp b/rehlds/HLTV/Proxy/src/ProxyClient.cpp index 82bdd27..2e47233 100644 --- a/rehlds/HLTV/Proxy/src/ProxyClient.cpp +++ b/rehlds/HLTV/Proxy/src/ProxyClient.cpp @@ -86,6 +86,11 @@ bool ProxyClient::ProcessStringCmd(char *string) return true; } + if (!cmdLine.CountToken()) { + m_System->DPrintf("WARNING! ProxyClient::ProcessStringCmd: invalid command string.\n"); + return false; + } + char *cmd = cmdLine.GetToken(0); for (auto& local_cmd : m_LocalCmdReg) { diff --git a/rehlds/HLTV/common/BaseClient.cpp b/rehlds/HLTV/common/BaseClient.cpp index 0c3a433..9f10489 100644 --- a/rehlds/HLTV/common/BaseClient.cpp +++ b/rehlds/HLTV/common/BaseClient.cpp @@ -266,6 +266,11 @@ bool BaseClient::ProcessStringCmd(char *string) return false; } + if (!cmdLine.CountToken()) { + m_System->DPrintf("WARNING! BaseClient::ProcessStringCmd: invalid command string.\n"); + return false; + } + char *cmd = cmdLine.GetToken(0); for (auto& local_cmd : m_LocalCmdReg) { From 801be3ee5bdd81ec28f65520905a4acab8f47251 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 12 Jun 2021 00:22:30 +0700 Subject: [PATCH 49/61] SV_ParseMove, SV_ParseConsistencyResponse: check length --- rehlds/engine/common.cpp | 16 ++++++++++++++++ rehlds/engine/common.h | 2 ++ rehlds/engine/sv_user.cpp | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index b9d1210..c9f07a6 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -1164,6 +1164,22 @@ void SZ_Clear(sizebuf_t *buf) buf->cursize = 0; } +qboolean SZ_HasSpaceToRead(const sizebuf_t *buf, int length) +{ + if ((msg_readcount + length) > buf->maxsize) + return FALSE; + + return TRUE; +} + +qboolean SZ_HasSomethingToRead(const sizebuf_t *buf, int length) +{ + if ((msg_readcount + length) > buf->cursize) + return FALSE; + + return TRUE; +} + void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length) { void *data; diff --git a/rehlds/engine/common.h b/rehlds/engine/common.h index 2d81b3f..22d07e9 100644 --- a/rehlds/engine/common.h +++ b/rehlds/engine/common.h @@ -159,6 +159,8 @@ void MSG_ReadUsercmd(usercmd_t *to, usercmd_t *from); void SZ_Alloc(const char *name, sizebuf_t *buf, int startsize); void SZ_Clear(sizebuf_t *buf); +qboolean SZ_HasSpaceToRead(const sizebuf_t *buf, int length); +qboolean SZ_HasSomethingToRead(const sizebuf_t *buf, int length); void *SZ_GetSpace(sizebuf_t *buf, int length); void SZ_Write(sizebuf_t *buf, const void *data, int length); void SZ_Print(sizebuf_t *buf, const char *data); diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 168828b..306e1e8 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -93,6 +93,15 @@ void SV_ParseConsistencyResponse(client_t *pSenderClient) int c = 0; Q_memset(nullbuffer, 0, sizeof(nullbuffer)); int value = MSG_ReadShort(); + + if (value <= 0 || !SZ_HasSomethingToRead(&net_message, value)) + { + msg_badread = TRUE; + Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), value); + SV_DropClient(host_client, FALSE, "Invalid length"); + return; + } + COM_UnMunge(&net_message.data[msg_readcount], value, g_psvs.spawncount); MSG_StartBitReading(&net_message); @@ -1540,6 +1549,15 @@ void SV_ParseMove(client_t *pSenderClient) placeholder = msg_readcount + 1; mlen = MSG_ReadByte(); + + if (mlen <= 0 || !SZ_HasSpaceToRead(&net_message, mlen + 2)) + { + msg_badread = TRUE; + Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), mlen); + SV_DropClient(host_client, FALSE, "Invalid length"); + return; + } + cbchecksum = MSG_ReadByte(); COM_UnMunge(&net_message.data[placeholder + 1], mlen, host_client->netchan.incoming_sequence); From d9613d20939f70d778483de3dcbaec566ad3cd32 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sun, 13 Jun 2021 00:06:02 +0700 Subject: [PATCH 50/61] SV_ParseMove: Fixed wrong check length --- rehlds/engine/sv_user.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 306e1e8..a50862b 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -1549,8 +1549,9 @@ void SV_ParseMove(client_t *pSenderClient) placeholder = msg_readcount + 1; mlen = MSG_ReadByte(); + cbchecksum = MSG_ReadByte(); - if (mlen <= 0 || !SZ_HasSpaceToRead(&net_message, mlen + 2)) + if (mlen <= 0 || !SZ_HasSpaceToRead(&net_message, mlen)) { msg_badread = TRUE; Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), mlen); @@ -1558,7 +1559,6 @@ void SV_ParseMove(client_t *pSenderClient) return; } - cbchecksum = MSG_ReadByte(); COM_UnMunge(&net_message.data[placeholder + 1], mlen, host_client->netchan.incoming_sequence); packetLossByte = MSG_ReadByte(); From 81fe33454555b53d895020042ed662d3c8b6e795 Mon Sep 17 00:00:00 2001 From: Karol Szuster Date: Mon, 14 Jun 2021 00:43:27 +0200 Subject: [PATCH 51/61] Add GetEntityInit hook (#832) * Add GetEntityInit hook --- rehlds/engine/sys_dll.cpp | 12 +++++++++++- rehlds/engine/sys_dll.h | 2 ++ rehlds/public/rehlds/rehlds_api.h | 8 +++++++- rehlds/rehlds/rehlds_api_impl.cpp | 6 +++++- rehlds/rehlds/rehlds_api_impl.h | 6 ++++++ rehlds/version/version.h | 2 +- 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index add30da..fb2a5fb 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -770,11 +770,21 @@ const char* EXT_FUNC NameForFunction(uint32 function) return NULL; } -ENTITYINIT EXT_FUNC GetEntityInit(char *pClassName) +ENTITYINIT GetEntityInit_internal(char *pClassName) { return (ENTITYINIT)GetDispatch(pClassName); } +ENTITYINIT EXT_FUNC GetEntityInit_api(char *pClassName) +{ + return g_RehldsHookchains.m_GetEntityInit.callChain(GetEntityInit_internal, pClassName); +} + +ENTITYINIT GetEntityInit(char *pClassName) +{ + return GetEntityInit_api(pClassName); +} + FIELDIOFUNCTION GetIOFunction(char *pName) { return (FIELDIOFUNCTION)GetDispatch(pName); diff --git a/rehlds/engine/sys_dll.h b/rehlds/engine/sys_dll.h index 630235b..228b09a 100644 --- a/rehlds/engine/sys_dll.h +++ b/rehlds/engine/sys_dll.h @@ -120,6 +120,8 @@ uint32 FindNameInTable(extensiondll_t *pDll, const char *pName); NOBODY const char *ConvertNameToLocalPlatform(const char *pchInName); uint32 FunctionFromName(const char *pName); const char *NameForFunction(uint32 function); +ENTITYINIT GetEntityInit_internal(char *pClassName); +ENTITYINIT GetEntityInit_api(char *pClassName); ENTITYINIT GetEntityInit(char *pClassName); FIELDIOFUNCTION GetIOFunction(char *pName); NOBODY void DLL_SetModKey(modinfo_t *pinfo, char *pkey, char *pvalue); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 506d474..5b8a40d 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -37,7 +37,7 @@ #include "pr_dlls.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 8 +#define REHLDS_API_VERSION_MINOR 9 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -207,6 +207,11 @@ typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Frame; typedef IHookChain IRehldsHook_SV_ShouldSendConsistencyList; typedef IHookChainRegistry IRehldsHookRegistry_SV_ShouldSendConsistencyList; +//GetEntityInit hook +typedef IHookChain IRehldsHook_GetEntityInit; +typedef IHookChainRegistry IRehldsHookRegistry_GetEntityInit; + + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -253,6 +258,7 @@ public: virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits() = 0; virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0; virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0; + virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit() = 0; }; struct RehldsFuncs_t { diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 838305c..7cfe15e 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -515,7 +515,7 @@ RehldsFuncs_t g_RehldsApiFuncs = &AddCvarListener_api, &RemoveExtDll_api, &RemoveCvarListener_api, - &GetEntityInit, + &GetEntityInit_api, &MSG_ReadChar_api, &MSG_ReadByte_api, &MSG_ReadLong_api, @@ -831,6 +831,10 @@ IRehldsHookRegistry_SV_ShouldSendConsistencyList* CRehldsHookchains::SV_ShouldSe return &m_SV_ShouldSendConsistencyList; } +IRehldsHookRegistry_GetEntityInit* CRehldsHookchains::GetEntityInit() { + return &m_GetEntityInit; +} + int EXT_FUNC CRehldsApi::GetMajorVersion() { return REHLDS_API_VERSION_MAJOR; diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 3af1e94..835a24b 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -202,6 +202,10 @@ typedef IVoidHookChainRegistryImpl<> CRehldsHookRegistry_SV_Frame; typedef IHookChainImpl CRehldsHook_SV_ShouldSendConsistencyList; typedef IHookChainRegistryImpl CRehldsHookRegistry_SV_ShouldSendConsistencyList; +//GetEntityInit hook +typedef IHookChainImpl CRehldsHook_GetEntityInit; +typedef IHookChainRegistryImpl CRehldsHookRegistry_GetEntityInit; + class CRehldsHookchains : public IRehldsHookchains { public: CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect; @@ -246,6 +250,7 @@ public: CRehldsHookRegistry_SV_CheckConnectionLessRateLimits m_SV_CheckConnectionLessRateLimits; CRehldsHookRegistry_SV_Frame m_SV_Frame; CRehldsHookRegistry_SV_ShouldSendConsistencyList m_SV_ShouldSendConsistencyList; + CRehldsHookRegistry_GetEntityInit m_GetEntityInit; public: EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect(); @@ -290,6 +295,7 @@ public: EXT_FUNC virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits(); EXT_FUNC virtual IRehldsHookRegistry_SV_Frame* SV_Frame(); EXT_FUNC virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList(); + EXT_FUNC virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit(); }; extern CRehldsHookchains g_RehldsHookchains; diff --git a/rehlds/version/version.h b/rehlds/version/version.h index d209933..43f4008 100644 --- a/rehlds/version/version.h +++ b/rehlds/version/version.h @@ -6,5 +6,5 @@ #pragma once #define VERSION_MAJOR 3 -#define VERSION_MINOR 8 +#define VERSION_MINOR 9 #define VERSION_MAINTENANCE 0 From 39b441099c8c4d4c29ca71434a43ba30698487dd Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Mon, 14 Jun 2021 02:19:51 +0300 Subject: [PATCH 52/61] Implement CVar sv_usercmd_custom_random_seed (#837) --- README.md | 1 + rehlds/engine/server.h | 1 + rehlds/engine/sv_main.cpp | 2 ++ rehlds/engine/sv_user.cpp | 8 ++++++++ 4 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 32f395c..52e965c 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
  • sv_rehlds_attachedentities_playeranimationspeed_fix // Fixes bug with gait animation speed increase when player has some attached entities (aiments). Can cause animation lags when cl_updaterate is low. Default: 0
  • sv_rehlds_maxclients_from_single_ip // Limit number of connections from the single ip address. Default: 5
  • sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist. +
  • sv_usercmd_custom_random_seed // When enabled server will populate an additional random seed independent of the client. Default: 0
diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index b94f7c4..23c72c8 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -376,6 +376,7 @@ extern cvar_t sv_rehlds_userinfo_transmitted_fields; extern cvar_t sv_rehlds_attachedentities_playeranimationspeed_fix; extern cvar_t sv_rehlds_local_gametime; extern cvar_t sv_rehlds_send_mapcycle; +extern cvar_t sv_usercmd_custom_random_seed; #endif extern int sv_playermodel; diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 904053a..5988519 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -209,6 +209,7 @@ cvar_t sv_rehlds_local_gametime = {"sv_rehlds_local_gametime", "0", 0, 0.0f, nul cvar_t sv_rehlds_send_mapcycle = { "sv_rehlds_send_mapcycle", "0", 0, 0.0f, nullptr }; cvar_t sv_rehlds_maxclients_from_single_ip = { "sv_rehlds_maxclients_from_single_ip", "5", 0, 5.0f, nullptr }; cvar_t sv_use_entity_file = { "sv_use_entity_file", "0", 0, 0.0f, nullptr }; +cvar_t sv_usercmd_custom_random_seed = { "sv_usercmd_custom_random_seed", "0", 0, 0.0f, nullptr }; #endif delta_t *SV_LookupDelta(char *name) @@ -8016,6 +8017,7 @@ void SV_Init(void) Cvar_RegisterVariable(&sv_rollspeed); Cvar_RegisterVariable(&sv_rollangle); Cvar_RegisterVariable(&sv_use_entity_file); + Cvar_RegisterVariable(&sv_usercmd_custom_random_seed); #endif for (int i = 0; i < MAX_MODELS; i++) diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index a50862b..16a48c4 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -782,6 +782,14 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed) if (!host_client->fakeclient) SV_SetupMove(host_client); +#ifdef REHLDS_FIXES + if (sv_usercmd_custom_random_seed.value) + { + float fltTimeNow = float(Sys_FloatTime() * 1000.0); + random_seed = *reinterpret_cast((char *)&fltTimeNow); + } +#endif + gEntityInterface.pfnCmdStart(sv_player, ucmd, random_seed); frametime = float(ucmd->msec * 0.001); host_client->svtimebase = frametime + host_client->svtimebase; From f3d60248fad3a5f6d1a96cb8ee38cc3c6016119d Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 16 Jun 2021 02:08:59 +0700 Subject: [PATCH 53/61] Enhanced IGameClient/IRehldsServerData/IRehldsServerStatic interfaces Added client_t:m_bSentNewResponse Bump API minor --- rehlds/engine/server.h | 1 + rehlds/public/rehlds/rehlds_api.h | 2 +- rehlds/public/rehlds/rehlds_interfaces.h | 189 +++++++ rehlds/rehlds/rehlds_interfaces_impl.cpp | 604 ++++++++++++++++++++++- rehlds/rehlds/rehlds_interfaces_impl.h | 179 +++++++ rehlds/version/version.h | 2 +- 6 files changed, 966 insertions(+), 11 deletions(-) diff --git a/rehlds/engine/server.h b/rehlds/engine/server.h index 23c72c8..d444140 100644 --- a/rehlds/engine/server.h +++ b/rehlds/engine/server.h @@ -241,6 +241,7 @@ typedef struct client_s uint32 m_VoiceStreams[2]; double m_lastvoicetime; int m_sendrescount; + qboolean m_bSentNewResponse; } client_t; enum diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 5b8a40d..4d0a74e 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -37,7 +37,7 @@ #include "pr_dlls.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 9 +#define REHLDS_API_VERSION_MINOR 10 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; diff --git a/rehlds/public/rehlds/rehlds_interfaces.h b/rehlds/public/rehlds/rehlds_interfaces.h index 7585d8d..da3768c 100644 --- a/rehlds/public/rehlds/rehlds_interfaces.h +++ b/rehlds/public/rehlds/rehlds_interfaces.h @@ -48,16 +48,22 @@ class IGameClient { public: virtual int GetId() = 0; + // false = client is free virtual bool IsActive() = 0; virtual void SetActive(bool active) = 0; + // false = don't send datagrams virtual bool IsSpawned() = 0; virtual void SetSpawned(bool spawned) = 0; + // The client's net connection virtual INetChan* GetNetChan() = 0; + // The datagram is written to after every frame, but only cleared + // when it is sent out to the client. It can be harmlessly overflowed virtual sizebuf_t* GetDatagram() = 0; + // EDICT_NUM(clientnum + 1) virtual edict_t* GetEdict() = 0; virtual USERID_t* GetNetworkUserID() = 0; @@ -67,15 +73,156 @@ public: virtual bool IsConnected() = 0; virtual void SetConnected(bool connected) = 0; + // Which other clients does this guy's voice stream go to? virtual uint32 GetVoiceStream(int stream_id) = 0; virtual void SetLastVoiceTime(double time) = 0; virtual double GetLastVoiceTime() = 0; + + // Does this client want to hear his own voice? virtual bool GetLoopback() = 0; virtual struct usercmd_s *GetLastCmd() = 0; + // This is spectator proxy (hltv) virtual bool IsProxy() = 0; virtual void SetProxy(bool proxy) = 0; + // This client is a fake player controlled by the game DLL + virtual bool IsFakeClient() = 0; + virtual void SetFakeClient(bool state) = 0; + + // On server, getting data + virtual bool IsFullyConnected() = 0; + virtual void SetFullyConnected(bool state) = 0; + + virtual bool IsUploading() = 0; + virtual void SetUploading(bool state) = 0; + + virtual bool IsHasUserMsgs() = 0; + virtual void SetHasUserMsgs(bool value) = 0; + + virtual bool HasForceUnmodified() = 0; + virtual void SetHasForceUnmodified(bool value) = 0; + + // Number of packets choked at the server because the client - server network channel + // is backlogged with too much data + virtual int GetChokeCount() = 0; + virtual void SetChokeCount(int count) = 0; + + // -1 = no compression. This is where the server is creating the compressed info from + virtual int GetDeltaSequence() = 0; + virtual void SetDeltaSequence(int value) = 0; + + // For filling in big drops + virtual void SetLastCmd(struct usercmd_s *ucmd) = 0; + + virtual double GetConnectTime() = 0; + virtual void SetConnectTime(double time) = 0; + + virtual double GetCmdTime() = 0; + virtual void SetCmdTime(double time) = 0; + + virtual double GetIgnoreCmdTime() = 0; + virtual void SetIgnoreCmdTime(double time) = 0; + + virtual float GetLatency() = 0; + virtual void SetLatency(float latency) = 0; + + virtual float GetPacketLoss() = 0; + virtual void SetPacketLoss(float packetLoss) = 0; + + virtual double GetLocalTime() = 0; + virtual void SetLocalTime(double time) = 0; + + virtual double GetSvTimeBase() = 0; + virtual void SetSvTimeBase(double time) = 0; + + // Or time of disconnect for zombies + virtual double GetConnectionStartedTime() = 0; + virtual void SetConnectionStartedTime(double time) = 0; + + // Time when we should send next world state update (datagram) + virtual double GetNextMessageTime() = 0; + virtual void SetNextMessageTime(double time) = 0; + + // Default time to wait for next message + virtual double GetNextMessageIntervalTime() = 0; + virtual void SetNextMessageIntervalTime(double time_interval) = 0; + + // false - only send messages if the client has sent one and the bandwidth is not choked + virtual bool GetSendMessageState() = 0; + virtual void SetSendMessageState(bool state) = 0; + + virtual bool GetSkipMessageState() = 0; + virtual void SetSkipMessageState(bool state) = 0; + + virtual bool GetSendInfoState() = 0; + virtual void SetSendInfoState(bool state) = 0; + + virtual float GetSendInfoTime() = 0; + virtual void SetSendInfoTime(float time) = 0; + + // updates can be deltad from here + virtual struct client_frame_s *GetFrames() = 0; + + // Per edict events + virtual struct event_state_s *GetEvents() = 0; + + // View Entity (camera or the client itself) svc_setview + virtual const edict_t *GetViewEntity() = 0; + virtual void SetViewEntity(const edict_t *entity) = 0; + + // Identifying number on server + virtual int GetUserID() = 0; + virtual void SetUserID(int iUserID) = 0; + + // name, etc (received from client) + virtual char *GetUserInfo() = 0; + + // MD5 hash is 32 hex #'s, plus trailing 0 + // Hashed CD Key (32 hex alphabetic chars + 0 terminator) + virtual char *GetHashedCDKey() = 0; + + virtual int GetTopColor() = 0; + virtual void SetTopColor(int color) = 0; + + virtual int GetBottomColor() = 0; + virtual void SetBottomColor(int color) = 0; + + virtual resource_t *GetResourcesOnHand() = 0; + virtual resource_t *GetResourcesNeeded() = 0; + + virtual FileHandle_t GetUploadFileHandle() = 0; + virtual void SetUploadFileHandle(FileHandle_t fhFile) = 0; + + virtual bool IsUploadDoneRegistering() = 0; + virtual void SetUploadDoneRegistering(bool state) = 0; + + virtual customization_t *GetCustomizationData() = 0; + + virtual int GetCRC32MapValue() = 0; + virtual void SetCRC32MapValue(int crcMapValue) = 0; + + // Perform client side prediction of weapon effects + // Determines that the client enabled prediction weapons and will be handled pfnGetWeaponData + virtual bool IsClientPredictingWeapons() = 0; + virtual void SetClientPredictingWeapons(bool state) = 0; + + // Perform server side lag compensation of player movement + // Determines that the client is requesting lag compensation + virtual bool IsClientLagCompensation() = 0; + virtual void SetClientLagCompensation(bool state) = 0; + + // Set on server (transmit to client) + virtual char *GetPhysInfo() = 0; + + virtual void SetVoiceStream(int stream_id, int value) = 0; + + virtual int GetSendResourceCount() = 0; + virtual void SetSendResourceCount(int count) = 0; + + virtual bool IsSentNewResponse() = 0; + virtual void SetSentNewResponse(bool state) = 0; + // this must be the last virtual function in class #ifdef REHLDS_SELF virtual client_t* GetClient() = 0; @@ -108,6 +255,12 @@ public: virtual client_t* GetClient_t(int id) = 0; virtual int GetIndexOfClient_t(client_t* client) = 0; virtual int GetMaxClientsLimit() = 0; + virtual client_t *GetNextClient_t(client_t *client) = 0; + virtual int GetSpawnCount() = 0; + virtual void SetSpawnCount(int count) = 0; + virtual struct server_log_s *GetLog() = 0; + virtual bool IsSecure() = 0; + virtual void SetSecure(bool value) = 0; }; class IRehldsServerData { @@ -134,4 +287,40 @@ public: virtual class ISteamGameServer *GetSteamGameServer() = 0; virtual struct netadr_s *GetNetFrom() = 0; virtual double GetOldTime() = 0; + + virtual void SetNetFrom(struct netadr_s *from) = 0; + virtual void SetWorldmapCrc(uint32 crcValue) = 0; + virtual void SetDecalNameNum(int num) = 0; + + virtual bool IsActive() = 0; + virtual void SetActive(bool state) = 0; + virtual bool IsPaused() = 0; + virtual void SetPaused(bool state) = 0; + virtual int GetLastIndexCheckInPVS() = 0; + virtual void SetLastIndexCheckInPVS(int id) = 0; + virtual double GetLastIndexCheckTimeInPVS() = 0; + virtual void SetLastIndexCheckTimeInPVS(double time) = 0; + virtual const char *GetOldName() = 0; + virtual void SetOldName(const char *name) = 0; + virtual const char *GetStartSpotName() = 0; + virtual void SetStartSpotName(const char *startspot) = 0; + virtual struct model_s *GetWorldModel() = 0; + virtual void SetWorldModel(struct model_s *model) = 0; + virtual struct consistency_s *GetConsistency(int index) = 0; + virtual struct model_s *GetModel(int index) = 0; + virtual struct event_s *GetEventPrecache(int index) = 0; + virtual struct entity_state_s *GetEntityBaseline(int index) = 0; + virtual struct extra_baselines_s *GetEntityInstanceBaselines() = 0; + virtual int GetNumGenericNames() = 0; + virtual void SetNumGenericNames(int num) = 0; + virtual int GetNumEdicts() = 0; + virtual void SetNumEdicts(int num_edicts) = 0; + virtual int GetMaxEdicts() = 0; + virtual void SetMaxEdicts(int max_edicts) = 0; + virtual edict_t *GetEdict(int index) = 0; + virtual server_state_t GetState() = 0; + virtual void SetState(server_state_t st) = 0; + virtual sizebuf_t *GetMulticastBuf() = 0; + virtual sizebuf_t *GetSpectatorBuf() = 0; + virtual sizebuf_t *GetSignonBuf() = 0; }; diff --git a/rehlds/rehlds/rehlds_interfaces_impl.cpp b/rehlds/rehlds/rehlds_interfaces_impl.cpp index 2044938..fa07ac5 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.cpp +++ b/rehlds/rehlds/rehlds_interfaces_impl.cpp @@ -53,40 +53,40 @@ struct usercmd_s* EXT_FUNC CGameClient::GetLastCmd() bool EXT_FUNC CGameClient::IsActive() { - return m_pClient->active != 0; + return m_pClient->active != FALSE; } void EXT_FUNC CGameClient::SetActive(bool active) { - m_pClient->active = active ? 1 : 0; + m_pClient->active = active ? TRUE : FALSE; } bool EXT_FUNC CGameClient::IsSpawned() { - return m_pClient->spawned != 0; + return m_pClient->spawned != FALSE; } void EXT_FUNC CGameClient::SetSpawned(bool spawned) { - m_pClient->spawned = spawned ? 1 : 0; + m_pClient->spawned = spawned ? TRUE : FALSE; } bool EXT_FUNC CGameClient::IsProxy() { - return m_pClient->proxy != 0; + return m_pClient->proxy != FALSE; } void EXT_FUNC CGameClient::SetProxy(bool proxy) { - m_pClient->proxy = proxy ? 1 : 0; + m_pClient->proxy = proxy ? TRUE : FALSE; } bool EXT_FUNC CGameClient::IsConnected() { - return m_pClient->connected != 0; + return m_pClient->connected != FALSE; } void EXT_FUNC CGameClient::SetConnected(bool connected) { - m_pClient->connected = connected ? 1 : 0; + m_pClient->connected = connected ? TRUE : FALSE; } uint32 EXT_FUNC CGameClient::GetVoiceStream(int stream_id) { @@ -104,7 +104,7 @@ double EXT_FUNC CGameClient::GetLastVoiceTime() { } bool EXT_FUNC CGameClient::GetLoopback() { - return m_pClient->m_bLoopback != 0; + return m_pClient->m_bLoopback != FALSE; } INetChan* EXT_FUNC CGameClient::GetNetChan() @@ -137,6 +137,378 @@ client_t* EXT_FUNC CGameClient::GetClient() return m_pClient; } +bool EXT_FUNC CGameClient::IsFakeClient() +{ + return m_pClient->fakeclient; +} + +void EXT_FUNC CGameClient::SetFakeClient(bool state) +{ + m_pClient->fakeclient = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsFullyConnected() +{ + return m_pClient->fully_connected; +} + +void EXT_FUNC CGameClient::SetFullyConnected(bool state) +{ + m_pClient->fully_connected = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsUploading() +{ + return m_pClient->uploading != FALSE; +} + +void EXT_FUNC CGameClient::SetUploading(bool state) +{ + m_pClient->uploading = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsHasUserMsgs() +{ + return m_pClient->hasusrmsgs != FALSE; +} + +void EXT_FUNC CGameClient::SetHasUserMsgs(bool value) +{ + m_pClient->hasusrmsgs = value ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::HasForceUnmodified() +{ + return m_pClient->has_force_unmodified != FALSE; +} + +void EXT_FUNC CGameClient::SetHasForceUnmodified(bool value) +{ + m_pClient->has_force_unmodified = value ? TRUE : FALSE; +} + +int EXT_FUNC CGameClient::GetChokeCount() +{ + return m_pClient->chokecount; +} + +void EXT_FUNC CGameClient::SetChokeCount(int count) +{ + m_pClient->chokecount = count; +} + +int EXT_FUNC CGameClient::GetDeltaSequence() +{ + return m_pClient->delta_sequence; +} + +void EXT_FUNC CGameClient::SetDeltaSequence(int value) +{ + m_pClient->delta_sequence = value; +} + +void EXT_FUNC CGameClient::SetLastCmd(usercmd_t *ucmd) +{ + m_pClient->lastcmd = *ucmd; +} + +double EXT_FUNC CGameClient::GetConnectTime() +{ + return m_pClient->connecttime; +} + +void EXT_FUNC CGameClient::SetConnectTime(double time) +{ + m_pClient->connecttime = time; +} + +double EXT_FUNC CGameClient::GetCmdTime() +{ + return m_pClient->cmdtime; +} + +void EXT_FUNC CGameClient::SetCmdTime(double time) +{ + m_pClient->cmdtime = time; +} + +double EXT_FUNC CGameClient::GetIgnoreCmdTime() +{ + return m_pClient->ignorecmdtime; +} + +void EXT_FUNC CGameClient::SetIgnoreCmdTime(double time) +{ + m_pClient->ignorecmdtime = time; +} + +float EXT_FUNC CGameClient::GetLatency() +{ + return m_pClient->latency; +} + +void EXT_FUNC CGameClient::SetLatency(float latency) +{ + m_pClient->latency = latency; +} + +float EXT_FUNC CGameClient::GetPacketLoss() +{ + return m_pClient->packet_loss; +} + +void EXT_FUNC CGameClient::SetPacketLoss(float packetLoss) +{ + m_pClient->packet_loss = packetLoss; +} + +double EXT_FUNC CGameClient::GetLocalTime() +{ + return m_pClient->localtime; +} + +void EXT_FUNC CGameClient::SetLocalTime(double time) +{ + m_pClient->localtime = time; +} + +double EXT_FUNC CGameClient::GetSvTimeBase() +{ + return m_pClient->svtimebase; +} + +void EXT_FUNC CGameClient::SetSvTimeBase(double time) +{ + m_pClient->svtimebase = time; +} + +double EXT_FUNC CGameClient::GetConnectionStartedTime() +{ + return m_pClient->connection_started; +} + +void EXT_FUNC CGameClient::SetConnectionStartedTime(double time) +{ + m_pClient->connection_started = time; +} + +double EXT_FUNC CGameClient::GetNextMessageTime() +{ + return m_pClient->next_messagetime; +} + +void EXT_FUNC CGameClient::SetNextMessageTime(double time) +{ + m_pClient->next_messagetime = time; +} + +double EXT_FUNC CGameClient::GetNextMessageIntervalTime() +{ + return m_pClient->next_messageinterval; +} + +void EXT_FUNC CGameClient::SetNextMessageIntervalTime(double time_interval) +{ + m_pClient->next_messageinterval = time_interval; +} + +bool EXT_FUNC CGameClient::GetSendMessageState() +{ + return m_pClient->send_message != FALSE; +} + +void EXT_FUNC CGameClient::SetSendMessageState(bool state) +{ + m_pClient->send_message = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::GetSkipMessageState() +{ + return m_pClient->skip_message != FALSE; +} + +void EXT_FUNC CGameClient::SetSkipMessageState(bool state) +{ + m_pClient->skip_message = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::GetSendInfoState() +{ + return m_pClient->sendinfo != FALSE; +} + +void EXT_FUNC CGameClient::SetSendInfoState(bool state) +{ + m_pClient->sendinfo = state ? TRUE : FALSE; +} + +float EXT_FUNC CGameClient::GetSendInfoTime() +{ + return m_pClient->sendinfo_time; +} + +void EXT_FUNC CGameClient::SetSendInfoTime(float time) +{ + m_pClient->sendinfo_time = time; +} + +client_frame_t *EXT_FUNC CGameClient::GetFrames() +{ + return m_pClient->frames; +} + +event_state_t *EXT_FUNC CGameClient::GetEvents() +{ + return &m_pClient->events; +} + +const edict_t *EXT_FUNC CGameClient::GetViewEntity() +{ + return m_pClient->pViewEntity; +} + +void EXT_FUNC CGameClient::SetViewEntity(const edict_t *entity) +{ + m_pClient->pViewEntity = entity; +} + +int EXT_FUNC CGameClient::GetUserID() +{ + return m_pClient->userid; +} + +void EXT_FUNC CGameClient::SetUserID(int iUserID) +{ + m_pClient->userid = iUserID; +} + +char *EXT_FUNC CGameClient::GetUserInfo() +{ + return m_pClient->userinfo; +} + +char *EXT_FUNC CGameClient::GetHashedCDKey() +{ + return m_pClient->hashedcdkey; +} + +int EXT_FUNC CGameClient::GetTopColor() +{ + return m_pClient->topcolor; +} + +void EXT_FUNC CGameClient::SetTopColor(int color) +{ + m_pClient->topcolor = color; +} + +int EXT_FUNC CGameClient::GetBottomColor() +{ + return m_pClient->bottomcolor; +} + +void EXT_FUNC CGameClient::SetBottomColor(int color) +{ + m_pClient->bottomcolor = color; +} + +resource_t *EXT_FUNC CGameClient::GetResourcesOnHand() +{ + return &m_pClient->resourcesonhand; +} + +resource_t *EXT_FUNC CGameClient::GetResourcesNeeded() +{ + return &m_pClient->resourcesneeded; +} + +FileHandle_t EXT_FUNC CGameClient::GetUploadFileHandle() +{ + return m_pClient->upload; +} + +void EXT_FUNC CGameClient::SetUploadFileHandle(FileHandle_t fhFile) +{ + m_pClient->upload = fhFile; +} + +bool EXT_FUNC CGameClient::IsUploadDoneRegistering() +{ + return m_pClient->uploaddoneregistering != FALSE; +} + +void EXT_FUNC CGameClient::SetUploadDoneRegistering(bool state) +{ + m_pClient->uploaddoneregistering = state ? TRUE : FALSE; +} + +customization_t *EXT_FUNC CGameClient::GetCustomizationData() +{ + return &m_pClient->customdata; +} + +int EXT_FUNC CGameClient::GetCRC32MapValue() +{ + return m_pClient->crcValue; +} + +void EXT_FUNC CGameClient::SetCRC32MapValue(int crcMapValue) +{ + m_pClient->crcValue = crcMapValue; +} + +bool EXT_FUNC CGameClient::IsClientPredictingWeapons() +{ + return m_pClient->lw != FALSE; +} + +void EXT_FUNC CGameClient::SetClientPredictingWeapons(bool state) +{ + m_pClient->lw = state ? TRUE : FALSE; +} + +bool EXT_FUNC CGameClient::IsClientLagCompensation() +{ + return m_pClient->lc != FALSE; +} + +void EXT_FUNC CGameClient::SetClientLagCompensation(bool state) +{ + m_pClient->lc = state ? TRUE : FALSE; +} + +char *EXT_FUNC CGameClient::GetPhysInfo() +{ + return m_pClient->physinfo; +} + +void EXT_FUNC CGameClient::SetVoiceStream(int stream_id, int value) +{ + if (stream_id < 0 || stream_id >= ARRAYSIZE(m_pClient->m_VoiceStreams)) + return; + + m_pClient->m_VoiceStreams[stream_id] = value; +} + +int EXT_FUNC CGameClient::GetSendResourceCount() +{ + return m_pClient->m_sendrescount; +} + +void EXT_FUNC CGameClient::SetSendResourceCount(int count) +{ + m_pClient->m_sendrescount = count; +} + +bool EXT_FUNC CGameClient::IsSentNewResponse() +{ + return m_pClient->m_bSentNewResponse != FALSE; +} + +void EXT_FUNC CGameClient::SetSentNewResponse(bool state) +{ + m_pClient->m_bSentNewResponse = state ? TRUE : FALSE; +} CNetChan::CNetChan(netchan_t* chan) { @@ -170,6 +542,36 @@ int EXT_FUNC CRehldsServerStatic::GetMaxClientsLimit() return g_psvs.maxclientslimit; } +client_t *EXT_FUNC CRehldsServerStatic::GetNextClient_t(client_t *client) +{ + return ++client; +} + +int EXT_FUNC CRehldsServerStatic::GetSpawnCount() +{ + return g_psvs.spawncount; +} + +void EXT_FUNC CRehldsServerStatic::SetSpawnCount(int count) +{ + g_psvs.spawncount = count; +} + +server_log_t *EXT_FUNC CRehldsServerStatic::GetLog() +{ + return &g_psvs.log; +} + +bool EXT_FUNC CRehldsServerStatic::IsSecure() +{ + return g_psvs.isSecure != FALSE; +} + +void EXT_FUNC CRehldsServerStatic::SetSecure(bool value) +{ + g_psvs.isSecure = value ? TRUE : FALSE; +} + bool EXT_FUNC CRehldsServerStatic::IsLogActive() { return g_psvs.log.active ? true : false; @@ -226,6 +628,10 @@ uint32 EXT_FUNC CRehldsServerData::GetWorldmapCrc() { return g_psv.worldmapCRC; } +void EXT_FUNC CRehldsServerData::SetWorldmapCrc(uint32 crcValue) { + g_psv.worldmapCRC = crcValue; +} + uint8* EXT_FUNC CRehldsServerData::GetClientDllMd5() { return g_psv.clientdllmd5; } @@ -254,6 +660,10 @@ int EXT_FUNC CRehldsServerData::GetDecalNameNum() { return sv_decalnamecount; } +void EXT_FUNC CRehldsServerData::SetDecalNameNum(int num) { + sv_decalnamecount = num; +} + double EXT_FUNC CRehldsServerData::GetTime() { return g_psv.time; } @@ -274,6 +684,178 @@ struct resource_s *EXT_FUNC CRehldsServerData::GetResource(int index) { #endif // REHLDS_FIXES } +bool EXT_FUNC CRehldsServerData::IsActive() +{ + return g_psv.active != FALSE; +} + +void EXT_FUNC CRehldsServerData::SetActive(bool state) +{ + g_psv.active = state ? TRUE : FALSE; +} + +bool EXT_FUNC CRehldsServerData::IsPaused() +{ + return g_psv.paused != FALSE; +} + +void EXT_FUNC CRehldsServerData::SetPaused(bool state) +{ + g_psv.paused = state ? TRUE : FALSE; +} + +int EXT_FUNC CRehldsServerData::GetLastIndexCheckInPVS() +{ + return g_psv.lastcheck; +} + +void EXT_FUNC CRehldsServerData::SetLastIndexCheckInPVS(int id) +{ + g_psv.lastcheck = id; +} + +double EXT_FUNC CRehldsServerData::GetLastIndexCheckTimeInPVS() +{ + return g_psv.lastchecktime; +} + +void EXT_FUNC CRehldsServerData::SetLastIndexCheckTimeInPVS(double time) +{ + g_psv.lastchecktime = time; +} + +const char *EXT_FUNC CRehldsServerData::GetOldName() +{ + return g_psv.oldname; +} + +void EXT_FUNC CRehldsServerData::SetOldName(const char *name) +{ + Q_strncpy(g_psv.oldname, name, ARRAYSIZE(g_psv.oldname) - 1); + g_psv.oldname[ARRAYSIZE(g_psv.oldname) - 1] = '\0'; +} + +const char *EXT_FUNC CRehldsServerData::GetStartSpotName() +{ + return g_psv.startspot; +} + +void EXT_FUNC CRehldsServerData::SetStartSpotName(const char *startspot) +{ + Q_strncpy(g_psv.startspot, startspot, ARRAYSIZE(g_psv.startspot) - 1); + g_psv.startspot[ARRAYSIZE(g_psv.startspot) - 1] = '\0'; +} + +model_t *EXT_FUNC CRehldsServerData::GetWorldModel() +{ + return g_psv.worldmodel; +} + +void EXT_FUNC CRehldsServerData::SetWorldModel(model_t *model) +{ + g_psv.worldmodel = model; +} + +consistency_t *EXT_FUNC CRehldsServerData::GetConsistency(int index) +{ + if (index < 0 || index >= MAX_CONSISTENCY_LIST) + return NULL; + + return &g_psv.consistency_list[index]; +} + +model_t *EXT_FUNC CRehldsServerData::GetModel(int index) +{ + if (index < 0 || index >= MAX_MODELS) + return NULL; + + return g_psv.models[index]; +} + +event_t *EXT_FUNC CRehldsServerData::GetEventPrecache(int index) +{ + if (index < 0 || index >= MAX_EVENTS) + return NULL; + + return &g_psv.event_precache[index]; +} + +entity_state_t *EXT_FUNC CRehldsServerData::GetEntityBaseline(int index) +{ + if (index < 0 || index >= g_psv.max_edicts) + return NULL; + + return &g_psv.baselines[index]; +} + +extra_baselines_t *EXT_FUNC CRehldsServerData::GetEntityInstanceBaselines() +{ + return g_psv.instance_baselines; +} + +int EXT_FUNC CRehldsServerData::GetNumGenericNames() +{ + return g_psv.num_generic_names; +} + +void EXT_FUNC CRehldsServerData::SetNumGenericNames(int num) +{ + g_psv.num_generic_names = num; +} + +int EXT_FUNC CRehldsServerData::GetNumEdicts() +{ + return g_psv.num_edicts; +} + +void EXT_FUNC CRehldsServerData::SetNumEdicts(int num_edicts) +{ + g_psv.num_edicts = num_edicts; +} + +int EXT_FUNC CRehldsServerData::GetMaxEdicts() +{ + return g_psv.max_edicts; +} + +void EXT_FUNC CRehldsServerData::SetMaxEdicts(int max_edicts) +{ + g_psv.max_edicts = max_edicts; +} + +edict_t *EXT_FUNC CRehldsServerData::GetEdict(int index) +{ + if (index < 0 || index >= g_psv.max_edicts) + return NULL; + + return &g_psv.edicts[index]; +} + +server_state_t EXT_FUNC CRehldsServerData::GetState() +{ + return g_psv.state; +} + +void EXT_FUNC CRehldsServerData::SetState(server_state_t st) +{ + g_psv.state = st; +} + +sizebuf_t *EXT_FUNC CRehldsServerData::GetMulticastBuf() +{ + return &g_psv.multicast; +} + +sizebuf_t *EXT_FUNC CRehldsServerData::GetSpectatorBuf() +{ + return &g_psv.spectator; +} + +sizebuf_t *EXT_FUNC CRehldsServerData::GetSignonBuf() +{ + return &g_psv.signon; +} + void Rehlds_Interfaces_FreeClients() { if (g_GameClients == NULL) @@ -320,3 +902,7 @@ ISteamGameServer* EXT_FUNC CRehldsServerData::GetSteamGameServer() { netadr_t* EXT_FUNC CRehldsServerData::GetNetFrom() { return &net_from; } + +void EXT_FUNC CRehldsServerData::SetNetFrom(netadr_t *from) { + net_from = *from; +} diff --git a/rehlds/rehlds/rehlds_interfaces_impl.h b/rehlds/rehlds/rehlds_interfaces_impl.h index c22215f..5cf4dba 100644 --- a/rehlds/rehlds/rehlds_interfaces_impl.h +++ b/rehlds/rehlds/rehlds_interfaces_impl.h @@ -103,6 +103,143 @@ public: virtual client_t* GetClient(); + // This client is a fake player controlled by the game DLL + virtual bool IsFakeClient(); + virtual void SetFakeClient(bool state); + + // On server, getting data + virtual bool IsFullyConnected(); + virtual void SetFullyConnected(bool state); + + virtual bool IsUploading(); + virtual void SetUploading(bool state); + + virtual bool IsHasUserMsgs(); + virtual void SetHasUserMsgs(bool value); + + virtual bool HasForceUnmodified(); + virtual void SetHasForceUnmodified(bool value); + + // Number of packets choked at the server because the client - server network channel + // is backlogged with too much data + virtual int GetChokeCount(); + virtual void SetChokeCount(int count); + + // -1 = no compression. This is where the server is creating the compressed info from + virtual int GetDeltaSequence(); + virtual void SetDeltaSequence(int value); + + // For filling in big drops + virtual void SetLastCmd(struct usercmd_s *ucmd); + + virtual double GetConnectTime(); + virtual void SetConnectTime(double time); + + virtual double GetCmdTime(); + virtual void SetCmdTime(double time); + + virtual double GetIgnoreCmdTime(); + virtual void SetIgnoreCmdTime(double time); + + virtual float GetLatency(); + virtual void SetLatency(float latency); + + virtual float GetPacketLoss(); + virtual void SetPacketLoss(float packetLoss); + + virtual double GetLocalTime(); + virtual void SetLocalTime(double time); + + virtual double GetSvTimeBase(); + virtual void SetSvTimeBase(double time); + + // Or time of disconnect for zombies + virtual double GetConnectionStartedTime(); + virtual void SetConnectionStartedTime(double time); + + // Time when we should send next world state update (datagram) + virtual double GetNextMessageTime(); + virtual void SetNextMessageTime(double time); + + // Default time to wait for next message + virtual double GetNextMessageIntervalTime(); + virtual void SetNextMessageIntervalTime(double time_interval); + + // false - only send messages if the client has sent one and the bandwidth is not choked + virtual bool GetSendMessageState(); + virtual void SetSendMessageState(bool state); + + virtual bool GetSkipMessageState(); + virtual void SetSkipMessageState(bool state); + + virtual bool GetSendInfoState(); + virtual void SetSendInfoState(bool state); + + virtual float GetSendInfoTime(); + virtual void SetSendInfoTime(float time); + + // updates can be deltad from here + virtual struct client_frame_s *GetFrames(); + + // Per edict events + virtual struct event_state_s *GetEvents(); + + // View Entity (camera or the client itself) svc_setview + virtual const edict_t *GetViewEntity(); + virtual void SetViewEntity(const edict_t *entity); + + // Identifying number on server + virtual int GetUserID(); + virtual void SetUserID(int iUserID); + + // name, etc (received from client) + virtual char *GetUserInfo(); + + // MD5 hash is 32 hex #'s, plus trailing 0 + // Hashed CD Key (32 hex alphabetic chars + 0 terminator) + virtual char *GetHashedCDKey(); + + virtual int GetTopColor(); + virtual void SetTopColor(int color); + + virtual int GetBottomColor(); + virtual void SetBottomColor(int color); + + virtual resource_t *GetResourcesOnHand(); + virtual resource_t *GetResourcesNeeded(); + + virtual FileHandle_t GetUploadFileHandle(); + virtual void SetUploadFileHandle(FileHandle_t fhFile); + + virtual bool IsUploadDoneRegistering(); + virtual void SetUploadDoneRegistering(bool state); + + virtual customization_t *GetCustomizationData(); + + virtual int GetCRC32MapValue(); + virtual void SetCRC32MapValue(int crcMapValue); + + // Perform client side prediction of weapon effects + // Determines that the client enabled prediction weapons and will be handled pfnGetWeaponData + virtual bool IsClientPredictingWeapons(); + virtual void SetClientPredictingWeapons(bool state); + + // Perform server side lag compensation of player movement + // Determines that the client is requesting lag compensation + virtual bool IsClientLagCompensation(); + virtual void SetClientLagCompensation(bool state); + + // Set on server (transmit to client) + virtual char *GetPhysInfo(); + + virtual void SetVoiceStream(int stream_id, int value); + + virtual int GetSendResourceCount(); + virtual void SetSendResourceCount(int count); + + virtual bool IsSentNewResponse(); + virtual void SetSentNewResponse(bool state); + public: bool GetSpawnedOnce() const { return m_bSpawnedOnce; } void SetSpawnedOnce(bool spawned) { m_bSpawnedOnce = spawned; } @@ -125,6 +262,12 @@ public: virtual client_t* GetClient_t(int id); virtual int GetIndexOfClient_t(client_t* client); virtual int GetMaxClientsLimit(); + virtual client_t *GetNextClient_t(client_t *client); + virtual int GetSpawnCount(); + virtual void SetSpawnCount(int count); + virtual struct server_log_s *GetLog(); + virtual bool IsSecure(); + virtual void SetSecure(bool value); }; class CRehldsServerData : public IRehldsServerData { @@ -149,6 +292,42 @@ public: virtual ISteamGameServer *GetSteamGameServer(); virtual netadr_t *GetNetFrom(); virtual double GetOldTime(); + + virtual void SetNetFrom(struct netadr_s *from); + virtual void SetWorldmapCrc(uint32 crcValue); + virtual void SetDecalNameNum(int num); + + virtual bool IsActive(); + virtual void SetActive(bool state); + virtual bool IsPaused(); + virtual void SetPaused(bool state); + virtual int GetLastIndexCheckInPVS(); + virtual void SetLastIndexCheckInPVS(int id); + virtual double GetLastIndexCheckTimeInPVS(); + virtual void SetLastIndexCheckTimeInPVS(double time); + virtual const char *GetOldName(); + virtual void SetOldName(const char *name); + virtual const char *GetStartSpotName(); + virtual void SetStartSpotName(const char *startspot); + virtual struct model_s *GetWorldModel(); + virtual void SetWorldModel(struct model_s *model); + virtual struct consistency_s *GetConsistency(int index); + virtual struct model_s *GetModel(int index); + virtual struct event_s *GetEventPrecache(int index); + virtual struct entity_state_s *GetEntityBaseline(int index); + virtual struct extra_baselines_s *GetEntityInstanceBaselines(); + virtual int GetNumGenericNames(); + virtual void SetNumGenericNames(int num); + virtual int GetNumEdicts(); + virtual void SetNumEdicts(int num_edicts); + virtual int GetMaxEdicts(); + virtual void SetMaxEdicts(int max_edicts); + virtual edict_t *GetEdict(int index); + virtual server_state_t GetState(); + virtual void SetState(server_state_t st); + virtual sizebuf_t *GetMulticastBuf(); + virtual sizebuf_t *GetSpectatorBuf(); + virtual sizebuf_t *GetSignonBuf(); }; extern CGameClient** g_GameClients; diff --git a/rehlds/version/version.h b/rehlds/version/version.h index 43f4008..0a1f095 100644 --- a/rehlds/version/version.h +++ b/rehlds/version/version.h @@ -6,5 +6,5 @@ #pragma once #define VERSION_MAJOR 3 -#define VERSION_MINOR 9 +#define VERSION_MINOR 10 #define VERSION_MAINTENANCE 0 From 3a9bfb9ca1cfd0f482ef94b611ae69bd577a0d0e Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 16 Jun 2021 04:21:25 +0700 Subject: [PATCH 54/61] SV_New_f: Deny new connection twice at a time if user messages are received SV_ReadClientMessage: Fix empty names on bad read --- rehlds/engine/sv_main.cpp | 5 ++++- rehlds/engine/sv_user.cpp | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 5988519..4a2d54c 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -1498,7 +1498,7 @@ void SV_New_f(void) return; } - if (!host_client->active && host_client->spawned) + if ((host_client->hasusrmsgs && host_client->m_bSentNewResponse) || (!host_client->active && host_client->spawned)) { return; } @@ -1564,6 +1564,7 @@ void SV_New_f(void) } Netchan_CreateFragments(TRUE, &host_client->netchan, &msg); Netchan_FragSend(&host_client->netchan); + host_client->m_bSentNewResponse = TRUE; } void SV_SendRes_f(void) @@ -7371,6 +7372,8 @@ void SV_InactivateClients(void) cl->connected = TRUE; cl->spawned = FALSE; cl->fully_connected = FALSE; + cl->hasusrmsgs = FALSE; + cl->m_bSentNewResponse = FALSE; SZ_Clear(&cl->netchan.message); SZ_Clear(&cl->datagram); diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 16a48c4..7abd811 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -1779,6 +1779,12 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) { return; } +#ifdef REHLDS_FIXES + // Save current name of the client before a possible kick + char name[32]; + Q_strlcpy(name, host_client->name); +#endif + void(*func)(client_t *) = sv_clcfuncs[opcode].pfnParse; if (func) func(cl); @@ -1786,7 +1792,7 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) { #ifdef REHLDS_FIXES if (msg_badread) { - Con_Printf("SV_ReadClientMessage: badread on %s, opcode %s\n", host_client->name, sv_clcfuncs[opcode].pszname); + Con_Printf("SV_ReadClientMessage: badread on %s, opcode %s\n", name, sv_clcfuncs[opcode].pszname); } #endif From 0fed5b8038408c54a93cefbe7fda0c7f1b63953c Mon Sep 17 00:00:00 2001 From: Artem Golubikhin Date: Sat, 19 Jun 2021 13:12:24 +0300 Subject: [PATCH 55/61] Fixed volume checking in emit sound (#341) Co-authored-by: Dmitry Novikov Co-authored-by: Sergey Shorokhov --- rehlds/engine/pr_cmds.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index c56eaec..6b949ad 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -312,7 +312,11 @@ void EXT_FUNC PF_ambientsound_I(edict_t *entity, float *pos, const char *samp, f void EXT_FUNC PF_sound_I(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch) { +#ifdef REHLDS_FIXES + if (volume < 0.0f || volume > 1.0f) +#else if (volume < 0.0 || volume > 255.0) +#endif Sys_Error("%s: volume = %i", __func__, volume); if (attenuation < 0.0 || attenuation > 4.0) Sys_Error("%s: attenuation = %f", __func__, attenuation); From 478f338e376e2872a2f62a5235f3ff15d1110b07 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 19 Jun 2021 20:30:05 +0700 Subject: [PATCH 56/61] PF_sound_I: fix formatting --- rehlds/engine/pr_cmds.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index 6b949ad..df82bce 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -317,7 +317,7 @@ void EXT_FUNC PF_sound_I(edict_t *entity, int channel, const char *sample, float #else if (volume < 0.0 || volume > 255.0) #endif - Sys_Error("%s: volume = %i", __func__, volume); + Sys_Error("%s: volume = %f", __func__, volume); if (attenuation < 0.0 || attenuation > 4.0) Sys_Error("%s: attenuation = %f", __func__, attenuation); if (channel < 0 || channel > 7) From f23498bef76f7e250d998c8fb6d3b4996e42b92c Mon Sep 17 00:00:00 2001 From: Very Strange Karaulov <62130676+2020karaulov2020@users.noreply.github.com> Date: Sat, 19 Jun 2021 21:44:18 +0300 Subject: [PATCH 57/61] sv_user.cpp: Small code refactoring (#810) * Small code style fix in sv_user.cpp * SV_EstablishTimeBase_internal: code refactoring Co-authored-by: Sergey Shorokhov --- rehlds/engine/sv_user.cpp | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/rehlds/engine/sv_user.cpp b/rehlds/engine/sv_user.cpp index 7abd811..5e2c001 100644 --- a/rehlds/engine/sv_user.cpp +++ b/rehlds/engine/sv_user.cpp @@ -320,7 +320,7 @@ bool EXT_FUNC SV_ShouldSendConsistencyList_mod(IGameClient *cl, bool forceConsis if (g_psvs.maxclients == 1 || g_psv.num_consistency == 0 || cl->IsProxy()) return false; - if ((!forceConsistency && mp_consistency.value == 0.0f)) + if (!forceConsistency && mp_consistency.value == 0.0f) return false; return true; @@ -1502,31 +1502,44 @@ void SV_EstablishTimeBase(client_t *cl, usercmd_t *cmds, int dropped, int numbac void SV_EstablishTimeBase_internal(client_t *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds) { - int cmdnum; - double runcmd_time; + int i; + double runcmd_time = 0.0; + double time_at_end = 0.0; + constexpr int MAX_DROPPED_CMDS = 24; - runcmd_time = 0.0; - cmdnum = dropped; - if (dropped < 24) + // If we haven't dropped too many packets, then run some commands + if (dropped < MAX_DROPPED_CMDS) { if (dropped > numbackup) { - cmdnum = dropped - (dropped - numbackup); - runcmd_time = (double)cl->lastcmd.msec * (dropped - numbackup) / 1000.0; + // Con_Printf("%s: lost %i cmds\n", __func__, dropped - numbackup); } - for (; cmdnum > 0; cmdnum--) + int droppedcmds = dropped; + + // Run the last known cmd for each dropped cmd we don't have a backup for + while (droppedcmds > numbackup) { - runcmd_time += cmds[cmdnum - 1 + numcmds].msec / 1000.0; + runcmd_time += cl->lastcmd.msec / 1000.0; + droppedcmds--; + } + + // Now run the "history" commands if we still have dropped packets + while (droppedcmds > 0) + { + int cmdnum = numcmds + droppedcmds - 1; + runcmd_time += cmds[cmdnum].msec / 1000.0; + droppedcmds--; } } - for (; numcmds > 0; numcmds--) + // Now run any new command(s). Go backward because the most recent command is at index 0 + for (i = numcmds - 1; i >= 0; i--) { - runcmd_time += cmds[numcmds - 1].msec / 1000.0; + time_at_end += cmds[i].msec / 1000.0; } - cl->svtimebase = host_frametime + g_psv.time - runcmd_time; + cl->svtimebase = host_frametime + g_psv.time - (time_at_end + runcmd_time); } void SV_ParseMove(client_t *pSenderClient) From 527d0819b954301f9c4d507078b8f8706d8b8f1e Mon Sep 17 00:00:00 2001 From: Very Strange Karaulov <62130676+2020karaulov2020@users.noreply.github.com> Date: Sat, 19 Jun 2021 22:30:12 +0300 Subject: [PATCH 58/61] static_map.h: fix lowercase convert (#806) * More readability in convert lowercase Co-authored-by: Sergey Shorokhov Co-authored-by: Artem Golubikhin --- rehlds/public/rehlds/static_map.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rehlds/public/rehlds/static_map.h b/rehlds/public/rehlds/static_map.h index b1da16f..8b63d4c 100644 --- a/rehlds/public/rehlds/static_map.h +++ b/rehlds/public/rehlds/static_map.h @@ -229,8 +229,8 @@ protected: if (cpuinfo.sse4_2) { while (*pcc) { char cc = *(pcc++); - if (cc >= 'A' || cc <= 'Z') { - cc |= 0x20; + if (cc >= 'A' && cc <= 'Z') { + cc = (cc - 'A') + 'a'; } cksum = crc32c_t8_sse(cksum, cc); } @@ -240,8 +240,8 @@ protected: { while (*pcc) { char cc = *(pcc++); - if (cc >= 'A' || cc <= 'Z') { - cc |= 0x20; + if (cc >= 'A' && cc <= 'Z') { + cc = (cc - 'A') + 'a'; } cksum = crc32c_t8_nosse(cksum, cc); } From ad6f6ad39610f453c0c4f9ace5275dc69c9ab782 Mon Sep 17 00:00:00 2001 From: Very Strange Karaulov <62130676+2020karaulov2020@users.noreply.github.com> Date: Sat, 19 Jun 2021 22:39:40 +0300 Subject: [PATCH 59/61] sv_main.cpp: `SV_New_f()` uses `Q_snprintf()` unsafe format. (#807) --- rehlds/engine/sv_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 4a2d54c..7c2f627 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -1537,8 +1537,8 @@ void SV_New_f(void) gEntityInterface.pfnClientDisconnect(ent); } - Q_snprintf(szName, sizeof(szName), host_client->name); - Q_snprintf(szAddress, sizeof(szAddress), NET_AdrToString(host_client->netchan.remote_address)); + Q_snprintf(szName, sizeof(szName), "%s", host_client->name); + Q_snprintf(szAddress, sizeof(szAddress), "%s", NET_AdrToString(host_client->netchan.remote_address)); Q_snprintf(szRejectReason, sizeof(szRejectReason), "Connection rejected by game\n"); // Allow the game dll to reject this client. From 9508c8376bd14fbcd92beaa93b191ee4fb1c90a3 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Wed, 23 Jun 2021 16:04:53 +0300 Subject: [PATCH 60/61] change destinition folder for linux build (#842) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f2d8af..5e9f100 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -277,7 +277,7 @@ jobs: github.event.action == 'published' && startsWith(github.ref, 'refs/tags/') run: | - 7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/ hlsdk/ + 7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/linux32/ hlsdk/ 7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/ - name: Publish artifacts From aaffe43e3e7a99f267b29ed84d7405a989242052 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 24 Jun 2021 19:09:10 +0700 Subject: [PATCH 61/61] Reset m_bSentNewResponse to allow new connection when the client goes through the full stage of connection (cl:connect -> sv:S2C_CONNECTION -> cl:new -> SV_New_f) Related 3a9bfb9 --- rehlds/engine/sv_main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 7c2f627..74a285f 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -1657,6 +1657,9 @@ void EXT_FUNC SV_Spawn_f_internal(void) } else { +#ifdef REHLDS_FIXES + host_client->m_bSentNewResponse = FALSE; +#endif SV_New_f(); } } @@ -2488,6 +2491,7 @@ void EXT_FUNC SV_ConnectClient_internal(void) host_client->fully_connected = FALSE; #ifdef REHLDS_FIXES + host_client->m_bSentNewResponse = FALSE; g_GameClients[host_client - g_psvs.clients]->SetSpawnedOnce(false); #endif // REHLDS_FIXES