Fix returnAdress for msvc

This commit is contained in:
FlightlessMango 2020-06-23 14:39:45 +02:00
parent 8bb60450ac
commit 114137d977
2 changed files with 21 additions and 4 deletions

View File

@ -11,6 +11,9 @@
#include "imgui_impl_win32.h"
#include "dx_shared.h"
#include "d3d11hook.h"
#ifdef _MSC_VER
#include <intrin.h>
#endif
#pragma comment(lib, "d3d11.lib")
@ -73,9 +76,15 @@ long __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT F
ImGui_ImplDX11_Init(device, context);
init = true;
});
static auto addr = __builtin_return_address(0);
if(addr == __builtin_return_address(0))
#ifdef _MSC_VER
static auto addr = _ReturnAddress();
if(addr == _ReturnAddress()){
#else
static auto addr = __builtin_return_address(0);
if(addr == __builtin_return_address(0)){
#endif
ImplHookDX11_Present(g_pd3dDevice, g_pd3dContext, g_pSwapChain);
}
return oPresent(pSwapChain, SyncInterval, Flags);
}

View File

@ -11,6 +11,9 @@
#include "imgui_impl_win32.h"
#include "imgui_impl_dx9.h"
#include "dx_shared.h"
#ifdef _MSC_VER
#include <intrin.h>
#endif
typedef long(__stdcall* Reset)(LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
static Reset oReset = NULL;
@ -46,8 +49,13 @@ long __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
}
ImGui::SetCurrentContext(state.imgui_ctx);
static auto addr = __builtin_return_address(0);
if(addr == __builtin_return_address(0)){
#ifdef _MSC_VER
static auto addr = _ReturnAddress();
if(addr == _ReturnAddress()){
#else
static auto addr = __builtin_return_address(0);
if(addr == __builtin_return_address(0)){
#endif
check_keybinds(params);
update_hud_info(sw_stats, params, vendorID);
ImGui_ImplDX9_NewFrame();