L L4D2node

CBaseEntity::GetScriptInstance

0x0060e1f0 · 267 bytes · __thiscall

_ZN11CBaseEntity17GetScriptInstanceEv

Decompiled

undefined (1 param)

/* CBaseEntity::GetScriptInstance() */

int __thiscall CBaseEntity::GetScriptInstance(CBaseEntity *this)

{
  code *pcVar1;
  code *pcVar2;
  undefined1 *puVar3;
  int *piVar4;
  int iVar5;
  undefined4 uVar6;
  undefined1 *puVar7;
  undefined4 *puVar8;
  undefined4 *puVar9;
  int in_GS_OFFSET;
  undefined1 local_4c [28];
  undefined4 local_30 [4];
  int local_20;
  
  puVar9 = (undefined4 *)local_4c;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar5 = *(int *)(this + 0x3f4);
  puVar8 = (undefined4 *)local_4c;
  if (iVar5 == 0) {
    if (*(int *)(this + 0x3f8) == 0) {
      puVar9 = (undefined4 *)&stack0xfffffba4;
      (**(code **)(*g_pScriptVM + 0x6c))();
      AllocPooledString((char *)local_30);
      *(undefined4 *)(this + 0x3f8) = local_30[0];
    }
    pcVar1 = *(code **)(*g_pScriptVM + 0x5c);
    iVar5 = *(int *)this;
    *puVar9 = this;
    pcVar2 = *(code **)(iVar5 + 0x34);
    puVar9[-1] = 0x60e24c;
    uVar6 = (*pcVar2)();
    puVar9[2] = this;
    puVar9[1] = uVar6;
    *puVar9 = g_pScriptVM;
    puVar9[-1] = 0x60e25e;
    uVar6 = (*pcVar1)();
    piVar4 = g_pScriptVM;
    *(undefined4 *)(this + 0x3f4) = uVar6;
    puVar3 = *(undefined1 **)(this + 0x3f8);
    pcVar1 = *(code **)(*piVar4 + 0x60);
    puVar9[1] = uVar6;
    puVar7 = &DAT_00d539c2;
    if (puVar3 != (undefined1 *)0x0) {
      puVar7 = puVar3;
    }
    *puVar9 = piVar4;
    puVar9[2] = puVar7;
    puVar9[-1] = 0x60e28c;
    (*pcVar1)();
    iVar5 = *(int *)(this + 0x3f4);
    puVar8 = puVar9;
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    *(undefined **)((int)puVar8 + -4) = &UNK_0060e302;
    __stack_chk_fail();
  }
  return iVar5;
}

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)