From e35db54454c6c050bd209a17aa908efb39d7ca7c Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Thu, 18 Sep 2014 21:34:07 +0200 Subject: [PATCH] Fix and simplify GCPad::SetMotor() abs() takes an int argument. Casting -0.5..0.5 to int always resulted in zero. --- Source/Core/Core/HW/GCPadEmu.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index b6ed46d0b7..2619cacf15 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -122,11 +122,8 @@ void GCPad::GetInput(GCPadStatus* const pad) void GCPad::SetMotor(const u8 on) { - ControlState state = static_cast(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); }