From 306c8d14db47a7b3c8d0bd2a3877772bcc8ce21d Mon Sep 17 00:00:00 2001 From: Adam Moss Date: Tue, 6 Jan 2015 19:17:43 +0000 Subject: [PATCH 1/6] SDL Input: Support more types of force feedback for controllers through SDL. --- .../ControllerInterface/SDL/SDL.cpp | 92 +++++++++++++++++++ .../InputCommon/ControllerInterface/SDL/SDL.h | 24 +++++ 2 files changed, 116 insertions(+) diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index 4402b286c3..b75670394c 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -126,6 +126,18 @@ Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index, const unsi // ramp effect if (supported_effects & SDL_HAPTIC_RAMP) AddOutput(new RampEffect(m_haptic)); + + // sine effect + if (supported_effects & SDL_HAPTIC_SINE) + AddOutput(new SineEffect(m_haptic)); + + // triangle effect + if (supported_effects & SDL_HAPTIC_TRIANGLE) + AddOutput(new TriangleEffect(m_haptic)); + + // left-right effect + if (supported_effects & SDL_HAPTIC_LEFTRIGHT) + AddOutput(new LeftRightEffect(m_haptic)); } #endif @@ -178,8 +190,24 @@ std::string Joystick::RampEffect::GetName() const return "Ramp"; } +std::string Joystick::SineEffect::GetName() const +{ + return "Sine"; +} + +std::string Joystick::TriangleEffect::GetName() const +{ + return "Triangle"; +} + +std::string Joystick::LeftRightEffect::GetName() const +{ + return "LeftRight"; +} + void Joystick::ConstantEffect::SetState(ControlState state) { + memset(&m_effect, 0, sizeof(m_effect)); if (state) { m_effect.type = SDL_HAPTIC_CONSTANT; @@ -196,6 +224,7 @@ void Joystick::ConstantEffect::SetState(ControlState state) void Joystick::RampEffect::SetState(ControlState state) { + memset(&m_effect, 0, sizeof(m_effect)); if (state) { m_effect.type = SDL_HAPTIC_RAMP; @@ -209,6 +238,69 @@ void Joystick::RampEffect::SetState(ControlState state) m_effect.ramp.start = (Sint16)(state * 0x7FFF); Update(); } + +void Joystick::SineEffect::SetState(ControlState state) +{ + memset(&m_effect, 0, sizeof(m_effect)); + if (state) + { + m_effect.type = SDL_HAPTIC_SINE; + m_effect.periodic.period = 1000; + m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); + m_effect.periodic.offset = 0; + m_effect.periodic.phase = 18000; + m_effect.periodic.length = SDL_HAPTIC_INFINITY; + m_effect.periodic.delay = 0; + m_effect.periodic.attack_length = 0; + } + else + { + m_effect.type = 0; + } + + Update(); +} + +void Joystick::TriangleEffect::SetState(ControlState state) +{ + memset(&m_effect, 0, sizeof(m_effect)); + if (state) + { + m_effect.type = SDL_HAPTIC_TRIANGLE; + m_effect.periodic.period = 1000; + m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); + m_effect.periodic.offset = 0; + m_effect.periodic.phase = 18000; + m_effect.periodic.length = SDL_HAPTIC_INFINITY; + m_effect.periodic.delay = 0; + m_effect.periodic.attack_length = 0; + } + else + { + m_effect.type = 0; + } + + Update(); +} + +void Joystick::LeftRightEffect::SetState(ControlState state) +{ + memset(&m_effect, 0, sizeof(m_effect)); + if (state) + { + m_effect.type = SDL_HAPTIC_LEFTRIGHT; + m_effect.leftright.length = SDL_HAPTIC_INFINITY; + // max ranges tuned to 'feel' similar in magnitude to triangle/sine on xbox360 controller + m_effect.leftright.large_magnitude = (Uint16)(state * 0x4000); + m_effect.leftright.small_magnitude = (Uint16)(state * 0xFFFF); + } + else + { + m_effect.type = 0; + } + + Update(); +} #endif void Joystick::UpdateInput() diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h index dc449e9ab5..4b18426aa6 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h @@ -98,6 +98,30 @@ private: std::string GetName() const override; void SetState(ControlState state) override; }; + + class SineEffect : public HapticEffect + { + public: + SineEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} + std::string GetName() const override; + void SetState(ControlState state) override; + }; + + class TriangleEffect : public HapticEffect + { + public: + TriangleEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} + std::string GetName() const override; + void SetState(ControlState state) override; + }; + + class LeftRightEffect : public HapticEffect + { + public: + LeftRightEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} + std::string GetName() const override; + void SetState(ControlState state) override; + }; #endif public: From 17ad68ff86c7508f4e8a82ae65f31bc2d59cee79 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 8 Jan 2015 13:37:06 +0100 Subject: [PATCH 2/6] SDL: more global memset --- .../ControllerInterface/SDL/SDL.cpp | 19 ++++++++++--------- .../InputCommon/ControllerInterface/SDL/SDL.h | 13 ++++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index b75670394c..8ed142740e 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -205,9 +205,14 @@ std::string Joystick::LeftRightEffect::GetName() const return "LeftRight"; } -void Joystick::ConstantEffect::SetState(ControlState state) +void Joystick::HapticEffect::SetState(ControlState state) { memset(&m_effect, 0, sizeof(m_effect)); + _SetState(state); +} + +void Joystick::ConstantEffect::_SetState(ControlState state) +{ if (state) { m_effect.type = SDL_HAPTIC_CONSTANT; @@ -222,9 +227,8 @@ void Joystick::ConstantEffect::SetState(ControlState state) Update(); } -void Joystick::RampEffect::SetState(ControlState state) +void Joystick::RampEffect::_SetState(ControlState state) { - memset(&m_effect, 0, sizeof(m_effect)); if (state) { m_effect.type = SDL_HAPTIC_RAMP; @@ -239,9 +243,8 @@ void Joystick::RampEffect::SetState(ControlState state) Update(); } -void Joystick::SineEffect::SetState(ControlState state) +void Joystick::SineEffect::_SetState(ControlState state) { - memset(&m_effect, 0, sizeof(m_effect)); if (state) { m_effect.type = SDL_HAPTIC_SINE; @@ -261,9 +264,8 @@ void Joystick::SineEffect::SetState(ControlState state) Update(); } -void Joystick::TriangleEffect::SetState(ControlState state) +void Joystick::TriangleEffect::_SetState(ControlState state) { - memset(&m_effect, 0, sizeof(m_effect)); if (state) { m_effect.type = SDL_HAPTIC_TRIANGLE; @@ -283,9 +285,8 @@ void Joystick::TriangleEffect::SetState(ControlState state) Update(); } -void Joystick::LeftRightEffect::SetState(ControlState state) +void Joystick::LeftRightEffect::_SetState(ControlState state) { - memset(&m_effect, 0, sizeof(m_effect)); if (state) { m_effect.type = SDL_HAPTIC_LEFTRIGHT; diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h index 4b18426aa6..af1f8ebcb7 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h @@ -77,10 +77,13 @@ private: protected: void Update(); + virtual void _SetState(ControlState state) = 0; SDL_HapticEffect m_effect; SDL_Haptic* m_haptic; int m_id; + private: + virtual void SetState(ControlState state) override final; }; class ConstantEffect : public HapticEffect @@ -88,7 +91,7 @@ private: public: ConstantEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void SetState(ControlState state) override; + void _SetState(ControlState state) override; }; class RampEffect : public HapticEffect @@ -96,7 +99,7 @@ private: public: RampEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void SetState(ControlState state) override; + void _SetState(ControlState state) override; }; class SineEffect : public HapticEffect @@ -104,7 +107,7 @@ private: public: SineEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void SetState(ControlState state) override; + void _SetState(ControlState state) override; }; class TriangleEffect : public HapticEffect @@ -112,7 +115,7 @@ private: public: TriangleEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void SetState(ControlState state) override; + void _SetState(ControlState state) override; }; class LeftRightEffect : public HapticEffect @@ -120,7 +123,7 @@ private: public: LeftRightEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void SetState(ControlState state) override; + void _SetState(ControlState state) override; }; #endif From f47cce2210883033a8bdbdccc2ae34cfe8ca1bc5 Mon Sep 17 00:00:00 2001 From: "Adam D. Moss" Date: Thu, 8 Jan 2015 15:17:29 +0000 Subject: [PATCH 3/6] SDL: Refactor the SDL haptic effects a little. --- .../ControllerInterface/SDL/SDL.cpp | 27 +++++++------------ .../InputCommon/ControllerInterface/SDL/SDL.h | 17 +++++++----- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index 8ed142740e..ae1b8be06f 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -208,42 +208,39 @@ std::string Joystick::LeftRightEffect::GetName() const void Joystick::HapticEffect::SetState(ControlState state) { memset(&m_effect, 0, sizeof(m_effect)); - _SetState(state); + SetSDLHapticEffect(state); + Update(); } -void Joystick::ConstantEffect::_SetState(ControlState state) +void Joystick::ConstantEffect::SetSDLHapticEffect(ControlState state) { if (state) { m_effect.type = SDL_HAPTIC_CONSTANT; m_effect.constant.length = SDL_HAPTIC_INFINITY; + m_effect.constant.level = (Sint16)(state * 0x7FFF); } else { m_effect.type = 0; } - - m_effect.constant.level = (Sint16)(state * 0x7FFF); - Update(); } -void Joystick::RampEffect::_SetState(ControlState state) +void Joystick::RampEffect::SetSDLHapticEffect(ControlState state) { if (state) { m_effect.type = SDL_HAPTIC_RAMP; m_effect.ramp.length = SDL_HAPTIC_INFINITY; + m_effect.ramp.start = (Sint16)(state * 0x7FFF); } else { m_effect.type = 0; } - - m_effect.ramp.start = (Sint16)(state * 0x7FFF); - Update(); } -void Joystick::SineEffect::_SetState(ControlState state) +void Joystick::SineEffect::SetSDLHapticEffect(ControlState state) { if (state) { @@ -260,11 +257,9 @@ void Joystick::SineEffect::_SetState(ControlState state) { m_effect.type = 0; } - - Update(); } -void Joystick::TriangleEffect::_SetState(ControlState state) +void Joystick::TriangleEffect::SetSDLHapticEffect(ControlState state) { if (state) { @@ -281,11 +276,9 @@ void Joystick::TriangleEffect::_SetState(ControlState state) { m_effect.type = 0; } - - Update(); } -void Joystick::LeftRightEffect::_SetState(ControlState state) +void Joystick::LeftRightEffect::SetSDLHapticEffect(ControlState state) { if (state) { @@ -299,8 +292,6 @@ void Joystick::LeftRightEffect::_SetState(ControlState state) { m_effect.type = 0; } - - Update(); } #endif diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h index af1f8ebcb7..2bf695c698 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.h @@ -77,7 +77,7 @@ private: protected: void Update(); - virtual void _SetState(ControlState state) = 0; + virtual void SetSDLHapticEffect(ControlState state) = 0; SDL_HapticEffect m_effect; SDL_Haptic* m_haptic; @@ -91,7 +91,8 @@ private: public: ConstantEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void _SetState(ControlState state) override; + private: + void SetSDLHapticEffect(ControlState state) override; }; class RampEffect : public HapticEffect @@ -99,7 +100,8 @@ private: public: RampEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void _SetState(ControlState state) override; + private: + void SetSDLHapticEffect(ControlState state) override; }; class SineEffect : public HapticEffect @@ -107,7 +109,8 @@ private: public: SineEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void _SetState(ControlState state) override; + private: + void SetSDLHapticEffect(ControlState state) override; }; class TriangleEffect : public HapticEffect @@ -115,7 +118,8 @@ private: public: TriangleEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void _SetState(ControlState state) override; + private: + void SetSDLHapticEffect(ControlState state) override; }; class LeftRightEffect : public HapticEffect @@ -123,7 +127,8 @@ private: public: LeftRightEffect(SDL_Haptic* haptic) : HapticEffect(haptic) {} std::string GetName() const override; - void _SetState(ControlState state) override; + private: + void SetSDLHapticEffect(ControlState state) override; }; #endif From 63660cb17c5050c0298ff9c353ad2bfd9a5de190 Mon Sep 17 00:00:00 2001 From: "Adam D. Moss" Date: Sun, 11 Jan 2015 11:42:30 +0000 Subject: [PATCH 4/6] SDL Input: More minor refactoring of SDL haptic effects --- .../ControllerInterface/SDL/SDL.cpp | 99 +++++++------------ 1 file changed, 36 insertions(+), 63 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index ae1b8be06f..ddd2f26e6e 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -208,90 +208,63 @@ std::string Joystick::LeftRightEffect::GetName() const void Joystick::HapticEffect::SetState(ControlState state) { memset(&m_effect, 0, sizeof(m_effect)); - SetSDLHapticEffect(state); + if (state) + { + SetSDLHapticEffect(state); + } + else + { + // this module uses type==0 to indicate 'off' + m_effect.type = 0; + } Update(); } void Joystick::ConstantEffect::SetSDLHapticEffect(ControlState state) { - if (state) - { - m_effect.type = SDL_HAPTIC_CONSTANT; - m_effect.constant.length = SDL_HAPTIC_INFINITY; - m_effect.constant.level = (Sint16)(state * 0x7FFF); - } - else - { - m_effect.type = 0; - } + m_effect.type = SDL_HAPTIC_CONSTANT; + m_effect.constant.length = SDL_HAPTIC_INFINITY; + m_effect.constant.level = (Sint16)(state * 0x7FFF); } void Joystick::RampEffect::SetSDLHapticEffect(ControlState state) { - if (state) - { - m_effect.type = SDL_HAPTIC_RAMP; - m_effect.ramp.length = SDL_HAPTIC_INFINITY; - m_effect.ramp.start = (Sint16)(state * 0x7FFF); - } - else - { - m_effect.type = 0; - } + m_effect.type = SDL_HAPTIC_RAMP; + m_effect.ramp.length = SDL_HAPTIC_INFINITY; + m_effect.ramp.start = (Sint16)(state * 0x7FFF); } void Joystick::SineEffect::SetSDLHapticEffect(ControlState state) { - if (state) - { - m_effect.type = SDL_HAPTIC_SINE; - m_effect.periodic.period = 1000; - m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); - m_effect.periodic.offset = 0; - m_effect.periodic.phase = 18000; - m_effect.periodic.length = SDL_HAPTIC_INFINITY; - m_effect.periodic.delay = 0; - m_effect.periodic.attack_length = 0; - } - else - { - m_effect.type = 0; - } + m_effect.type = SDL_HAPTIC_SINE; + m_effect.periodic.period = 1000; + m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); + m_effect.periodic.offset = 0; + m_effect.periodic.phase = 18000; + m_effect.periodic.length = SDL_HAPTIC_INFINITY; + m_effect.periodic.delay = 0; + m_effect.periodic.attack_length = 0; } void Joystick::TriangleEffect::SetSDLHapticEffect(ControlState state) { - if (state) - { - m_effect.type = SDL_HAPTIC_TRIANGLE; - m_effect.periodic.period = 1000; - m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); - m_effect.periodic.offset = 0; - m_effect.periodic.phase = 18000; - m_effect.periodic.length = SDL_HAPTIC_INFINITY; - m_effect.periodic.delay = 0; - m_effect.periodic.attack_length = 0; - } - else - { - m_effect.type = 0; - } + m_effect.type = SDL_HAPTIC_TRIANGLE; + m_effect.periodic.period = 1000; + m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); + m_effect.periodic.offset = 0; + m_effect.periodic.phase = 18000; + m_effect.periodic.length = SDL_HAPTIC_INFINITY; + m_effect.periodic.delay = 0; + m_effect.periodic.attack_length = 0; } void Joystick::LeftRightEffect::SetSDLHapticEffect(ControlState state) { - if (state) - { - m_effect.type = SDL_HAPTIC_LEFTRIGHT; - m_effect.leftright.length = SDL_HAPTIC_INFINITY; - // max ranges tuned to 'feel' similar in magnitude to triangle/sine on xbox360 controller - m_effect.leftright.large_magnitude = (Uint16)(state * 0x4000); - m_effect.leftright.small_magnitude = (Uint16)(state * 0xFFFF); - } - else - { - m_effect.type = 0; - } + m_effect.type = SDL_HAPTIC_LEFTRIGHT; + m_effect.leftright.length = SDL_HAPTIC_INFINITY; + // max ranges tuned to 'feel' similar in magnitude to triangle/sine on xbox360 controller + m_effect.leftright.large_magnitude = (Uint16)(state * 0x4000); + m_effect.leftright.small_magnitude = (Uint16)(state * 0xFFFF); } #endif From 076c2b8ec70531ce02e5a7b3da3173ce5e2998fe Mon Sep 17 00:00:00 2001 From: "Adam D. Moss" Date: Sun, 11 Jan 2015 11:57:48 +0000 Subject: [PATCH 5/6] SDL input: unhardcode a few values. & change effect length to half a second instead of infinite, in futile attempt to avoid runaway rumbles. --- .../ControllerInterface/SDL/SDL.cpp | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index ddd2f26e6e..f37a674b03 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -18,6 +18,14 @@ namespace ciface namespace SDL { +namespace +{ +// 10ms = 100Hz which homebrew docs very roughly imply is within WiiMote normal +// range, used for periodic haptic effects though often ignored by devices +const u16 RUMBLE_PERIOD = 10; +const u16 RUMBLE_LENGTH_MAX = 500; // ms: enough to span multiple frames at low FPS, but still finite +} + static std::string GetJoystickName(int index) { #if SDL_VERSION_ATLEAST(2, 0, 0) @@ -223,25 +231,25 @@ void Joystick::HapticEffect::SetState(ControlState state) void Joystick::ConstantEffect::SetSDLHapticEffect(ControlState state) { m_effect.type = SDL_HAPTIC_CONSTANT; - m_effect.constant.length = SDL_HAPTIC_INFINITY; + m_effect.constant.length = RUMBLE_LENGTH_MAX; m_effect.constant.level = (Sint16)(state * 0x7FFF); } void Joystick::RampEffect::SetSDLHapticEffect(ControlState state) { m_effect.type = SDL_HAPTIC_RAMP; - m_effect.ramp.length = SDL_HAPTIC_INFINITY; + m_effect.ramp.length = RUMBLE_LENGTH_MAX; m_effect.ramp.start = (Sint16)(state * 0x7FFF); } void Joystick::SineEffect::SetSDLHapticEffect(ControlState state) { m_effect.type = SDL_HAPTIC_SINE; - m_effect.periodic.period = 1000; + m_effect.periodic.period = RUMBLE_PERIOD; m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); m_effect.periodic.offset = 0; m_effect.periodic.phase = 18000; - m_effect.periodic.length = SDL_HAPTIC_INFINITY; + m_effect.periodic.length = RUMBLE_LENGTH_MAX; m_effect.periodic.delay = 0; m_effect.periodic.attack_length = 0; } @@ -249,11 +257,11 @@ void Joystick::SineEffect::SetSDLHapticEffect(ControlState state) void Joystick::TriangleEffect::SetSDLHapticEffect(ControlState state) { m_effect.type = SDL_HAPTIC_TRIANGLE; - m_effect.periodic.period = 1000; + m_effect.periodic.period = RUMBLE_PERIOD; m_effect.periodic.magnitude = (Sint16)(state * 0x7FFF); m_effect.periodic.offset = 0; m_effect.periodic.phase = 18000; - m_effect.periodic.length = SDL_HAPTIC_INFINITY; + m_effect.periodic.length = RUMBLE_LENGTH_MAX; m_effect.periodic.delay = 0; m_effect.periodic.attack_length = 0; } @@ -261,7 +269,7 @@ void Joystick::TriangleEffect::SetSDLHapticEffect(ControlState state) void Joystick::LeftRightEffect::SetSDLHapticEffect(ControlState state) { m_effect.type = SDL_HAPTIC_LEFTRIGHT; - m_effect.leftright.length = SDL_HAPTIC_INFINITY; + m_effect.leftright.length = RUMBLE_LENGTH_MAX; // max ranges tuned to 'feel' similar in magnitude to triangle/sine on xbox360 controller m_effect.leftright.large_magnitude = (Uint16)(state * 0x4000); m_effect.leftright.small_magnitude = (Uint16)(state * 0xFFFF); From 3300c176e46fda826e528d1ac10ff514ef3d9ec2 Mon Sep 17 00:00:00 2001 From: "Adam D. Moss" Date: Tue, 13 Jan 2015 16:00:35 +0000 Subject: [PATCH 6/6] SDL haptic: minor style change based on review feedback --- Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index f37a674b03..a1fd428a0d 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -18,13 +18,10 @@ namespace ciface namespace SDL { -namespace -{ // 10ms = 100Hz which homebrew docs very roughly imply is within WiiMote normal // range, used for periodic haptic effects though often ignored by devices -const u16 RUMBLE_PERIOD = 10; -const u16 RUMBLE_LENGTH_MAX = 500; // ms: enough to span multiple frames at low FPS, but still finite -} +static const u16 RUMBLE_PERIOD = 10; +static const u16 RUMBLE_LENGTH_MAX = 500; // ms: enough to span multiple frames at low FPS, but still finite static std::string GetJoystickName(int index) {