L L4D2node

CStudioHdr::ResetVModel

0x0059d140 · 303 bytes · __thiscall

_ZNK10CStudioHdr11ResetVModelEPK14virtualmodel_t

Decompiled

undefined (2 params)

/* WARNING: Variable defined which should be unmapped: param_1 */
/* CStudioHdr::ResetVModel(virtualmodel_t const*) const */

virtualmodel_t * __thiscall CStudioHdr::ResetVModel(CStudioHdr *this,virtualmodel_t *param_1)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  int iVar4;
  
  if (param_1 == (virtualmodel_t *)0x0) {
    *(undefined4 *)(this + 4) = 0;
    return (virtualmodel_t *)0x0;
  }
  *(virtualmodel_t **)(this + 4) = param_1;
  iVar4 = *(int *)(param_1 + 100);
  *(undefined4 *)(this + 0x14) = 0;
  if (iVar4 == 0) {
    return param_1;
  }
  iVar2 = *(int *)(this + 0xc);
  if (iVar2 < iVar4) {
    iVar1 = *(int *)(this + 0x10);
    if (iVar1 < 0) goto LAB_0059d17f;
    if (iVar1 == 0) {
      if (iVar2 == 0) {
        if (iVar4 < 9) {
          iVar2 = 8;
          goto LAB_0059d1df;
        }
        iVar2 = 8;
      }
      do {
        iVar2 = iVar2 * 2;
      } while (iVar2 < iVar4);
    }
    else {
      for (iVar2 = ((iVar4 + -1) / iVar1 + 1) * iVar1; iVar2 < iVar4; iVar2 = (iVar2 + iVar4) / 2) {
      }
    }
LAB_0059d1df:
    *(int *)(this + 0xc) = iVar2;
    if (*(void **)(this + 8) != (void *)0x0) {
      pvVar3 = realloc(*(void **)(this + 8),iVar2 << 2);
      iVar1 = *(int *)(this + 0x14);
      *(void **)(this + 8) = pvVar3;
      *(void **)(this + 0x18) = pvVar3;
      iVar2 = iVar4 + iVar1;
      *(int *)(this + 0x14) = iVar2;
      if ((0 < iVar4) && (0 < iVar1)) {
        _V_memmove((void *)((int)pvVar3 + iVar4 * 4),pvVar3,iVar1 << 2);
        iVar2 = *(int *)(this + 0x14);
      }
      goto LAB_0059d188;
    }
    pvVar3 = malloc(iVar2 << 2);
    *(void **)(this + 8) = pvVar3;
  }
  else {
LAB_0059d17f:
    pvVar3 = *(void **)(this + 8);
  }
  *(int *)(this + 0x14) = iVar4;
  *(void **)(this + 0x18) = pvVar3;
  iVar2 = iVar4;
LAB_0059d188:
  if (0 < iVar2) {
    iVar4 = 0;
    do {
      *(undefined4 *)(*(int *)(this + 8) + iVar4 * 4) = 0;
      iVar4 = iVar4 + 1;
    } while (iVar4 < *(int *)(this + 0x14));
  }
  return param_1;
}

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)