Repository navigation
Conversation
ClassifyObject() only looked at fields two by two and never classified an
eightbyte holding a single field, so Vector { x, y, z } was SSE + None: the z
returned in xmm1 was never stored (SDKCall returning a Vector by value got z = 0).
Merge the class of every field into the eightbyte it is laid out in instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BinTools: classify every eightbyte of small objects on System V x86_64
Bug
On Linux x86_64,
SDKCallwithSDKType_Vector/SDKPass_ByValuereturnsz = 0. For exampleWeapon_ShootPositionon CS:S x64 gives123.50 -456.25 0.00instead of123.50 -456.25 128.00.ClassifyObject()walks fields two by two and never classifies an eightbyte that holds a single field.Vector { float x, y, z; }is therefore classified SSE + None, and the second return register (xmm1, which holdsz) is never stored.Upstream master has the same code (checked 2026-10-19), so this affects every SourceMod x86_64 Linux server.
Fix
Each eightbyte gets the merged class of every field laid out in it. Fields are naturally aligned and in declaration order, which is what the System V ABI says (§3.2.3). For a
Vectorthat gives SSE + SSE →xmm0+xmm1.Testing
On CS:S x64 (build 11003710),
SDKCall(Weapon_ShootPosition)now returns the full eye position (it matchesGetClientEyePosition). Covered byplugins/testsuite/dhooks/dhooks-css-test.spfrom #9.Based on
1.13-7427(our pin). It's independent of DHooks and worth sending upstream as well.