Commit Graph

252 Commits (ffdecc34f4148d6ef1dce937776c4fe899494778)

Author SHA1 Message Date
Ryan Foster 1db301f907 win-capture: Log window capture's target
Closes jp9000/obs-studio#983
2017-11-26 18:00:51 -08:00
Bazhenoff b9d044267d graphics-hook: blacklist OpenGL capture for "cm_client.exe"
Closes jp9000/obs-studio#1076
2017-11-16 17:57:11 -08:00
jp9000 e5d660e944 graphics-hook: Blacklist specific game from GL capture
"Life is Feudal: Your Own" will use Direct3D to render the game, then
OpenGL to render its in-game menus, which causes a conflict with itself.
This specifically blacklists the game from capturing OpenGL to prevent
that from happening.
2017-10-02 15:29:04 -07:00
jp9000 008e38f5b6 win-capture: Remove buffering from window capture
Removes the unnecessary buffering from window capture to prevent window
capture from being one frame out of sync
2017-10-02 07:36:02 -07:00
Gol-D-Ace 8d8c2e5a22 Update translations from Crowdin 2017-08-10 16:07:40 +02:00
Richard Stanway bc3a5cb832
win-capture: Log when game capture compatibilty mode is set 2017-07-01 21:39:20 +02:00
Richard Stanway 20cc8e6ab7
inject-helper: Set error mode to SEM_FAILCRITICALERRORS
This prevents spurious dialog boxes appearing, such as "No disk is in the
drive" if the application attempts to access an invalid drive.
2017-06-21 17:42:05 +02:00
Richard Stanway 8ad8e18d04
get-graphics-offsets: Set error mode to SEM_FAILCRITICALERRORS
This prevents spurious dialog boxes appearing, such as "No disk is in the
drive" if the application attempts to access an invalid drive.
2017-06-21 17:41:26 +02:00
jp9000 603825ee39 win-capture: Use PROCESS_QUERY_INFORMATION for game capture
PROCESS_QUERY_LIMITED_INFORMATION might be a bit insufficient for what
we need to do.
2017-06-19 16:02:02 -07:00
jp9000 1ca9f8872e win-capture: Add IDXGISwapChain1::Present1 hook support
Allows capturing games/programs that may be using Present1 instead of
the regular Present call for rendering.
2017-06-19 15:45:00 -07:00
jp9000 c4036b18bb win-capture/graphics-hook: Fix D3D10/D3D11 detection
When hooking DXGI-based graphics programs in the hook, the first hook
point is IDXGISwapChain::Present.  To be able to initiate a capture, a
pointer to the device context that created the swap chain is required,
which can be retrieved via IDXGISwapChain::GetDevice.  Determining
whether the device context was D3D10 or D3D11 has always been somewhat
of an issue due to D3D10 and D3D11 being nearly identical, as well as
their interoperability/interchangeability.  The GetDevice function would
first be called with the UUID of ID3D10Device, then if that failed,
the UUID of ID3D11Device.

However, with certain specific D3D11 games, GetDevice would for some
unknown reason succeed with the UUID of ID3D10Device, which would cause
capture to fail.  (Conversely, attempting to call GetDevice with the
UUID of ID3D11Device on a device that's actually ID3D10Device would
always succeed, so reversing the order of the test was not an option).
There were originally three known D3D11 games that would erroneously
succeed when querying a D3D10 device interface:  Call of Duty: Ghosts,
Just Cause 3, and theHunter: Call of the Wild.  All other known D3D11
games would work correctly.  Because it was only these three games, a
hack was originally implemented in the form of an executable exception
list that would force them to capture D3D11.

Unfortunately, Oculus games are now failing under the same circumstance
as well, so a simple hack will no longer work.  To fix this, a more
reliable method of detecting which context it is had to be discovered:
simply check the feature level using ID3D11Device::GetFeatureLevel.  If
the feature level is D3D_FEATURE_LEVEL_11_0 or D3D_FEATURE_LEVEL_11_1,
the device is definitely a D3D11 device.  Otherwise, continue the tests
as they were before.  Successfully tested with many D3D10 games, many
D3D11 games, and especially those three D3D11 games that previously were
detected as D3D10 erroneously.
2017-06-15 03:48:43 -07:00
jp9000 0acf86ba04 win-capture: Limit OpenProcess flags to prevent A/C issues
Limits OpenProcess flags to only the flags that are necessary to prevent
any further issues with anti-cheat hooks in the future.
2017-05-29 19:30:10 -07:00
Gol-D-Ace 3d2cacd782 Update translations from Crowdin 2017-05-20 10:18:41 +02:00
Richard Stanway 0c167d27a6
win-capture: Hide cursor when in background (window capture) 2017-05-11 00:01:33 +02:00
Richard Stanway 9e95b2eb6f
Various: Don't use boolean bitfields
Using bitfields causes less optimized code generation and the memory
savings are minimal as none of the objects are instantiated enough
times to be worth it.

