From 5da6997805814f36bd1bdd049dffc472c00ffea0 Mon Sep 17 00:00:00 2001 From: Will Xyen Date: Wed, 29 Jan 2020 00:09:26 -0500 Subject: [PATCH] address MR comments. --- src/main/d3d9exhook/d3d9ex.c | 11 +++++------ src/main/hooklib/adapter.h | 7 ++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/d3d9exhook/d3d9ex.c b/src/main/d3d9exhook/d3d9ex.c index 7e6cf3e..0e52202 100644 --- a/src/main/d3d9exhook/d3d9ex.c +++ b/src/main/d3d9exhook/d3d9ex.c @@ -228,10 +228,11 @@ static HRESULT STDCALL my_CreateDeviceEx( ZeroMemory(&dm, sizeof(dm)); dm.dmSize = sizeof(dm); - if (0 != - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)) { + if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)) { + int32_t delta = d3d9ex_force_orientation - dm.dmDisplayOrientation; + if (delta % 2 != 0) { // swap height and width DWORD dwTemp = dm.dmPelsHeight; @@ -241,9 +242,9 @@ static HRESULT STDCALL my_CreateDeviceEx( dm.dmDisplayOrientation = d3d9ex_force_orientation; - long lRet = ChangeDisplaySettings(&dm, CDS_FULLSCREEN); + long cd_ret = ChangeDisplaySettings(&dm, CDS_FULLSCREEN); - if (lRet == DISP_CHANGE_SUCCESSFUL) { + if (cd_ret == DISP_CHANGE_SUCCESSFUL) { log_info("Overriding rotation suceeded"); } else { log_info("Overriding rotation failed"); @@ -256,8 +257,6 @@ static HRESULT STDCALL my_CreateDeviceEx( hr = IDirect3D9Ex_CreateDeviceEx( real, adapter, type, hwnd, flags, pp, fdm, pdev); - // TODO stuff - return hr; } diff --git a/src/main/hooklib/adapter.h b/src/main/hooklib/adapter.h index 298965a..3f5e5da 100644 --- a/src/main/hooklib/adapter.h +++ b/src/main/hooklib/adapter.h @@ -1,10 +1,15 @@ #ifndef HOOKLIB_ADAPTER_H #define HOOKLIB_ADAPTER_H +/** + * Hooks GetAdaptersInfo to attempt only returning 1 adapter. + * + */ void adapter_hook_init(void); /** - * Uses the provided address to try and match a network adapter + * Uses the provided address to try and match a network adapter. + * This adapter is then returned as the only adapter. * * @param network ip to match */