L L4D2node

SVC_Menu::WriteToBuffer

0x000b6c00 · 366 bytes · __thiscall

_ZN8SVC_Menu13WriteToBufferER8bf_write

Decompiled

undefined (2 params)

/* SVC_Menu::WriteToBuffer(bf_write&) */

byte __thiscall SVC_Menu::WriteToBuffer(SVC_Menu *this,bf_write *param_1)

{
  uint uVar1;
  int iVar2;
  uint *puVar3;
  int iVar4;
  uint uVar5;
  byte bVar6;
  void *local_54 [4];
  uint local_44;
  
  if (*(int *)(this + 0x4c) != 0) {
    CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_54,0,0,0);
                    /* try { // try from 000b6c48 to 000b6d14 has its CatchHandler @ 000b6d7c */
    CUtlBuffer::ActivateByteSwapping((CUtlBuffer *)local_54,true);
    KeyValues::WriteAsBinary(*(KeyValues **)(this + 0x4c),(CUtlBuffer *)local_54);
    if ((int)local_44 < 0x1001) {
      uVar1 = (**(code **)(*(int *)this + 0x24))(this);
      uVar5 = *(uint *)(param_1 + 0xc);
      if (*(int *)(param_1 + 8) < (int)(uVar5 + 6)) {
        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 8);
        param_1[0x10] = (bf_write)0x1;
      }
      else {
        iVar2 = ((int)uVar5 >> 5) * 4;
        uVar5 = uVar5 & 0x1f;
        puVar3 = (uint *)(iVar2 + *(int *)param_1);
        *puVar3 = uVar1 << (sbyte)uVar5 | *puVar3 & *(uint *)(&DAT_003f2db8 + uVar5 * 0x84);
        iVar4 = 0x20 - uVar5;
        if (iVar4 < 6) {
          puVar3 = (uint *)(*(int *)param_1 + 4 + iVar2);
          *puVar3 = (&g_BitWriteMasks)[6 - iVar4] & *puVar3 | uVar1 >> ((byte)iVar4 & 0x1f);
        }
        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 6;
      }
      bf_write::WriteShort(param_1,*(int *)(this + 0x50));
      bf_write::WriteWord(param_1,local_44);
      bf_write::WriteBytes(param_1,local_54[0],local_44);
      bVar6 = (byte)param_1[0x10] ^ 1;
    }
    else {
      Msg("Too much menu data (4096 bytes max)\n");
      bVar6 = 0;
    }
    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_54);
    return bVar6;
  }
  return 0;
}

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)