L L4D2node

CHintSystem::Init

0x00467210 · 556 bytes · __thiscall

_ZN11CHintSystem4InitEP11CBasePlayeriPPKc

Decompiled

undefined (4 params)

/* CHintSystem::Init(CBasePlayer*, int, char const**) */

void __thiscall CHintSystem::Init(CHintSystem *this,CBasePlayer *param_1,int param_2,char **param_3)

{
  CHintSystem *__s;
  CHintMessageQueue *this_00;
  CHintMessageTimers *this_01;
  CHintSystem *pCVar1;
  undefined4 *puVar2;
  int iVar3;
  uint uVar4;
  
  this[8] = (CHintSystem)0x1;
  *(CBasePlayer **)this = param_1;
  iVar3 = param_2 + 0x3e;
  if (-1 < param_2 + 0x1f) {
    iVar3 = param_2 + 0x1f;
  }
  uVar4 = iVar3 >> 5;
  if (uVar4 == *(ushort *)(this + 0xe)) {
    __s = *(CHintSystem **)(this + 0x14);
    if (((int)(uint)*(ushort *)(this + 0xc) <= param_2) && (__s != (CHintSystem *)0x0)) {
      *(uint *)(__s + uVar4 * 4 + -4) =
           *(uint *)(__s + uVar4 * 4 + -4) &
           *(uint *)(GetEndMask(int)::bitStringEndMasks + (*(ushort *)(this + 0xc) & 0x1f) * 4);
      __s = *(CHintSystem **)(this + 0x14);
    }
  }
  else {
    pCVar1 = *(CHintSystem **)(this + 0x14);
    if (pCVar1 == (CHintSystem *)0x0) {
      if (uVar4 == 0) {
        *(undefined2 *)(this + 0xe) = 0;
        __s = (CHintSystem *)0x0;
      }
      else {
        if (uVar4 == 1) {
          pCVar1 = this + 0x10;
          *(CHintSystem **)(this + 0x14) = pCVar1;
          *(undefined2 *)(this + 0xe) = 1;
        }
        else {
          pCVar1 = malloc(uVar4 * 4);
          *(short *)(this + 0xe) = (short)uVar4;
          *(CHintSystem **)(this + 0x14) = pCVar1;
          __s = (CHintSystem *)0x0;
          if (pCVar1 == (CHintSystem *)0x0) goto LAB_004672cb;
        }
        memset(pCVar1,0,uVar4 << 2);
        __s = *(CHintSystem **)(this + 0x14);
      }
    }
    else {
      if (uVar4 == 0) {
        if (1 < *(ushort *)(this + 0xe)) {
          free(pCVar1);
        }
        *(undefined4 *)(this + 0x14) = 0;
        __s = (CHintSystem *)0x0;
      }
      else {
        __s = this + 0x10;
        if (pCVar1 == __s) {
          if (uVar4 != 1) {
            puVar2 = malloc(uVar4 * 4);
            *(undefined4 **)(this + 0x14) = puVar2;
            *puVar2 = *(undefined4 *)(this + 0x10);
            __s = *(CHintSystem **)(this + 0x14);
          }
        }
        else if (uVar4 == 1) {
          *(undefined4 *)(this + 0x10) = *(undefined4 *)pCVar1;
          free(pCVar1);
          *(CHintSystem **)(this + 0x14) = __s;
        }
        else {
          __s = realloc(pCVar1,uVar4 * 4);
          *(CHintSystem **)(this + 0x14) = __s;
        }
      }
      if ((int)(uint)*(ushort *)(this + 0xc) <= param_2) {
        *(uint *)(__s + (uint)*(ushort *)(this + 0xe) * 4 + -4) =
             *(uint *)(__s + (uint)*(ushort *)(this + 0xe) * 4 + -4) &
             *(uint *)(GetEndMask(int)::bitStringEndMasks + (*(ushort *)(this + 0xc) & 0x1f) * 4);
        memset((void *)(*(int *)(this + 0x14) + (uint)*(ushort *)(this + 0xe) * 4),0,
               (uVar4 - *(ushort *)(this + 0xe)) * 4);
        __s = *(CHintSystem **)(this + 0x14);
      }
      *(short *)(this + 0xe) = (short)uVar4;
    }
  }
LAB_004672cb:
  *(short *)(this + 0xc) = (short)param_2;
  if (__s != (CHintSystem *)0x0) {
    memset(__s,0,(uint)*(ushort *)(this + 0xe) << 2);
  }
  *(char ***)(this + 0x18) = param_3;
  if (*(int *)this != 0) {
    this_00 = ::operator_new(0x1c);
                    /* try { // try from 00467311 to 00467315 has its CatchHandler @ 0046746f */
    CHintMessageQueue::CHintMessageQueue(this_00,*(CBasePlayer **)this);
    *(CHintMessageQueue **)(this + 0x1c) = this_00;
    this_01 = ::operator_new(0x1c);
                    /* try { // try from 00467335 to 00467339 has its CatchHandler @ 0046745d */
    CHintMessageTimers::CHintMessageTimers(this_01,this,*(CHintMessageQueue **)(this + 0x1c));
    *(CHintMessageTimers **)(this + 0x20) = this_01;
  }
  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)