L L4D2node

CDirectorChallengeMode::DoUserConsoleFunc

0x0089f780 · 1104 bytes · __thiscall

_ZN22CDirectorChallengeMode17DoUserConsoleFuncEP11CBasePlayer12CVariantBaseI24CVariantDefaultAllocatorE

Decompiled

undefined (3 params)

/* WARNING: Removing unreachable block (ram,0x0089f9a6) */
/* WARNING: Removing unreachable block (ram,0x0089f8f6) */
/* WARNING: Removing unreachable block (ram,0x0089f954) */
/* WARNING: Removing unreachable block (ram,0x0089f9fe) */
/* WARNING: Removing unreachable block (ram,0x0089f8ce) */
/* CDirectorChallengeMode::DoUserConsoleFunc(CBasePlayer*, CVariantBase<CVariantDefaultAllocator>)
    */

void __thiscall
CDirectorChallengeMode::DoUserConsoleFunc
          (CDirectorChallengeMode *this,CBaseEntity *param_1,int *param_3)

{
  undefined4 uVar1;
  char *pcVar2;
  undefined4 *puVar3;
  int iVar4;
  void *local_4c [2];
  undefined2 local_44;
  ushort local_42;
  char *local_40;
  int local_3c;
  undefined2 local_38;
  ushort local_36;
  void *local_34;
  undefined4 local_30;
  undefined2 local_2c;
  ushort local_2a;
  char *local_28;
  int local_24;
  undefined2 local_20;
  ushort local_1e;
  
  if (0xfffffffd < *(int *)(this + 0x134) - 1U) {
    DevMsg("No scripted user function to call\n");
    return;
  }
  local_42 = 0;
  local_38 = (undefined2)param_3[2];
  local_44 = 0;
  local_4c[0] = (void *)0x0;
  local_36 = 0;
  local_40 = (char *)0x0;
  local_3c = 0;
  switch(local_38) {
  case 3:
    puVar3 = (undefined4 *)*param_3;
    local_38 = 3;
    goto LAB_0089f80b;
  case 4:
    puVar3 = (undefined4 *)*param_3;
    local_38 = 4;
    local_40 = malloc(0x10);
    *(undefined4 *)local_40 = *puVar3;
    *(undefined4 *)(local_40 + 4) = puVar3[1];
    *(undefined4 *)(local_40 + 8) = puVar3[2];
    local_36 = 1;
    *(undefined4 *)(local_40 + 0xc) = puVar3[3];
    break;
  default:
    local_40 = (char *)*param_3;
    local_3c = param_3[1];
    break;
  case 0x1c:
    puVar3 = (undefined4 *)*param_3;
    local_38 = 0x1c;
    local_40 = malloc(8);
    *(undefined4 *)local_40 = *puVar3;
    *(undefined4 *)(local_40 + 4) = puVar3[1];
    local_36 = 1;
    break;
  case 0x1f:
    pcVar2 = (char *)*param_3;
    local_38 = 0x1f;
                    /* try { // try from 0089fa99 to 0089fa9d has its CatchHandler @ 0089fc50 */
    iVar4 = _V_strlen(pcVar2);
    local_40 = malloc(iVar4 + 1U);
    memcpy(local_40,pcVar2,iVar4 + 1U);
    local_36 = local_36 | 1;
    break;
  case 0x28:
    puVar3 = (undefined4 *)*param_3;
    local_38 = 0x28;
LAB_0089f80b:
    local_40 = malloc(0xc);
    *(undefined4 *)local_40 = *puVar3;
    *(undefined4 *)(local_40 + 4) = puVar3[1];
    *(undefined4 *)(local_40 + 8) = puVar3[2];
    local_36 = 1;
  }
  if (param_1 == (CBaseEntity *)0x0) {
    local_34 = (void *)0x0;
  }
  else {
                    /* try { // try from 0089f850 to 0089f874 has its CatchHandler @ 0089fc17 */
    local_34 = (void *)CBaseEntity::GetScriptInstance(param_1);
  }
  uVar1 = *(undefined4 *)(this + 0x134);
  puVar3 = (undefined4 *)CDirector::GetScriptScope(TheDirector,1);
  pcVar2 = local_40;
  local_2a = 0;
  local_1e = 0;
  local_2c = 0x20;
  local_30 = 0;
  local_28 = (char *)0x0;
  local_24 = 0;
  switch(local_38) {
  case 3:
    local_20 = 3;
    goto LAB_0089fa0e;
  case 4:
    local_1e = 0;
    local_20 = 4;
    local_28 = malloc(0x10);
    *(undefined4 *)local_28 = *(undefined4 *)pcVar2;
    *(undefined4 *)(local_28 + 4) = *(undefined4 *)(pcVar2 + 4);
    *(undefined4 *)(local_28 + 8) = *(undefined4 *)(pcVar2 + 8);
    local_1e = 1;
    *(undefined4 *)(local_28 + 0xc) = *(undefined4 *)(pcVar2 + 0xc);
    break;
  default:
    local_20 = local_38;
    local_28 = local_40;
    local_24 = local_3c;
    break;
  case 0x1c:
    local_1e = 0;
    local_20 = 0x1c;
    local_28 = malloc(8);
    *(undefined4 *)local_28 = *(undefined4 *)pcVar2;
    local_1e = 1;
    *(undefined4 *)(local_28 + 4) = *(undefined4 *)(pcVar2 + 4);
    break;
  case 0x1f:
    local_1e = 0;
    local_20 = 0x1f;
                    /* try { // try from 0089f912 to 0089f916 has its CatchHandler @ 0089fc37 */
    iVar4 = _V_strlen(local_40);
    local_28 = malloc(iVar4 + 1U);
    memcpy(local_28,pcVar2,iVar4 + 1U);
    local_1e = local_1e | 1;
    break;
  case 0x28:
    local_20 = 0x28;
LAB_0089fa0e:
    local_1e = 0;
    local_28 = malloc(0xc);
    *(undefined4 *)local_28 = *(undefined4 *)pcVar2;
    *(undefined4 *)(local_28 + 4) = *(undefined4 *)(pcVar2 + 4);
    *(undefined4 *)(local_28 + 8) = *(undefined4 *)(pcVar2 + 8);
    local_1e = 1;
  }
                    /* try { // try from 0089fb85 to 0089fb87 has its CatchHandler @ 0089fc37 */
  iVar4 = (**(code **)(*g_pScriptVM + 0x50))(g_pScriptVM,uVar1,&local_34,2,local_4c,*puVar3,1);
  if ((local_1e & 1) != 0) {
    free(local_28);
    local_1e = local_1e & 0xfffe;
  }
  local_28 = (char *)0x0;
  local_24 = 0;
  local_20 = 0;
  if ((local_2a & 1) != 0) {
    free(local_34);
  }
  if ((local_36 & 1) != 0) {
    free(local_40);
  }
  if (iVar4 != 0) {
                    /* try { // try from 0089fbd1 to 0089fbd5 has its CatchHandler @ 0089fc50 */
    DevWarning("ScriptedMode: Failed to successfully call user console func\n");
  }
  if ((local_42 & 1) == 0) {
    return;
  }
  free(local_4c[0]);
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)