L L4D2node

CBaseAnimating::LockStudioHdr

0x005e0e70 · 305 bytes · __thiscall

_ZN14CBaseAnimating13LockStudioHdrEv

Decompiled

undefined (1 param)

/* CBaseAnimating::LockStudioHdr() */

uint __thiscall CBaseAnimating::LockStudioHdr(CBaseAnimating *this)

{
  CBaseAnimating *pCVar1;
  uint uVar2;
  short sVar3;
  uint uVar4;
  int iVar5;
  studiohdr_t *psVar6;
  CStudioHdr *this_00;
  
  uVar4 = ThreadGetCurrentId();
  pCVar1 = this + 0x13e4;
  if (uVar4 == *(uint *)(this + 0x13e4)) {
LAB_005e0e9f:
    *(int *)(this + 0x13e8) = *(int *)(this + 0x13e8) + 1;
  }
  else {
    LOCK();
    uVar2 = *(uint *)pCVar1;
    if (uVar2 == 0) {
      *(uint *)pCVar1 = uVar4;
    }
    UNLOCK();
    if (uVar2 == 0) goto LAB_005e0e9f;
    CThreadFastMutex::Lock((uint)pCVar1,uVar4);
  }
                    /* try { // try from 005e0eb1 to 005e0f1d has its CatchHandler @ 005e0faf */
  iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
  if ((iVar5 == 0) || (sVar3 = (**(code **)(*modelinfo + 0xac))(modelinfo,iVar5), sVar3 == -1))
  goto LAB_005e0f24;
  psVar6 = (studiohdr_t *)(**(code **)(*(int *)mdlcache + 0xa4))(mdlcache,sVar3);
  this_00 = *(CStudioHdr **)(this + 0x13e0);
  if (this_00 == (CStudioHdr *)0x0) {
    if (psVar6 != (studiohdr_t *)0x0) {
                    /* try { // try from 005e0f7b to 005e0f7f has its CatchHandler @ 005e0faf */
      this_00 = ::operator_new(0x68);
                    /* try { // try from 005e0f85 to 005e0f89 has its CatchHandler @ 005e0fd2 */
      CStudioHdr::CStudioHdr(this_00);
                    /* try { // try from 005e0f9d to 005e0fa1 has its CatchHandler @ 005e0faf */
      CStudioHdr::Init(this_00,psVar6,mdlcache);
      if (this_00 != (CStudioHdr *)0x0) goto LAB_005e0efa;
    }
  }
  else {
LAB_005e0efa:
    if (*(int *)(this_00 + 4) != 0) {
      (**(code **)(*(int *)mdlcache + 0xa4))(mdlcache,*(undefined2 *)(*(int *)this_00 + 0x158));
    }
  }
  *(CStudioHdr **)(this + 0x13e0) = this_00;
LAB_005e0f24:
  *(int *)(this + 0x13e8) = *(int *)(this + 0x13e8) + -1;
  uVar4 = *(uint *)(this + 0x13e8);
  if (uVar4 == 0) {
    LOCK();
    uVar4 = *(uint *)pCVar1;
    *(uint *)pCVar1 = 0;
    UNLOCK();
  }
  return uVar4;
}

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)