bind
0x00183d10 · 372 bytes · __cdecl
_ZL4bindRK8CCommand
Decompiled
undefined (1 param)
/* bind(CCommand const&) */
void bind(CCommand *param_1)
{
int iVar1;
int iVar2;
char *pcVar3;
undefined1 *puVar4;
int in_GS_OFFSET;
char local_420 [1024];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar1 = *(int *)param_1;
if (iVar1 - 2U < 2) {
iVar2 = (**(code **)(*g_pInputSystem + 0x74))(g_pInputSystem,*(undefined4 *)(param_1 + 0x40c));
if (iVar2 == -1) {
puVar4 = &DAT_002c79d4;
if (1 < *(int *)param_1) {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
ConMsg("\"%s\" isn\'t a valid key\n",puVar4);
}
else if (iVar1 == 2) {
if ((&s_KeyContext)[iVar2 * 2] == 0) {
puVar4 = &DAT_002c79d4;
if (1 < *(int *)param_1) {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
ConMsg("\"%s\" is not bound\n",puVar4);
}
else {
puVar4 = &DAT_002c79d4;
if (1 < *(int *)param_1) {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
ConMsg("\"%s\" = \"%s\"\n",puVar4,(&s_KeyContext)[iVar2 * 2]);
}
}
else {
if (iVar2 == 0x46) {
V_strncpy(local_420,"cancelselect",0x400);
}
else {
local_420[0] = '\0';
pcVar3 = "";
if (2 < *(int *)param_1) {
pcVar3 = *(char **)(param_1 + 0x410);
}
V_strncat(local_420,pcVar3,0x400,-1);
}
Key_SetBinding(iVar2,local_420);
}
}
else {
ConMsg("bind <key> [command] : attach a command to a key\n");
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.