C++ Modules - Accessing CNavArea/CBaseEntity serverside?

Good day.

I’ve been getting into creating GMod modules lately, and there’s one thing I haven’t been able to figure out- How can I access the CNavArea/CBaseEntity classes from within a module? I have heard about methods involving getting the classes via finding addresses in memory, but I have not found any explanation of how to do this.

There’s no simple explanation for it, you’ll have to understand C and some of the underlying ASM concepts. The very simple walkthrough for doing this is to find somewhere where the navmesh singleton exists in memory. Then from there attach a debugger and find the assembly code that moves the pointer, to the singleton, into a register (I thought this should be a _thiscall but my comment shows it doing move eax which is _fastcall on windows? I haven’t done any RE on windows in a while…). From there you can scan for the code in memory and then use the pointer like you would normally.

Feel free to copy the code from the fgt_navstuff module and tinker around with it to figure things out. It makes use of the allied modders (sourcemod) sigscan class examples. Hopefully looking at the code and signatures alongside a debugger will teach you more than I can half-ass explain.