CNavMesh::Dump
0x007202d0 · 972 bytes · __thiscall
_ZN8CNavMesh4DumpEv
Decompiled
undefined (1 param)
/* CNavMesh::Dump() */
undefined4 __thiscall CNavMesh::Dump(CNavMesh *this)
{
int *piVar1;
char *pcVar2;
int iVar3;
undefined4 uVar4;
undefined4 uVar5;
int iVar6;
int iVar7;
int *piVar8;
int in_GS_OFFSET;
int local_188;
void *local_170;
undefined4 local_16c;
undefined4 local_168;
size_t local_164;
void *local_160;
CUtlBuffer local_15c [4];
undefined4 local_158;
char acStack_128 [4];
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pcVar2 = (char *)GetFilename();
if (pcVar2 == (char *)0x0) {
uVar4 = 0;
pcVar2 = (char *)this;
goto LAB_007204bd;
}
iVar3 = _V_strlen(pcVar2);
if (iVar3 < 5) {
pcVar2 = "Nav file name too short.";
uVar4 = 0;
Warning("Nav file name too short.");
goto LAB_007204bd;
}
_V_strcpy(local_124,pcVar2);
_V_strcpy(acStack_128 + iVar3,"_nav.txt");
CUtlBuffer::CUtlBuffer(local_15c,0,0,1);
/* try { // try from 0072036f to 007203eb has its CatchHandler @ 007206a9 */
CUtlBuffer::Printf(local_15c,"----------------------------------------------\n");
CUtlBuffer::Printf(local_15c," Valve Nav Mesh Text Dump v1.0 \n");
CUtlBuffer::Printf(local_15c,"----------------------------------------------\n");
CUtlBuffer::Printf(local_15c,"\n");
iVar3 = DAT_00fe6000;
CUtlBuffer::Printf(local_15c,"Number of Nav Areas: %d\n",DAT_00fe6000);
CUtlBuffer::Printf(local_15c,"\n");
local_170 = (void *)0x0;
local_16c = 0;
local_168 = 0;
local_164 = 0;
local_160 = (void *)0x0;
if (iVar3 != 0) {
CUtlVector<int,CUtlMemory<int,int>>::GrowVector
((CUtlVector<int,CUtlMemory<int,int>> *)&local_170,iVar3);
if ((int)(local_164 - iVar3) < 1) {
if (0 < iVar3) {
LAB_00720563:
iVar6 = 0;
do {
*(int *)((int)local_170 + iVar6 * 4) = iVar6;
iVar6 = iVar6 + 1;
} while (iVar6 != iVar3);
}
}
else if (0 < iVar3) {
_V_memmove((void *)((int)local_170 + iVar3 * 4),local_170,(local_164 - iVar3) * 4);
goto LAB_00720563;
}
if (1 < (int)local_164) {
if (local_170 == (void *)0x0) {
local_188 = local_164 - 1;
do {
if (0 < local_188) {
iVar6 = 0;
iVar3 = 1;
do {
while( true ) {
piVar1 = (int *)((int)local_170 + iVar3 * 4);
piVar8 = (int *)((int)local_170 + iVar6);
iVar7 = NavAreaDumpSortFn(piVar8,piVar1);
if (-1 < iVar7) break;
iVar3 = iVar3 + 1;
iVar7 = *piVar8;
iVar6 = iVar6 + 4;
*piVar8 = *piVar1;
*piVar1 = iVar7;
if (local_188 + 1 == iVar3) goto LAB_0072066b;
}
iVar3 = iVar3 + 1;
iVar6 = iVar6 + 4;
} while (local_188 + 1 != iVar3);
}
LAB_0072066b:
local_188 = local_188 + -1;
} while (local_188 != -1);
}
else {
qsort(local_170,local_164,4,NavAreaDumpSortFn);
}
}
if (0 < (int)local_164) {
iVar3 = 0;
do {
piVar1 = *(int **)(TheNavAreas + *(int *)((int)local_170 + iVar3 * 4) * 4);
(**(code **)(*piVar1 + 0x44))(piVar1,local_15c);
iVar3 = iVar3 + 1;
} while (iVar3 < (int)local_164);
}
}
/* try { // try from 00720450 to 0072047c has its CatchHandler @ 007206c1 */
uVar4 = (**(code **)(*(int *)(filesystem + 4) + 0x3c))
(filesystem + 4,local_124,&DAT_00c146f4,local_15c);
if ((char)uVar4 == '\0') {
Warning("Unable to save %d bytes to %s\n",local_158,local_124);
}
else {
/* try { // try from 00720510 to 007206a3 has its CatchHandler @ 007206c1 */
uVar5 = (**(code **)(*(int *)(filesystem + 4) + 0x1c))(filesystem + 4,local_124,0);
DevMsg("Size of nav dump file \'%s\' is %u bytes.\n",local_124,uVar5);
}
local_164 = 0;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)&local_170);
local_160 = local_170;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)&local_170);
pcVar2 = (char *)local_15c;
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)pcVar2);
LAB_007204bd:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail(pcVar2);
}
return uVar4;
}
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.