summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/Src/ControllerInterface/DInput
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-08-16 19:17:07 +1200
committerMatthew Parlane <parlane@gmail.com>2013-08-16 19:17:07 +1200
commit9de7611ff940d24551bc77a5e29b86911e3fa749 (patch)
tree7615ec4cfd3aaba63d96ef1cb3cc33fd0efa516a /Source/Core/InputCommon/Src/ControllerInterface/DInput
parent417552b21e30aee3dc2b720d65c2cd757997a33e (diff)
parentbff2bc1288fa4309e1b2aef1486845ba01311100 (diff)
Merge branch 'master' into wii-network
Conflicts: CMakeLists.txt Source/Core/Core/Core.vcxproj Source/Core/DolphinWX/Dolphin.vcxproj Source/Core/DolphinWX/Dolphin.vcxproj.filters Source/Dolphin_2010.sln Source/VSProps/Dolphin.Win32.props Source/VSProps/Dolphin.x64.props
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp19
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.h4
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp21
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h13
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp17
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.h6
6 files changed, 21 insertions, 59 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp
index 01baf9cf1a..6b7b492ea9 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.cpp
@@ -1,17 +1,10 @@
-#include "../ControllerInterface.h"
-
-#ifdef CIFACE_USE_DINPUT
#include "DInput.h"
#include "StringUtil.h"
-#ifdef CIFACE_USE_DINPUT_JOYSTICK
- #include "DInputJoystick.h"
-#endif
-#ifdef CIFACE_USE_DINPUT_KBM
- #include "DInputKeyboardMouse.h"
-#endif
+#include "DInputJoystick.h"
+#include "DInputKeyboardMouse.h"
#pragma comment(lib, "Dinput8.lib")
#pragma comment(lib, "dxguid.lib")
@@ -55,18 +48,14 @@ std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device)
return result;
}
-void Init(std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
+void Init(std::vector<Core::Device*>& devices, HWND hwnd)
{
IDirectInput8* idi8;
if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, NULL)))
return;
-#ifdef CIFACE_USE_DINPUT_KBM
InitKeyboardMouse(idi8, devices, hwnd);
-#endif
-#ifdef CIFACE_USE_DINPUT_JOYSTICK
InitJoystick(idi8, devices, hwnd);
-#endif
idi8->Release();
@@ -74,5 +63,3 @@ void Init(std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
}
}
-
-#endif
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.h b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.h
index 9ee48c190f..86452c23ab 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInput.h
@@ -1,7 +1,7 @@
#ifndef _CIFACE_DINPUT_H_
#define _CIFACE_DINPUT_H_
-#include "../ControllerInterface.h"
+#include "../Device.h"
#define DINPUT_SOURCE_NAME "DInput"
@@ -23,7 +23,7 @@ BOOL CALLBACK DIEnumDeviceObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVO
BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef);
std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device);
-void Init(std::vector<ControllerInterface::Device*>& devices, HWND hwnd);
+void Init(std::vector<Core::Device*>& devices, HWND hwnd);
}
}
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
index 916d142149..fa33595ee8 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp
@@ -1,10 +1,14 @@
-#include "../ControllerInterface.h"
-
-#ifdef CIFACE_USE_DINPUT_JOYSTICK
#include "DInputJoystick.h"
#include "DInput.h"
+#include <map>
+#include <sstream>
+#include <algorithm>
+
+#include <wbemidl.h>
+#include <oleauto.h>
+
namespace ciface
{
namespace DInput
@@ -36,7 +40,6 @@ static const struct
#define DATA_BUFFER_SIZE 32
-#ifdef NO_DUPLICATE_DINPUT_XINPUT
//-----------------------------------------------------------------------------
// Modified some MSDN code to get all the XInput device GUID.Data1 values in a vector,
// faster than checking all the devices for each DirectInput device, like MSDN says to do
@@ -140,9 +143,8 @@ LCleanup:
if( bCleanupCOM )
CoUninitialize();
}
-#endif
-void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND hwnd)
+void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices, HWND hwnd)
{
std::list<DIDEVICEINSTANCE> joysticks;
idi8->EnumDevices( DI8DEVCLASS_GAMECTRL, DIEnumDevicesCallback, (LPVOID)&joysticks, DIEDFL_ATTACHEDONLY );
@@ -151,21 +153,18 @@ void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::De
// multiple joysticks with the same name shall get unique ids starting at 0
std::map< std::basic_string<TCHAR>, int> name_counts;
-#ifdef NO_DUPLICATE_DINPUT_XINPUT
std::vector<DWORD> xinput_guids;
GetXInputGUIDS( xinput_guids );
-#endif
std::list<DIDEVICEINSTANCE>::iterator
i = joysticks.begin(),
e = joysticks.end();
for ( ; i!=e; ++i )
{
-#ifdef NO_DUPLICATE_DINPUT_XINPUT
// skip XInput Devices
if ( std::find( xinput_guids.begin(), xinput_guids.end(), i->guidProduct.Data1 ) != xinput_guids.end() )
continue;
-#endif
+
LPDIRECTINPUTDEVICE8 js_device;
if (SUCCEEDED(idi8->CreateDevice(i->guidInstance, &js_device, NULL)))
{
@@ -599,5 +598,3 @@ Joystick::Force<P>::Force(u8 index, EffectState& state)
}
}
-
-#endif
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h
index a783381154..ad383bd764 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.h
@@ -1,7 +1,7 @@
#ifndef _CIFACE_DINPUT_JOYSTICK_H_
#define _CIFACE_DINPUT_JOYSTICK_H_
-#include "../ControllerInterface.h"
+#include "../Device.h"
#define DIRECTINPUT_VERSION 0x0800
#define WIN32_LEAN_AND_MEAN
@@ -11,21 +11,14 @@
#include <list>
-#ifdef CIFACE_USE_XINPUT
- // this takes so long, idk if it should be enabled :(
- #define NO_DUPLICATE_DINPUT_XINPUT
- #include <wbemidl.h>
- #include <oleauto.h>
-#endif
-
namespace ciface
{
namespace DInput
{
-void InitJoystick(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND hwnd);
+void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices, HWND hwnd);
-class Joystick : public ControllerInterface::Device
+class Joystick : public Core::Device
{
private:
struct EffectState
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp
index ea6452376d..850ff27281 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp
@@ -1,6 +1,3 @@
-#include "../ControllerInterface.h"
-
-#ifdef CIFACE_USE_DINPUT_KBM
#include "DInputKeyboardMouse.h"
#include "DInput.h"
@@ -42,7 +39,7 @@ static const struct
// lil silly
static HWND hwnd;
-void InitKeyboardMouse(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND _hwnd)
+void InitKeyboardMouse(IDirectInput8* const idi8, std::vector<Core::Device*>& devices, HWND _hwnd)
{
hwnd = _hwnd;
@@ -252,16 +249,6 @@ std::string KeyboardMouse::GetSource() const
return DINPUT_SOURCE_NAME;
}
-//ControlState KeyboardMouse::GetInputState(const ControllerInterface::Device::Input* const input) const
-//{
-// return (((Input*)input)->GetState(&m_state_in));
-//}
-//
-//void KeyboardMouse::SetOutputState(const ControllerInterface::Device::Output* const output, const ControlState state)
-//{
-// ((Output*)output)->SetState(state, m_state_out);
-//}
-
// names
std::string KeyboardMouse::Key::GetName() const
{
@@ -322,5 +309,3 @@ void KeyboardMouse::Light::SetState(const ControlState state)
}
}
-
-#endif
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.h
index cacef516b0..73398ca1b1 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.h
+++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputKeyboardMouse.h
@@ -1,7 +1,7 @@
#ifndef _CIFACE_DINPUT_KBM_H_
#define _CIFACE_DINPUT_KBM_H_
-#include "../ControllerInterface.h"
+#include "../Device.h"
#define DIRECTINPUT_VERSION 0x0800
#define WIN32_LEAN_AND_MEAN
@@ -14,9 +14,9 @@ namespace ciface
namespace DInput
{
-void InitKeyboardMouse(IDirectInput8* const idi8, std::vector<ControllerInterface::Device*>& devices, HWND _hwnd);
+void InitKeyboardMouse(IDirectInput8* const idi8, std::vector<Core::Device*>& devices, HWND _hwnd);
-class KeyboardMouse : public ControllerInterface::Device
+class KeyboardMouse : public Core::Device
{
private:
struct State