See https://blogs.msdn.microsoft.com/oldnewthing/20081126-00/?p=20073
2017-05-10 23:28:46 +02:00
Richard Stanway 62c40eac0c
win-capture: Hide cursor when in background (game capture)
Prevents random OS cursors showing if someone alt+tabs out of a game but
still moves their cursor over the captured area (possibly fullscreen).
2017-05-10 23:08:25 +02:00
Richard Stanway 2ae706782c
Merge branch 'new-get-graphics-offsets'
Added offsets to support Windows 10 Creator's Update
2017-05-01 16:15:16 +02:00
jp9000 2e0d237341 win-capture: Fix and clarify window capture prioritization
Changes "class" prioritization to attempt to find the window either with
the same title, or the next window of the same window class (window
type), changes "title" prioritization to only find the window based
upon its title, and changes "executable" prioritization to attempt to
find the window with the same title, or the next window of the same
executable.

Additionally changes the text associated with these selections to
clarify that functionality to users.
2017-04-30 00:25:02 -07:00
Richard Stanway 38294d6c47
win-capture: Add missing 32 bit offsets 2017-04-26 21:36:49 +02:00
Richard Stanway 35a9b2d27f
win-capture: Update get-graphics-offsets
Added support for multiple signature matching and variable offset
positions. Added support for Win7 64 bit signature for consistency.
2017-04-26 21:23:34 +02:00
Richard Stanway d4de8b9a7e win-capture: Log if shared texture capture is unavailable 2017-04-26 21:04:41 +02:00
Ryan Foster be98cee2a0 Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
Gol-D-Ace dbf95bdc15 Update translations from Crowdin 2017-03-05 23:40:11 +01:00
Gol-D-Ace a13c0a3c29 Update translations from Crowdin 2017-02-27 20:54:02 +01:00
Richard Stanway d2e9e47bb4 graphics-hook: Account for sizeof(wchar_t) in len 2017-02-25 17:18:55 +01:00
Cam 8a6491c9bf win-capture: Add hook exception for theHunter: COTW
Adds an exception to skip d3d10 checks for theHunter: Call of the Wild,
which fixes incompatibility with game capture.

Closes jp9000/obs-studio#801
2017-02-25 06:42:36 -08:00
jp9000 5b8a0a2777 win-capture: Blacklist chrome/firefox from game capture 2017-02-21 23:05:49 -08:00
jp9000 eb90b7dfff win-capture: Fall back to GetWindow if FindWindowEx fails
When kaspersky is installed on windows 7, FindWindowEx will fail to find
any windows due to apparently being blocked by kaspersky, so detect when
that happens, and fall back to GetWindow instead if it does.
2017-02-21 00:42:14 -08:00
jp9000 839e593e77 Revert "Revert "win-capture: Use FindWindowEx to traverse window list""
This reverts commit f4d7f0cbba.

Never thought a revert of a revert would happen.
2017-01-18 20:18:28 -08:00
jp9000 c30d4f5075 win-capture: Fix game capture size bug when rehooking
When rehooking, even if scaling is off, it'll unintentionally overwrite
the game's backbuffer texture size with the scale size.
2017-01-16 04:19:16 -08:00
jp9000 f4d7f0cbba Revert "win-capture: Use FindWindowEx to traverse window list"
This reverts commit bd67c18c02.

