L L4D2node

CPhoneHome::Init

0x001818f0 · 371 bytes · __thiscall

_ZN10CPhoneHome4InitEv

Decompiled

undefined (1 param)

/* CPhoneHome::Init() */

void __thiscall CPhoneHome::Init(CPhoneHome *this)

{
  char *pcVar1;
  char cVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  char *pcVar6;
  CBlockingUDPSocket *this_00;
  char *pcVar7;
  int in_GS_OFFSET;
  char acStack_41 [33];
  int local_20;
  
  pcVar1 = acStack_41 + 1;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  V_strncpy(pcVar1,"VLV_INTERNAL                    ",0x20);
  piVar3 = (int *)CommandLine_Tier0();
  iVar4 = (**(code **)(*piVar3 + 0x28))(piVar3,&DAT_002b5536);
  if (0 < iVar4) {
    piVar3 = (int *)CommandLine_Tier0();
    iVar5 = (**(code **)(*piVar3 + 0x24))(piVar3);
    if (iVar4 + 1 < iVar5) {
      piVar3 = (int *)CommandLine_Tier0();
      pcVar6 = (char *)(**(code **)(*piVar3 + 0x2c))(piVar3,iVar4 + 1);
      _V_memset(pcVar1,0,0x20);
      V_strncpy(pcVar1,pcVar6,0x20);
    }
    else {
      acStack_41[1] = 0x21;
    }
  }
  iVar4 = _V_strlen(pcVar1);
  if (0 < iVar4) {
    iVar4 = _V_strlen("VLV_INTERNAL");
    iVar4 = V_strnicmp(pcVar1,"VLV_INTERNAL",iVar4);
    if (iVar4 != 0) {
      iVar4 = _V_strlen(pcVar1);
      if (pcVar1 < pcVar1 + iVar4 + -1) {
        cVar2 = acStack_41[iVar4];
        pcVar6 = pcVar1 + iVar4 + -1;
        while (cVar2 == ' ') {
          pcVar7 = pcVar6 + -1;
          *pcVar6 = '\0';
          if (pcVar7 == pcVar1) break;
          pcVar6 = pcVar7;
          cVar2 = *pcVar7;
        }
      }
      cVar2 = NET_StringToAdr("67.132.200.140:27013",(netadr_s *)(this + 8));
      if (cVar2 != '\0') {
        this[4] = (CPhoneHome)0x1;
        V_strncpy((char *)(this + 0x14),pcVar1,0x20);
        this_00 = operator_new(0x18);
                    /* try { // try from 00181a64 to 00181a68 has its CatchHandler @ 00181a76 */
        CBlockingUDPSocket::CBlockingUDPSocket(this_00);
        *(CBlockingUDPSocket **)(this + 0x3c) = this_00;
      }
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)