L L4D2node

GCSDK::CMessageList::BInit

0x00070d90 · 605 bytes · __thiscall

_ZN5GCSDK12CMessageList5BInitEv

Decompiled

undefined (1 param)

/* GCSDK::CMessageList::BInit() */

undefined4 __thiscall GCSDK::CMessageList::BInit(CMessageList *this)

{
  short *psVar1;
  uint uVar2;
  char cVar3;
  int *piVar4;
  void *pvVar5;
  int iVar6;
  MsgInfo_t *pMVar7;
  uint uVar8;
  int iVar9;
  int *piVar10;
  int in_GS_OFFSET;
  int local_130;
  CDbgFmtMsg local_120 [256];
  int local_20;
  
  piVar10 = CMessageListRegistration::sm_pFirst;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (CMessageListRegistration::sm_pFirst == (int *)0x0) {
    iVar9 = 0;
  }
  else {
    iVar9 = 0;
    piVar4 = CMessageListRegistration::sm_pFirst;
    do {
      iVar9 = iVar9 + piVar4[2];
      piVar4 = (int *)*piVar4;
    } while (piVar4 != (int *)0x0);
  }
  if ((*(int *)(this + 0x18) < iVar9) && (-1 < *(int *)(this + 0x1c))) {
    *(int *)(this + 0x18) = iVar9;
    if (*(void **)(this + 0x14) == (void *)0x0) {
      pvVar5 = malloc(iVar9 * 0x18);
      *(void **)(this + 0x14) = pvVar5;
    }
    else {
      pvVar5 = realloc(*(void **)(this + 0x14),iVar9 * 0x18);
      piVar10 = CMessageListRegistration::sm_pFirst;
      *(void **)(this + 0x14) = pvVar5;
    }
  }
  else {
    pvVar5 = *(void **)(this + 0x14);
  }
  *(void **)(this + 0x24) = pvVar5;
  *(undefined4 *)(this + 0x20) = 0;
  *(undefined4 *)(this + 0xc) = 0;
  if (piVar10 != (int *)0x0) {
    do {
      if (0 < piVar10[2]) {
        local_130 = 0;
        iVar9 = 0;
        do {
          uVar2 = *(uint *)(piVar10[1] + iVar9);
          uVar8 = uVar2 >> 4;
          AssureBucket(this,uVar8);
          psVar1 = (short *)(*(int *)(*(int *)this + uVar8 * 4) + (uVar2 & 0xf) * 2);
          if (*psVar1 == -1) {
            *psVar1 = 0;
          }
          else {
            CDbgFmtMsg::CDbgFmtMsg
                      (local_120,"Message collision: %s",*(undefined4 *)(piVar10[1] + 4 + iVar9));
            iVar6 = LoggingSystem_LogAssert
                              ("%s (%d) : %s\n","/data/src/gcsdk/messagelist.cpp",0x56,local_120);
            if (iVar6 == 1) {
              cVar3 = ShouldUseNewAssertDialog();
              if (cVar3 == '\0') {
LAB_00070f29:
                raise(5);
              }
              else {
                CDbgFmtMsg::CDbgFmtMsg
                          (local_120,"Message collision: %s",*(undefined4 *)(piVar10[1] + 4 + iVar9)
                          );
                    /* try { // try from 00070fba to 00070fbe has its CatchHandler @ 00070ffb */
                cVar3 = DoNewAssertDialog("/data/src/gcsdk/messagelist.cpp",0x56,local_120);
                if (cVar3 != '\0') goto LAB_00070f29;
              }
              _ExitOnFatalAssert("/data/src/gcsdk/messagelist.cpp",0x56);
            }
          }
          pMVar7 = (MsgInfo_t *)(piVar10[1] + iVar9);
          iVar9 = iVar9 + 0x18;
          CUtlVector<GCSDK::MsgInfo_t,CUtlMemory<GCSDK::MsgInfo_t,int>>::InsertBefore
                    ((CUtlVector<GCSDK::MsgInfo_t,CUtlMemory<GCSDK::MsgInfo_t,int>> *)(this + 0x14),
                     *(int *)(this + 0x20),pMVar7);
          local_130 = local_130 + 1;
        } while (local_130 < piVar10[2]);
      }
      piVar10 = (int *)*piVar10;
    } while (piVar10 != (int *)0x0);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return 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)