Commit Graph

110 Commits (845a9d2f1a707aa43d8df19c0a342fc160ba6ba1)

Author SHA1 Message Date
jp9000 3ef3ce29e4 win-capture: Update d3d9 hooks for win10 preview 2015-07-08 12:50:27 -07:00
dodgepong fb679bdd02 Add latest translations from CrowdIn 2015-07-08 14:56:07 -04:00
jp9000 f4d0da4e04 win-capture: Add direct hooking and use by default
I've come to realize that it's probably not wise to deviate from the
original version's functionality due to the fact that the original
version works without issues.  I'm wondering if some of the capture
problems have been due to the fact that the direct hook method (via
CreateRemoteThread) was removed, so I put it back in, made it default,
and added an option to use anti-cheat compatibility just like in the
original version.
2015-07-05 15:17:07 -07:00
jp9000 b0570c46c3 win-capture: Add inject library files
This is intended to separate the library injection code so that both the
inject helper process and the plugin itself can inject directly if they
wish.
2015-07-05 15:17:06 -07:00
jp9000 a6aa2f9204 win-capture: Add 64bit bounce to func_hook
When hooking 64bit functions, sometimes the offset between the function
being hooked and the hook itself can be large enough to where it
requires a 64bit offset to be used.  However, because a 64bit jump
requires overwriting so many code instructions in the function, it can
sometimes overwrite code in to an adjacent function, thereby causing a
crash.

The 64bit hook bounce (created by R1CH) is designed to prevent using
very long jumps in the target by creating executable memory within a
32bit offset of that target, and then writing it with the 64bit long
jump instruction instead.  Then in the target function, it will jump to
that memory instead, thus forcing the actual hooked function to use a
32bit hook instead of a 64bit hook, and using at most 5 bytes for the
actual hook, preventing any likelihood of it overwriting an adjacent
function.
2015-07-03 12:17:25 -07:00
Bl00drav3n ba4ac47ee3 win-capture: Modify 16bit to 32bit color conversion to use SSE 2015-06-04 22:23:50 +02:00
dodgepong d0fbe3b382 Add latest translations from CrowdIn 2015-05-08 17:10:39 -04:00
jp9000 5d75d88ccd win-capture: Fix compatibility bug for window cap.
The compatibility mode setting wasn't being set when an update occurred.
2015-05-01 02:07:19 -07:00
dodgepong a04548070c UI: Add latest translations from CrowdIn 2015-03-25 20:51:25 -04:00
jp9000 96353332f3 win-capture: Fix game capture acquiring issue
If capture starts too quickly, the file mapping will return 2, which
means file not found, and it would then reset the capture and try again.
Sometimes this would result in long intervals where it wouldn't capture.
This fixes the issue by simply making game capture retry if file mapping
returns error number 2.
2015-03-25 14:14:43 -07:00
jp9000 2d5c6dfae9 win-capture: Rename 'Monitor' to 'Display' capture
The name 'Monitor' is a bit inconsistent with what it's called by the
operating system.
2015-03-22 19:18:18 -07:00
jp9000 e20ec366b2 Make capture sources w/o alpha use opaque effect
This fixes an issue primarily with filter rendering: when capturing
windows and displays, their alpha channel is almost always 0, causing
the image to be completely invisible unintentionally.  The original fix
for this for many sources was just to turn off the blending, which would
be fine if you're not rendering any filters, but filters will render to
render targets first, and that lack of alpha will end up carrying over
in to the final image.

This doesn't apply to any mac captures because mac actually seems to set
the alpha channel to 1.
2015-03-22 19:18:05 -07:00
jp9000 104415d5c3 win-capture: Fix hook bug that could cause crashes
I had this issue where IDXGISwapChain::ResizeBuffers would fail in the
hooks, causing games to crash when they resized their backbuffers
because ResizeBuffers would return an 'invalid call' HRESULT value.  In
the ResizeBuffers documentation it says that it will only happen if a
backbuffer currently has any outstanding references, but there's no way
this would happen unless ResizeBuffers internally calls Present or vise
versa.

