Skip to content

Commit

Permalink
Rewrite / Optimizations / Improvements (#139)
Browse files Browse the repository at this point in the history
* hasValidAngles shouldn't matter because spawn is already ignored

* rm tps check for now, we're going to hook funcs instead

* run nullcmds (essentially) on bunk clients, stop spamming on unconnected clients

* add steam spew to debug mode only

* more cleanup

* IsClientKickQueue etc

* add windows_speaker_cfg and undo some drastic changes

* version + compile

* plugin

* updatefile

* respect ban/punish cvar for kicking for new cvar

* dont whine about speakercfg not being found

* force require extensions

* exts / incs

* fix gamedata

* update exts to proper vers from forums

* add updated srctvmgr

* add more detailed prints to discord log, clean up other misc

* rm junk comment

* add eye pos history to log/discord, more cleanup using dynamic char arrays for discord

* gamedata + point_worldtext comments etc

* remove spammy log

* rm more dbg spam

* .

* dead code removal, general cleanup, etc

* whine like hell if stac is unloaded, remove more dumb code with setrandomseed

* turn bind bypass prevention

* fix bypass with banqueued

* fixup mistake with logic in oprc

* yeet memory leak lmao

* optimizations and tons of code cleanup
remove userinfo spam
rework pingmasking fixes for much cleaner code

* rework a ton of lag checks, further optimizations with the help of perf finding hot functions

* i'm already in hell, i might as well convert all the ugly "Cl" variables for clients to "cl"

* polish

* comment

* chmod

* update updatefile

* readme

* recompile

* fixup a bunch of bugs, clean up discord notifs, update aimsnap to be better

* ignore bot signonstate stuff

* readd the loss check and add more fixes for cmdnum spike check

* actually just add nullcmd/nulltick lag check to everything but dont set in lag timeout

* cache tickrate instead of checking it all the damn time

* proper optimizations to isDefaultTickrate, also stop calling it every frame Lol

* optimize livefeed more

* more tweaks / comments

* fix (bang) cmdnum/tickcount logic and add detail to cmdnum spike discord msg

* leverage connect extension to get proper steamids and remove dead code

* see last commit re steamid changes

* cleanup with consistency

* float_rand on some timers

* add proper invalid usercmd checks, remove dead code

* bins

* proper gate more dbg msgs

* yet more dbg

* wholesale rework of discord json using sm-json include

* add avatar and fix map change race condition with steamid etc

* readd discord

* bins

* fix comment

* fix issue with client's names getting changed by other plugins breaking steamid grabbing

* fixup steamid copying from PreConnect and do some more optimizations

* rm spam connect msgs

* update smx
  • Loading branch information
sapphonie authored May 16, 2023
1 parent 8d3a017 commit caddfac
Show file tree
Hide file tree
Showing 48 changed files with 8,554 additions and 2,423 deletions.
Empty file modified LICENSE
100644 → 100755
Empty file.
257 changes: 130 additions & 127 deletions README.md
100644 → 100755

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions cvars.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,6 @@ stac_log_to_file "1"
// Maximum: "1.000000"
stac_fixpingmasking_enabled "1"

// [StAC] maximum number of times a client can spam userinfo updates (over the course of 10 seconds) before getting banned.
// (recommended 10+)
// -
// Default: "25"
// Minimum: "-1.000000"
stac_max_userinfo_spam_detections "25"

// [StAC] forcibly reconnect clients unauthorized with steam - this protects against cheat clients not setting steamids, at the cost of making your server inaccessible when Steam is down.
// (recommended 0, only enable this if you have consistent issues with unauthed cheaters!)
// -
Expand Down
Empty file modified extensions/SteamWorks.ext.dll
100644 → 100755
Empty file.
Binary file added extensions/connect.ext.2.ep2v.dll
Binary file not shown.
Binary file added extensions/connect.ext.2.ep2v.so
Binary file not shown.
Binary file added extensions/conplex.ext.dll
Binary file not shown.
Binary file added extensions/conplex.ext.so
Binary file not shown.
Binary file added extensions/sourcetvmanager.ext.2.tf2.dll
Binary file not shown.
Binary file modified extensions/sourcetvmanager.ext.2.tf2.so
100644 → 100755
Binary file not shown.
Binary file added extensions/webcon.ext.dll
Binary file not shown.
Binary file added extensions/webcon.ext.so
Binary file not shown.
134 changes: 134 additions & 0 deletions gamedata/connect.games.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
"Games"
{
"#default"
{
"#supported"
{
"engine" "dods"
"engine" "css"
"engine" "hl2dm"
"engine" "tf2"
}

"Offsets"
{
"ISteamGameServer__BeginAuthSession"
{
"linux" "29"
"mac" "29"
"windows" "29"
}

"ISteamGameServer__EndAuthSession"
{
"linux" "30"
"mac" "30"
"windows" "30"
}
}

"Signatures"
{
"CBaseServer__CheckMasterServerRequestRestart"
{
"library" "engine"
"windows" "\xE8\x2A\x2A\x2A\x2A\x83\x78\x04\x00\x74\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x48\x04\x8B\x01\x8B\x40\x2C\xFF\xD0\x84\xC0\x74\x2A\x56"
}

"Steam3Server"
{
"library" "engine"
"linux" "@_Z12Steam3Serverv"
"mac" "@_Z12Steam3Serverv"
}
}
}

"#default"
{
"#supported"
{
"engine" "dods"
"engine" "css"
"engine" "hl2dm"
}

"Signatures"
{
"CBaseServer__ConnectClient"
{
"library" "engine"
"linux" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"mac" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"windows" "\x55\x8B\xEC\x81\xEC\x04\x05\x00\x00\x56\x68\x2A\x2A\x2A\x2A\x8B\xF1"
}

"CBaseServer__RejectConnection"
{
"library" "engine"
"linux" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"mac" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"windows" "\x55\x8B\xEC\x81\xEC\x04\x05\x00\x00\x56\x6A\xFF"
}

"CBaseClient__SetSteamID"
{
"library" "engine"
"linux" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
"mac" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
"windows" "\x55\x8B\xEC\x8B\x55\x08\x8B\x02\x89\x41\x59\x8B\x42\x04"
}

"CBaseServer__CheckChallengeType"
{
"library" "engine"
"linux" "@_ZN11CBaseServer18CheckChallengeTypeEP11CBaseClientiR8netadr_siPKcii"
"mac" "@_ZN11CBaseServer18CheckChallengeTypeEP11CBaseClientiR8netadr_siPKcii"
"windows" "\x55\x8B\xEC\x83\xEC\x14\x56\x57\x8B\x7D\x2A\x8B\xF1"
}
}
}

"#default"
{
"#supported"
{
"engine" "tf2"
}

"Signatures"
{
"CBaseServer__ConnectClient"
{
"library" "engine"
"linux" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"mac" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"windows" "\x55\x8B\xEC\x81\xEC\x24\x05\x00\x00"
}

"CBaseServer__RejectConnection"
{
"library" "engine"
"linux" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"mac" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"windows" "\x55\x8B\xEC\x81\xEC\x04\x05\x00\x00\x57"
}

"CBaseClient__SetSteamID"
{
"library" "engine"
"linux" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
"mac" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
"windows" "\x55\x8B\xEC\x56\x57\x8B\x7D\x08\x8B\xF1\x8D\x4E\x04"
}

"CBaseServer__CheckChallengeType"
{
"library" "engine"
"linux" "@_ZN11CBaseServer18CheckChallengeTypeEP11CBaseClientiR8netadr_siPKcii"
"mac" "@_ZN11CBaseServer18CheckChallengeTypeEP11CBaseClientiR8netadr_siPKcii"
"windows" "\x55\x8B\xEC\x83\xEC\x14\x53\x8B\x5D\x14"
}
}
}
}
187 changes: 187 additions & 0 deletions gamedata/conplex.games.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
"Games"
{
"#default"
{
"Signatures"
{
/*
* String: "Socket ProcessAccept Error: %s\n"
*/
"ProcessAccept"
{
"library" "engine"
"linux" "@_ZN14CSocketCreator13ProcessAcceptEv"
}

/*
* If this signature exists, it is used to scope the ProcessAccept detour to only the RCon server.
*
* String: "RCON Cmd: recv error (%s)\n"
* You're looking for the one that doesn't also contain "Lost RCON connection, please retry command (%s)\n"
*/
"RunFrame"
{
"library" "engine"
"linux" "@_ZN11CRConServer8RunFrameEv"
}

/*
* Optional, used to ban clients sending invalid data.
*
* String: "Banning %s for rcon hacking attempts\n"
*/
"HandleFailedRconAuth"
{
"library" "engine"
"linux" "@_ZN11CRConServer20HandleFailedRconAuthERK8netadr_s"
}
}
}

"tf"
{
"Signatures"
{
"ProcessAccept"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x57\x8D\x45\xF8\xC7\x45\xF8\x10\x00\x00\x00\x50"
}

"RunFrame"
{
"library" "engine"
"windows" "\x55\x8B\xEC\xB8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x53\x8B\xD9\x56\x57"
}

"HandleFailedRconAuth"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x18\xA1\x2A\x2A\x2A\x2A\x8B\x15\x2A\x2A\x2A\x2A\x53\x56\x57"
}
}
}

