2014-02-10 18:54:46 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// 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
|
|
|
{
|
|
|
|
|
2013-06-17 00:07:10 +00:00
|
|
|
void InitJoystick(IDirectInput8* const idi8, std::vector<Core::Device*>& devices, 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:
|
2010-04-02 02:48:24 +00:00
|
|
|
class Button : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00:00
|
|
|
Button(u8 index, const BYTE& button) : m_index(index), m_button(button) {}
|
|
|
|
ControlState GetState() const;
|
2010-04-02 02:48:24 +00:00
|
|
|
private:
|
2011-03-14 01:20:11 +00:00
|
|
|
const BYTE& m_button;
|
|
|
|
const u8 m_index;
|
2010-04-02 02:48:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Axis : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00: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-02 02:48:24 +00:00
|
|
|
private:
|
2011-03-14 01:20:11 +00:00
|
|
|
const LONG& m_axis;
|
|
|
|
const LONG m_base, m_range;
|
|
|
|
const u8 m_index;
|
2010-04-02 02:48:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Hat : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00:00
|
|
|
Hat(u8 index, const DWORD& hat, u8 direction) : m_index(index), m_hat(hat), m_direction(direction) {}
|
|
|
|
ControlState GetState() const;
|
2010-04-02 02:48:24 +00:00
|
|
|
private:
|
2011-03-14 01:20:11 +00:00
|
|
|
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:
|
2014-11-13 08:55:14 +00:00
|
|
|
void UpdateInput() override;
|
2010-04-02 02:48:24 +00:00
|
|
|
|
2011-03-14 01:20:11 +00:00
|
|
|
Joystick(const LPDIRECTINPUTDEVICE8 device, const unsigned int index);
|
2010-04-02 02:48:24 +00:00
|
|
|
~Joystick();
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2010-04-02 02:48:24 +00:00
|
|
|
std::string GetName() const;
|
|
|
|
int GetId() const;
|
|
|
|
std::string GetSource() const;
|
|
|
|
|
|
|
|
private:
|
2014-01-31 00:51:21 +00:00
|
|
|
const LPDIRECTINPUTDEVICE8 m_device;
|
|
|
|
const unsigned int m_index;
|
2010-04-02 02:48:24 +00:00
|
|
|
|
2014-01-31 00:51:21 +00:00
|
|
|
DIJOYSTATE m_state_in;
|
2010-04-02 02:48:24 +00:00
|
|
|
|
2014-01-31 00:51:21 +00:00
|
|
|
bool m_buffered;
|
2010-04-02 02:48:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|