Skip to content

Commit 118e20e

Browse files
committed
Fix for recent TF2 update
1 parent cd2ee71 commit 118e20e

File tree

12 files changed

+80
-54
lines changed

12 files changed

+80
-54
lines changed

gamedata/sigsegv/entities.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108

109109
"CTFFlameThrower::SetWeaponState"
110110
{
111-
type "sym regex"
112-
sym "_ZN15CTFFlameThrower14SetWeaponStateEi\\.part\\..*"
111+
type "sym"
112+
sym "_ZN15CTFFlameThrower14SetWeaponStateEi"
113113
}
114114

115115
"CBaseAnimating::GetBoneTransform"

gamedata/sigsegv/misc.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3289,7 +3289,18 @@
32893289
type "sym"
32903290
sym "_ZN8CNetChan22IsValidFileForTransferEPKc"
32913291
}
3292-
3292+
"SV_Frame"
3293+
{
3294+
lib "engine"
3295+
type "sym"
3296+
sym "_Z8SV_Frameb"
3297+
}
3298+
"CBaseServer::RunFrame"
3299+
{
3300+
lib "engine"
3301+
type "sym"
3302+
sym "_ZN11CBaseServer8RunFrameEv"
3303+
}
32933304
}
32943305
"addrs_group"
32953306
{

src/common.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
#define WARN_IGNORE__CLASS_MEMACCESS()
7777
#endif
7878

79+
#if defined SE_IS_TF2 || defined SE_IS_CSS || defined SE_IS_SDK2013
80+
#define SE_IS_SDK2013_BASED
81+
#endif
7982

8083
class IVEngineServer;
8184
class IServerGameDLL;
@@ -382,11 +385,7 @@ WARN_RESTORE()
382385
WARN_IGNORE__SIGN_COMPARE()
383386
#include <utlbuffer.h>
384387
WARN_RESTORE()
385-
#ifdef SE_IS_TF2
386-
#include "sdk2013/shareddefs.h"
387-
#else
388388
#include <shareddefs.h>
389-
#endif
390389
#include <icvar.h>
391390
#include "sdk2013/convar.h"
392391

@@ -416,11 +415,7 @@ WARN_RESTORE()
416415
#include <usercmd.h>
417416
#include <npcevent.h>
418417
#include <bitbuf.h>
419-
#ifdef SE_IS_TF2
420-
#include "sdk2013/eiface.h"
421-
#else
422418
#include <eiface.h>
423-
#endif
424419
#include "sdk2013/imaterialsystem_V081.h"
425420
#include <materialsystem/imaterial.h>
426421
#include <toolframework/itoolentity.h>
@@ -430,11 +425,7 @@ WARN_RESTORE()
430425
#include <ai_activity.h>
431426
#include <igameevents.h>
432427
#include <inetmessage.h>
433-
#ifdef SE_IS_TF2
434-
#include "sdk2013/inetchannel.h"
435-
#else
436428
#include <inetchannel.h>
437-
#endif
438429
#include <irecipientfilter.h>
439430
//#include <usermessages.h>
440431
#include <cdll_int.h>
@@ -544,7 +535,6 @@ WARN_RESTORE()
544535
#endif
545536

546537
#ifdef SE_IS_TF2
547-
static_assert(_SIGSEGV_SDK2013_OVERRIDE__PUBLIC_SHAREDDEFS_H);
548538
#else
549539
static_assert(_SIGSEGV_SDK2013_OVERRIDE__PUBLIC_TIER0_PLATFORM_H);
550540
static_assert(_SIGSEGV_SDK2013_OVERRIDE__PUBLIC_TIER0_COMMONMACROS_H);

src/mod/attr/custom_attributes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5340,7 +5340,7 @@ namespace Mod::Attr::Custom_Attributes
53405340
DETOUR_MEMBER_CALL(state);
53415341
}
53425342

5343-
DETOUR_DECL_MEMBER_CALL_CONVENTION(__gcc_regcall, void, CTFFlameThrower_SetWeaponState, int state)
5343+
DETOUR_DECL_MEMBER(void, CTFFlameThrower_SetWeaponState, int state)
53445344
{
53455345
auto flamethrower = reinterpret_cast<CTFFlameThrower *>(this);
53465346
if (state != flamethrower->m_iWeaponState) {

src/mod/etc/workshop_map_fix.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ namespace Mod::Etc::Workshop_Map_Fix
353353
ScanWorkshopMaps();
354354
}
355355
if (removeOldLinksTimer.HasStarted() && removeOldLinksTimer.IsElapsed()) {
356+
removeOldLinksTimer.Invalidate();
356357
RemoveOldLinks();
357358
}
358359
}

