mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Start to make possible use of "full analog surface". (useful for triggers on some silly physical gamepads)
This commit is contained in:
parent
69c91a20ea
commit
38b01d176a
@ -461,7 +461,7 @@ ControllerInterface::Device::Control* ControllerInterface::InputReference::Detec
|
|||||||
i = device->Inputs().begin(),
|
i = device->Inputs().begin(),
|
||||||
e = device->Inputs().end();
|
e = device->Inputs().end();
|
||||||
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i)
|
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i)
|
||||||
*state++ = ((*i)->GetState() > INPUT_DETECT_THRESHOLD);
|
*state++ = ((*i)->GetState() > (1 - INPUT_DETECT_THRESHOLD));
|
||||||
|
|
||||||
while (time < ms)
|
while (time < ms)
|
||||||
{
|
{
|
||||||
@ -477,7 +477,7 @@ ControllerInterface::Device::Control* ControllerInterface::InputReference::Detec
|
|||||||
if (false == *state)
|
if (false == *state)
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
else
|
else if ((*i)->GetState() < (1 - INPUT_DETECT_THRESHOLD))
|
||||||
*state = false;
|
*state = false;
|
||||||
}
|
}
|
||||||
Common::SleepCurrentThread(10); time += 10;
|
Common::SleepCurrentThread(10); time += 10;
|
||||||
|
@ -123,6 +123,36 @@ public:
|
|||||||
void AddInput(Input* const i);
|
void AddInput(Input* const i);
|
||||||
void AddOutput(Output* const o);
|
void AddOutput(Output* const o);
|
||||||
|
|
||||||
|
class FullAnalogSurface : public Input
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FullAnalogSurface(Input* low, Input* high)
|
||||||
|
: m_low(*low), m_high(*high)
|
||||||
|
{}
|
||||||
|
|
||||||
|
ControlState GetState() const
|
||||||
|
{
|
||||||
|
return (1 + m_high.GetState() - m_low.GetState()) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetName() const
|
||||||
|
{
|
||||||
|
return m_low.GetName() + *m_high.GetName().rbegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Input& m_low;
|
||||||
|
Input& m_high;
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddAnalogInputs(Input* low, Input* high)
|
||||||
|
{
|
||||||
|
AddInput(low);
|
||||||
|
AddInput(high);
|
||||||
|
AddInput(new FullAnalogSurface(low, high));
|
||||||
|
AddInput(new FullAnalogSurface(high, low));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Input*> m_inputs;
|
std::vector<Input*> m_inputs;
|
||||||
std::vector<Output*> m_outputs;
|
std::vector<Output*> m_outputs;
|
||||||
|
Loading…
Reference in New Issue
Block a user