vprof_playback_start
0x002339a0 · 1112 bytes · __cdecl
_ZL20vprof_playback_startRK8CCommand
Decompiled
undefined (1 param)
/* vprof_playback_start(CCommand const&) */
void vprof_playback_start(CCommand *param_1)
{
int iVar1;
char *pcVar2;
int iVar3;
char *pcVar4;
int in_GS_OFFSET;
int local_430;
undefined4 local_42c;
undefined1 local_428;
undefined1 local_427;
undefined1 local_426;
undefined1 local_425;
undefined1 local_424;
undefined1 local_423;
undefined1 local_422;
undefined1 local_421;
char local_420 [512];
char local_220 [512];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)param_1 < 2) {
Warning("vprof_playback_start requires a filename\n");
}
else {
local_420[0] = '\0';
iVar3 = 1;
do {
iVar1 = iVar3 * 4;
iVar3 = iVar3 + 1;
V_strncat(local_420,*(char **)(param_1 + iVar1 + 0x408),0x200,-1);
} while (iVar3 < *(int *)param_1);
if ((g_VProfRecorder._6624_4_ - 1 < 2) && (g_VProfRecorder._6628_4_ != 0)) {
if (g_VProfRecorder._6624_4_ == 1) {
g_VProfRecorder._6660_4_ = g_VProfRecorder._6660_4_ + 1;
}
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,g_VProfRecorder._6628_4_);
}
g_VProfRecorder._6624_4_ = 0;
g_VProfRecorder._6628_4_ = 0;
g_pVProfileForDisplay = &g_VProfCurrentProfile;
g_VProfRecorder._6636_4_ = 0xffffffff;
g_VProfRecorder[0x19fc] = 1;
CVProfile::Term();
pcVar2 = strchr(local_420,0x2e);
pcVar4 = local_420;
if (pcVar2 == (char *)0x0) {
pcVar4 = local_220;
V_snprintf(pcVar4,0x200,"%s.vprof",local_420);
}
g_VProfRecorder._6632_4_ = 0xffffffff;
g_VProfRecorder._6628_4_ =
(**(code **)(*(int *)(g_pFileSystem + 4) + 8))(g_pFileSystem + 4,pcVar4,&DAT_002a3e98,0);
g_VProfRecorder[0x1a08] = 1;
g_VProfRecorder._6624_4_ = 2;
if (g_VProfRecorder._6628_4_ == 0) {
Warning("vprof_playback_start: Open( %s ) failed.\n",pcVar4);
}
else {
if ((g_VProfRecorder[0x1a0c] & 1) == 0) {
(*(code *)**(undefined4 **)(g_pFileSystem + 4))(g_pFileSystem + 4,&local_430);
}
else {
(*(code *)**(undefined4 **)(g_pFileSystem + 4))
(g_pFileSystem + 4,&local_428,4,g_VProfRecorder._6628_4_);
local_424 = local_425;
local_423 = local_426;
local_422 = local_427;
local_421 = local_428;
_V_memcpy(&local_430,&local_424,4);
}
if (local_430 == 1) {
if ((g_VProfRecorder[0x1a0c] & 1) == 0) {
(*(code *)**(undefined4 **)(g_pFileSystem + 4))
(g_pFileSystem + 4,&local_42c,4,g_VProfRecorder._6628_4_);
}
else {
(*(code *)**(undefined4 **)(g_pFileSystem + 4))
(g_pFileSystem + 4,&local_428,4,g_VProfRecorder._6628_4_);
local_424 = local_425;
local_423 = local_426;
local_422 = local_427;
local_421 = local_428;
_V_memcpy(&local_42c,&local_424,4);
}
g_VProfRecorder._4240_4_ = local_42c;
g_VProfRecorder._6640_4_ =
(**(code **)(*(int *)(g_pFileSystem + 4) + 0x14))
(g_pFileSystem + 4,g_VProfRecorder._6628_4_);
g_VProfRecorder[0x19f4] = 0;
g_VProfRecorder._6648_4_ =
(**(code **)(*(int *)(g_pFileSystem + 4) + 0x18))
(g_pFileSystem + 4,g_VProfRecorder._6628_4_);
g_VProfRecorder._4108_4_ = 1;
CVProfRecorder::Playback_ReadTick((CVProfRecorder *)g_VProfRecorder,-1,(bool *)0x0);
g_pVProfileForDisplay = g_VProfRecorder;
}
else {
if ((g_VProfRecorder._6624_4_ - 1 < 2) && (g_VProfRecorder._6628_4_ != 0)) {
if (g_VProfRecorder._6624_4_ == 1) {
g_VProfRecorder._6660_4_ = g_VProfRecorder._6660_4_ + 1;
}
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))
(g_pFileSystem + 4,g_VProfRecorder._6628_4_);
}
g_VProfRecorder._6624_4_ = 0;
g_VProfRecorder._6628_4_ = 0;
g_pVProfileForDisplay = &g_VProfCurrentProfile;
g_VProfRecorder._6636_4_ = 0xffffffff;
g_VProfRecorder[0x19fc] = 1;
CVProfile::Term();
Warning("VPROF PLAYBACK ASSERT (%s, line %d) - stopping playback.\n",
"/data/src/engine/./vprof_record.cpp",0x158);
}
}
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
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.