src/mod/mvm/blu_velocity_limit_remove.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ namespace Mod::MvM::Blu_Velocity_Limit_Remove
99
0x83, 0xf8, 0x03, // +0x0005 cmp eax, 3
1010
0x0f, 0x85, 0xd0, 0xfe, 0xff, 0xff, // +0x0008 jnz loc_11DF4A7
1111
#else
12-
0xe8, 0x1d, 0x6d, 0xba, 0xff, // +0x0000 call _ZNK11CBaseEntity13GetTeamNumberEv; CBaseEntity::GetTeamNumber(void)
13-
0x83, 0xc4, 0x10, // +0x0005 add esp, 10h
14-
0x83, 0xf8, 0x03, // +0x0008 cmp eax, 3
15-
0x0f, 0x85, 0xc3, 0xfe, 0xff, 0xff, // +0x000b jnz loc_F1DCA2
12+
0xe8, 0x8d, 0x05, 0x94, 0xff, // +0x0000 call _ZNK11CBaseEntity13GetTeamNumberEv; CBaseEntity::GetTeamNumber(void)
13+
0x83, 0xc4, 0x10, // +0x0005 add esp, 10h
14+
0x83, 0xf8, 0x03, // +0x0008 cmp eax, 3
15+
0x75, 0x9b, // +0x000b jnz short loc_CEAB46
1616
#endif
1717
};
1818

@@ -35,7 +35,7 @@ namespace Mod::MvM::Blu_Velocity_Limit_Remove
3535
//buf.SetDword(0x00 +1, (uint32_t)AddrManager::GetAddr("CBaseEntity::GetTeamNumber"));
3636
mask[0x05 + 2] = 0x00;
3737
mask.SetDword(0x00 + 1, 0x00000000);
38-
mask.SetDword(0x0b + 2, 0x00000000);
38+
mask[0x0b + 1] = 0x00;
3939
#endif
4040

4141
return true;

src/mod/perf/func_optimize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#include "mod.h"
23
#include "util/scope.h"
34
#include "util/clientmsg.h"
@@ -821,7 +822,7 @@ namespace Mod::Perf::Func_Optimize
821822
#endif
822823
//MOD_ADD_DETOUR_MEMBER(CLagCompensationManager_BacktrackPlayer, "CLagCompensationManager::BacktrackPlayer");
823824

824-
825+
825826
}
826827

827828
virtual bool ShouldReceiveCallbacks() const override { return this->IsEnabled(); }

