win-capture: Fix hook collisions with multiple game captures

Before this change, after a game capture source would send a signal to
init or restart a graphics hook, it would respond to any and all hook
ready signals.

With multiple game capture sources in the same scene, a source could
receive the signal intended for another source, and show the wrong
texture.

This change adds the window handle to the name for shared data with the
hook, resulting in hooks for other sources being ignored.
This commit is contained in:
VodBox
2020-02-18 21:20:48 +13:00
parent fd244a6896
commit d2e115881d
2 changed files with 12 additions and 6 deletions

View File

@@ -1251,8 +1251,13 @@ static inline enum capture_result init_capture_data(struct game_capture *gc)
CloseHandle(gc->hook_data_map);
gc->hook_data_map = open_map_plus_id(gc, SHMEM_TEXTURE,
gc->global_hook_info->map_id);
wchar_t name[64];
_snwprintf(name, 64, L"%s_%d_", SHMEM_TEXTURE,
(uint32_t)(uintptr_t)gc->window);
gc->hook_data_map =
open_map_plus_id(gc, name, gc->global_hook_info->map_id);
if (!gc->hook_data_map) {
DWORD error = GetLastError();
if (error == 2) {