This fixes a bug where games like "Don't Starve Together" wouldn't
capture because their actual render window is a completely different
window than their actual window on the screen.
So, because we already have the hook info by this point with the last
known window handle available, instead of using 0 here, we can just use
the window handle provided by the shared memory. And we didn't even
have to change the hook! That's nice.
Make sure HWND tracking is cleaned up when Vulkan surfaces are
destroyed. Also use unbounded linked list to fix games that leak
surfaces on Alt+Tab like Doom.
Also replace CRITICAL_SECTION with SRWLOCK, both for claimed speed
benefit, and to remove initialization code.
Certain UWP programs can't obtain a normal window handle from their API
for whatever reason (this was observed with minecraft win10 edition), so
if the normal window handle on the map fails, try window handle 0
instead.
Sometimes the width/height would initially be at 0x0 when the swap chain
was alt-tabbing, causing the capture to fail full-stop when trying to
reacquire.
Starting with Windows 10 2004, we can disable WGC cursor capture, and
provide a user toggle. We swap out WGC support for our own though
because ours does not break hardware cursor support.
Game capture assumes the top-level ancestor HWND, not a child HWND.
This fixes bugs such as the VLC window not capturing anymore due to the
fact that the capture HWND of VLC is a child window of the main VLC
window and not the main VLC window itself.
In window capture, it will search for a window with a specific title,
but will not search minimized windows. This fixes that by making is
acquire the correct window even if that window is minimized, rather than
potentially risk it capturing the wrong window of the same type.
Checks the hook version to ensure compatibility with hook DLL. It's
unlikely it'll ever be necessary to increment the hook version, but this
is just a precautionary thing that allows a hook DLL to make sure it's
rejected by an older OBS version if needed. Again however, very
unlikely that the major version will ever be incremented.
The inject helper should be able to specify the full path rather than
assume the path of the hook DLL. This change allows us to modify the
hook's location. This needs to be done because the hook needs to be
relocated to ProgramData to prevent the possibility of multiple Vulkan
capture hooks.
Prevents multiple separate hook DLLs from being loaded in to a target at
once. This is done just in the off-chance that someone might add
another hook to the Vulkan layer registry.
Allows automatically outputting the function name as part of the hook
logging. This really doesn't need to be a manual process. Makes code a
bit cleaner when used.