L L4D2node

CModelRender::CleanupStaticLightingState

0x00185e80 · 460 bytes · __thiscall

_ZN12CModelRender26CleanupStaticLightingStateEiPP13memhandle_t__

Decompiled

undefined (3 params)

/* CModelRender::CleanupStaticLightingState(int, memhandle_t__**) */

void __thiscall
CModelRender::CleanupStaticLightingState(CModelRender *this,int param_1,memhandle_t__ **param_2)

{
  code *pcVar1;
  bool bVar2;
  char cVar3;
  int *piVar4;
  undefined4 *puVar5;
  undefined4 *puVar6;
  memhandle_t__ **__dest;
  int iVar7;
  
  piVar4 = (int *)(**(code **)(*materials + 0x180))(materials);
  if (piVar4 != (int *)0x0) {
                    /* try { // try from 00185eab to 00185ead has its CatchHandler @ 0018609f */
    (**(code **)(*piVar4 + 8))(piVar4);
  }
                    /* try { // try from 00185eb6 to 00185ef3 has its CatchHandler @ 0018609b */
  puVar5 = (undefined4 *)(**(code **)(*piVar4 + 0x238))(piVar4);
  if (puVar5 != (undefined4 *)0x0) {
    if ((param_2 == (memhandle_t__ **)0x0) ||
       (cVar3 = (**(code **)(*piVar4 + 0x194))(piVar4,param_2), cVar3 == '\0')) {
                    /* try { // try from 00185fa5 to 00185fe8 has its CatchHandler @ 0018609b */
      __dest = (memhandle_t__ **)(**(code **)(*piVar4 + 0x184))(piVar4,param_1 * 4);
      if ((__dest != (memhandle_t__ **)0x0) && (param_2 != (memhandle_t__ **)0x0)) {
        memcpy(__dest,param_2,param_1 * 4);
      }
      bVar2 = true;
    }
    else {
      (**(code **)(*piVar4 + 0x18c))(piVar4);
      bVar2 = false;
      __dest = param_2;
    }
    pcVar1 = *(code **)*puVar5;
                    /* try { // try from 00185f09 to 00185f4a has its CatchHandler @ 0018605e */
    puVar6 = operator_new(0x24);
    puVar6[3] = 1;
    *puVar6 = &PTR_AddRef_002b6ae8;
    puVar6[2] = &PTR__CMemberFunctor2_002b6b04;
    puVar6[4] = UnlockCacheCacheHandleArray;
    puVar6[5] = 0;
    puVar6[6] = this;
    puVar6[7] = param_1;
    puVar6[8] = __dest;
    (*pcVar1)(puVar5,puVar6);
    if ((piVar4 != (int *)0x0) && (__dest != (memhandle_t__ **)0x0)) {
      if (bVar2) {
        (**(code **)(*piVar4 + 0x188))(piVar4,__dest);
      }
      else {
        (**(code **)(*piVar4 + 400))(piVar4);
      }
    }
    if ((piVar4 != (int *)0x0) && ((**(code **)(*piVar4 + 0xc))(piVar4), piVar4 != (int *)0x0)) {
      (**(code **)(*piVar4 + 4))(piVar4);
    }
    return;
  }
  if (0 < param_1) {
    iVar7 = 0;
    do {
      if (param_2[iVar7] != (memhandle_t__ *)0x0) {
        (**(code **)(**(int **)(this + 8) + 0x2c))(*(int **)(this + 8),param_2[iVar7]);
      }
      iVar7 = iVar7 + 1;
    } while (iVar7 != param_1);
  }
  if (piVar4 == (int *)0x0) {
    return;
  }
  (**(code **)(*piVar4 + 0xc))(piVar4);
  if (piVar4 == (int *)0x0) {
    return;
  }
  (**(code **)(*piVar4 + 4))(piVar4);
  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)