Commit Graph

19 Commits

Author SHA1 Message Date
Mikkel Krautz
93ad74b467 Add MinHook-based overlay for Windows x64.
This commit adds MinHook as a 3rd party
dependency and adds an alternative HardHook
implementation that makes use of MinHook.

This new MinHook-based HardHook implementation
allows us to provide an overlay for Mumble on
Windows x64.

The x64 overlay hasn't seen much testing in
real-world x64 games, except some minor testing
for World of Warcraft running in x64 mode, where
it works just fine.

There seems to be a compatibility with the Uplay
overlay, which causes Far Cry 4 to crash at the
"Press any key to continue" screen that is shown
just after launching the game. However,
Assassin's Creed: Unity works fine, so it might
just be a Far Cry 4 issue.

The x64 overlay also seems to interoperate with
the Steam overlay just fine.

I think this is a good starting point for the
feature. Let us get it into snapshots and let
us try to squash any addition bugs we find.
2015-01-03 19:44:02 +01:00
Kissaki
dfbc1b9279 Overlay: Changes as per PR-comments
* Make cpp-local functions static so they are local file/translation unit
scope.
* Remove unused variables uiAudioCount and bVideoHooked
* Comment extern declarations, where there definitions are located.
* Improve constant naming JUMPOP_OFFSET => JMP_OP_SIZE.
* Remove extern declaration from method definitions.
* Adjust type declaration formatting to typical formatting.
* Use voidFunc typedef to pass around function address pointers.
** C++-style casts instead of C-style raw casts.
* Other minor formatting (/whitespace) adjustments
* Fix log text.
* Improve log text.
* Consistent, improved varnaming in d3d9.cpp on address calculation;
naming fn and base.
2013-11-24 19:20:24 +01:00
Kissaki
250835e83b Overlay: Rework Code.
* Separate DXGI logic from D3D10 into a separate file dxgi.cpp
* Structure code and logic, introduce additional functions
* Introduce constants
* Code commenting
* d3d9.cpp:
** Access devMap via std::find rather than operator[]
** Introduce class Stash to temporarily set variable value and revert on
destruction
** Move logic to function findOriginalDevice
** Use widestring for modulename (consistency)
** Implement Hook for Direct3DCreate9Ex
** Move function IsFnInModule to common lib.cpp/.h
* opengl.cpp:
** Add whitespace to format code
** Fix logging scope prefix
** Remove static global variable
2013-11-22 19:27:52 +01:00
Kissaki
11d5305f69 Code refacs; fix typo and adjust texts
* fix typo
* debug text adjustments
2013-06-11 23:03:23 +02:00
Kissaki
cab4a3d852 Extend Windows Overlay code and clean it up.
Extend to handle library freeing.
Codeformatting and -cleanup, robustness, and make debugoutput more consistent.

* Indroduce hook for freeing loaded DLLs.
This separates logic between loading and freeing, leading to adjustments to
the recently introduced checks for freed DLLs.
* In HardHook::reset() do a clean and complete reset rather than minimal.
* Memvarinitialisation in HardHook
* Remove logically unused variable bPresenting in d3d9.cpp (always false)
* In d3d10.cpp prefix debugoutput with D3D10 consistently; no more DXGI
which is ambiguous with a d3d11 file that also uses DXGI.
* Consistently use ods instead of fods in the overlay files.
Not in HardHook yet, as that class is used in the Mumble client as well atm
* Fix forwarded return value types (LONG to ULONG)
* TODOs for hook-call-logic in multiple places
* Commenting, formatting and scope / order adjustments
* Introduce variables with constant values (replacing magic/undescriptive constants/numbers)
2013-06-11 23:02:14 +02:00
Kissaki
85fa2ce57a Code formatting, smaller refacs, robustness.
* Performance: Prefix increment in loops.
* Check VirtualAlloc return
* Check for successful memory allocation in cloneCode
* Swap assignment of pCode and uiCode
(if alloc were to fail and not assign, uiCode shouldn't be nulled either)
* declare statics before non-static members
* Introduce variables replacing magic constants
* Reduce varscopes
2013-06-04 22:37:38 +02:00
Kissaki
33069f82de comments. more elaborative debugoutput, consistent prefixing. 2013-06-04 22:37:37 +02:00
Wesley W. Terpstra
10b2d00043 Prevent overlay from disappearing on D3D DLL reloading.
This is confirmed to fix the missing overlay in Guild Wars 2.

When D3D was used by a process thus loading the DLL, but then unloaded we did not inject on subsequent loading of the D3D DLL (in the same exe). Guild Wars 2 did un- and reload the DLL when switching from their launcher to the game.
This commit introduces HardHook::reset() and checks for inactive hardhooks for a newly loaded DLL.

The changes were submitted on sourceforge
https://sourceforge.net/p/mumble/bugs/909/#bf9e
2013-06-04 22:37:36 +02:00
Mikkel Krautz
071be0f906 HardHook: add additional opcodes. 2012-11-11 13:35:32 +01:00
Kissaki
9bd10b0001 refacs; initialization, var-scope reduction, replace c-style casts, rm unused
* DBus.h, AudioOutputSpeech.cpp: initialize uninitialized members,
* d3d10.cpp: actually use assigned results for a dbg output
* lib.cpp, link.cpp: c-style to c++-style casts
* SpeexMark.cpp, ResampMark.cpp: rm unused var
* AGC.cpp, ResampMark.cpp:
rm unused var (ineffective return statement after prior return;
thus removing unused code - but someone check if sth. was missed there)
2012-10-24 19:24:33 +02:00
Stefan Hacker
3bcc83eb57 More comments for HardHook code 2012-07-06 21:14:20 +02:00
Kissaki
5fe6801b1b handle some cppcheck-found issues:
* uninitialized membervars,
* AudioOutput.cpp: fix delete on array to delete[]
* OSS.cpp: close file descriptor in false data case
* OverlayEditorScene.cpp: rm duplicate logic
* fix ifndef to match usage of declared variable
* member var initializations
* check for null (ds in d3d9 as some lines above),
* lower scope of var decl.,
* swap bufsize check and array dereference so check is before! deref,
* initialize member vars in constr.
2011-10-09 14:01:58 +02:00
Thorvald Natvig
f3437a6ba7 Update copyright year ranges of dev team. 2011-03-18 05:52:51 +01:00
Thorvald Natvig
84834d4d54 Indent, changelog, submodule and language update 2011-03-13 04:22:40 +01:00
Stefan Hacker
8c952c3bd2 Remove duplicate overlay debug output code.
Factor fods and its base function out to ods.h/cpp and use it in HardHook as well as lib functionality. This also fixes previous divergence between the two ods functions.
2011-03-06 20:39:35 +01:00
Stefan Hacker
b986e84b6c Fix possible access violation in Overlay
cloneCode function followed pointer chains without making sure to get read privileges to the corresponding areas. This patch fixes that and makes sure setup and cloneCode function do not rely on each other for getting read privileges .
2011-03-04 01:17:52 +01:00
Stefan Hacker
05096f71cc Add some comments to hooking code 2011-03-04 00:48:23 +01:00
Benjamin Jemlich
bee5338dda Readd overlay hook on DLL_THREAD_ATTACH 2010-11-02 17:14:38 +01:00
Thorvald Natvig
d44c84cb1a This is not the window you are looking for 2010-02-28 18:16:27 +01:00