Skip to content

fix: Ensure compatibility with CS2Fixes#1163

Merged
roflmuffin merged 2 commits intoroflmuffin:mainfrom
ELDment:fix-crash
Dec 28, 2025
Merged

fix: Ensure compatibility with CS2Fixes#1163
roflmuffin merged 2 commits intoroflmuffin:mainfrom
ELDment:fix-crash

Conversation

@ELDment
Copy link
Copy Markdown
Contributor

@ELDment ELDment commented Dec 27, 2025

#1151
#1151 (comment)

this pr fixes the crash on windows at least, linux is untested

00145a87-3fdc-48c4-b2ed-28aa66fdaddd

Root cause:

CS# hooks CBaseEntity_TakeDamageOld at startup, but CS2Fixes needs to hook it too, since CS# loads before CS2Fixes, once CS# hooks the function, CS2Fixes can no longer find the original signature in memory (leading to errors)

Fix:

we now only cache the memory address of CBaseEntity_TakeDamageOld during CS# startup, then defer the actual hook until all Metamod plugins have finished loading

@ELDment ELDment requested a review from roflmuffin as a code owner December 27, 2025 04:01
@roflmuffin
Copy link
Copy Markdown
Owner

This looks good to me. Could we remove the commented out code from the old file and then I'll merge?

@ELDment
Copy link
Copy Markdown
Contributor Author

ELDment commented Dec 27, 2025

This looks good to me. Could we remove the commented out code from the old file and then I'll merge?

updated

@ELDment
Copy link
Copy Markdown
Contributor Author

ELDment commented Dec 27, 2025

Side note:

possibly related to #1148 as well, not sure

@roflmuffin roflmuffin merged commit 9a8d45c into roflmuffin:main Dec 28, 2025
7 checks passed
mrc4tt pushed a commit to mrc4tt/CounterStrikeSharp that referenced this pull request Dec 31, 2025
@ELDment ELDment deleted the fix-crash branch January 1, 2026 02:20
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.

2 participants