src/mod/pop/popmgr_extensions.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,17 +4616,25 @@ namespace Mod::Pop::PopMgr_Extensions
46164616
FOR_EACH_SUBKEY(kv, kv_mission) {
46174617
auto name = kv_mission->GetName();
46184618
if (name[0] == '*' || FStrEq(name, map) || (name[strlen(name)-1] == '*' && V_strncmp(name, map, strlen(name)-1))) {
4619-
if (kv_mission->GetString()[0] != '|') {
4620-
thisMapPopfiles.erase(std::remove(thisMapPopfiles.begin(), thisMapPopfiles.end(), kv_mission->GetString()), thisMapPopfiles.end());
4621-
}
4622-
else {
4619+
if (kv_mission->GetString()[0] == '-' ) {
46234620
auto filter = std::regex(kv_mission->GetString()+1, std::regex_constants::ECMAScript);
46244621
for (auto it = thisMapPopfiles.end() - 1; it != thisMapPopfiles.begin()-1; it--) {
46254622
if (std::regex_match(*it, filter, std::regex_constants::match_any)) {
46264623
thisMapPopfiles.erase(it);
46274624
}
46284625
}
46294626
}
4627+
else if (kv_mission->GetString()[0] == '+') {
4628+
auto filter = std::regex(kv_mission->GetString()+1, std::regex_constants::ECMAScript);
4629+
for (auto it = thisMapPopfiles.end() - 1; it != thisMapPopfiles.begin()-1; it--) {
4630+
if (!std::regex_match(*it, filter, std::regex_constants::match_any)) {
4631+
thisMapPopfiles.erase(it);
4632+
}
4633+
}
4634+
}
4635+
else {
4636+
thisMapPopfiles.erase(std::remove(thisMapPopfiles.begin(), thisMapPopfiles.end(), kv_mission->GetString()), thisMapPopfiles.end());
4637+
}
46304638
}
46314639
}
46324640
}
@@ -4637,18 +4645,22 @@ namespace Mod::Pop::PopMgr_Extensions
46374645
{
46384646
std::vector<std::string> bannedMissions;
46394647
std::vector<std::regex> bannedMissionsRegex;
4648+
std::vector<std::regex> bannedMissionsRegexInclude;
46404649

46414650
auto map = STRING(gpGlobals->mapname);
46424651
KeyValues *kv = LoadBannedMissionsFile();
46434652
if (kv != nullptr) {
46444653
FOR_EACH_SUBKEY(kv, kv_mission) {
46454654
auto name = kv_mission->GetName();
46464655
if (name[0] == '*' || stricmp(name, map) == 0) {
4647-
if (kv_mission->GetString()[0] != '|') {
4648-
bannedMissions.push_back(kv_mission->GetString());
4656+
if (kv_mission->GetString()[0] == '-') {
4657+
bannedMissionsRegex.push_back(std::regex(kv_mission->GetString()+1, std::regex_constants::ECMAScript));
4658+
}
4659+
else if (kv_mission->GetString()[0] == '+') {
4660+
bannedMissionsRegexInclude.push_back(std::regex(kv_mission->GetString()+1, std::regex_constants::ECMAScript));
46494661
}
46504662
else {
4651-
bannedMissionsRegex.push_back(std::regex(kv_mission->GetString()+1, std::regex_constants::ECMAScript));
4663+
bannedMissions.push_back(kv_mission->GetString());
46524664
}
46534665
}
46544666
}
@@ -4684,8 +4696,14 @@ namespace Mod::Pop::PopMgr_Extensions
46844696
DETOUR_STATIC_CALL(vec);
46854697
}
46864698

4687-
if (!bannedMissionsRegex.empty()) {
4699+
if (!bannedMissionsRegex.empty() || !bannedMissionsRegexInclude.empty()) {
46884700
FOR_EACH_VEC_BACK(vec, i) {
4701+
for (auto &regex : bannedMissionsRegexInclude) {
4702+
if (!std::regex_match(vec[i].Get(), regex, std::regex_constants::match_any)) {
4703+
vec.Remove(i);
4704+
break;
4705+
}
4706+
}
46894707
for (auto &regex : bannedMissionsRegex) {
46904708
if (std::regex_match(vec[i].Get(), regex, std::regex_constants::match_any)) {
46914709
vec.Remove(i);

src/sdk2013/shareddefs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#pragma once
1212
#endif
1313

14-
#define _SIGSEGV_SDK2013_OVERRIDE__PUBLIC_SHAREDDEFS_H 1
15-
1614
#define TICK_INTERVAL (gpGlobals->interval_per_tick)
1715

1816

src/stub/populators.cpp

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ static constexpr uint8_t s_Buf_CPopulationManager_m_RespecPoints[] = {
77
#ifdef PLATFORM_64BITS
88
0x55, // +0x0000 push rbp
99
0x48, 0x89, 0xe5, // +0x0001 mov rbp, rsp
10-
0x41, 0x54, // +0x0004 push r12
11-
0x49, 0x89, 0xfc, // +0x0006 mov r12, rdi
12-
0x48, 0x81, 0xc7, 0xc0, 0x08, 0x00, 0x00, // +0x0009 add rdi, 8C0h
13-
0x48, 0x83, 0xec, 0x08, // +0x0010 sub rsp, 8
14-
0xe8, 0x17, 0x3a, 0x00, 0x00, // +0x0014 call CUtlRBTree<...>::RemoveAll
10+
0x41, 0x55, // +0x0004 push r13
11+
0x41, 0x54, // +0x0006 push r12
12+
0x53, // +0x0008 push rbx
13+
0x48, 0x89, 0xfb, // +0x0009 mov rbx, rdi
14+
0x48, 0x81, 0xc7, 0xc0, 0x08, 0x00, 0x00, // +0x000c add rdi, 8C0h
15+
0x48, 0x83, 0xec, 0x08, // +0x0013 sub rsp, 8
16+
0xe8, 0x04, 0x3a, 0x00, 0x00, // +0x0017 call CUtlRBTree<...>::RemoveAll
1517
#else
16-
0x55, // +0000 push ebp
17-
0x89, 0xe5, // +0001 mov ebp,esp
18-
0x53, // +0003 push ebx
19-
0x83, 0xec, 0x3c, // +0004 sub esp,0x3c
20-
0x8b, 0x5d, 0x08, // +0007 mov ebx,[ebp+this]
21-
0x8d, 0x83, 0xe4, 0x06, 0x00, 0x00, // +000A lea eax,[ebx+0xVVVVVVVV]
22-
0x50, // +0010 push eax
23-
0xe8, 0xe6, 0x64, 0x00, 0x00, // +0011 call CUtlRBTree<...>::RemoveAll
18+
0x55, // +0x0000 push ebp
19+
0x89, 0xe5, // +0x0001 mov ebp, esp
20+
0x57, // +0x0003 push edi
21+
0x56, // +0x0004 push esi
22+
0x53, // +0x0005 push ebx
23+
0x83, 0xec, 0x18, // +0x0006 sub esp, 18h
24+
0x8b, 0x5d, 0x08, // +0x0009 mov ebx, [ebp+this]
25+
0x8d, 0x83, 0x14, 0x07, 0x00, 0x00, // +0x000c lea eax, [ebx+714h]
26+
0x50, // +0x0012 push eax
27+
0xe8, 0x38, 0x38, 0x00, 0x00, // +0x0013 call CUtlRBTree<...>::RemoveAll
2428
#endif
2529
};
2630

@@ -35,13 +39,13 @@ struct CExtract_CPopulationManager_m_RespecPoints : public IExtract<int32_t>
3539
buf.CopyFrom(s_Buf_CPopulationManager_m_RespecPoints);
3640

3741
#ifdef PLATFORM_64BITS
38-
mask.SetRange(0x09 + 3, 4, 0x00);
39-
mask.SetRange(0x10 + 3, 1, 0x00);
40-
mask.SetRange(0x14 + 1, 4, 0x00);
42+
mask.SetRange(0x0c + 3, 4, 0x00);
43+
mask.SetRange(0x13 + 3, 1, 0x00);
44+
mask.SetRange(0x17 + 1, 4, 0x00);
4145
#else
42-
mask.SetRange(0x04 + 2, 1, 0x00);
43-
mask.SetRange(0x0a + 2, 4, 0x00);
44-
mask.SetRange(0x11 + 1, 4, 0x00);
46+
mask.SetRange(0x06 + 2, 1, 0x00);
47+
mask.SetRange(0x0c + 2, 4, 0x00);
48+
mask.SetRange(0x13 + 1, 4, 0x00);
4549
#endif
4650

4751
return true;
@@ -51,9 +55,9 @@ struct CExtract_CPopulationManager_m_RespecPoints : public IExtract<int32_t>
5155
virtual uint32_t GetFuncOffMin() const override { return 0x0000; }
5256
virtual uint32_t GetFuncOffMax() const override { return 0x0000; }
5357
#ifdef PLATFORM_64BITS
54-
virtual uint32_t GetExtractOffset() const override { return 0x0009 + 3; }
58+
virtual uint32_t GetExtractOffset() const override { return 0x000c + 3; }
5559
#else
56-
virtual uint32_t GetExtractOffset() const override { return 0x000a + 2; }
60+
virtual uint32_t GetExtractOffset() const override { return 0x000c + 2; }
5761
#endif
5862
};
5963

src/stub/server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ MemberFuncThunk<CClientFrameManager *, void> CClientFrameManager::ft_RemoveOldes
1010
MemberFuncThunk<CHLTVServer *, void, CBaseClient *> CHLTVServer::ft_StartMaster("CHLTVServer::StartMaster");
1111

1212
MemberFuncThunk<CBaseServer *, CBaseClient *, const char *> CBaseServer::ft_CreateFakeClient("CBaseServer::CreateFakeClient");
13+
MemberFuncThunk<CBaseServer *, void> CBaseServer::ft_RunFrame("CBaseServer::RunFrame");
1314

1415
MemberVFuncThunk<CBaseServer *, float> CBaseServer::vt_GetCPUUsage (TypeName<CBaseServer>(), "CBaseServer::GetCPUUsage");
1516
MemberVFuncThunk<CBaseServer *, void, int> CBaseServer::vt_UserInfoChanged(TypeName<CBaseServer>(), "CBaseServer::UserInfoChanged");

src/stub/server.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class CBaseServer : public IServer
7272
{
7373
public:
7474
CBaseClient *CreateFakeClient(const char *name) { return ft_CreateFakeClient(this, name); }
75+
void RunFrame() { ft_RunFrame(this); }
7576

7677
float GetCPUUsage() { return vt_GetCPUUsage(this); }
7778
void UserInfoChanged(int slot) { vt_UserInfoChanged(this, slot); }
@@ -84,6 +85,7 @@ class CBaseServer : public IServer
8485
#endif
8586
private:
8687
static MemberFuncThunk<CBaseServer *, CBaseClient *, const char *> ft_CreateFakeClient;
88+
static MemberFuncThunk<CBaseServer *, void> ft_RunFrame;
8789

8890
static MemberVFuncThunk<CBaseServer *, float> vt_GetCPUUsage;
8991
static MemberVFuncThunk<CBaseServer *, void, int> vt_UserInfoChanged;

0 commit comments

Comments
 (0)