Commit Graph

102 Commits (707047a31e22d335a3c007ec9ae18699f2695408)

Author SHA1 Message Date
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
jp9000 e7790ab52c win-capture: Wait before auto-fullscreen hooking
If using the auto-fullscreen feature to hook in to a fullscreen, I found
that if you don't wait a few seconds before initializing the hook that
you can catch the process when it's just starting up and loading
important libraries (especially things such as steam/uplay/etc), which
can cause a little bit of interference with the process and on rare
occasions cause it to crash.

To help prevent the likelihood of that happening, this just makes it so
that the hook waits at least 3 seconds before even attempting to inject
the hook when using auto-fullscreen mode.  After some extensive testing
I haven't had any issues since.
2015-01-05 03:01:19 -08:00
jp9000 69223e3645 win-capture: Retry hooks on most failures
The design to not retry the hooks on most general error is just bad.
There are plenty of legitimate cases where it should retry the hook.

This changes it so that if a general failure occurs or if it isn't
capturing when the inject helper exits, it retries and increases the
length of time between retries.
2015-01-05 03:01:12 -08:00
jp9000 6a0677a407 win-capture: Rename variables for consistency
Variables that track time should not have the name 'interval', they
should have the name 'time' instead so it's crystal clear that the
variable is tracking time.
2015-01-05 02:53:29 -08:00
jp9000 edf9d9f41f win-capture: Add 'retry_interval' variable
Adds a variable 'retry_interval' to game capture that allows the
interval at which game capture checks to update to longer intervals if
the hook initialization has some sort of failure.

The reason why I want to do this is because I don't really like it when
the hook updates too often in failure, it just leads to log file spam
that I feel can be reduced, and it frequent updates feel a bit invasive.
I just generally feel more comfortable reducing the interval at which
the hook retries after failure.
2015-01-05 02:52:57 -08:00
jp9000 272f709d1d win-hook: Fix variable name typo
Was 'error_aqcuiring', now 'error_acquiring'
2015-01-05 02:45:42 -08:00
jp9000 14bcb3ad18 win-capture: Change inject-hook intervals
This makes a minor adjustment to the interval at which the inject helper
tries to post the inject message to the target process.  Only 2 seconds
before, now up to 4 seconds, with the PostThreadMessage called every
half second for the duration.

The reason I did this is because I noticed that on rare occasions that
it wouldn't hook due to the low interval; usually just because the
target process is busy and isn't able to process its message queue, and
therefor the hook wouldn't go through due to the fact that
SetWindowsHookEx won't inject until the set event has occurred.  The
inject helper program would just close before the thread message had
finally been processed, which would cancel the SetWindowsHookEx hooking.
2015-01-05 02:45:41 -08:00
jp9000 12011d4380 win-capture: Increase game capture update interval
Instead of checking every 3 seconds whether to hook, check every 2
seconds.  3 seconds felt a bit long to me.
2015-01-05 02:45:37 -08:00
jp9000 e6752f6b41 win-capture: Fix potentially overwritten values
The code neglected to take in to account that start_capture can also be
called when the texture updates its size/format in the hook and 'ready'
is signaled again, so it's possible that existing variables in the game
capture structure could be overwritten with new ones unintentionally.
2015-01-05 02:45:37 -08:00