Skip to content

Conversation

@mrwonko
Copy link

@mrwonko mrwonko commented Apr 21, 2025

Collected fixes and refactorings to make the QVM support a little harder to misuse. See individual commit messages for details. Of particular importance are 105647d for the correct typing of m_pVehicle and f81e893 for fixing the use of client_t.gentity

mrwonko added 5 commits March 1, 2025 18:46
This gets rid of the confusing and brittle g2Tmp static variable, replacing it
with individual local variables instead.
This expresses its dual nature a bit more clearly than a void pointer.
It seems dangerous to pretend that the pointers to pointers inside
sharedEntityMapper_t are all ordinary pointers. Instead, let's use a
union type to clearly distinguish between ordinary native pointers and
32-bit pointers into QVM memory that need to be translated first.

I chose to only use a single union-pointer-type, instead of one per
pointed-to type, for simplicity. I added some light type annotations
using no-op defines, but there's no actual type checking.

I did all this in the pursuit of properly marking Vehicle_t as having
different memory layouts in native and QVM. It is only used for
null-checks at the moment, which is safe, but if somebody were to try to
access its fields, they need to be aware of the type mismatch.
We need to use the gentityMapper instead, to properly handle QVM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant