L L4D2node

SwapClosecaptionFile

0x003de700 · 252 bytes · __cdecl

_Z20SwapClosecaptionFilePv

Decompiled

undefined (1 param)

/* SwapClosecaptionFile(void*) */

undefined4 SwapClosecaptionFile(void *param_1)

{
  undefined4 uVar1;
  undefined1 *puVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  void *pvVar6;
  CByteswap local_24 [4];
  undefined1 local_20;
  undefined1 local_1f;
  undefined1 local_1e;
  undefined1 local_1d;
  
  uVar1 = 0;
  local_24[0] = (CByteswap)((byte)local_24[0] | 3);
  if ((*(int *)param_1 == 0x44434356) && (*(int *)((int)param_1 + 4) == 1)) {
    iVar5 = *(int *)((int)param_1 + 0x10);
    if (iVar5 != 0) {
      iVar4 = 0;
      pvVar6 = (void *)((int)param_1 + 0x18);
      do {
        iVar4 = iVar4 + 1;
        CByteswap::SwapFieldsToTargetEndian
                  (local_24,pvVar6,pvVar6,(datamap_t *)CaptionLookup_t::m_DataMap);
        pvVar6 = (void *)((int)pvVar6 + 0xc);
      } while (iVar5 != iVar4);
    }
    puVar2 = (undefined1 *)(*(int *)((int)param_1 + 0x14) + (int)param_1);
    uVar3 = (uint)(*(int *)((int)param_1 + 8) * *(int *)((int)param_1 + 0xc)) >> 2;
    if (((uVar3 != 0) && (puVar2 != (undefined1 *)0x0)) && (((byte)local_24[0] & 1) != 0)) {
      iVar5 = 0;
      do {
        local_20 = puVar2[3];
        iVar5 = iVar5 + 1;
        local_1f = puVar2[2];
        local_1e = puVar2[1];
        local_1d = *puVar2;
        _V_memcpy(puVar2,&local_20,4);
        puVar2 = puVar2 + 4;
      } while (iVar5 < (int)uVar3);
    }
    CByteswap::SwapFieldsToTargetEndian
              (local_24,param_1,param_1,(datamap_t *)CompiledCaptionHeader_t::m_DataMap);
    uVar1 = 1;
  }
  return uVar1;
}

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)