After ResizeBuffers has been called, the very first call to Present will
somehow seemingly invalidate and/or destroy the current backbuffer.
It's very strange, but that seems to be what's going on, at least for
the game I was testing.  So if you are performing a post-overlay
capture, then you must ignore the capture on the very first call to
Present.

It's Microsoft's code so you can't really know what's going on, you just
have to work around these strange issues seemingly in the dark.
2015-02-14 09:12:24 -08:00
jp9000 8b59b606c5 win-capture: Use right call type for hook funcs
Although STDMETHODCALLTYPE is technically WINAPI (__stdcall), it's best
not to make any assumptions.
2015-02-14 07:48:36 -08:00
jp9000 ae931b32cf win-capture: Fix debug function strings
These had an older name of what the function used to be named
2015-02-14 07:48:35 -08:00
Bl00drav3n 1f9f50c800 Fixed a bug in color conversion code for 16bit textures. 2015-02-14 01:08:38 +01:00
dodgepong 2b01030607 Add latest translations from crowdin 2015-02-11 19:15:08 -05:00
dodgepong eb918d01b4 Add latest translations from CrowdIn 2015-02-09 19:26:17 -05:00
Bl00drav3n 74042fff96 win-capture: Implement D3D8 game capture support 2015-02-09 05:02:48 -08:00
jp9000 731930af50 win-capture: Fix parameter type warning
Parameter expects uint8_t*, was using char*, so just cast to fix it.
2015-02-09 03:56:06 -08:00
jp9000 883d93e84c win-dshow: Remove unnecessarily inline define
This is already defined when including libobs headers
2015-02-09 03:55:31 -08:00
jp9000 372a23de68 win-capture: Use inline define with VC only
mingw already supports the regular inline keyword in C; VC does not.
2015-02-09 03:55:17 -08:00
jp9000 12a000cae5 win-capture: Refactor inline functions
Apparently someone dumb (aka me) neglected to properly handle the inline
graphics hook API functions.  You're not supposed to 'extern' inline
functions, they need to be defined for each file when ever they're used.
2015-02-09 03:51:08 -08:00
jp9000 91b33908d9 win-capture: Remove unused static variables 2015-02-09 03:50:50 -08:00
jp9000 fce3cf6bdb win-capture: static keyword comes before const 2015-02-09 03:49:48 -08:00
jp9000 f8c7df2616 win-capture: Fix bug initializing via d3d9 swap
Apparently neglected to use the reference operator.  I think this may
partially be one of the reasons why many developers still choose to use
pointers instead of references, but fortunately an actual GOOD compiler
warns about this (aka anything but vc)
2015-02-09 03:49:47 -08:00
jp9000 fbf881ecdd win-capture: Fix enum switch warnings
The enum switch warning is used to signify when you are missing
enum values.
2015-02-09 03:49:46 -08:00
jp9000 253989bd72 win-capture: Mark unused parameters 2015-02-09 03:49:45 -08:00
jp9000 04c54162b2 win-capture: Fix ptr -> int cast warnings (mingw) 2015-02-09 03:49:44 -08:00
jp9000 2301a6f578 win-capture: Clarify if statement via inline func
Clears up a warning (to prevent && and || confusion), and clarifies what
specifically the if statement is trying to accomplish (check to see if
the capture is valid)
2015-02-09 03:49:43 -08:00
jp9000 e2ee8adf77 win-capture: Fix potentially uninitialized vars 2015-02-09 03:49:20 -08:00
jp9000 aa3bdd9845 win-capture: Fix incorrect parameter type warning
Was using const char** when the parameter expects const uint8_t**
2015-02-09 03:49:19 -08:00
jp9000 6b38fa35b0 Use _MSC_VER for MSVC-specific pragmas
These aren't used on mingw so they need to be surrounded by #ifdef
_MSC_VER
2015-02-09 03:49:18 -08:00
jp9000 5dfecab15c Fix windows printf format warnings (from mingw) 2015-02-09 03:49:14 -08:00
jp9000 0c1d121ff2 Remove various unused variables
Unused variables detected by mingw
2015-02-09 03:49:13 -08:00
martell a83e74dc1c Disable SEH for mingw-w64
The SEH implementation is not quite working properly in mingw-w64, so
disable it for the time being.
2015-02-09 03:47:27 -08:00
martell 97cc9b610a win-capture: on mingw-w64 support try and catch 2015-02-09 03:41:56 -08:00
martell c5478f52d9 win-capture: explicitly cast function pointers
This solves invalid conversions when building with gcc
2015-02-09 03:41:55 -08:00
martell 1e056fd7ec win-capture: deal with a 32bit handle cast errors
The HWND type is a void pointer, but HWND values are global and always
32bit despite, so casting to 32bit can cause cast warnings on actual
good compilers like gcc via mingw.  This change correctly handles the
casting to 32bits without producing unwanted warnings or errors on
mingw.
2015-02-09 03:41:54 -08:00
martell c5fa22ae93 win-capture: avoid multiple definitions of data
At link time unless they are defined static they will conflict
2015-02-09 03:41:54 -08:00
martell 45cec546bd win-capture: fix link libs for mingw-w64
win-capture should not postfix .lib to psapi.

