CDedicatedServerAPI::BuildMapCycleListHints
0x00216a80 · 970 bytes · __thiscall
_ZN19CDedicatedServerAPI22BuildMapCycleListHintsEPPc
Decompiled
undefined (2 params)
/* CDedicatedServerAPI::BuildMapCycleListHints(char**) */
undefined4 __thiscall
CDedicatedServerAPI::BuildMapCycleListHints(CDedicatedServerAPI *this,char **param_1)
{
int iVar1;
uint uVar2;
uint uVar3;
char *pcVar4;
size_t sVar5;
int iVar6;
undefined4 uVar7;
size_t sVar8;
char *pcVar9;
uint *puVar10;
uint *puVar11;
int in_GS_OFFSET;
char *pcVar12;
char local_434 [260];
char local_330 [260];
uint local_22c [65];
char local_126 [262];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
V_FileBase(com_gamedir,local_434,0x104);
V_snprintf(local_330,0x104,"%s\\mapcycle.txt",local_434);
iVar1 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
(g_pFileSystem + 4,local_330,&DAT_002a3e98,0);
if (iVar1 == 0) {
ConMsg("Unable to open %s",local_330);
uVar7 = 0;
}
else {
V_snprintf((char *)local_22c,0x106,"%s\\%s\\%s%s\r\n",szReslistsBaseDir,local_434,
szCommonPreloads,szReslistsExt,iVar1);
puVar11 = local_22c;
do {
puVar10 = puVar11;
uVar2 = *puVar10 + 0xfefefeff & ~*puVar10;
uVar3 = uVar2 & 0x80808080;
puVar11 = puVar10 + 1;
} while (uVar3 == 0);
if ((uVar2 & 0x8080) == 0) {
puVar11 = (uint *)((int)puVar10 + 6);
uVar3 = uVar3 >> 0x10;
}
pcVar12 = (char *)((int)puVar11 + (-(int)local_22c - (uint)CARRY1((byte)uVar3,(byte)uVar3)) + -2
);
pcVar4 = malloc((size_t)pcVar12);
*param_1 = pcVar4;
if (pcVar4 == (char *)0x0) {
pcVar12 = "Unable to allocate memory for map cycle hints list";
LAB_00216d1f:
ConMsg(pcVar12);
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,iVar1);
uVar7 = 0;
}
else {
V_strncpy(pcVar4,(char *)local_22c,(int)pcVar12);
sVar5 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x18))(g_pFileSystem + 4,iVar1);
if (((sVar5 != 0) && (pcVar4 = malloc(sVar5), pcVar4 != (char *)0x0)) &&
(iVar6 = (*(code *)**(undefined4 **)(g_pFileSystem + 4))
(g_pFileSystem + 4,pcVar4,sVar5,iVar1), iVar6 == 1)) {
while (pcVar4 = (char *)COM_Parse(pcVar4), com_token != '\0') {
V_strncpy((char *)local_22c,&com_token,0x106);
iVar6 = COM_TokenWaiting(pcVar4);
if (iVar6 != 0) {
pcVar4 = (char *)COM_Parse(pcVar4);
}
V_snprintf(local_126,0x106,"%s\\%s\\%s%s\r\n",szReslistsBaseDir,local_434,local_22c,
szReslistsExt);
pcVar9 = *param_1;
sVar5 = strlen(pcVar9);
sVar8 = strlen(local_126);
pcVar9 = realloc(pcVar9,sVar5 + 2 + sVar8);
*param_1 = pcVar9;
if (pcVar9 == (char *)0x0) {
pcVar12 = "Unable to reallocate memory for map cycle hints list";
goto LAB_00216d1f;
}
V_strncat(pcVar9,local_126,(uint)pcVar12,-1);
}
}
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,iVar1);
V_snprintf((char *)local_22c,0x106,"%s\\%s\\mp_maps.txt\r\n",szReslistsBaseDir,local_434);
pcVar4 = *param_1;
sVar5 = strlen(pcVar4);
puVar11 = local_22c;
do {
puVar10 = puVar11;
uVar2 = *puVar10 + 0xfefefeff & ~*puVar10;
uVar3 = uVar2 & 0x80808080;
puVar11 = puVar10 + 1;
} while (uVar3 == 0);
if ((uVar2 & 0x8080) == 0) {
puVar11 = (uint *)((int)puVar10 + 6);
uVar3 = uVar3 >> 0x10;
}
pcVar4 = realloc(pcVar4,(size_t)((int)puVar11 +
sVar5 + (-(int)local_22c -
(uint)CARRY1((byte)uVar3,(byte)uVar3)) + -1));
*param_1 = pcVar4;
V_strncat(pcVar4,(char *)local_22c,(uint)pcVar12,-1);
uVar7 = 1;
}
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return uVar7;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.