Make plugins aware of pointer size

This commit is contained in:
Kenzzer 2025-10-24 08:23:24 +00:00
parent bf1ca7e1a4
commit 9dc2ce5036
No known key found for this signature in database
GPG Key ID: 64C3FD4332686DC1
2 changed files with 8 additions and 0 deletions

View File

@ -330,6 +330,13 @@ bool CPlugin::ReadInfo()
else
m_MaxClientsVar = nullptr;
if (base->FindPubvarByName("PointerSize", &idx) == SP_ERROR_NONE) {
sp_pubvar_t* var = nullptr;
if (base->GetPubvarByIndex(idx, &var) == SP_ERROR_NONE && var) {
*var->offs = sizeof(void*);
}
}
return true;
}

View File

@ -36,3 +36,4 @@
#define _virtual_address_included
public const Address __Virtual_Address__ = 0;
public const Address PointerSize = 0; /**< Size of a pointer in bytes (same as `sizeof(void*)`) */