"cstrike"
{
"Signatures"
{
"ProcessAccept"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x57\x8D\x45\xF8\xC7\x45\xF8\x10\x00\x00\x00\x50"
}

"RunFrame"
{
"library" "engine"
"windows" "\x55\x8B\xEC\xB8\x68\x10\x00\x00\xE8\x2A\x2A\x2A\x2A\x53\x56\x8B\xF1\x57"
}

"HandleFailedRconAuth"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x18\xA1\x2A\x2A\x2A\x2A\x8B\x15\x2A\x2A\x2A\x2A\x53\x56\x57"
}
}
}

"hl2mp"
{
"Signatures"
{
"ProcessAccept"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x57\x8D\x45\xF8\xC7\x45\xF8\x10\x00\x00\x00\x50"
}

"RunFrame"
{
"library" "engine"
"windows" "\x55\x8B\xEC\xB8\x68\x10\x00\x00\xE8\x2A\x2A\x2A\x2A\x53\x56\x8B\xF1\x57"
}

"HandleFailedRconAuth"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x18\xA1\x2A\x2A\x2A\x2A\x8B\x15\x2A\x2A\x2A\x2A\x53\x56\x57"
}
}
}

"dod"
{
"Signatures"
{
"ProcessAccept"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x57\x8D\x45\xF8\xC7\x45\xF8\x10\x00\x00\x00\x50"
}

"RunFrame"
{
"library" "engine"
"windows" "\x55\x8B\xEC\xB8\x68\x10\x00\x00\xE8\x2A\x2A\x2A\x2A\x53\x56\x8B\xF1\x57"
}

"HandleFailedRconAuth"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x18\xA1\x2A\x2A\x2A\x2A\x8B\x15\x2A\x2A\x2A\x2A\x53\x56\x57"
}
}
}

