|
@@ -729,7 +729,6 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
|
|
|
static int
|
|
|
SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
|
|
|
{
|
|
|
- Uint32 tmp;
|
|
|
SDL_HapticConstant *constant;
|
|
|
SDL_HapticPeriodic *periodic;
|
|
|
SDL_HapticCondition *condition;
|
|
@@ -807,9 +806,8 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
|
|
|
dest->u.periodic.period = CLAMP(periodic->period);
|
|
|
dest->u.periodic.magnitude = periodic->magnitude;
|
|
|
dest->u.periodic.offset = periodic->offset;
|
|
|
- /* Phase is calculated based of offset from period and then clamped. */
|
|
|
- tmp = ((periodic->phase % 36000) * dest->u.periodic.period) / 36000;
|
|
|
- dest->u.periodic.phase = CLAMP(tmp);
|
|
|
+ /* Linux phase is defined in interval "[0x0000, 0x10000[", corresponds with "[0deg, 360deg[" phase shift. */
|
|
|
+ dest->u.periodic.phase = ((Uint32)periodic->phase * 0x10000U) / 36000;
|
|
|
|
|
|
/* Envelope */
|
|
|
dest->u.periodic.envelope.attack_length =
|