mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
InputCommon: Split Device stuff out
The ExpressionParser needs this to be out of here to prevent issues with cyclic references.
This commit is contained in:
@ -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
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user