summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-12-07 15:14:29 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-12-31 14:03:19 -0500
commit34692ab826abc8f8faa61bdb2280b742424528f1 (patch)
treeb0eedc645badbea316ff59c125eaf808b28777ec /Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
parent43e618682e8093602fc83dfa902ee7ae3fd3a4f6 (diff)
Remove unnecessary Src/ folders
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
new file mode 100644
index 0000000000..6b7b492ea9
--- /dev/null
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInput.cpp
@@ -0,0 +1,65 @@
+
+#include "DInput.h"
+
+#include "StringUtil.h"
+
+#include "DInputJoystick.h"
+#include "DInputKeyboardMouse.h"
+
+#pragma comment(lib, "Dinput8.lib")
+#pragma comment(lib, "dxguid.lib")
+
+namespace ciface
+{
+namespace DInput
+{
+
+//BOOL CALLBACK DIEnumEffectsCallback(LPCDIEFFECTINFO pdei, LPVOID pvRef)
+//{
+// ((std::list<DIEFFECTINFO>*)pvRef)->push_back(*pdei);
+// return DIENUM_CONTINUE;
+//}
+
+BOOL CALLBACK DIEnumDeviceObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
+{
+ ((std::list<DIDEVICEOBJECTINSTANCE>*)pvRef)->push_back(*lpddoi);
+ return DIENUM_CONTINUE;
+}
+
+BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
+{
+ ((std::list<DIDEVICEINSTANCE>*)pvRef)->push_back(*lpddi);
+ return DIENUM_CONTINUE;
+}
+
+std::string GetDeviceName(const LPDIRECTINPUTDEVICE8 device)
+{
+ DIPROPSTRING str = {};
+ str.diph.dwSize = sizeof(str);
+ str.diph.dwHeaderSize = sizeof(str.diph);
+ str.diph.dwHow = DIPH_DEVICE;
+
+ std::string result;
+ if (SUCCEEDED(device->GetProperty(DIPROP_PRODUCTNAME, &str.diph)))
+ {
+ result = StripSpaces(UTF16ToUTF8(str.wsz));
+ }
+
+ return result;
+}
+
+void Init(std::vector<Core::Device*>& devices, HWND hwnd)
+{
+ IDirectInput8* idi8;
+ if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&idi8, NULL)))
+ return;
+
+ InitKeyboardMouse(idi8, devices, hwnd);
+ InitJoystick(idi8, devices, hwnd);
+
+ idi8->Release();
+
+}
+
+}
+}