Key_WriteBindings
0x001848a0 · 823 bytes · __cdecl
_Z17Key_WriteBindingsR10CUtlBufferi
Decompiled
undefined (2 params)
/* Key_WriteBindings(CUtlBuffer&, int) */
void Key_WriteBindings(CUtlBuffer *param_1,int param_2)
{
uint uVar1;
char *pcVar2;
CUtlMemory<CUtlString,int> *pCVar3;
undefined4 uVar4;
CUtlMemory<unsigned_char,int> *this;
uint uVar5;
int iVar6;
int iVar7;
int *piVar8;
CUtlMemory<CUtlString,int> *pCVar9;
int in_GS_OFFSET;
int local_894;
uint local_890;
CUtlString local_88c [16];
CUtlMemory<CUtlString,int> local_87c [12];
int local_870 [17];
CUtlMemory<CUtlString,int> local_82c [5];
char local_827 [2055];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pCVar3 = local_87c;
do {
*(undefined4 *)pCVar3 = 0;
pCVar9 = pCVar3 + 0x14;
*(undefined4 *)(pCVar3 + 4) = 0;
*(undefined4 *)(pCVar3 + 8) = 0;
*(undefined4 *)(pCVar3 + 0xc) = 0;
*(undefined4 *)(pCVar3 + 0x10) = 0;
pCVar3 = pCVar9;
} while (pCVar9 != local_82c);
local_890 = 0xfffffdde;
uVar5 = 0xffffff8e;
do {
pcVar2 = *(char **)(uVar5 * 8 + 0x3a3eb0);
if ((pcVar2 != (char *)0x0) && (*pcVar2 != '\0')) {
/* try { // try from 00184938 to 00184a06 has its CatchHandler @ 00184bd8 */
uVar4 = (**(code **)(*g_pInputSystem + 0x6c))(g_pInputSystem,uVar5 + 0x72);
if (uVar5 < 0x230) {
if (uVar5 < 0x80) {
local_894 = (int)uVar5 >> 5;
}
else if (uVar5 - 0x80 < 0x10) {
local_894 = (int)(uVar5 - 0x80) >> 2;
}
else {
uVar1 = uVar5 - 0x90;
if (uVar1 < 0x30) {
local_894 = ((int)uVar1 / 6 + ((int)uVar1 >> 0x1f) >> 1) - ((int)uVar1 >> 0x1f);
}
else if (uVar5 - 0xc0 < 0xf0) {
local_894 = (int)(uVar5 - 0xc0) / 0x1e;
}
else {
if (0x7f < local_890) goto LAB_00184949;
local_894 = (int)local_890 >> 4;
}
}
if (-1 < param_2) goto LAB_001849d7;
if (local_894 == 0) goto LAB_0018495a;
CUtlString::CUtlString(local_88c);
/* try { // try from 00184a35 to 00184a74 has its CatchHandler @ 00184c43 */
CFmtStrN<2048>::CFmtStrN
((CFmtStrN<2048> *)local_82c,"cmd%d bind \"%s\" \"%s\"\n",local_894 + 1,uVar4,
pcVar2);
CUtlString::operator=(local_88c,local_827);
CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)
(local_87c + local_894 * 0x14),local_870[local_894 * 5],local_88c);
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_88c);
}
else {
LAB_00184949:
local_894 = 0;
if (-1 < param_2) {
LAB_001849d7:
if (param_2 != local_894) goto LAB_00184900;
}
LAB_0018495a:
CUtlBuffer::Printf(param_1,"bind \"%s\" \"%s\"\n",uVar4,pcVar2);
}
}
LAB_00184900:
local_890 = local_890 + 1;
uVar5 = uVar5 + 1;
if (uVar5 == 0x230) {
if (1 < DAT_003a1734) {
local_894 = 1;
piVar8 = local_870 + 2;
do {
iVar7 = piVar8[3];
iVar6 = 0;
if (0 < iVar7) {
do {
/* try { // try from 00184b2a to 00184b42 has its CatchHandler @ 00184bd8 */
uVar4 = CUtlString::Get((CUtlString *)(iVar6 * 0x10 + *piVar8));
CUtlBuffer::Printf(param_1,"%s",uVar4);
iVar6 = iVar6 + 1;
} while (iVar6 != iVar7);
}
local_894 = local_894 + 1;
piVar8 = piVar8 + 5;
} while (local_894 < DAT_003a1734);
}
pCVar3 = local_82c;
do {
pCVar9 = pCVar3 + -0x14;
iVar7 = *(int *)(pCVar3 + -8) + -1;
iVar6 = iVar7 * 0x10;
if (-1 < iVar7) {
do {
iVar7 = iVar7 + -1;
this = (CUtlMemory<unsigned_char,int> *)(*(int *)pCVar9 + iVar6);
iVar6 = iVar6 + -0x10;
CUtlMemory<unsigned_char,int>::Purge(this);
} while (iVar7 != -1);
}
*(undefined4 *)(pCVar3 + -8) = 0;
CUtlMemory<CUtlString,int>::Purge(pCVar9);
*(undefined4 *)(pCVar3 + -4) = *(undefined4 *)pCVar9;
CUtlMemory<CUtlString,int>::Purge(pCVar9);
pCVar3 = pCVar9;
} while (pCVar9 != local_87c);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
} while( true );
}
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.