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

Added Windows Multimedia Module (winmm.dll) hook #216

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

retroluxfilm
Copy link
Contributor

Added Windows Multimedia Module (winmm.dll) hook to allow to launch reshade for games that are difficult to hook early to catch the rendering api. For example HL Alyx in VR etc. I choose to add this hook as the winmm.dll ist often the most early dll loaded by the game/application which helps to get the hook in the game at the right time. Had a few issues for VR titles and this helps to have universal hook. Still it might cause a bit more cpu cycles due to additional hooks that are actually only needed to load reshade and not to really to intercept the methods.

I imported all methods from the winmm.dll interface and partly generated the exports and the basic method cages. The rest was done by hand using the original interfaces. Not sure if that was required to automatically pass all dlls calls to the original dll or if there was an easier way on how to do it. Let me know if that is ok how it is implemented or if you would like to have it differently

@crosire
Copy link
Owner

crosire commented Jun 26, 2021

That's a bit too many exports for my taste. DirectInput was a nice addition, since it requires so little code, but I'm not convinced it's necessary to add more.
I'm pretty sure I remember having ReShade running in Half Life Alyx before, but will need to install again to check (usually with Source Engine games you have to put the ReShade DLL in the bin directory, since the engine does a SetDllDirectory to that location and therefore loads DLLs from there).

@retroluxfilm
Copy link
Contributor Author

Yes I was on the edge about this as well. Especially as this is not the core about what reshade does. So I can totally understand if you dont want that in.

On the other hand I only mangaged to get HL Alyx working by either renaming the reshade dll to kernel32.dll (out of luck and possible with side effects ) in the bin folder. Or an alternative was dropping the reshade elements into the SteamVR folder and naming it dxgi.dll but this also caused that SteamHome and possible other games got hooked as well. Not an ideal solution. By using the optional winmm hook it at least ensures to call all original methods and maintaining their functionality.

Adding a preprocessor to disable the exports could be an compromise?

# Conflicts:
#	ReShade.vcxproj
#	source/dll_main.cpp
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