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