mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-01 02:21:26 +02:00
Fix and simplify GCPad::SetMotor()
abs() takes an int argument. Casting -0.5..0.5 to int always resulted in zero.
This commit is contained in:
parent
d7b7487405
commit
e35db54454
@ -122,11 +122,8 @@ void GCPad::GetInput(GCPadStatus* const pad)
|
||||
|
||||
void GCPad::SetMotor(const u8 on)
|
||||
{
|
||||
ControlState state = static_cast<ControlState>(on) / 255;
|
||||
ControlState force = abs(state - 0.5) * 2;
|
||||
if (state < 0.5)
|
||||
force = -force;
|
||||
|
||||
// map 0..255 to -1.0..1.0
|
||||
ControlState force = on / 127.5 - 1;
|
||||
m_rumble->controls[0]->control_ref->State(force);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user