Remove internal stack traces and add native signature bindings#924
Closed
SlynxCZ wants to merge 0 commit intoroflmuffin:mainfrom
Closed
Remove internal stack traces and add native signature bindings#924SlynxCZ wants to merge 0 commit intoroflmuffin:mainfrom
SlynxCZ wants to merge 0 commit intoroflmuffin:mainfrom
Conversation
Owner
|
It would be good to implement the changes to the stacktrace tracking, but there are too many other miscellaneous changes in this PR (including formatting). Would it be possible to create a separate PR with only the script context changes and nothing else, and without the formatting changes. |
Owner
|
I've reverted the internal stacktrace in #927 |
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.
Summary
This PR removes the runtime stack trace collection from
RegisterCallbackTrace(...)due to significant overhead, and instead adds native-level signature bindings with clean wrappers.These changes are runtime-neutral, fully backward compatible, and improve performance, stability, and modding capability.
Why
Removed:
StackTrace(2, true)was previously used to capture the origin of each registered delegate. However, testing revealed that it incurs a high runtime cost when many callbacks are registered (especially during map start or event hooks).Since
AcceleratorCSSalready provides external callback tracing at runtime with near-zero overhead, this internal mechanism was redundant.New Focus:
Instead of internal diagnostics, this PR focuses on exposing native engine features for plugin developers via clean C# wrappers.
Added
New native functions were added to
VirtualFunctionsvia signature binding:CBaseModelEntity::SetBodygroupCAttributeList::SetOrAddAttributeValueByNameCBasePlayerWeapon::ChangeSubclassExample usage:
These are wrapped in:
CBaseModelEntity.SetBodygroup(...)CAttributeList.SetAttribute(...)CBasePlayerWeapon.ChangeSubclass(...)AcceleratorCSS Compatibility
This PR keeps the system fully compatible with AcceleratorCSS — a native Metamod plugin for CSS that:
SIGSEGV, native callstacks, and callback profilesIt now fully relies on the lightweight external trace mechanism, without duplicating effort inside CounterStrikeSharp itself.
Future versions of AcceleratorCSS will expand with:
Implementation
StackTrace(2, true))SetBodygroupSetOrAddAttributeValueByNameChangeSubclassCBaseModelEntity.csCAttributeList.csCBasePlayerWeapon.csNotes
Let me know if you prefer config gating or capability restriction. Otherwise, this is stable, validated, and good to merge.