L L4D2node

rr2::CResponseDB::FindMatches

0x00bd8560 · 1254 bytes · __thiscall

_ZN3rr211CResponseDB11FindMatchesERNS_14CResponseQueryERNS_11MatchList_tEbPNS_11IResponseDB20MatchProfilingData_tE

Decompiled

undefined (5 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* rr2::CResponseDB::FindMatches(rr2::CResponseQuery&, rr2::MatchList_t&, bool,
   rr2::IResponseDB::MatchProfilingData_t*) */

undefined4 __thiscall
rr2::CResponseDB::FindMatches
          (CResponseDB *this,CResponseQuery *param_1,MatchList_t *param_2,bool param_3,
          MatchProfilingData_t *param_4)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  undefined8 uVar4;
  undefined8 uVar5;
  undefined8 uVar6;
  undefined8 uVar7;
  char cVar8;
  int iVar9;
  void *pvVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  longdouble lVar14;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_34 = 0;
  local_30 = 0;
  if (___atan2f_finite == 0) {
    local_20 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_34,0,0,0,0,"/data/src/responselib/responsedb.cpp",0x25,
               &FindMatches(rr2::CResponseQuery&,rr2::MatchList_t&,bool,rr2::IResponseDB::MatchProfilingData_t*)
                ::tm_fmt,"(%s)%s","Unaccounted","CResponseDB::FindMatches");
    local_20 = ___atan2f_finite;
  }
  iVar11 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
                    /* try { // try from 00bd869e to 00bd86ec has its CatchHandler @ 00bd8a94 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar11 == iVar9)) {
    if ((char *)*_DAT_0105d15c != "CResponseDB::FindMatches") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd56f4b,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  uVar4 = rdtsc();
                    /* try { // try from 00bd8627 to 00bd8654 has its CatchHandler @ 00bd8a73 */
  CResponseQuery::Sort(param_1);
  uVar5 = rdtsc();
  *(undefined4 *)(param_2 + 0xc) = 0;
  iVar9 = Q_log2(*(uint *)(this + 0x48));
  iVar11 = *(int *)(param_2 + 4);
  if ((iVar11 < iVar9) && (-1 < *(int *)(param_2 + 8))) {
    *(int *)(param_2 + 4) = iVar9;
    if (*(void **)param_2 == (void *)0x0) {
      pvVar10 = malloc(iVar9 * 0xc);
      *(void **)param_2 = pvVar10;
      iVar11 = iVar9;
    }
    else {
      pvVar10 = realloc(*(void **)param_2,iVar9 * 0xc);
      *(void **)param_2 = pvVar10;
      iVar11 = *(int *)(param_2 + 4);
    }
  }
  else {
    pvVar10 = *(void **)param_2;
  }
  *(void **)(param_2 + 0x10) = pvVar10;
  iVar1 = *(int *)(this + 0x48);
  uVar6 = rdtsc();
  iVar2 = *(int *)(param_2 + 0xc);
  iVar9 = iVar2 + 1;
  if (iVar9 <= iVar11) goto LAB_00bd8727;
  iVar13 = *(int *)(param_2 + 8);
  if (iVar13 < 0) goto LAB_00bd8727;
  if (iVar13 == 0) {
    if (iVar11 == 0) {
      if (iVar9 < 4) {
        iVar13 = 3;
        goto LAB_00bd89d7;
      }
      iVar11 = 3;
    }
    do {
      iVar13 = iVar11 * 2;
      if (iVar9 <= iVar13) break;
      iVar13 = iVar11 * 4;
      iVar11 = iVar13;
    } while (iVar13 < iVar9);
  }
  else {
    for (iVar13 = iVar13 * (iVar2 / iVar13 + 1); iVar13 < iVar9; iVar13 = (iVar13 + iVar9) / 2) {
    }
  }
LAB_00bd89d7:
  *(int *)(param_2 + 4) = iVar13;
  if (pvVar10 == (void *)0x0) {
    pvVar10 = malloc(iVar13 * 0xc);
    *(void **)param_2 = pvVar10;
  }
  else {
    pvVar10 = realloc(pvVar10,iVar13 * 0xc);
    *(void **)param_2 = pvVar10;
    iVar9 = *(int *)(param_2 + 0xc) + 1;
  }
