DInput: Remove the unsupported Lights output

The LEDs feature doesn't actually do anything: the SetState method is
entirely commented out.
This commit is contained in:
Jasper St. Pierre 2014-11-13 00:35:29 -08:00
parent b5d4e8d37e
commit 0c056c6411
2 changed files with 0 additions and 78 deletions

View File

@ -30,17 +30,6 @@ static const struct
#include "InputCommon/ControllerInterface/DInput/NamedKeys.h" // NOLINT
};
static const struct
{
const BYTE code;
const char* const name;
} named_lights[] =
{
{ VK_NUMLOCK, "NUM LOCK" },
{ VK_CAPITAL, "CAPS LOCK" },
{ VK_SCROLL, "SCROLL LOCK" }
};
// lil silly
static HWND hwnd;
@ -102,16 +91,11 @@ KeyboardMouse::KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIREC
m_last_update = GetTickCount();
ZeroMemory(&m_state_in, sizeof(m_state_in));
ZeroMemory(m_state_out, sizeof(m_state_out));
ZeroMemory(&m_current_state_out, sizeof(m_current_state_out));
// KEYBOARD
// add keys
for (u8 i = 0; i < sizeof(named_keys)/sizeof(*named_keys); ++i)
AddInput(new Key(i, m_state_in.keyboard[named_keys[i].code]));
// add lights
for (u8 i = 0; i < sizeof(named_lights)/sizeof(*named_lights); ++i)
AddOutput(new Light(i));
// MOUSE
// get caps
@ -198,45 +182,6 @@ bool KeyboardMouse::UpdateInput()
return false;
}
bool KeyboardMouse::UpdateOutput()
{
class KInput : public INPUT
{
public:
KInput( const unsigned char key, const bool up = false )
{
memset( this, 0, sizeof(*this) );
type = INPUT_KEYBOARD;
ki.wVk = key;
if (up)
ki.dwFlags = KEYEVENTF_KEYUP;
}
};
std::vector< KInput > kbinputs;
for (unsigned int i = 0; i < sizeof(m_state_out)/sizeof(*m_state_out); ++i)
{
bool want_on = false;
if (m_state_out[i])
want_on = m_state_out[i] > GetTickCount() % 255 ; // light should flash when output is 0.5
// lights are set to their original state when output is zero
if (want_on ^ m_current_state_out[i])
{
kbinputs.push_back(KInput(named_lights[i].code)); // press
kbinputs.push_back(KInput(named_lights[i].code, true)); // release
m_current_state_out[i] ^= 1;
}
}
if (kbinputs.size())
return ( kbinputs.size() == SendInput( (UINT)kbinputs.size(), &kbinputs[0], sizeof( kbinputs[0] ) ) );
else
return true;
}
std::string KeyboardMouse::GetName() const
{
return "Keyboard Mouse";
@ -280,11 +225,6 @@ std::string KeyboardMouse::Cursor::GetName() const
return tmpstr;
}
std::string KeyboardMouse::Light::GetName() const
{
return named_lights[m_index].name;
}
// get/set state
ControlState KeyboardMouse::Key::GetState() const
{
@ -306,10 +246,5 @@ ControlState KeyboardMouse::Cursor::GetState() const
return std::max(0.0, ControlState(m_axis) / (m_positive ? 1.0 : -1.0));
}
void KeyboardMouse::Light::SetState(const ControlState state)
{
//state_out[m_index] = (unsigned char)(state * 255);
}
}
}

View File

@ -76,19 +76,8 @@ private:
const bool m_positive;
};
class Light : public Output
{
public:
std::string GetName() const;
Light(u8 index) : m_index(index) {}
void SetState(ControlState state);
private:
const u8 m_index;
};
public:
bool UpdateInput();
bool UpdateOutput();
KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIRECTINPUTDEVICE8 mo_device);
~KeyboardMouse();
@ -103,8 +92,6 @@ private:
DWORD m_last_update;
State m_state_in;
unsigned char m_state_out[3]; // NUM CAPS SCROLL
bool m_current_state_out[3]; // NUM CAPS SCROLL
};
}