L L4D2node

Host_FinishAsyncServer

0x00177890 · 958 bytes · unknown

_Z22Host_FinishAsyncServerv

Decompiled

undefined (0 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* Host_FinishAsyncServer() */

void Host_FinishAsyncServer(void)

{
  uint *puVar1;
  code *pcVar2;
  code *pcVar3;
  int *piVar4;
  char cVar5;
  int iVar6;
  undefined4 uVar7;
  int iVar8;
  int *local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  int local_2c;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  if (g_pAsyncServerJob == (int *)0x0) {
    return;
  }
  local_44 = 0;
  local_40 = 0;
  if (_Plat_SetBenchmarkMode == 0) {
    local_2c = 0;
  }
  else {
    (**(code **)(_Plat_SetBenchmarkMode + 0x50))
              (_Plat_SetBenchmarkMode,&local_44,0,0,0,0,"/data/src/engine/./host.cpp",0xb12,
               &Host_FinishAsyncServer()::tm_fmt,"(%s)%s","AsyncServer","WaitForAsyncServer");
    local_2c = _Plat_SetBenchmarkMode;
  }
  iVar8 = _DAT_0040b9d4;
  local_34 = local_44;
  local_30 = local_40;
                    /* try { // try from 0017794d to 00177951 has its CatchHandler @ 00177c9f */
  if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
     (iVar6 = ThreadGetCurrentId(), iVar8 == iVar6)) {
    if ((char *)*_DAT_0040b030 != "WaitForAsyncServer") {
                    /* try { // try from 00177bb0 to 00177bd3 has its CatchHandler @ 00177c9f */
      _DAT_0040b030 =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b2794,(char *)0x0,0x2b279b);
    }
    puVar1 = (uint *)(_DAT_0040b0bc + 4 + _DAT_0040b030[0x1c] * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0040b02c = '\0';
  }
  piVar4 = g_pAsyncServerJob;
  if ((DAT_003b7f64 < 2) || (1 < DAT_003b8064)) {
    if (g_pAsyncServerJob == (int *)0x0) goto LAB_00177aae;
    if ((g_pAsyncServerJob[3] - 1U < 2) || (g_pAsyncServerJob[3] == 4)) {
      local_48 = g_pAsyncServerJob;
                    /* try { // try from 00177b64 to 00177b66 has its CatchHandler @ 00177ca3 */
      (**(code **)(*_g_pThreadPool + 0x30))(_g_pThreadPool,&local_48,1,1,0xffffffff);
    }
  }
  else {
    iVar8 = g_pAsyncServerJob[3];
    if ((iVar8 - 1U < 2) || (iVar8 == 4)) {
      local_3c = 0;
      local_38 = 0;
      if (_g_Telemetry == 0) {
        local_20 = 0;
      }
      else {
        pcVar2 = *(code **)(_g_Telemetry + 0x50);
        pcVar3 = *(code **)(_g_Telemetry + 0x14);
                    /* try { // try from 001779b2 to 00177a26 has its CatchHandler @ 00177ca3 */
        uVar7 = (**(code **)(*g_pAsyncServerJob + 0x10))(g_pAsyncServerJob);
        uVar7 = (*pcVar3)(_g_Telemetry,uVar7);
        (*pcVar2)(_g_Telemetry,&local_3c,0,0,0,0,"/data/src/public/vstdlib/jobthread.h",0x4eb,
                  &CJob::Execute()::tm_fmt,"%s %s %d","Execute",uVar7,iVar8);
        local_20 = _g_Telemetry;
      }
      local_28 = local_3c;
      local_24 = local_38;
      pthread_mutex_lock((pthread_mutex_t *)(piVar4 + 5));
                    /* try { // try from 00177a4c to 00177a6a has its CatchHandler @ 00177c6b */
      (**(code **)*piVar4)(piVar4);
      if ((piVar4[3] == 1) || (piVar4[3] == 4)) {
        piVar4[3] = 2;
                    /* try { // try from 00177bec to 00177c04 has its CatchHandler @ 00177c6b */
        iVar8 = (**(code **)(*piVar4 + 0x18))(piVar4);
        piVar4[3] = iVar8;
        (**(code **)(*piVar4 + 0x20))(piVar4);
        CThreadEvent::Set();
      }
      (**(code **)(*piVar4 + 4))(piVar4);
      pthread_mutex_unlock((pthread_mutex_t *)(piVar4 + 5));
      if (local_20 != 0) {
        (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
      }
    }
  }
                    /* try { // try from 00177aab to 00177abc has its CatchHandler @ 00177ca3 */
  (**(code **)(*piVar4 + 4))(piVar4);
LAB_00177aae:
  g_pAsyncServerJob = (int *)0x0;
  SV_FrameExecuteThreadDeferred();
  iVar8 = _DAT_0040b9d4;
  if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
     (iVar6 = ThreadGetCurrentId(), iVar8 == iVar6)) {
    cVar5 = CVProfNode::ExitScope();
    if (cVar5 != '\0') {
      _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
    }
    DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
  }
  if (local_2c != 0) {
    (**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
  }
  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)