LAB_00bd8727:
  *(int *)(param_2 + 0xc) = iVar9;
  *(void **)(param_2 + 0x10) = pvVar10;
  iVar11 = (iVar9 - iVar2) + -1;
  if (0 < iVar11) {
                    /* try { // try from 00bd8991 to 00bd8a11 has its CatchHandler @ 00bd8a73 */
    _V_memmove((void *)((int)pvVar10 + iVar2 * 0xc + 0xc),(void *)((int)pvVar10 + iVar2 * 0xc),
               iVar11 * 0xc);
    iVar9 = *(int *)(param_2 + 0xc);
  }
  iVar11 = 0;
  if (0 < iVar1) {
    do {
                    /* try { // try from 00bd8786 to 00bd87de has its CatchHandler @ 00bd8a73 */
      lVar14 = (longdouble)
               CRule::Match((CRule *)(iVar11 * 100 + *(int *)(this + 0x3c)),param_1,
                            (MatchInfo_t *)(*(int *)param_2 + (iVar9 * 3 + -3) * 4));
      if ((float)lVar14 == 0.0) {
LAB_00bd8750:
        iVar9 = *(int *)(param_2 + 0xc);
      }
      else {
        iVar2 = *(int *)(param_2 + 0xc);
        iVar13 = *(int *)(param_2 + 4);
        iVar9 = iVar2 + 1;
        if (iVar13 < iVar9) {
          iVar12 = *(int *)(param_2 + 8);
          if (iVar12 < 0) goto LAB_00bd87a9;
          if (iVar12 == 0) {
            if (iVar13 == 0) {
              if (iVar9 < 4) {
                iVar12 = 3;
                goto LAB_00bd881f;
              }
              iVar13 = 3;
            }
            do {
              iVar12 = iVar13 * 2;
              if (iVar9 <= iVar12) break;
              iVar12 = iVar13 * 4;
              iVar13 = iVar12;
            } while (iVar12 < iVar9);
          }
          else {
            for (iVar12 = (iVar2 / iVar12 + 1) * iVar12; iVar12 < iVar9;
                iVar12 = (iVar12 + iVar9) / 2) {
            }
          }
LAB_00bd881f:
          *(int *)(param_2 + 4) = iVar12;
          if (*(void **)param_2 == (void *)0x0) {
            pvVar10 = malloc(iVar12 * 0xc);
            *(void **)param_2 = pvVar10;
          }
          else {
            pvVar10 = realloc(*(void **)param_2,iVar12 * 0xc);
            *(void **)param_2 = pvVar10;
            iVar9 = *(int *)(param_2 + 0xc) + 1;
          }
        }
        else {
LAB_00bd87a9:
          pvVar10 = *(void **)param_2;
        }
        *(int *)(param_2 + 0xc) = iVar9;
        *(void **)(param_2 + 0x10) = pvVar10;
        iVar13 = (iVar9 - iVar2) + -1;
        if (0 < iVar13) {
          _V_memmove((void *)((int)pvVar10 + iVar2 * 0xc + 0xc),(void *)((int)pvVar10 + iVar2 * 0xc)
                     ,iVar13 * 0xc);
          goto LAB_00bd8750;
        }
      }
      iVar11 = iVar11 + 1;
    } while (iVar11 != iVar1);
  }
  if (0 < iVar9) {
    *(int *)(param_2 + 0xc) = iVar9 + -1;
  }
  if (param_3) {
    MatchList_t::SortByScoreDescending(param_2);
  }
  uVar7 = rdtsc();
  if (param_4 != (MatchProfilingData_t *)0x0) {
    uVar3 = *(undefined4 *)(param_1 + 0xc);
    *(uint *)param_4 = (uint)uVar7 - (uint)uVar6;
    *(uint *)(param_4 + 4) =
         ((int)((ulonglong)uVar7 >> 0x20) - (int)((ulonglong)uVar6 >> 0x20)) -
         (uint)((uint)uVar7 < (uint)uVar6);
    *(undefined4 *)(param_4 + 0x10) = uVar3;
    *(int *)(param_4 + 0x14) = iVar11;
    *(uint *)(param_4 + 8) = (uint)uVar5 - (uint)uVar4;
    *(uint *)(param_4 + 0xc) =
         ((int)((ulonglong)uVar5 >> 0x20) - (int)((ulonglong)uVar4 >> 0x20)) -
         (uint)((uint)uVar5 < (uint)uVar4);
  }
  iVar11 = _DAT_0105db00;
  uVar3 = *(undefined4 *)(param_2 + 0xc);
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar9 = ThreadGetCurrentId(), iVar11 == iVar9)) {
    cVar8 = CVProfNode::ExitScope();
    if (cVar8 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_20 != 0) {
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
  }
  return uVar3;
}

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)