Key_NameForBinding
0x00184260 · 563 bytes · __cdecl
_Z18Key_NameForBindingPKcii21BindingLookupOption_t
Decompiled
undefined (4 params)
/* Key_NameForBinding(char const*, int, int, BindingLookupOption_t) */
int Key_NameForBinding(char *param_1,undefined4 param_2,int param_3,int param_4)
{
char cVar1;
char *pcVar2;
char *pcVar3;
int iVar4;
uint uVar5;
int in_GS_OFFSET;
int local_138;
char local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_1 != (char *)0x0) {
do {
uVar5 = 0xffffff8e;
local_138 = 0;
param_1 = param_1 + (*param_1 == '+');
do {
pcVar3 = *(char **)(uVar5 * 8 + 0x3a3eb0);
if ((pcVar3 != (char *)0x0) && (cVar1 = *pcVar3, cVar1 != '\0')) {
pcVar2 = strchr(pcVar3,0x3b);
if (pcVar2 == (char *)0x0) {
iVar4 = V_strcasecmp(pcVar3 + (cVar1 == '+'),param_1);
if (iVar4 == 0) {
iVar4 = (**(code **)(*g_pInputSystem + 0x6c))(g_pInputSystem,uVar5 + 0x72);
LAB_00184369:
if (iVar4 != 0) {
if (param_4 != -1) {
if (param_4 != 2) {
if (param_4 == 0) {
if (0x22f < uVar5) goto LAB_00184440;
}
else if ((param_4 == 1) && (uVar5 < 0xc0)) goto LAB_00184440;
goto LAB_00184398;
}
if (0x16f < uVar5 - 0xc0) goto LAB_00184398;
}
LAB_00184440:
if (local_138 == param_3) goto LAB_00184476;
local_138 = local_138 + 1;
}
}
}
else {
V_strncpy(local_120,pcVar3,0x100);
pcVar3 = strtok(local_120,";");
while (pcVar3 != (char *)0x0) {
iVar4 = V_strcasecmp(pcVar3 + (*pcVar3 == '+'),param_1);
if (iVar4 == 0) {
iVar4 = (**(code **)(*g_pInputSystem + 0x6c))(g_pInputSystem,uVar5 + 0x72);
goto LAB_00184369;
}
pcVar3 = strtok((char *)0x0,";");
}
}
}
LAB_00184398:
uVar5 = uVar5 + 1;
} while (uVar5 != 0x230);
iVar4 = _V_stricmp("duck",param_1);
if (iVar4 == 0) {
param_1 = "toggle_duck";
}
else {
iVar4 = _V_stricmp("zoom",param_1);
if (iVar4 != 0) break;
param_1 = "toggle_zoom";
}
param_3 = local_138;
param_4 = -1;
} while( true );
}
iVar4 = 0;
LAB_00184476:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return iVar4;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.