MM_Title_RichPresence_Update
0x0003d220 · 1361 bytes · __cdecl
_Z28MM_Title_RichPresence_UpdateP9KeyValuesS0_
Decompiled
undefined (2 params)
/* MM_Title_RichPresence_Update(KeyValues*, KeyValues*) */
void MM_Title_RichPresence_Update(KeyValues *param_1,KeyValues *param_2)
{
code *pcVar1;
byte bVar2;
char *pcVar3;
KeyValues *pKVar4;
int iVar5;
char *pcVar6;
KeyValues *pKVar7;
uint uVar8;
KeyValues *this;
int iVar9;
uint uVar10;
uint uVar11;
uint uVar12;
undefined **ppuVar13;
undefined8 uVar14;
undefined4 uVar15;
KeyValues *local_20;
if (param_1 == (KeyValues *)0x0) {
return;
}
if (param_2 == (KeyValues *)0x0) {
MM_Title_RichPresence_PlayersChanged(param_1);
param_2 = param_1;
}
pcVar3 = (char *)KeyValues::GetString(param_1,"Game/campaign","");
local_20 = (KeyValues *)0x0;
if (*pcVar3 != '\0') {
pKVar4 = (KeyValues *)(*(code *)**(undefined4 **)g_pMatchExtL4D)(g_pMatchExtL4D);
local_20 = (KeyValues *)KeyValues::FindKey(pKVar4,pcVar3,false);
}
pKVar4 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 8))(g_pMatchExtL4D,param_1,0);
pcVar3 = (char *)KeyValues::GetString(param_2,"System/access",(char *)0x0);
if ((pcVar3 != (char *)0x0) && (g_pcv_CONTEXT_ACCESS != (undefined *)0x0)) {
ppuVar13 = &g_pcv_CONTEXT_ACCESS;
pcVar6 = g_pcv_CONTEXT_ACCESS;
do {
iVar5 = _V_stricmp(pcVar6,pcVar3);
if (iVar5 == 0) break;
ppuVar13 = ppuVar13 + 2;
pcVar6 = *ppuVar13;
} while (pcVar6 != (char *)0x0);
}
pcVar3 = (char *)KeyValues::GetString(param_2,"Game/state",(char *)0x0);
if ((pcVar3 != (char *)0x0) && (g_pcv_CONTEXT_STATE != (undefined *)0x0)) {
ppuVar13 = &g_pcv_CONTEXT_STATE;
pcVar6 = g_pcv_CONTEXT_STATE;
do {
iVar5 = _V_stricmp(pcVar6,pcVar3);
if (iVar5 == 0) break;
ppuVar13 = ppuVar13 + 2;
pcVar6 = *ppuVar13;
} while (pcVar6 != (char *)0x0);
}
pcVar3 = (char *)KeyValues::GetString(param_2,"Game/mode",(char *)0x0);
if (pcVar3 != (char *)0x0) {
GetGameModeContext(pcVar3);
}
pcVar3 = (char *)KeyValues::GetString(param_2,"Game/difficulty",(char *)0x0);
if ((pcVar3 != (char *)0x0) && (g_pcv_CONTEXT_DIFFICULTY != (undefined *)0x0)) {
ppuVar13 = &g_pcv_CONTEXT_DIFFICULTY;
pcVar6 = g_pcv_CONTEXT_DIFFICULTY;
do {
iVar5 = _V_stricmp(pcVar6,pcVar3);
if (iVar5 == 0) break;
ppuVar13 = ppuVar13 + 2;
pcVar6 = *ppuVar13;
} while (pcVar6 != (char *)0x0);
}
pKVar7 = (KeyValues *)KeyValues::FindKey(param_2,"Game/maxrounds",false);
if (pKVar7 != (KeyValues *)0x0) {
MM_Title_RichPresence_Update(KeyValues*,KeyValues*)::val =
KeyValues::GetInt(pKVar7,(char *)0x0,0);
}
iVar5 = KeyValues::GetString(param_2,"Game/campaign",(char *)0x0);
if (iVar5 == 0) {
pKVar7 = (KeyValues *)KeyValues::FindKey(param_2,"Game/chapter",false);
if (pKVar7 == (KeyValues *)0x0) goto LAB_0003d469;
LAB_0003d429:
MM_Title_RichPresence_Update(KeyValues*,KeyValues*)::val =
KeyValues::GetInt(pKVar7,(char *)0x0,0);
}
else {
KeyValues::GetInt(local_20,"x360ctx",2);
pKVar7 = (KeyValues *)KeyValues::FindKey(param_2,"Game/chapter",false);
if (pKVar7 != (KeyValues *)0x0) goto LAB_0003d429;
}
pKVar7 = pKVar4;
if ((pKVar4 != (KeyValues *)0x0) || (pKVar7 = local_20, local_20 != (KeyValues *)0x0)) {
KeyValues::GetInt(pKVar7,"x360ctx",2);
}
LAB_0003d469:
pcVar3 = (char *)KeyValues::FindKey(param_2,"Game/dlcrequired",false);
if (pcVar3 != (char *)0x0) {
uVar15 = 0;
uVar14 = KeyValues::GetUint64(pcVar3,0);
uVar10 = (uint)((ulonglong)uVar14 >> 0x20);
if (0 < *(int *)(mm_matchmaking_dlcsquery._28_4_ + 0x30)) {
uVar11 = 1;
do {
bVar2 = (byte)uVar11 & 0x1f;
uVar8 = (uint)uVar14 >> bVar2 | uVar10 << 0x20 - bVar2;
if ((uVar11 & 0x20) != 0) {
uVar8 = uVar10 >> ((byte)uVar11 & 0x1f);
}
*(uint *)(MM_Title_RichPresence_Update(KeyValues*,KeyValues*)::val + uVar11 * 4) = uVar8 & 1
;
uVar12 = uVar11 + 1;
DevMsg("DLC%d required: %d\n",uVar11,uVar8 & 1,uVar15);
uVar11 = uVar12;
} while ((int)uVar12 <= *(int *)(mm_matchmaking_dlcsquery._28_4_ + 0x30));
}
}
pcVar3 = (char *)KeyValues::GetString(param_1,"Game/mode",(char *)0x0);
if (pcVar3 != (char *)0x0) {
pKVar7 = (KeyValues *)(**(code **)(*(int *)g_pMatchExtL4D + 0x10))(g_pMatchExtL4D,pcVar3);
pcVar1 = *(code **)(*(int *)g_pMatchExtL4D + 0x10);
uVar15 = KeyValues::GetString(pKVar7,"base",pcVar3);
this = (KeyValues *)(*pcVar1)(g_pMatchExtL4D,uVar15);
iVar5 = KeyValues::GetInt(pKVar7,"x360presence",1);
if (iVar5 == 1) {
iVar5 = KeyValues::GetInt(this,"x360presence",1);
pKVar7 = this;
}
pcVar3 = (char *)KeyValues::GetString(param_1,"System/network","");
iVar9 = _V_stricmp("offline",pcVar3);
if (iVar9 == 0) {
iVar5 = KeyValues::GetInt(pKVar7,"x360presence:/network:offline",iVar5);
}
pcVar3 = (char *)KeyValues::GetString(param_1,"Options/play","");
iVar9 = _V_stricmp("commentary",pcVar3);
if (iVar9 == 0) {
iVar5 = KeyValues::GetInt(pKVar7,"x360presence:/play:commentary",iVar5);
}
iVar5 = KeyValues::GetInt(local_20,"x360presence",iVar5);
iVar5 = KeyValues::GetInt(pKVar4,"x360presence",iVar5);
pcVar3 = (char *)KeyValues::GetString(param_1,"Game/state","lobby");
iVar9 = _V_stricmp("lobby",pcVar3);
if (iVar9 != 0) {
iVar9 = KeyValues::GetInt(pKVar7,"x360presence:/state:game",1);
iVar5 = iVar5 + iVar9;
}
pcVar3 = (char *)KeyValues::GetString(param_1,"Options/play","");
iVar9 = _V_stricmp("credits",pcVar3);
if (iVar9 == 0) {
KeyValues::GetInt(pKVar7,"x360presence:/play:credits",iVar5);
}
}
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.