The graphics hook also requires psapi when linking.

Also change some link libs as mingw-w64 libraries are not postfixed
.lib.
2015-02-09 03:41:53 -08:00
jp9000 28278682a3 win-capture: Add option to show/hide game cursor 2015-02-07 03:06:16 -08:00
jp9000 428a7def16 win-capture: Use PSAPI GetProcessImageFileName
If the PSAPI_VERSION macro is not set to 1 when using
GetProcessImageFileName, it will attempt to import it as
K32GetProcessImageFileName from kernel32.dll instead of psapi.dll, which
breaks compatibility with vista and xp.
2015-01-07 05:26:32 -08:00
jp9000 733398e660 win-capture: Remove Activate/Reactivate text
The Activate button is longer in use, so this text isn't used anymore.
I neglected to remove the text when removing the Activate button.
2015-01-06 02:18:11 -08:00
jp9000 67ed290148 win-capture: Clarify inject helper intervals 2015-01-06 01:55:17 -08:00
jp9000 2e6010b36d win-capture: Use macros for intervals
Having macros that state what these numbers mean is much more ideal than
just having a random number thrown in there, wondering why it was used
and what its purpose is (magic numbers).
2015-01-06 01:41:13 -08:00
jp9000 4f2c48a937 win-capture: Remove game capture 'Activate' button
The activate button is just silly for configuration in retrospect.  It's
confusing to users, and was even confusing to some other developers.
Instead of using an 'Activate' button for game capture every time you
want to capture a window, just make the 'window' list have a default 'no
window' value (empty), and then have it always active when an actual
window is selected.  The way syphon handles this on mac is actually
where I took the idea from (as suggested by Palana).
2015-01-06 01:30:55 -08:00
jp9000 cca34bfb4e win-capture: Fix bug with GDI monitor capture
With the new code that checks to see if the source is visible, I didn't
realize that I actually didn't set the source variable, so it would end
up never actually drawing.
2015-01-05 14:15:34 -08:00
jp9000 0f09834c68 win-capture: Change error message for file mapping
If shared memory file mapping fails, I've found that it's somewhat
normal due to something in windows -- usually the capture will always
eventually start up after a few tries.  Only seems to apply to some
games though, for example seems to happen with counterstrike a lot for
some strange reason.  Capture always eventually starts back up though.
I remember seeing this with OBS1 as well in many cases but always
thought it was some sort of fluke
2015-01-05 03:01:20 -08:00
jp9000 c1289b893e win-capture: Log more hooking errors
Adds a few previously-missing log messages that specify the actual
reason why there was an error acquiring the hook, rather than just
saying nothing.
2015-01-05 03:01:20 -08:00