L L4D2node

GCSDK::CSchema::BSetVarField

0x0008cf30 · 800 bytes · __thiscall

_ZN5GCSDK7CSchema12BSetVarFieldEPvPNS_10VarField_tEPKvjPbb

Decompiled

undefined (7 params)

/* GCSDK::CSchema::BSetVarField(void*, GCSDK::VarField_t*, void const*, unsigned int, bool*, bool)
    */

undefined4 __thiscall
GCSDK::CSchema::BSetVarField
          (CSchema *this,void *param_1,VarField_t *param_2,void *param_3,uint param_4,bool *param_5,
          bool param_6)

{
  undefined1 uVar1;
  int iVar2;
  uint uVar3;
  size_t __size;
  undefined1 *puVar4;
  undefined1 *puVar5;
  int iVar6;
  void *pvVar7;
  uint *puVar8;
  undefined1 *puVar9;
  int iVar10;
  uint *puVar11;
  int *piVar12;
  VarField_t *pVVar13;
  undefined1 *local_24;
  undefined1 *local_20;
  
  piVar12 = (int *)0x0;
  if (this[0xbc] != (CSchema)0x0) {
    piVar12 = (int *)((int)param_1 + *(int *)(this + 0xf4) + -0x10);
  }
  *param_5 = false;
  if (param_4 < 0xf4241) {
    if (piVar12[2] == 0) {
      if (param_4 != 0) {
        pvVar7 = malloc(param_4);
        *param_5 = true;
        _V_memcpy(pvVar7,param_3,param_4);
        *piVar12 = (int)pvVar7;
        piVar12[2] = param_4;
        *(undefined4 *)(param_2 + 4) = 0;
        *(uint *)param_2 = param_4;
        return 1;
      }
      return 1;
    }
    if ((param_4 != 0) && (*(uint *)param_2 == param_4)) {
      _V_memcpy((void *)(*piVar12 + *(int *)(param_2 + 4)),param_3,param_4);
      return 1;
    }
    *param_5 = true;
    iVar6 = piVar12[2];
    iVar2 = *(int *)param_2;
    uVar3 = *(uint *)(param_2 + 4);
    __size = param_4 + (iVar6 - iVar2);
    if (__size + *(int *)(this + 0xf4) < 0x3d0901) {
      if (__size == 0) {
        if (param_6) {
          free((void *)*piVar12);
        }
        piVar12[2] = 0;
        *piVar12 = 0;
        piVar12[3] = 0;
        *(undefined4 *)(param_2 + 4) = 0;
        *(uint *)param_2 = param_4;
      }
      else {
        if (((iVar2 == 0) && (uVar3 == 0)) && (param_4 <= (uint)piVar12[3])) {
          pvVar7 = (void *)*piVar12;
          if (0 < *(int *)(this + 0x94)) {
            puVar8 = *(uint **)(this + 0x88);
            puVar11 = puVar8 + *(int *)(this + 0x94) * 0x46;
            do {
              if (*puVar8 < 2) {
                pvVar7 = (void *)((int)pvVar7 + *(int *)((int)param_1 + puVar8[0x45]));
              }
              puVar8 = puVar8 + 0x46;
            } while (puVar8 != puVar11);
          }
          _V_memcpy(pvVar7,param_3,param_4);
          *(uint *)param_2 = param_4;
          *(int *)(param_2 + 4) = (int)pvVar7 - *piVar12;
          piVar12[3] = piVar12[3] - param_4;
          return 1;
        }
        puVar4 = malloc(__size);
        puVar5 = (undefined1 *)*piVar12;
        local_20 = puVar5 + iVar6;
        puVar9 = puVar5;
        local_24 = puVar4;
        for (; puVar5 < local_20; puVar5 = puVar5 + *(int *)param_2) {
          while ((*(int *)param_2 == 0 || (*(int *)(param_2 + 4) != (int)puVar5 - (int)puVar9))) {
            uVar1 = *puVar5;
            puVar5 = puVar5 + 1;
            *local_24 = uVar1;
            local_24 = local_24 + 1;
            puVar9 = (undefined1 *)*piVar12;
            local_20 = puVar9 + piVar12[2];
            if (local_20 <= puVar5) goto LAB_0008d05c;
          }
        }
LAB_0008d05c:
        _V_memcpy(local_24,param_3,param_4);
        if (param_6) {
          free((void *)*piVar12);
        }
        piVar12[3] = 0;
        piVar12[2] = __size;
        *piVar12 = (int)puVar4;
        *(uint *)param_2 = param_4;
        if (param_4 == 0) {
          *(undefined4 *)(param_2 + 4) = 0;
        }
        else {
          *(int *)(param_2 + 4) = (int)local_24 - *piVar12;
        }
        if (0 < *(int *)(this + 0x94)) {
          iVar10 = 0;
          iVar6 = 0;
          do {
            if (((*(uint *)(*(int *)(this + 0x88) + iVar10) < 2) &&
                (pVVar13 = (VarField_t *)
                           ((int)param_1 + ((uint *)(*(int *)(this + 0x88) + iVar10))[0x45]),
                pVVar13 != param_2)) && ((*(int *)pVVar13 != 0 && (uVar3 < *(uint *)(pVVar13 + 4))))
               ) {
              *(uint *)(pVVar13 + 4) = *(uint *)(pVVar13 + 4) - iVar2;
            }
            iVar6 = iVar6 + 1;
            iVar10 = iVar10 + 0x118;
          } while (iVar6 < *(int *)(this + 0x94));
        }
      }
      return 1;
    }
  }
  return 0;
}

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)