"csgo"
{
"Signatures"
{
"ProcessAccept"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x56\x57\x8D\x45\xF8\xC7\x45\xF8\x10\x00\x00\x00\x50"
"linux" "\x55\x89\xE5\x83\xEC\x58\x89\x5D\xF4\x8B\x5D\x08\x8D\x45\xE0"
}

"RunFrame"
{
"library" "engine"
"windows" "\x55\x8B\xEC\xB8\x64\x10\x00\x00\xE8\x2A\x2A\x2A\x2A\x53"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x6C\x10\x00\x00\x8B\x75\x08\x83\xC6\x04"
}

"HandleFailedRconAuth"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x10\x8B\x15\x2A\x2A\x2A\x2A\x89\x4D\xFC"
"linux" "\x55\xB8\x2A\x2A\x2A\x2A\x89\xE5\x57\x56\x53\x83\xEC\x5C\x8B\x15\x2A\x2A\x2A\x2A\x8B"
}
}
}

"left4dead2"
{
"Signatures"
{
"ProcessAccept"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x28\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\xFC\x53\x57\x8B\xF9"
}

"RunFrame"
{
"library" "engine"
"windows" "\x55\x8B\xEC\xB8\x2C\x10\x00\x00\xE8\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\xFC\x53\x8B\xD9\x56\x57\x8D\x4B\x04"
}

"HandleFailedRconAuth"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x10\x53\x56\x8B\xD9\x8B\x43\x2A\x57\x33\xFF"
}
}
}
}
14 changes: 7 additions & 7 deletions gamedata/sourcetvmanager.games.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"linux"
{
"signature" "CHLTVServer_DemoRecorderRef"
"read" "43"
"read" "42"
}
}
}
Expand Down Expand Up @@ -121,15 +121,15 @@
{
"library" "engine"
// ping(CCommand const&) "Client ping times:\n"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x3C\x8B\x45\x08\x83\xB8\x08\x05\x00\x00\x03"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x1C\x8B\x45\x2A\x83\xB8\x2A\x2A\x2A\x2A\x03"
"windows" "\x55\x8B\xEC\x51\x8B\x4D\x08\x83\xB9\x08\x05\x00\x00\x03"
}

