Add offset-reading capability for networked CUtlVector instances#1330
Add offset-reading capability for networked CUtlVector instances#1330KyleSanderson merged 6 commits intoalliedmodders:masterfrom
Conversation
asherkin
left a comment
There was a problem hiding this comment.
This looks great! It is a perfect first step towards supporting these props natively.
Not pull-ready yet; need recommendations on code style and how to deal with the
CSendPropExtra_UtlVectorgutted frompublic/dt_utlvector_send.cpp.
I'd say the HACK_CSendPropExtra_UtlVector struct here is a fine solution - this branch is highly unlikely to be hit in an engine that doesn't support CUtlVector props, and should only be reached for actual CUtlVectors, so won't have random fallout even if broken. It might be worth a quick check in CS:GO to make sure the struct matches there.
Co-authored-by: Asher Baker <[email protected]>
|
A disassembly of
I'll go ahead and set this up for review since it appears to clear both games. |
|
Do we even need the whole struct? It looks like only one member is used. If there's any chance that this could different across engine variables, why not just put its offset in gamedata? |
|
I don't have an opinion for / against putting it in gamedata, but I'd imagine we could also use No problems switching it over to gamedata if that's the consensus. |
|
Using gamedata makes sense 👍 |
KyleSanderson
left a comment
There was a problem hiding this comment.
This looks good, nice work man. When it's ready for review (after the offsets stuff comes in - which is a good suggestion) r? me again and I'll take another look for style and things like that.
|
Moved it over to offsets as requested. I'm not sure where in Let me know if I should add it into common.games or all the engine ones. |
|
|
|
Done. |
|
Nice work on this one - didn't want to nit you on this one @nosoop so made a tiny commit and landed. Thanks for the contribution! |
This was initially discussed in the SourceMod Discord; PR provides a way to get the actual offset of networked class members of type
CUtlVectorsuch asCBaseFlex::m_AnimOverlayandCTFPlayer::m_hMyWearables.Tested working in TF2 with the following snippet:
Not pull-ready yet; need recommendations on code style and how to deal with the
CSendPropExtra_UtlVectorgutted frompublic/dt_utlvector_send.cpp.Heuristic per following message (the
lengthproxyalso holds the extradata, so I opted to use the parent table instead):