CMatchTitleGameSettingsMgr::InitializeGameSettings
0x0003ac00 · 1609 bytes · __regparm3
_ZN26CMatchTitleGameSettingsMgr22InitializeGameSettingsEP9KeyValuesPKc.part.10
Decompiled
undefined (2 params)
/* CMatchTitleGameSettingsMgr::InitializeGameSettings(KeyValues*, char const*) [clone .part.10] */
void __regparm3 CMatchTitleGameSettingsMgr::InitializeGameSettings(KeyValues *param_1,char *param_2)
{
char *pcVar1;
char *pcVar2;
KeyValues *pKVar3;
int iVar4;
char *pcVar5;
KeyValues *pKVar6;
undefined4 uVar7;
KeyValues *pKVar8;
int iVar9;
char *pcVar10;
KeyValues *this;
KeyValues *extraout_ECX;
int in_GS_OFFSET;
undefined8 uVar11;
undefined *puVar12;
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,"System/network","LIVE");
pcVar2 = (char *)KeyValues::GetString(param_1,"Options/play","");
pKVar3 = (KeyValues *)KeyValues::FindKey(param_1,"Game",true);
if (pKVar3 != (KeyValues *)0x0) {
KeyValues::SetString(pKVar3,"state","lobby");
iVar4 = KeyValues::FindKey(pKVar3,"mode",false);
if (iVar4 == 0) {
KeyValues::SetString(pKVar3,"mode","coop");
}
pcVar5 = (char *)KeyValues::GetString(pKVar3,"mode","");
pKVar6 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar5);
uVar7 = KeyValues::GetString(pKVar6,"base",pcVar5);
pKVar8 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,uVar7);
iVar4 = StringAfterPrefix(pcVar5,"team");
if (iVar4 == 0) {
pcVar10 = (char *)KeyValues::GetString(pKVar3,"campaign","");
if (*pcVar10 == '\0') {
this = (KeyValues *)
(**(code **)(*(int *)g_pMatchExtL4D + 0x14))
(g_pMatchExtL4D,param_1,0xffffffff,0xffffffff);
pcVar10 = (char *)KeyValues::GetString(this,"Name","");
KeyValues::SetString(pKVar3,"campaign",pcVar10);
}
iVar4 = KeyValues::GetInt(pKVar8,"singlechapter",0);
iVar4 = KeyValues::GetInt(pKVar6,"singlechapter",(uint)(iVar4 != 0));
iVar9 = KeyValues::GetInt(pKVar3,"chapter",0);
if (iVar9 == 0) {
if (iVar4 == 0) {
KeyValues::SetInt(pKVar3,"chapter",1);
}
else {
uVar7 = KeyValues::GetString(pKVar3,"campaign","");
CFmtStrN<256>::CFmtStrN(local_12c,"%s/modes/%s/chapters",uVar7,pcVar5);
pKVar8 = (KeyValues *)(*(code *)**(undefined4 **)g_pMatchExtL4D)(g_pMatchExtL4D);
uVar7 = KeyValues::GetInt(pKVar8,local_127,1);
iVar4 = RandomInt(1,uVar7);
KeyValues::SetInt(pKVar3,"chapter",iVar4);
}
}
}
else {
iVar4 = KeyValues::GetInt(pKVar8,"singlechapter",0);
KeyValues::GetInt(pKVar6,"singlechapter",(uint)(iVar4 != 0));
}
iVar4 = KeyValues::FindKey(pKVar3,"difficulty",false);
if (iVar4 == 0) {
KeyValues::SetString(pKVar3,"difficulty","normal");
}
iVar4 = KeyValues::FindKey(pKVar3,"maxrounds",false);
if (iVar4 == 0) {
KeyValues::SetInt(pKVar3,"maxrounds",3);
}
iVar4 = KeyValues::GetInt(pKVar6,"addon",0);
if (iVar4 == 0) {
iVar4 = _V_stricmp("offline",pcVar1);
if (iVar4 == 0) {
pKVar6 = (KeyValues *)(*(code *)**(undefined4 **)g_pMatchExtL4D)(g_pMatchExtL4D);
pKVar6 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar6);
pcVar5 = (char *)KeyValues::GetString(pKVar6,"Name","");
KeyValues::SetString(pKVar3,"campaign",pcVar5);
KeyValues::SetInt(pKVar3,"chapter",1);
}
}
iVar4 = _V_stricmp("commentary",pcVar2);
if (iVar4 == 0) {
KeyValues::SetString(pKVar3,"campaign","L4D2C5");
KeyValues::SetInt(pKVar3,"chapter",1);
KeyValues::SetString(pKVar3,"difficulty","easy");
}
iVar4 = _V_stricmp("credits",pcVar2);
if (iVar4 == 0) {
KeyValues::SetString(pKVar3,"campaign","credits");
KeyValues::SetInt(pKVar3,"chapter",1);
KeyValues::SetString(pKVar3,"difficulty","easy");
}
}
pKVar3 = (KeyValues *)KeyValues::FindKey(param_1,"Game/MissionInfo",true);
pcVar2 = (char *)KeyValues::GetString(param_1,"Game/campaign","");
TransferMissionInformationToInfo(pcVar2,pKVar3,param_1);
pKVar3 = (KeyValues *)KeyValues::FindKey(param_1,"Game/ModeInfo",true);
pcVar2 = (char *)KeyValues::GetString(param_1,"Game/mode","");
TransferModeInformationToInfo(pcVar2,pKVar3,extraout_ECX);
uVar11 = DetermineDlcRequiredMask(param_1);
uVar7 = (undefined4)((ulonglong)uVar11 >> 0x20);
KeyValues::SetUint64((char *)param_1,CONCAT44((int)uVar11,"Game/dlcrequired"));
iVar4 = _V_stricmp("offline",pcVar1);
if (iVar4 != 0) {
puVar12 = &DAT_000b2b65;
pcVar1 = (char *)KeyValues::GetString(param_1,"Game/mode","");
pKVar3 = (KeyValues *)
(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar1,puVar12,uVar7);
iVar9 = KeyValues::GetInt(pKVar3,"maxplayers",0);
iVar4 = 4;
if (3 < iVar9) {
iVar4 = iVar9;
}
iVar9 = 8;
if (iVar4 < 9) {
iVar9 = iVar4;
}
iVar4 = StringAfterPrefix(pcVar1,"team");
if (iVar4 != 0) {
iVar9 = iVar9 >> 1;
}
KeyValues::SetInt(param_1,"Members/numSlots",iVar9);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.