"CHLTVServer::BroadcastEventLocal"
{
"library" "engine"
// _ZN11CHLTVServer19BroadcastEventLocalEP10IGameEventb
"linux" "\x55\x89\xE5\x57\x56\x8D\x45\xB0\x53\x83\xEC\x6C"
"linux" "\x55\x89\xE5\x57\x56\x8D\x45\x2A\x53\x83\xEC\x68\xC7\x45\x2A\x2A\x2A\x2A\x2A\x8B\x5D\x2A\x50\x8B\x7D"
// "SourceTV broadcast local event: %s\n"
"windows" "\x55\x8B\xEC\x83\xEC\x4C\x53\x8B\xD9\xC7\x45\xB4\x2A\x2A\x2A\x2A\x56\x8D"
}
Expand All @@ -138,7 +138,7 @@
{
"library" "engine"
// _ZN11CHLTVServer18BroadcastLocalChatEPKcS1_
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x6C\x8B\x15\x2A\x2A\x2A\x2A\x8B\x02"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x5C\xA1\x2A\x2A\x2A\x2A\x8B\x7D\x2A\x8B\x00"
// "hltv_chat"
"windows" "\x55\x8B\xEC\x83\xEC\x54\xA1\x2A\x2A\x2A\x2A\x53"
}
Expand All @@ -147,7 +147,7 @@
{
"library" "engine"
// _ZN11CHLTVServer26StopRecordingAndFreeFramesEbPK9CGameInfo
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x4C\x0F\xB6\x45\x0C\x8B\x75\x08"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x3C\x8B\x75\x2A\x8B\x5D\x2A\x88\x5D"
// _ZN11CHLTVServer11IsRecordingEv
"windows" "\x8B\x81\x2A\x2A\x2A\x2A\x81\xC1\x2A\x2A\x2A\x2A\x8B\x40\x2A\xFF\xE0"
}
Expand All @@ -159,15 +159,15 @@
"library" "engine"
// "StartRecording: couldn't open demo file %s.\n"
// _ZN17CHLTVDemoRecorder14StartRecordingEPKcb
"linux" "\x55\x89\xE5\x83\xEC\x18\x89\x5D\xF8\x8B\x5D\x08\x89\x75\xFC\x8B\x75\x0C\x8B\x03\xC7\x44\x24\x04\x00\x00\x00\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x24\x01\x00\x00\x8B\x5D\x08\x65\xA1\x14\x00\x00\x00"
}

"CHLTVDemoRecorder::StopRecording"
{
"library" "engine"
// "Completed GOTV demo \"%s\", recording time %.1f\n"
// _ZN17CHLTVDemoRecorder13StopRecordingEPK9CGameInfo
"linux" "\x55\x89\xE5\x56\x53\x83\xEC\x30\x8B\x5D\x08\x80\xBB\x40\x05\x00\x00\x00"
"linux" "\x55\x89\xE5\x8B\x45\x08\x80\xB8\x40\x05\x00\x00\x00"
}
}
}
Expand Down
Loading

0 comments on commit caddfac

Please sign in to comment.