diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index d67d1654b3..454e6a21ac 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -35,6 +35,7 @@ if(WIN32) ControllerInterface/DInput/DInputJoystick.cpp ControllerInterface/DInput/DInputKeyboardMouse.cpp ControllerInterface/DInput/XInputFilter.cpp + ControllerInterface/Win32/Win32.cpp ControllerInterface/XInput/XInput.cpp ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp ) diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 3da92e8b75..6eeb41e8b8 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -8,11 +8,8 @@ #include "Common/Logging/Log.h" -#ifdef CIFACE_USE_XINPUT -#include "InputCommon/ControllerInterface/XInput/XInput.h" -#endif -#ifdef CIFACE_USE_DINPUT -#include "InputCommon/ControllerInterface/DInput/DInput.h" +#ifdef CIFACE_USE_WIN32 +#include "InputCommon/ControllerInterface/Win32/Win32.h" #endif #ifdef CIFACE_USE_XLIB #include "InputCommon/ControllerInterface/Xlib/XInput2.h" @@ -48,11 +45,8 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi) m_is_populating_devices = true; -#ifdef CIFACE_USE_DINPUT -// nothing needed -#endif -#ifdef CIFACE_USE_XINPUT - ciface::XInput::Init(); +#ifdef CIFACE_USE_WIN32 + ciface::Win32::Init(); #endif #ifdef CIFACE_USE_XLIB // nothing needed @@ -99,12 +93,8 @@ void ControllerInterface::RefreshDevices() m_is_populating_devices = true; -#ifdef CIFACE_USE_DINPUT - if (m_wsi.type == WindowSystemType::Windows) - ciface::DInput::PopulateDevices(reinterpret_cast(m_wsi.render_surface)); -#endif -#ifdef CIFACE_USE_XINPUT - ciface::XInput::PopulateDevices(); +#ifdef CIFACE_USE_WIN32 + ciface::Win32::PopulateDevices(m_wsi.render_surface); #endif #ifdef CIFACE_USE_XLIB if (m_wsi.type == WindowSystemType::X11) @@ -160,14 +150,11 @@ void ControllerInterface::Shutdown() // BEFORE we shutdown the backends. InvokeDevicesChangedCallbacks(); -#ifdef CIFACE_USE_XINPUT - ciface::XInput::DeInit(); -#endif -#ifdef CIFACE_USE_DINPUT -// nothing needed +#ifdef CIFACE_USE_WIN32 + ciface::Win32::DeInit(); #endif #ifdef CIFACE_USE_XLIB -// nothing needed + // nothing needed #endif #ifdef CIFACE_USE_OSX ciface::OSX::DeInit(); diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 7330172421..2ad53fc79b 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -15,8 +15,7 @@ // enable disable sources #ifdef _WIN32 -#define CIFACE_USE_XINPUT -#define CIFACE_USE_DINPUT +#define CIFACE_USE_WIN32 #endif #if defined(HAVE_X11) && HAVE_X11 #define CIFACE_USE_XLIB diff --git a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp new file mode 100644 index 0000000000..2ce583e608 --- /dev/null +++ b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp @@ -0,0 +1,26 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "InputCommon/ControllerInterface/Win32/Win32.h" + +#include "InputCommon/ControllerInterface/DInput/DInput.h" +#include "InputCommon/ControllerInterface/XInput/XInput.h" + +void ciface::Win32::Init() +{ + // DInput::Init(); + XInput::Init(); +} + +void ciface::Win32::PopulateDevices(void* hwnd) +{ + DInput::PopulateDevices(static_cast(hwnd)); + XInput::PopulateDevices(); +} + +void ciface::Win32::DeInit() +{ + // DInput::DeInit(); + XInput::DeInit(); +} diff --git a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.h b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.h new file mode 100644 index 0000000000..038a792e54 --- /dev/null +++ b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.h @@ -0,0 +1,15 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +namespace ciface +{ +namespace Win32 +{ +void Init(); +void PopulateDevices(void* hwnd); +void DeInit(); +} +} diff --git a/Source/Core/InputCommon/InputCommon.vcxproj b/Source/Core/InputCommon/InputCommon.vcxproj index 0c8e95d400..6bf821f032 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj +++ b/Source/Core/InputCommon/InputCommon.vcxproj @@ -63,6 +63,7 @@ +