CMatchTitleGameSettingsMgr::PrepareTeamLinkForGame
0x0003b510 · 953 bytes · __thiscall
_ZN26CMatchTitleGameSettingsMgr22PrepareTeamLinkForGameEP9KeyValuesS1_
Decompiled
undefined (3 params)
/* CMatchTitleGameSettingsMgr::PrepareTeamLinkForGame(KeyValues*, KeyValues*) */
KeyValues * __thiscall
CMatchTitleGameSettingsMgr::PrepareTeamLinkForGame
(CMatchTitleGameSettingsMgr *this,KeyValues *param_1,KeyValues *param_2)
{
char *pcVar1;
char *pcVar2;
int iVar3;
int iVar4;
KeyValues *pKVar5;
undefined4 uVar6;
KeyValues *this_00;
int iVar7;
int iVar8;
int in_GS_OFFSET;
ulonglong uVar9;
ulonglong uVar10;
char *pcVar11;
KeyValues *local_134;
char *local_130;
CFmtStrN<256> local_12c [5];
char local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pcVar1 = (char *)KeyValues::GetString(param_1,"Game/mode","coop");
uVar9 = ComputeMembersDlcMaskFromSettings(param_1);
uVar10 = ComputeMembersDlcMaskFromSettings(param_2);
pcVar2 = (char *)KeyValues::GetString(param_1,"Game/campaign","");
pcVar11 = "Game/campaign";
local_130 = (char *)KeyValues::GetString(param_2,"Game/campaign","");
if ((*pcVar2 == '\0') || (*local_130 == '\0')) {
local_134 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar11);
/* try { // try from 0003b735 to 0003b739 has its CatchHandler @ 0003b8c4 */
KeyValues::KeyValues(local_134,"PrepareTeamLinkForGame",(IKeyValuesSystem *)0x0,false);
if (*pcVar2 == '\0') {
if (*local_130 == '\0') {
pKVar5 = (KeyValues *)
(**(code **)(*(int *)g_pMatchExtL4D + 0x14))(g_pMatchExtL4D,param_1,uVar9 & uVar10)
;
local_130 = (char *)KeyValues::GetString(pKVar5,"name","");
}
}
else if (*local_130 == '\0') {
local_130 = pcVar2;
}
KeyValues::SetString(local_134,"Update/Game/campaign",local_130);
local_130 = (char *)KeyValues::GetString(local_134,"Update/Game/campaign","");
iVar3 = KeyValues::GetInt(param_1,"Game/chapter",0);
pcVar11 = "Game/chapter";
iVar4 = KeyValues::GetInt(param_2,"Game/chapter",0);
if ((iVar4 != 0) && (iVar3 != 0)) goto LAB_0003b6e2;
if (local_134 == (KeyValues *)0x0) goto LAB_0003b600;
}
else {
iVar3 = KeyValues::GetInt(param_1,"Game/chapter",0);
pcVar11 = "Game/chapter";
iVar4 = KeyValues::GetInt(param_2,"Game/chapter",0);
local_130 = pcVar2;
if ((iVar4 != 0) && (iVar3 != 0)) {
local_134 = (KeyValues *)0x0;
goto LAB_0003b6e2;
}
LAB_0003b600:
local_134 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pcVar11);
/* try { // try from 0003b62d to 0003b631 has its CatchHandler @ 0003b8dc */
KeyValues::KeyValues(local_134,"PrepareTeamLinkForGame",(IKeyValuesSystem *)0x0,false);
}
pKVar5 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar1);
uVar6 = KeyValues::GetString(pKVar5,"base",pcVar1);
this_00 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,uVar6);
iVar7 = KeyValues::GetInt(this_00,"singlechapter",0);
iVar7 = KeyValues::GetInt(pKVar5,"singlechapter",(uint)(iVar7 != 0));
iVar8 = 1;
if (iVar7 != 0) {
CFmtStrN<256>::CFmtStrN(local_12c,"%s/modes/%s/chapters",local_130,pcVar1);
pKVar5 = (KeyValues *)(*(code *)**(undefined4 **)g_pMatchExtL4D)(g_pMatchExtL4D);
uVar6 = KeyValues::GetInt(pKVar5,local_127,1);
iVar8 = RandomInt(1,uVar6);
}
if (iVar3 == 0) {
iVar3 = iVar8;
}
if (iVar4 == 0) {
iVar4 = iVar3;
}
KeyValues::SetInt(local_134,"Update/Game/chapter",iVar4);
LAB_0003b6e2:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return local_134;
}
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.