L L4D2node

Info_SetValueForStarKey

0x00202610 · 585 bytes · __cdecl

_Z23Info_SetValueForStarKeyPcPKcS1_i

Decompiled

undefined (4 params)

/* Info_SetValueForStarKey(char*, char const*, char const*, int) */

void Info_SetValueForStarKey(char *param_1,char *param_2,char *param_3,int param_4)

{
  byte bVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  uint __c;
  byte *pbVar6;
  int in_GS_OFFSET;
  byte local_820;
  byte local_81f [2047];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar3 = _V_strstr(param_2,"\\");
  if ((iVar3 == 0) && (iVar3 = _V_strstr(param_3,"\\"), iVar3 == 0)) {
    iVar3 = _V_strstr(param_2,"\"");
    if ((iVar3 == 0) && (iVar3 = _V_strstr(param_3,"\""), iVar3 == 0)) {
      iVar3 = _V_strlen(param_2);
      if ((iVar3 < 0x801) && (iVar3 = _V_strlen(param_3), iVar3 < 0x801)) {
        Info_RemoveKey(param_1,param_2);
        if ((param_3 != (char *)0x0) && (iVar3 = _V_strlen(param_3), iVar3 != 0)) {
          pbVar6 = &local_820;
          V_snprintf((char *)pbVar6,0x800,"\\%s\\%s",param_2,param_3);
          iVar3 = _V_strlen((char *)pbVar6);
          iVar4 = _V_strlen(param_1);
          if (iVar4 + iVar3 < param_4) {
LAB_002027d5:
            iVar3 = _V_strlen(param_1);
            pcVar5 = param_1 + iVar3;
LAB_002027df:
            bVar1 = *pbVar6;
            if (bVar1 != 0) {
              do {
                __c = (uint)bVar1;
                pbVar6 = pbVar6 + 1;
                iVar3 = _V_stricmp(param_2,"name");
                if (iVar3 != 0) {
                  __c = __c & 0x7f;
                  if (0x5f < __c - 0x20) goto LAB_002027df;
                  iVar3 = _V_stricmp(param_2,"team");
                  if (iVar3 == 0) {
                    __c = tolower(__c);
                  }
                }
                if ((int)__c < 0xe) goto LAB_002027df;
                *pcVar5 = (char)__c;
                bVar1 = *pbVar6;
                pcVar5 = pcVar5 + 1;
                if (bVar1 == 0) break;
              } while( true );
            }
            *pcVar5 = '\0';
          }
          else {
            cVar2 = Info_IsKeyImportant(param_2);
            while (cVar2 != '\0') {
              pcVar5 = (char *)Info_FindLargestKey(param_1,param_4);
              Info_RemoveKey(param_1,pcVar5);
              iVar3 = _V_strlen((char *)pbVar6);
              iVar4 = _V_strlen(param_1);
              if (iVar4 + iVar3 < param_4) {
                if (*pcVar5 != '\0') goto LAB_002027d5;
                break;
              }
              cVar2 = *pcVar5;
            }
            Msg("Info string length exceeded\n");
          }
        }
      }
      else {
        Msg("Keys and values must be < %i characters.\n",0x801);
      }
    }
    else {
      Msg("Can\'t use keys or values with a \"\n");
    }
  }
  else {
    Msg("Can\'t use keys or values with a \\\n");
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)