2014-02-10 11:54:46 -07:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
2010-04-01 20:48:24 -06:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "InputCommon/ControllerInterface/Device.h"
|
|
|
|
#include "InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h"
|
2011-03-14 22:04:27 -06:00
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
namespace ciface
|
|
|
|
{
|
2010-07-03 02:04:10 -06:00
|
|
|
namespace DInput
|
2010-04-01 20:48:24 -06:00
|
|
|
{
|
|
|
|
|
2013-06-16 18:07:10 -06:00
|
|
|
void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices, HWND hwnd);
|
2010-04-01 20:48:24 -06:00
|
|
|
|
2014-02-05 03:28:32 -07:00
|
|
|
class Joystick : public ForceFeedback::ForceFeedbackDevice
|
2010-04-01 20:48:24 -06:00
|
|
|
{
|
2011-03-13 19:20:11 -06:00
|
|
|
private:
|
2010-04-01 20:48:24 -06:00
|
|
|
class Button : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-13 19:20:11 -06:00
|
|
|
Button(u8 index, const BYTE& button) : m_index(index), m_button(button) {}
|
|
|
|
ControlState GetState() const;
|
2010-04-01 20:48:24 -06:00
|
|
|
private:
|
2011-03-13 19:20:11 -06:00
|
|
|
const BYTE& m_button;
|
|
|
|
const u8 m_index;
|
2010-04-01 20:48:24 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
class Axis : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-13 19:20:11 -06:00
|
|
|
Axis(u8 index, const LONG& axis, LONG base, LONG range) : m_index(index), m_axis(axis), m_base(base), m_range(range) {}
|
|
|
|
ControlState GetState() const;
|
2010-04-01 20:48:24 -06:00
|
|
|
private:
|
2011-03-13 19:20:11 -06:00
|
|
|
const LONG& m_axis;
|
|
|
|
const LONG m_base, m_range;
|
|
|
|
const u8 m_index;
|
2010-04-01 20:48:24 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
class Hat : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-13 19:20:11 -06:00
|
|
|
Hat(u8 index, const DWORD& hat, u8 direction) : m_index(index), m_hat(hat), m_direction(direction) {}
|
|
|
|
ControlState GetState() const;
|
2010-04-01 20:48:24 -06:00
|
|
|
private:
|
2011-03-13 19:20:11 -06:00
|
|
|
const DWORD& m_hat;
|
|
|
|
const u8 m_index, m_direction;
|
2010-04-01 20:48:24 -06:00
|
|
|
};
|
|
|
|
|
2011-03-13 19:20:11 -06:00
|
|
|
public:
|
2014-11-13 01:55:14 -07:00
|
|
|
void UpdateInput() override;
|
2010-04-01 20:48:24 -06:00
|
|
|
|
2011-03-13 19:20:11 -06:00
|
|
|
Joystick(const LPDIRECTINPUTDEVICE8 device, const unsigned int index);
|
2010-04-01 20:48:24 -06:00
|
|
|
~Joystick();
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2010-04-01 20:48:24 -06:00
|
|
|
std::string GetName() const;
|
|
|
|
int GetId() const;
|
|
|
|
std::string GetSource() const;
|
|
|
|
|
|
|
|
private:
|
2014-01-30 17:51:21 -07:00
|
|
|
const LPDIRECTINPUTDEVICE8 m_device;
|
|
|
|
const unsigned int m_index;
|
2010-04-01 20:48:24 -06:00
|
|
|
|
2014-01-30 17:51:21 -07:00
|
|
|
DIJOYSTATE m_state_in;
|
2010-04-01 20:48:24 -06:00
|
|
|
|
2014-01-30 17:51:21 -07:00
|
|
|
bool m_buffered;
|
2010-04-01 20:48:24 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|