diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-06-16 20:07:10 -0400 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-06-25 00:58:30 -0400 |
| commit | 877106b027431c6edb2d2c702fa6d811dac3d250 (patch) | |
| tree | a0d83be190efea7ad4915db7db9ac40f9192b251 /Source/Core/InputCommon/Src/ControllerInterface/DInput | |
| parent | 143d2eccb49b700ccd00dfa229b03d1d1a51533c (diff) | |
InputCommon: Split Device stuff out
The ExpressionParser needs this to be out of here to prevent issues
with cyclic references.
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface/DInput')
6 files changed, 17 insertions, 53 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..24502e7a8a 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DInput/DInputJoystick.cpp @@ -1,10 +1,11 @@ -#include "../ControllerInterface.h" - -#ifdef CIFACE_USE_DINPUT_JOYSTICK #include "DInputJoystick.h" #include "DInput.h" +#include <map> +#include <sstream> +#include <algorithm> + namespace ciface { namespace DInput @@ -142,7 +143,7 @@ LCleanup: } #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 ); @@ -599,5 +600,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 |
