Skip to content

Conversation

@Kenzzer
Copy link
Member

@Kenzzer Kenzzer commented Nov 28, 2024

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 !

@rtldg
Copy link
Contributor

rtldg commented Feb 23, 2025

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

} else if (vc->retinfo->vtype == Valve_Bool) {
bool *addr = (bool *)vc->retbuf;
if (vc->retinfo->flags & PASSFLAG_ASPOINTER)
{
addr = *(bool **)addr;
}
return *addr ? 1 : 0;
} else {
cell_t *addr = (cell_t *)vc->retbuf;
if (vc->retinfo->flags & PASSFLAG_ASPOINTER)
{
addr = *(cell_t **)addr;
}
return *addr;

This would allow things like calling CreateInterface with SDKCall() and actually having a usable result.

@Headline
Copy link
Member

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

@Kenzzer
Copy link
Member Author

Kenzzer commented Sep 21, 2025

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

@Kenzzer Kenzzer force-pushed the virtual_address branch 2 times, most recently from ab34ad7 to dffd568 Compare November 7, 2025 15:01
@Kenzzer
Copy link
Member Author

Kenzzer commented Nov 7, 2025

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 Kenzzer marked this pull request as ready for review November 7, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Testing untested by author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants