sourcemod
sourcemod copied to clipboard
Overhaul Address
Another Address PR!
The idea and implementation is primarily @dvander's, this PR just makes the bridge to SM. In order to use the new virtual address :
#define VIRTUAL_ADDRESS
#include <sourcemod>
#include <sdktools>
If enabled, plugins need to ensure their SDKCalls are using the new SDKType_VirtualAddress, whether they're on 32bits or 64bits. Otherwise the plugin will most definitively crash the server.
Marking as draft for now until I can get a few server operators to try this out. Extra natives idea are welcomed !
Can you also add this:
} else if (vc->retinfo->vtype == Valve_VirtualAddress) {
void *addr = (void *)vc->retbuf;
return g_pSM->ToPseudoAddress(addr);
} else {
to here https://github.com/alliedmodders/sourcemod/blob/b71d3c0174b9fd008a7dd4d523c06b75b811f49d/extensions/sdktools/vcaller.cpp#L532-L545
This would allow things like calling CreateInterface with SDKCall() and actually having a usable result.
@Kenzzer @rtldg anything else you guys can think of? Going to mark ready for review - plugin interface would instead be
#include <sourcemod>
#include <sdktools>
#include <virtual_address>
I think this is great, and indeed much better than the define.
A big thanks to @Malifox for taking the first step into trying this PR with a well established plugin, which helped me hunt down a ton of bugs.