COM_WriteFile
0x001266b0 · 242 bytes · __cdecl
_Z13COM_WriteFilePKcPvi
Decompiled
undefined (3 params)
/* COM_WriteFile(char const*, void*, int) */
void COM_WriteFile(char *param_1,void *param_2,int param_3)
{
code *pcVar1;
int iVar2;
int iVar3;
size_t sVar4;
int iVar5;
int in_GS_OFFSET;
undefined4 uStack_40;
int aiStack_38 [6];
int local_20 [4];
local_20[0] = *(int *)(in_GS_OFFSET + 0x14);
uStack_40 = 0x1266d2;
sVar4 = strlen(param_1);
iVar3 = -((sVar4 + 0x11 & 0xfffffff0) + 0x10);
iVar2 = (int)local_20 + iVar3;
*(size_t *)((int)aiStack_38 + iVar3) = sVar4 + 2;
*(char **)((int)aiStack_38 + iVar3 + 8) = param_1;
*(undefined **)((int)aiStack_38 + iVar3 + 4) = &DAT_002c48a3;
*(int *)((int)local_20 + iVar3 + -0x1c) = iVar2;
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x1266ff;
V_snprintf(*(char **)((int)local_20 + iVar3 + -0x1c),*(int *)((int)aiStack_38 + iVar3),
*(char **)((int)aiStack_38 + iVar3 + 4));
*(undefined4 *)((int)aiStack_38 + iVar3) = 0x2f;
*(int *)((int)local_20 + iVar3 + -0x1c) = iVar2;
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x12670f;
V_FixSlashes(*(char **)((int)local_20 + iVar3 + -0x1c),*(char *)((int)aiStack_38 + iVar3));
*(int *)((int)local_20 + iVar3 + -0x1c) = iVar2;
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x126717;
COM_CreatePath(*(char **)((int)local_20 + iVar3 + -0x1c));
iVar5 = *(int *)(g_pFileSystem + 4);
*(undefined4 *)((int)aiStack_38 + iVar3 + 8) = 0;
*(undefined **)((int)aiStack_38 + iVar3 + 4) = &DAT_002a5c80;
*(int *)((int)aiStack_38 + iVar3) = iVar2;
*(int *)((int)local_20 + iVar3 + -0x1c) = g_pFileSystem + 4;
pcVar1 = *(code **)(iVar5 + 8);
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x12673c;
iVar5 = (*pcVar1)();
if (iVar5 == 0) {
*(int *)((int)aiStack_38 + iVar3) = iVar2;
*(char **)((int)local_20 + iVar3 + -0x1c) = "COM_WriteFile: failed on %s\n";
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x1267a0;
Warning();
}
else {
iVar2 = *(int *)(g_pFileSystem + 4);
*(int *)((int)aiStack_38 + iVar3 + 8) = iVar5;
*(int *)((int)local_20 + iVar3 + -0x1c) = g_pFileSystem + 4;
*(int *)((int)aiStack_38 + iVar3 + 4) = param_3;
*(void **)((int)aiStack_38 + iVar3) = param_2;
pcVar1 = *(code **)(iVar2 + 4);
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x126762;
(*pcVar1)();
iVar2 = *(int *)(g_pFileSystem + 4);
*(int *)((int)aiStack_38 + iVar3) = iVar5;
*(int *)((int)local_20 + iVar3 + -0x1c) = g_pFileSystem + 4;
pcVar1 = *(code **)(iVar2 + 0xc);
*(undefined4 *)((int)&uStack_40 + iVar3) = 0x126777;
(*pcVar1)();
}
if (local_20[0] == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
*(undefined **)((int)&uStack_40 + iVar3) = &UNK_001267a7;
__stack_chk_fail();
}
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.