It is better to be explicit and API correct, even if the resulting
types ended up to be the same through typedefs or the implementation
reinterpret-casting to a memory address pointer.
* Only inject if all OpenGL functions used for overlay drawing are found
* Restructure code; use early returns to reduce code block depth
* FNFIND: Don’t redefine macro; use a separate one instead. Use a parameter
for the module handle.
This should make its use and influence less confusing.
* Remove GL function resolution of not used functions
* Remove unused SwapBuffer function hooks:
TL;DR: SwapBuffers calls wglSwapBuffers, so we do not need to hook it,
and wglSwapLayerBuffers is for layer planes, which are optional and of
arbitrary number and index - so we never use that to hook/draw.
In detail:
SwapBuffers is actually a function of Gdi32.dll, and the one
youre supposed to use on windows (MSDN [1]), at least when
statically linking.
The wgl functions are used when dynamically linking.
See OpenGL Windows FAQ [2]
* 5.190 What do I need to know about mixing WGL and GDI calls?
* 5.210 How do I properly use WGL functions?
> So since GDI and the ICD share function names like SwapBuffers, a
> wglSwapBuffers is needed to avoid ambiguity when loading the proc
> dynamically.
Quoted from [3]
wglSwapLayerBuffers is the swap function for layer planes Overlay, Underlay,
and Main Planes. [4]
So using wglSwapBuffers is always enough.
We could draw on other layers, but if hooking into wglSwapLayerBuffers we
would have to know which layer to draw on, and either call it from
wglSwapBuffers or not, depending on the original program rendering that
layer, so thats not feasible.
In ET:L, for every logged GDI SwapBuffers call, a wglSwapBuffers call follows.
[1] http://msdn.microsoft.com/en-us/library/dd369060%28v=vs.85%29
[2] https://www.opengl.org/archives/resources/faq/technical/mswindows.htm
[3] https://www.opengl.org/discussion_boards/showthread.php/141384-SwapBuffers-or-wglSwapBuffers
[4] http://msdn.microsoft.com/en-us/library/dd368815%28v=vs.85%29
* Declare scope on member variables
* Move GL context initialization logic into separate method
* Make GL context swapping logic more clear (switch and restore)
* Effectively changes: When a new Context object is created, it switches
the OpenGL context, restores the old, and then in the draw call switches
to the context again. Before, it would switch to the new context just
once.
* 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
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)