Reorganise 3rdparty, include breakpad with sln, drop mhook. Closes #84

This commit is contained in:
baldurk committed 2014-09-24 20:24:35 +01:00
1 parent 7dbb80b25e
commit 8d685de609
161 files changed
+378 -30987

No files matched your search

-48
View File
@@ -39,15 +39,6 @@ public:
{
bool success = true;
#if USE_MHOOK
// require dxgi.dll hooked as well for proper operation
if(GetModuleHandleA("dxgi.dll") == NULL)
{
RDCWARN("Failed to load dxgi.dll - not inserting D3D11 hooks.");
return false;
}
#endif
// also require d3dcompiler_??.dll
if(GetD3DCompiler() == NULL)
{
@@ -60,19 +51,6 @@ public:
if(!success) return false;
#if USE_MHOOK
// FRAPS compatibility. Save out the first 16 bytes (arbitrary number) of the 'real' function code.
// this should be
// jmp D3D11CreateDeviceAndSwapChain_hook
// push r12 <- this is where our trampoline jumps back to
// push r13
//
// FRAPS stomps over this with its own hook that we detect and handle later.
void *hooked_func_ptr = GetProcAddress(GetModuleHandleA("d3d11.dll"), "D3D11CreateDeviceAndSwapChain");
if(hooked_func_ptr == NULL) return false;
memcpy(CreateDeviceAndSwapChain_ident, hooked_func_ptr, 16);
#endif
m_HasHooks = true;
m_EnabledHooks = true;
@@ -192,32 +170,6 @@ private:
PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN createFunc = (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)GetProcAddress(GetModuleHandleA("d3d11.dll"), "D3D11CreateDeviceAndSwapChain");
#if USE_MHOOK
if(createFunc)
{
byte ident[16];
memcpy(ident, createFunc, 16);
// FRAPS compatibility. If FRAPS has come in and modified the real code to something like
// mov rax, [ptrintofraps]
// jmp rax
// then we just jump straight there. If we jump to the trampoline, we'll come in half way through
// those instructions and things will go boom very quickly.
//
// Note that when we call this function FRAPS then restores the asm from before it got here, which is our
// trampolined code, so FRAPS is going to call back into this function. We detect this re-entrancy
// at the top and just go straight into the real d3d function now that FRAPS has restored our trampoline,
// and return right back here
// What a headache!
//
// in the non-fraps case no-one else has messed with this code so the idents will be the same and we
// will use our trampolines.
if(!memcmp(ident, CreateDeviceAndSwapChain_ident, 16) && m_HasHooks)
createFunc = CreateDeviceAndSwapChain();
}
#endif
// shouldn't ever get here, we should either have it from procaddress or the trampoline, but let's be
// safe.
if(createFunc == NULL)
-5
View File
@@ -40,11 +40,6 @@ public:
{
bool success = true;
#if USE_MHOOK
// require d3d11.dll hooked as well for proper operation
if(GetModuleHandleA("d3d11.dll") == NULL) return false;
#endif
success &= CreateDXGIFactory.Initialize("CreateDXGIFactory", DLL_NAME, CreateDXGIFactory_hook);
success &= CreateDXGIFactory1.Initialize("CreateDXGIFactory1", DLL_NAME, CreateDXGIFactory1_hook);
-8
View File
@@ -228,14 +228,6 @@ class OpenGLHook : LibraryHook
if(!m_EnabledHooks)
return false;
#if USE_MHOOK
if(GetModuleHandleA(DLL_NAME) == NULL)
{
RDCWARN("Failed to load %hs - not inserting OpenGL hooks.", DLL_NAME);
return false;
}
#endif
bool success = SetupHooks(GL);
if(!success) return false;
+3 -26
View File
@@ -35,13 +35,7 @@ using std::map;
#if defined(WIN32)
#if USE_MHOOK
#include "3rdparty/mhook/mhook-lib/mhook.h"
#elif USE_IAT_HOOK
#include "os/win32/win32_hook.h"
#else
#error "No hook method enabled"
#endif
#include "os/win32/win32_hook.h"
template<typename FuncType>
class Hook
@@ -53,9 +47,6 @@ class Hook
}
~Hook()
{
#if USE_MHOOK
Mhook_Unhook(&orig_funcptr);
#endif
}
FuncType operator()()
@@ -67,29 +58,15 @@ class Hook
{
orig_funcptr = Process::GetFunctionAddress(module_name, function);
#if USE_MHOOK
if(orig_funcptr == NULL)
return false;
return Mhook_SetHook(&orig_funcptr, destination_function_ptr);
#elif USE_IAT_HOOK
return Win32_IAT_Hook(&orig_funcptr, module_name, function, destination_function_ptr);
#else
#error "No hook method enabled"
#endif
}
private:
void *orig_funcptr;
};
#if USE_MHOOK
#define HOOKS_BEGIN() Mhook_SuspendOtherThreads()
#define HOOKS_END() Mhook_ResumeOtherThreads()
#else
#define HOOKS_BEGIN() Win32_IAT_BeginHooks()
#define HOOKS_END() Win32_IAT_EndHooks()
#endif
#define HOOKS_BEGIN() Win32_IAT_BeginHooks()
#define HOOKS_END() Win32_IAT_EndHooks()
#elif defined(LINUX)