CNavMesh::Save
0x00720700 · 2447 bytes · __thiscall
_ZN8CNavMesh4SaveEv
Decompiled
undefined (1 param)
/* CNavMesh::Save() */
undefined4 __thiscall CNavMesh::Save(CNavMesh *this)
{
CNavMesh CVar1;
int *piVar2;
byte bVar3;
char cVar4;
ushort uVar5;
char *pcVar6;
char *pcVar7;
int iVar8;
undefined4 uVar9;
uint *puVar10;
uint *puVar11;
size_t sVar12;
void *pvVar13;
uint *puVar14;
undefined1 local_88;
undefined1 uStack_87;
undefined1 local_86;
undefined1 local_85;
undefined2 local_84;
undefined1 local_82;
undefined1 local_81;
undefined1 local_80;
undefined1 local_7f;
undefined1 local_7e;
undefined1 local_7d;
undefined1 local_7c;
undefined1 local_7b;
undefined1 local_7a;
undefined1 local_79;
undefined4 local_78;
undefined1 local_74;
undefined1 local_73;
undefined1 local_72;
undefined1 local_71;
undefined4 local_70;
undefined1 local_6c;
undefined1 local_6b;
undefined1 local_6a;
undefined1 local_69;
uint local_68;
undefined4 local_64;
undefined1 local_60;
undefined1 local_5f;
undefined1 local_5e;
undefined1 local_5d;
undefined4 local_5c;
undefined1 local_58;
undefined1 local_57;
undefined1 local_56;
undefined1 local_55;
int local_54;
undefined4 local_50;
int local_44;
byte local_3f;
int local_34;
byte local_20;
cVar4 = TestFilesWritable(this);
if (cVar4 != '\0') {
if (TheNavMesh[0x4e] == (CNavMesh)0x0) {
Warning("The nav mesh needs a full nav_analyze\n");
}
pcVar6 = (char *)GetFilename();
pcVar7 = pcVar6;
if (pcVar6 != (char *)0x0) {
for (; *pcVar7 != '\0'; pcVar7 = pcVar7 + 1) {
if (*pcVar7 == '\\') {
*pcVar7 = '/';
}
}
iVar8 = GetBspFilename();
if (iVar8 != 0) {
CUtlBuffer::CUtlBuffer((CUtlBuffer *)&local_54,0x1000,0x100000,0);
if ((local_3f & 1) == 0) {
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,4);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(undefined4 *)(local_54 + (local_44 - local_34)) = 0xfeedface;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
local_80 = 0xfe;
local_7f = 0xed;
local_7e = 0xfa;
local_7d = 0xce;
_V_memcpy(pvVar13,&local_80,4);
}
}
local_44 = local_44 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
/* try { // try from 007207ba to 00720c2f has its CatchHandler @ 007210ab */
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",0xfeedface);
}
if ((local_3f & 1) == 0) {
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,4);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(undefined4 *)(local_54 + (local_44 - local_34)) = 0x10;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
local_7c = 0;
local_7b = 0;
local_7a = 0;
local_79 = 0x10;
_V_memcpy(pvVar13,&local_7c,4);
}
}
local_44 = local_44 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",0x10);
}
uVar9 = (**(code **)(*(int *)this + 0x34))(this);
if ((local_3f & 1) == 0) {
local_78 = uVar9;
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,4);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(undefined4 *)(local_54 + (local_44 - local_34)) = uVar9;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
local_74 = local_78._3_1_;
local_73 = local_78._2_1_;
local_72 = local_78._1_1_;
local_71 = (undefined1)local_78;
_V_memcpy(pvVar13,&local_74,4);
}
}
local_44 = local_44 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",uVar9);
}
puVar10 = (uint *)(**(code **)(*(int *)(filesystem + 4) + 0x1c))(filesystem + 4,iVar8,0);
puVar14 = puVar10;
DevMsg("Size of bsp file \'%s\' is %u bytes.\n",iVar8,puVar10);
if ((local_3f & 1) == 0) {
local_70 = puVar10;
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,4);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(uint **)(local_54 + (local_44 - local_34)) = puVar10;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
puVar14 = (uint *)0x4;
local_6c = local_70._3_1_;
local_6b = local_70._2_1_;
local_6a = local_70._1_1_;
local_69 = (undefined1)local_70;
_V_memcpy(pvVar13,&local_6c,4);
}
}
local_44 = local_44 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",puVar10);
puVar14 = puVar10;
}
CVar1 = this[0x4e];
puVar10 = (uint *)(uint)(byte)CVar1;
if ((local_3f & 1) == 0) {
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,1);
if (cVar4 != '\0') {
*(CNavMesh *)(local_54 + (local_44 - local_34)) = CVar1;
local_44 = local_44 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",puVar10);
puVar14 = puVar10;
}
puVar10 = (uint *)0x0;
iVar8 = 0;
DAT_00fe6b50 = (uint *)0x0;
DAT_00fe6b58 = 0;
if (0 < (int)DAT_00fe6000) {
do {
local_68 = *(uint *)(*(int *)(TheNavAreas + iVar8 * 4) + 0x94);
if (local_68 == 0) {
DAT_00fe6b58 = 1;
}
else if ((int)puVar10 < 1) {
LAB_007208e8:
puVar14 = &local_68;
CUtlVector<unsigned_int,CUtlMemory<unsigned_int,int>>::InsertBefore
((CUtlVector<unsigned_int,CUtlMemory<unsigned_int,int>> *)&placeDirectory,
(int)puVar10,puVar14);
puVar10 = DAT_00fe6b50;
}
else if (local_68 != *placeDirectory) {
puVar11 = (uint *)0x0;
do {
puVar11 = (uint *)((int)puVar11 + 1);
if (puVar11 == puVar10) goto LAB_007208e8;
} while (local_68 != placeDirectory[(int)puVar11]);
if ((int)puVar11 < 0) goto LAB_007208e8;
}
iVar8 = iVar8 + 1;
} while (iVar8 < (int)DAT_00fe6000);
puVar10 = (uint *)((uint)puVar10 & 0xffff);
}
if ((local_3f & 1) == 0) {
/* try { // try from 00720c59 to 007210a2 has its CatchHandler @ 007210ab */
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,2);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(short *)(local_54 + (local_44 - local_34)) = (short)puVar10;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
uStack_87 = (undefined1)((uint)puVar10 >> 8);
puVar14 = (uint *)0x2;
local_86 = uStack_87;
local_88 = SUB41(puVar10,0);
local_85 = local_88;
_V_memcpy(pvVar13,&local_86,2);
}
}
local_44 = local_44 + 2;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",puVar10);
puVar14 = puVar10;
}
iVar8 = 0;
if (0 < (int)DAT_00fe6b50) {
do {
pcVar7 = (char *)PlaceToName(TheNavMesh,placeDirectory[iVar8]);
sVar12 = strlen(pcVar7);
uVar5 = (short)sVar12 + 1;
puVar14 = (uint *)(uint)uVar5;
if ((local_3f & 1) == 0) {
local_84 = uVar5;
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,2);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(ushort *)(local_54 + (local_44 - local_34)) = uVar5;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
local_82 = local_84._1_1_;
local_81 = (undefined1)local_84;
_V_memcpy(pvVar13,&local_82,2);
}
}
local_44 = local_44 + 2;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",puVar14);
}
CUtlBuffer::Put((CUtlBuffer *)&local_54,pcVar7,(int)puVar14);
iVar8 = iVar8 + 1;
} while (iVar8 < (int)DAT_00fe6b50);
}
bVar3 = DAT_00fe6b58;
puVar10 = (uint *)(uint)DAT_00fe6b58;
if ((local_3f & 1) == 0) {
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,1);
if (cVar4 != '\0') {
*(byte *)(local_54 + (local_44 - local_34)) = bVar3;
local_44 = local_44 + 1;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",puVar10);
puVar14 = puVar10;
}
(**(code **)(*(int *)this + 0x40))(this,(CUtlBuffer *)&local_54);
puVar10 = DAT_00fe6000;
if ((local_3f & 1) == 0) {
local_64 = DAT_00fe6000;
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,4);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(uint **)(local_54 + (local_44 - local_34)) = puVar10;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
puVar14 = (uint *)0x4;
local_60 = local_64._3_1_;
local_5f = local_64._2_1_;
local_5e = local_64._1_1_;
local_5d = (undefined1)local_64;
_V_memcpy(pvVar13,&local_60,4);
}
}
local_44 = local_44 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
puVar14 = DAT_00fe6000;
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",DAT_00fe6000);
}
iVar8 = 0;
if (0 < (int)DAT_00fe6000) {
do {
piVar2 = *(int **)(TheNavAreas + iVar8 * 4);
puVar14 = (uint *)0x10;
(**(code **)(*piVar2 + 0x30))(piVar2,(CUtlBuffer *)&local_54,0x10);
iVar8 = iVar8 + 1;
} while (iVar8 < (int)DAT_00fe6000);
}
puVar10 = *(uint **)(this + 0x51c);
if ((local_3f & 1) == 0) {
local_5c = puVar10;
cVar4 = CUtlBuffer::CheckPut((CUtlBuffer *)&local_54,4);
if (cVar4 != '\0') {
if ((local_20 & 1) == 0) {
*(uint **)(local_54 + (local_44 - local_34)) = puVar10;
}
else {
pvVar13 = (void *)((local_44 - local_34) + local_54);
if (pvVar13 != (void *)0x0) {
puVar14 = (uint *)0x4;
local_58 = local_5c._3_1_;
local_57 = local_5c._2_1_;
local_56 = local_5c._1_1_;
local_55 = (undefined1)local_5c;
_V_memcpy(pvVar13,&local_58,4);
}
}
local_44 = local_44 + 4;
CUtlBuffer::AddNullTermination((CUtlBuffer *)&local_54);
}
}
else {
CUtlBuffer::Printf((CUtlBuffer *)&local_54,"%u",puVar10);
puVar14 = puVar10;
}
iVar8 = 0;
if (0 < *(int *)(this + 0x51c)) {
do {
puVar14 = (uint *)0x10;
CNavLadder::Save(*(CUtlBuffer **)(*(int *)(this + 0x510) + iVar8 * 4),(uint)&local_54);
iVar8 = iVar8 + 1;
} while (iVar8 < *(int *)(this + 0x51c));
}
(**(code **)(*(int *)this + 0x38))(this,(CUtlBuffer *)&local_54,puVar14);
BumpFileHistory(pcVar6,*(int *)(nav_save_history._28_4_ + 0x30));
uVar9 = (**(code **)(*(int *)(filesystem + 4) + 0x3c))
(filesystem + 4,pcVar6,&DAT_00c146f4,(CUtlBuffer *)&local_54);
if ((char)uVar9 == '\0') {
Warning("Unable to save %d bytes to %s\n",local_50,pcVar6);
}
else {
uVar9 = (**(code **)(*(int *)(filesystem + 4) + 0x1c))(filesystem + 4,pcVar6,0);
DevMsg("Size of nav file \'%s\' is %u bytes.\n",pcVar6,uVar9);
uVar9 = Dump(this);
}
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_54);
return uVar9;
}
}
}
return 0;
}
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.