L L4D2node

LoadMOTDFile

0x006ca040 · 376 bytes · __cdecl

_Z12LoadMOTDFilePKcP6ConVar

Decompiled

undefined (2 params)

/* LoadMOTDFile(char const*, ConVar*) */

void LoadMOTDFile(char *param_1,ConVar *param_2)

{
  int iVar1;
  char *pcVar2;
  int iVar3;
  int in_GS_OFFSET;
  undefined1 local_4020 [16384];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar2 = "FCVAR_NEVER_AS_STRING";
  if (((byte)param_2[0x15] & 0x10) == 0) {
    pcVar2 = "";
    if (*(char **)(*(int *)(param_2 + 0x1c) + 0x24) != (char *)0x0) {
      pcVar2 = *(char **)(*(int *)(param_2 + 0x1c) + 0x24);
    }
  }
  iVar1 = (**(code **)(*(int *)(filesystem + 4) + 0x1c))(filesystem + 4,pcVar2,"GAME");
  if (iVar1 - 1U < 0x3ffe) {
    pcVar2 = "FCVAR_NEVER_AS_STRING";
    if (((byte)param_2[0x15] & 0x10) == 0) {
      pcVar2 = "";
      if (*(char **)(*(int *)(param_2 + 0x1c) + 0x24) != (char *)0x0) {
        pcVar2 = *(char **)(*(int *)(param_2 + 0x1c) + 0x24);
      }
    }
    iVar3 = (**(code **)(*(int *)(filesystem + 4) + 8))(filesystem + 4,pcVar2,"rb","GAME");
    if (iVar3 != 0) {
      (*(code *)**(undefined4 **)(filesystem + 4))(filesystem + 4,local_4020,iVar1,iVar3);
      (**(code **)(*(int *)(filesystem + 4) + 0xc))(filesystem + 4,iVar3);
      local_4020[iVar1] = 0;
      (**(code **)(*g_pStringTableInfoPanel + 0x24))
                (g_pStringTableInfoPanel,1,param_1,iVar1 + 1,local_4020);
    }
  }
  else {
    pcVar2 = "FCVAR_NEVER_AS_STRING";
    if (((byte)param_2[0x15] & 0x10) == 0) {
      pcVar2 = "";
      if (*(char **)(*(int *)(param_2 + 0x1c) + 0x24) != (char *)0x0) {
        pcVar2 = *(char **)(*(int *)(param_2 + 0x1c) + 0x24);
      }
    }
    DevMsg("Invalid file size for %s\n",pcVar2);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)