From 327d35377dd0edfcb3f0a5d7b2853f23102eb950 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 22 Aug 2014 17:17:49 -0700 Subject: [PATCH] windows: remove now-extraneous NOMINMAX and WIN32_LEAN_AND_MEAN #defines from dolphin code. Wrap dinput.h in a header defining DIRECTINPUT_VERSION instead of repeating it multiple places. --- Source/Core/Common/Common.h | 10 ---------- Source/Core/Core/HW/WiimoteReal/IOWin.cpp | 2 +- Source/Core/InputCommon/ControllerEmu.h | 3 --- .../InputCommon/ControllerInterface/DInput/DInput.cpp | 5 ++++- .../InputCommon/ControllerInterface/DInput/DInput.h | 5 +---- .../InputCommon/ControllerInterface/DInput/DInput8.h | 8 ++++++++ .../ControllerInterface/DInput/DInputKeyboardMouse.h | 5 +---- .../ForceFeedback/ForceFeedbackDevice.h | 5 +---- .../InputCommon/ControllerInterface/XInput/XInput.h | 1 - Source/Core/InputCommon/InputCommon.vcxproj | 5 +++-- Source/Core/InputCommon/InputCommon.vcxproj.filters | 7 +++++-- Source/Core/VideoCommon/VideoCommon.h | 1 - 12 files changed, 24 insertions(+), 33 deletions(-) create mode 100644 Source/Core/InputCommon/ControllerInterface/DInput/DInput8.h diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h index fa1cece364..6b6ddf266c 100644 --- a/Source/Core/Common/Common.h +++ b/Source/Core/Common/Common.h @@ -4,9 +4,6 @@ #pragma once -// DO NOT EVER INCLUDE directly _or indirectly_ from this file -// since it slows down the build a lot. - #include #include #include @@ -89,13 +86,6 @@ private: #elif defined _WIN32 -// Check MSC ver - #if !defined _MSC_VER || _MSC_VER <= 1000 - #error needs at least version 1000 of MSC - #endif - - #define NOMINMAX - // Memory leak checks #define CHECK_HEAP_INTEGRITY() diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp index 82c5b935b2..67481b3d80 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp @@ -9,7 +9,7 @@ #include #include #include -// The following Windows headers MUST be included after windows.h. +// The following Windows headers must be included AFTER windows.h. #include //NOLINT #include //NOLINT #include //NOLINT diff --git a/Source/Core/InputCommon/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu.h index f2c20d9bc9..3386982d01 100644 --- a/Source/Core/InputCommon/ControllerEmu.h +++ b/Source/Core/InputCommon/ControllerEmu.h @@ -4,9 +4,6 @@ #pragma once -// windows crap -#define NOMINMAX - #include #include #include diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp index 48b5884312..aac795d880 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp @@ -48,8 +48,11 @@ std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device) void Init(std::vector& devices, HWND hwnd) { IDirectInput8* idi8; - if (FAILED(DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, nullptr))) + if (FAILED(DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, + IID_IDirectInput8, (LPVOID*)&idi8, nullptr))) + { return; + } InitKeyboardMouse(idi8, devices, hwnd); InitJoystick(idi8, devices, hwnd); diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h index b4f1b27199..84f9832c53 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.h @@ -6,14 +6,11 @@ #define DINPUT_SOURCE_NAME "DInput" -#define DIRECTINPUT_VERSION 0x0800 -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX -#include #include #include #include "InputCommon/ControllerInterface/Device.h" +#include "InputCommon/ControllerInterface/DInput/DInput8.h" namespace ciface { diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput8.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInput8.h new file mode 100644 index 0000000000..8845b5740e --- /dev/null +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput8.h @@ -0,0 +1,8 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#define DIRECTINPUT_VERSION 0x0800 +#include diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h index 558917e9cc..8f7ac67452 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h @@ -4,13 +4,10 @@ #pragma once -#define DIRECTINPUT_VERSION 0x0800 -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX -#include #include #include "InputCommon/ControllerInterface/Device.h" +#include "InputCommon/ControllerInterface/DInput/DInput8.h" namespace ciface { diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h index 54a465d83e..31a1884aae 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h @@ -10,11 +10,8 @@ #include "InputCommon/ControllerInterface/Device.h" #ifdef _WIN32 -#define DIRECTINPUT_VERSION 0x0800 -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX #include -#include +#include "InputCommon/ControllerInterface/DInput/DInput8.h" #elif __APPLE__ #include "InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h" #endif diff --git a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h index f3dc398904..3c9eadc395 100644 --- a/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h +++ b/Source/Core/InputCommon/ControllerInterface/XInput/XInput.h @@ -5,7 +5,6 @@ #pragma once -#define NOMINMAX #include #include diff --git a/Source/Core/InputCommon/InputCommon.vcxproj b/Source/Core/InputCommon/InputCommon.vcxproj index b1b490c1d7..2866846075 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj +++ b/Source/Core/InputCommon/InputCommon.vcxproj @@ -1,4 +1,4 @@ - + @@ -51,6 +51,7 @@ + @@ -70,4 +71,4 @@ - + \ No newline at end of file diff --git a/Source/Core/InputCommon/InputCommon.vcxproj.filters b/Source/Core/InputCommon/InputCommon.vcxproj.filters index 0d509ca30c..25fab7a227 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj.filters +++ b/Source/Core/InputCommon/InputCommon.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -70,8 +70,11 @@ ControllerInterface\ForceFeedback + + ControllerInterface\DInput + - + \ No newline at end of file diff --git a/Source/Core/VideoCommon/VideoCommon.h b/Source/Core/VideoCommon/VideoCommon.h index 8786bfb245..082a489d69 100644 --- a/Source/Core/VideoCommon/VideoCommon.h +++ b/Source/Core/VideoCommon/VideoCommon.h @@ -5,7 +5,6 @@ #pragma once #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN #include #endif