Causes performance issues when the window isn't found.  The situation it
fixes is also very rare anyway.
2017-01-16 03:22:12 -08:00
jp9000 21d70fa207 win-capture: Don't use FindWindow for game capture keepalive
Using and creating a window can use issues in game capture if multiple
game captures are active, so revert back to using a mutex, and just
ignore the keepalive check failure if injected inside a UWP program
(only check to see if GetLastError reports that it's not found -- if it
returns access denied or any other error, assume it's in a UWP program,
and ignore the keepalive check).
2017-01-15 09:15:45 -08:00
Gol-D-Ace 6223ed6520 Update translations from Crowdin 2017-01-07 00:23:16 +01:00
Gol-D-Ace 69f0bc244a Update translations from Crowdin 2016-12-23 20:46:47 +01:00
jp9000 21be33805d win-capture: Release backbuffers immediately upon init
There's no need to keep a reference to the backbuffers.  That and the
backbuffer references weren't being released anyway, so that fixes that
bug.
2016-12-23 08:07:26 -08:00
jp9000 74a5bdf993 win-capture: If backbuffer count is 1, disable dxgi 1.4 use
Executing the dxgi 1.4 code causes it to cycle through backbuffers,
backbuffers which may not exist if in discard mode.
2016-12-23 08:02:35 -08:00
jp9000 414ff5ba14 win-capture: Refactor DX12 backbuffer code
It was undesirable to pass arrays via function parameters, so a
structure should be used instead.

Also increases total allowable backbuffers to 8.
2016-12-23 08:02:30 -08:00
jp9000 a4143be052 win-capture: Fix possible access of array beyond size
If the backbuffer count is larger than 3, it could still try to assign
backbuffers to pointers beyond the variable's array size when calling
swap->GetBuffer.
2016-12-23 07:49:13 -08:00
jp9000 2da7f3cb0e win-capture: Add a few new blacklisted game capture exes 2016-12-23 02:17:14 -08:00
jp9000 ad72194090 win-capture: Do not add certain windows to window lists
Due to using FindWindowEx to search for certain windows, certain windows
will show up that aren't usable/capturable.  Prevent these windows from
showing up in the window lists.
2016-12-23 02:15:59 -08:00
jp9000 4fe2ca0f75 win-capture: Fix possible null pointer dereference 2016-12-23 02:04:26 -08:00
jp9000 bd67c18c02 win-capture: Use FindWindowEx to traverse window list
For some unknown reason, GetWindow will not traverse the entire window
tree.  It could be due to Microsoft purposely hiding certain UWP
windows, though the reason is unknown.  For some equally unknown reason
FindWindowEx does work in its place.

This fixes the issue of not being able to find/capture certain windows,
such as halo 5: forge.
2016-12-23 01:53:44 -08:00
jp9000 3b5a30ce97 win-capture: Capture all D3D12 backbuffers
D3D12 capture does not take in to account when multiple backbuffers are
in used.  With previous versions of Direct3D there was no need to do
this, but with D3D12 you must explicitly capture each specific
backbuffer currently in use.
2016-12-23 01:53:15 -08:00
jp9000 68a8a5bf2b win-capture: Do not fall back to other windows for UWP windows
If capturing a UWP window, do not fall back to matching windows with the
same window class if the exact window is not found, as this will get any
other UWP window on the system (due to the fact that they all have the
same window class name).
2016-12-16 14:06:05 -08:00
jp9000 4f4aea4562 win-capture: Add debug messages when hooking
These are helpful for debugging UWP capture issues.
2016-12-16 14:06:04 -08:00
jp9000 61773bcbf2 win-capture: Fix cursor not painting with UWP windows
Because the hook cannot get the window handle of UWP windows, fall back
to using the window handle stored in the game capture source itself if
it's unavailable from the hook.
2016-12-16 14:06:03 -08:00
jp9000 b3119e0a8d win-capture: Don't hard fail if thread ID not found
Under certain circumstances, the program may not be able to acquire the
window thread ID for a UWP process, but will be able to acquire the
process ID.  In this case, it should soft fail and retry, rather than
assume it's unacquirable and stop trying to reacquire.
2016-12-16 14:06:02 -08:00
jp9000 a5337605cd win-capture: Add ApplicationFrameHost to game capture blacklist
The ApplicationFrameHost process is a sandbox process, and should not be
hooked.
2016-12-16 14:06:01 -08:00
jp9000 480d0e986f win-capture: Fix "attempting to hook [executable]" message
The "attempting to hook [executable]" message would not display the
correct executable if it's fallen back to a different window with the
same window class.
2016-12-16 14:06:00 -08:00
jp9000 209bcda1f4 win-capture: Wait a few frames for hook to load
Now that the game capture hook creates and controls all the
synchronization objects, it's no longer possible to expect that the hook
is fully loaded by the time game capture tries to initialize it.  In
that case, allow game capture to retry the hook for a few frames before
assuming something failed.
2016-12-16 14:05:59 -08:00