Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetDispatch hook #980

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tmp64
Copy link

@tmp64 tmp64 commented Aug 19, 2023

This PR adds a hook for GetDispatch function. It is used by WeaponMod.

It additionally bumps the API version to 3.14159265. #951 also bumped the version in rehlds/version/version.h but I didn't. Let me know and I'll fix the commit.

@StevenKal
Copy link
Contributor

Despite having "GetDispatch" hook could be better (since this is the "inside" function), was not the already existing hook "GetEntityInit" not enough for WeaponMod?

@tmp64
Copy link
Author

tmp64 commented Aug 24, 2023

You're right. I could just hook GetEntityInit since it simply calls GetDispatch. I'll check and report back later

ENTITYINIT GetEntityInit_internal(char *pClassName)
{
	return (ENTITYINIT)GetDispatch(pClassName);
}

ENTITYINIT EXT_FUNC GetEntityInit_api(char *pClassName)
{
	return g_RehldsHookchains.m_GetEntityInit.callChain(GetEntityInit_internal, pClassName);
}

ENTITYINIT GetEntityInit(char *pClassName)
{
	return GetEntityInit_api(pClassName);
}

@tmp64
Copy link
Author

tmp64 commented Aug 24, 2023

Yep, GetEntityInit hook works just fine. GetDispatch seems to be used as a generic dlsym in the engine. I guess this PR could be left as is in case someone wants to hook GameDLL functions without a hooking library.

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.

None yet

2 participants