mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
win-capture: Retry with last known window if first fails
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.
This commit is contained in:
parent
9b186a47e3
commit
b3ca1bd059
@ -1265,10 +1265,12 @@ static inline enum capture_result init_capture_data(struct game_capture *gc)
|
||||
|
||||
DWORD error = 0;
|
||||
if (!init_data_map(gc, gc->window)) {
|
||||
HWND retry_hwnd = (HWND)(uintptr_t)gc->global_hook_info->window;
|
||||
error = GetLastError();
|
||||
|
||||
/* if there's an error, try with 0 (for UWP programs) */
|
||||
if (init_data_map(gc, NULL)) {
|
||||
/* if there's an error, just override. some windows don't play
|
||||
* nice. */
|
||||
if (init_data_map(gc, retry_hwnd)) {
|
||||
error = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user