mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-06 18:06:26 +00:00
Re-add SDL_HAPTIC_SQUARE for SDL 3.0
Fixes https://github.com/libsdl-org/SDL/issues/8753 Closes https://github.com/libsdl-org/SDL/pull/8831 Closes https://github.com/libsdl-org/SDL/pull/8783
This commit is contained in:
@@ -366,7 +366,7 @@ int SDL_GetMaxHapticEffectsPlaying(SDL_Haptic *haptic)
|
||||
return haptic->nplaying;
|
||||
}
|
||||
|
||||
unsigned int SDL_GetHapticFeatures(SDL_Haptic *haptic)
|
||||
Uint32 SDL_GetHapticFeatures(SDL_Haptic *haptic)
|
||||
{
|
||||
CHECK_HAPTIC_MAGIC(haptic, 0);
|
||||
|
||||
|
@@ -48,7 +48,7 @@ struct SDL_Haptic
|
||||
struct haptic_effect *effects; /* Allocated effects */
|
||||
int neffects; /* Maximum amount of effects */
|
||||
int nplaying; /* Maximum amount of effects to play at the same time */
|
||||
unsigned int supported; /* Supported effects */
|
||||
Uint32 supported; /* Supported effects and features */
|
||||
int naxes; /* Number of axes on the device. */
|
||||
|
||||
struct haptic_hwdata *hwdata; /* Driver dependent */
|
||||
|
@@ -445,8 +445,7 @@ static unsigned int GetSupportedFeatures(SDL_Haptic *haptic)
|
||||
/* Test for effects. */
|
||||
FF_TEST(FFCAP_ET_CONSTANTFORCE, SDL_HAPTIC_CONSTANT);
|
||||
FF_TEST(FFCAP_ET_RAMPFORCE, SDL_HAPTIC_RAMP);
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* FF_TEST(FFCAP_ET_SQUARE, SDL_HAPTIC_SQUARE); */
|
||||
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);
|
||||
@@ -862,8 +861,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe
|
||||
break;
|
||||
|
||||
case SDL_HAPTIC_SINE:
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* case SDL_HAPTIC_SQUARE: */
|
||||
case SDL_HAPTIC_SQUARE:
|
||||
case SDL_HAPTIC_TRIANGLE:
|
||||
case SDL_HAPTIC_SAWTOOTHUP:
|
||||
case SDL_HAPTIC_SAWTOOTHDOWN:
|
||||
@@ -1077,9 +1075,8 @@ SDL_SYS_HapticEffectType(Uint16 type)
|
||||
case SDL_HAPTIC_RAMP:
|
||||
return kFFEffectType_RampForce_ID;
|
||||
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* case SDL_HAPTIC_SQUARE:
|
||||
return kFFEffectType_Square_ID; */
|
||||
case SDL_HAPTIC_SQUARE:
|
||||
return kFFEffectType_Square_ID;
|
||||
|
||||
case SDL_HAPTIC_SINE:
|
||||
return kFFEffectType_Sine_ID;
|
||||
|
@@ -100,8 +100,7 @@ static int EV_IsHaptic(int fd)
|
||||
/* Convert supported features to SDL_HAPTIC platform-neutral features. */
|
||||
EV_TEST(FF_CONSTANT, SDL_HAPTIC_CONSTANT);
|
||||
EV_TEST(FF_SINE, SDL_HAPTIC_SINE);
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* EV_TEST(FF_SQUARE, SDL_HAPTIC_SQUARE); */
|
||||
EV_TEST(FF_SQUARE, SDL_HAPTIC_SQUARE);
|
||||
EV_TEST(FF_TRIANGLE, SDL_HAPTIC_TRIANGLE);
|
||||
EV_TEST(FF_SAW_UP, SDL_HAPTIC_SAWTOOTHUP);
|
||||
EV_TEST(FF_SAW_DOWN, SDL_HAPTIC_SAWTOOTHDOWN);
|
||||
@@ -761,8 +760,7 @@ static int SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect *src)
|
||||
break;
|
||||
|
||||
case SDL_HAPTIC_SINE:
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* case SDL_HAPTIC_SQUARE: */
|
||||
case SDL_HAPTIC_SQUARE:
|
||||
case SDL_HAPTIC_TRIANGLE:
|
||||
case SDL_HAPTIC_SAWTOOTHUP:
|
||||
case SDL_HAPTIC_SAWTOOTHDOWN:
|
||||
@@ -785,9 +783,8 @@ static int SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect *src)
|
||||
/* Periodic */
|
||||
if (periodic->type == SDL_HAPTIC_SINE) {
|
||||
dest->u.periodic.waveform = FF_SINE;
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* else if (periodic->type == SDL_HAPTIC_SQUARE)
|
||||
dest->u.periodic.waveform = FF_SQUARE; */
|
||||
} else if (periodic->type == SDL_HAPTIC_SQUARE) {
|
||||
dest->u.periodic.waveform = FF_SQUARE;
|
||||
} else if (periodic->type == SDL_HAPTIC_TRIANGLE) {
|
||||
dest->u.periodic.waveform = FF_TRIANGLE;
|
||||
} else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP) {
|
||||
|
@@ -260,8 +260,7 @@ static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv)
|
||||
EFFECT_TEST(GUID_ConstantForce, SDL_HAPTIC_CONSTANT);
|
||||
EFFECT_TEST(GUID_CustomForce, SDL_HAPTIC_CUSTOM);
|
||||
EFFECT_TEST(GUID_Sine, SDL_HAPTIC_SINE);
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* EFFECT_TEST(GUID_Square, SDL_HAPTIC_SQUARE); */
|
||||
EFFECT_TEST(GUID_Square, SDL_HAPTIC_SQUARE);
|
||||
EFFECT_TEST(GUID_Triangle, SDL_HAPTIC_TRIANGLE);
|
||||
EFFECT_TEST(GUID_SawtoothUp, SDL_HAPTIC_SAWTOOTHUP);
|
||||
EFFECT_TEST(GUID_SawtoothDown, SDL_HAPTIC_SAWTOOTHDOWN);
|
||||
@@ -678,8 +677,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest,
|
||||
break;
|
||||
|
||||
case SDL_HAPTIC_SINE:
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* case SDL_HAPTIC_SQUARE: */
|
||||
case SDL_HAPTIC_SQUARE:
|
||||
case SDL_HAPTIC_TRIANGLE:
|
||||
case SDL_HAPTIC_SAWTOOTHUP:
|
||||
case SDL_HAPTIC_SAWTOOTHDOWN:
|
||||
@@ -889,9 +887,8 @@ static REFGUID SDL_SYS_HapticEffectType(SDL_HapticEffect *effect)
|
||||
case SDL_HAPTIC_RAMP:
|
||||
return &GUID_RampForce;
|
||||
|
||||
/* !!! FIXME: put this back when we have more bits in 2.1 */
|
||||
/* case SDL_HAPTIC_SQUARE:
|
||||
return &GUID_Square; */
|
||||
case SDL_HAPTIC_SQUARE:
|
||||
return &GUID_Square;
|
||||
|
||||
case SDL_HAPTIC_SINE:
|
||||
return &GUID_Sine;
|
||||
|
Reference in New Issue
Block a user