sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

Overhaul Address

Open Kenzzer opened this issue 1 year ago • 1 comments

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 !

Kenzzer avatar Nov 28 '24 23:11 Kenzzer

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.

rtldg avatar Feb 23 '25 12:02 rtldg

@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>

Headline avatar Sep 21 '25 00:09 Headline

I think this is great, and indeed much better than the define.

Kenzzer avatar Sep 21 '25 00:09 Kenzzer

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.

Kenzzer avatar Nov 07 '25 15:11 Kenzzer