CBaseServer::UpdateGameData
0x0010f310 · 1508 bytes · __thiscall
_ZN11CBaseServer14UpdateGameDataEv
Decompiled
undefined (1 param)
/* CBaseServer::UpdateGameData() */
void __thiscall CBaseServer::UpdateGameData(CBaseServer *this)
{
size_t __size;
code *pcVar1;
char cVar2;
size_t sVar3;
void *__ptr;
undefined4 uVar4;
int iVar5;
char *pcVar6;
CUtlMemory<unsigned_char,int> *this_00;
int iVar7;
int iVar8;
undefined4 uVar9;
CUtlVector *extraout_ECX;
undefined *puVar10;
int iVar11;
undefined *puVar12;
int in_GS_OFFSET;
int local_184;
CUtlMemory<char,int> *local_180;
CUtlString local_174 [16];
CUtlString local_164 [16];
void *local_154;
size_t local_150;
undefined4 local_14c;
size_t local_148;
void *local_144;
int local_140 [5];
CFmtStrN<256> local_12c [5];
char local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
UpdateGameType(this);
__size = *(size_t *)(this + 0x19c);
local_154 = (void *)0x0;
local_150 = 0;
local_14c = 0;
local_148 = 0;
local_144 = (void *)0x0;
if ((int)__size < 1) {
local_144 = (void *)0x0;
__ptr = *(void **)(this + 400);
if (__size == 0) goto LAB_0010f3ea;
}
else {
local_150 = __size;
local_144 = malloc(__size);
__ptr = *(void **)(this + 400);
}
local_154 = local_144;
CUtlVector<char,CUtlMemory<char,int>>::GrowVector
((CUtlVector<char,CUtlMemory<char,int>> *)&local_154,__size);
/* try { // try from 0010f3c0 to 0010f4a5 has its CatchHandler @ 0010f938 */
CUtlVector<char,CUtlMemory<char,int>>::ShiftElementsRight
((CUtlVector<char,CUtlMemory<char,int>> *)&local_154,0,__size);
if ((__ptr != (void *)0x0) && (0 < (int)__size)) {
sVar3 = 0;
do {
*(undefined1 *)((int)local_154 + sVar3) = *(undefined1 *)((int)__ptr + sVar3);
sVar3 = sVar3 + 1;
} while (sVar3 != __size);
}
__ptr = *(void **)(this + 400);
LAB_0010f3ea:
local_180 = (CUtlMemory<char,int> *)&local_154;
*(undefined4 *)(this + 0x19c) = 0;
local_184 = 0;
if ((*(int *)(this + 0x194) < 0x430) && (-1 < *(int *)(this + 0x198))) {
*(undefined4 *)(this + 0x194) = 0x430;
if (__ptr == (void *)0x0) {
local_184 = 0;
__ptr = malloc(0x430);
*(void **)(this + 400) = __ptr;
}
else {
__ptr = realloc(__ptr,0x430);
local_184 = *(int *)(this + 0x19c);
*(void **)(this + 400) = __ptr;
}
}
*(void **)(this + 0x1a0) = __ptr;
CUtlVector<char,CUtlMemory<char,int>>::GrowVector
((CUtlVector<char,CUtlMemory<char,int>> *)(this + 400),0x430);
CUtlVector<char,CUtlMemory<char,int>>::ShiftElementsRight
((CUtlVector<char,CUtlMemory<char,int>> *)(this + 400),local_184,0x430);
memset(*(void **)(this + 400),0,*(size_t *)(this + 0x19c));
CUtlString::CUtlString(local_174);
/* try { // try from 0010f4ab to 0010f5b5 has its CatchHandler @ 0010f8f4 */
cVar2 = (**(code **)(*(int *)this + 0x60))(this);
if ((cVar2 != '\0') && (*(int *)(sv_steamgroup_exclusive._28_4_ + 0x30) == 0)) {
uVar4 = GetHostVersion();
pcVar6 = "FCVAR_NEVER_AS_STRING";
if ((sv_search_key[0x15] & 0x10) == 0) {
pcVar6 = "";
if (*(char **)(sv_search_key._28_4_ + 0x24) != (char *)0x0) {
pcVar6 = *(char **)(sv_search_key._28_4_ + 0x24);
}
}
CFmtStrN<256>::CFmtStrN(local_12c,"key:%s%d",pcVar6,uVar4);
AddTagString(this,local_174,local_127);
}
iVar11 = *(int *)(this + 0x19c);
iVar5 = CUtlString::Length(local_174);
if (iVar5 < iVar11 + -2) {
CUtlString::CUtlString(local_164);
pcVar6 = "FCVAR_NEVER_AS_STRING";
if ((sv_steamgroup[0x15] & 0x10) == 0) {
pcVar6 = "";
if (*(char **)(sv_steamgroup._28_4_ + 0x24) != (char *)0x0) {
pcVar6 = *(char **)(sv_steamgroup._28_4_ + 0x24);
}
}
local_140[0] = 0;
local_140[1] = 0;
local_140[2] = 0;
local_140[3] = 0;
local_140[4] = 0;
/* try { // try from 0010f60e to 0010f66a has its CatchHandler @ 0010f953 */
BuildTokenList(pcVar6,(char)local_140,extraout_ECX);
if (0 < local_140[3]) {
iVar11 = 0;
do {
uVar4 = CUtlString::Get((CUtlString *)(iVar11 * 0x10 + local_140[0]));
CFmtStrN<256>::CFmtStrN(local_12c,"grp:%si",uVar4);
AddTagString(this,local_164,local_127);
iVar11 = iVar11 + 1;
} while (iVar11 < local_140[3]);
}
iVar11 = local_140[3] + -1;
iVar5 = iVar11 * 0x10;
if (-1 < iVar11) {
do {
iVar11 = iVar11 + -1;
this_00 = (CUtlMemory<unsigned_char,int> *)(local_140[0] + iVar5);
iVar5 = iVar5 + -0x10;
CUtlMemory<unsigned_char,int>::Purge(this_00);
} while (iVar11 != -1);
}
local_140[3] = 0;
CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_140);
local_140[4] = local_140[0];
CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_140);
iVar11 = *(int *)(this + 0x19c);
/* try { // try from 0010f6e7 to 0010f8a0 has its CatchHandler @ 0010f93c */
iVar5 = CUtlString::Length(local_174);
iVar7 = CUtlString::Length(local_164);
if (iVar11 + -2 <= iVar5 + iVar7) {
Warning(
"GameData: Too many Steam groups set for sv_steamgroup, not advertising Steam groups affiliation.\n"
);
CUtlString::Purge(local_164);
}
if (serverGameDLL != (int *)0x0) {
pcVar1 = *(code **)(*serverGameDLL + 0xa4);
iVar11 = *(int *)(this + 0x19c);
iVar5 = CUtlString::Length(local_174);
iVar7 = CUtlString::Length(local_164);
(*pcVar1)(serverGameDLL,*(undefined4 *)(this + 400),((iVar11 - iVar5) - iVar7) + -3);
}
iVar7 = _V_strlen(*(char **)(this + 400));
iVar11 = *(int *)(this + 400);
iVar5 = *(int *)(this + 0x19c);
uVar4 = CUtlString::Get(local_174);
iVar8 = CUtlString::Length(local_164);
puVar12 = &DAT_002abe42;
if (iVar8 == 0) {
puVar12 = &DAT_002c79d4;
}
uVar9 = CUtlString::Get(local_164);
puVar10 = &DAT_002abe42;
if (iVar7 == 0) {
puVar10 = &DAT_002c79d4;
}
V_snprintf((char *)(iVar11 + iVar7),(iVar5 - iVar7) + -1,"%s%s%s%s",puVar10,uVar9,puVar12,uVar4)
;
iVar11 = Steam3Server();
if (*(int *)(iVar11 + 4) != 0) {
iVar11 = Steam3Server();
(**(code **)(**(int **)(iVar11 + 4) + 0x58))
(*(int **)(iVar11 + 4),*(undefined4 *)(this + 400));
}
if ((local_148 != *(size_t *)(this + 0x19c)) ||
(iVar11 = memcmp(local_154,*(void **)(this + 400),local_148), iVar11 != 0)) {
*(int *)(this + 0x1a4) = *(int *)(this + 0x1a4) + 1;
}
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_164);
}
else {
Warning("GameData: sv_search_key too long, cannot advertise server!\n");
}
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_174);
local_148 = 0;
CUtlMemory<char,int>::Purge(local_180);
local_144 = local_154;
CUtlMemory<char,int>::Purge(local_180);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.