Replaced SDL_HAPTIC_SQUARE with SDL_HAPTIC_LEFTRIGHT.

We needed a bit, so we're hoping no one needs this effect, especially when
it's fairly close to SDL_HAPTIC_SINE, we hope.

SDL_HAPTIC_LEFTRIGHT maps to XInput's functionality, so this removes the SINE
code for the XInput driver to keep things clean.

This also makes the simplified Rumble API use SDL_HAPTIC_LEFTRIGHT if
SDL_HAPTIC_SINE isn't available, to keep XInput working.

When we break the ABI, and can extend the supported capabilities field from
a Uint16, we'll add SDL_HAPTIC_SQUARE back in.

This patch is based on work by Ethan Lee.
This commit is contained in:
Ryan C. Gordon 2013-08-10 13:38:09 -04:00
parent 24097af6ac
commit c35c4a6f18
6 changed files with 146 additions and 62 deletions

View file

@ -342,7 +342,8 @@ GetSupportedFeatures(SDL_Haptic * haptic)
/* Test for effects. */
FF_TEST(FFCAP_ET_CONSTANTFORCE, SDL_HAPTIC_CONSTANT);
FF_TEST(FFCAP_ET_RAMPFORCE, SDL_HAPTIC_RAMP);
FF_TEST(FFCAP_ET_SQUARE, SDL_HAPTIC_SQUARE);
/* !!! FIXME: put this back when we have more bits in 2.1 */
/*FF_TEST(FFCAP_ET_SQUARE, SDL_HAPTIC_SQUARE);*/
FF_TEST(FFCAP_ET_SINE, SDL_HAPTIC_SINE);
FF_TEST(FFCAP_ET_TRIANGLE, SDL_HAPTIC_TRIANGLE);
FF_TEST(FFCAP_ET_SAWTOOTHUP, SDL_HAPTIC_SAWTOOTHUP);
@ -750,7 +751,8 @@ SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest,
break;
case SDL_HAPTIC_SINE:
case SDL_HAPTIC_SQUARE:
/* !!! FIXME: put this back when we have more bits in 2.1 */
/*case SDL_HAPTIC_SQUARE:*/
case SDL_HAPTIC_TRIANGLE:
case SDL_HAPTIC_SAWTOOTHUP:
case SDL_HAPTIC_SAWTOOTHDOWN:
@ -978,8 +980,9 @@ SDL_SYS_HapticEffectType(Uint16 type)
case SDL_HAPTIC_RAMP:
return kFFEffectType_RampForce_ID;
case SDL_HAPTIC_SQUARE:
return kFFEffectType_Square_ID;
/* !!! FIXME: put this back when we have more bits in 2.1 */
/*case SDL_HAPTIC_SQUARE:
return kFFEffectType_Square_ID;*/
case SDL_HAPTIC_SINE:
return kFFEffectType_Sine_ID;