# HG changeset patch # User Edgar Simo # Date 1217952176 0 # Node ID 4eee4d565368e54c69eef8546bf6ecfe54fa3e76 # Parent a84ce5ae893618ef1f6b5e0c51d5876313b09204 Better handling of direction axes. diff -r a84ce5ae8936 -r 4eee4d565368 src/haptic/darwin/SDL_syshaptic.c --- a/src/haptic/darwin/SDL_syshaptic.c Tue Aug 05 15:56:35 2008 +0000 +++ b/src/haptic/darwin/SDL_syshaptic.c Tue Aug 05 16:02:56 2008 +0000 @@ -555,14 +555,18 @@ case SDL_HAPTIC_CARTESIAN: effect->dwFlags |= FFEFF_CARTESIAN; rglDir[0] = dir->dir[0]; - rglDir[1] = dir->dir[1]; - rglDir[2] = dir->dir[2]; + if (naxes > 1) + rglDir[1] = dir->dir[1]; + if (naxes > 2) + rglDir[2] = dir->dir[2]; return 0; case SDL_HAPTIC_SPHERICAL: effect->dwFlags |= FFEFF_SPHERICAL; rglDir[0] = dir->dir[0]; - rglDir[1] = dir->dir[1]; - rglDir[2] = dir->dir[2]; + if (naxes > 1) + rglDir[1] = dir->dir[1]; + if (naxes > 2) + rglDir[2] = dir->dir[2]; return 0; default: diff -r a84ce5ae8936 -r 4eee4d565368 src/haptic/win32/SDL_syshaptic.c --- a/src/haptic/win32/SDL_syshaptic.c Tue Aug 05 15:56:35 2008 +0000 +++ b/src/haptic/win32/SDL_syshaptic.c Tue Aug 05 16:02:56 2008 +0000 @@ -568,14 +568,18 @@ case SDL_HAPTIC_CARTESIAN: effect->dwFlags |= DIEFF_CARTESIAN; rglDir[0] = dir->dir[0]; - rglDir[1] = dir->dir[1]; - rglDir[2] = dir->dir[2]; + if (naxes > 1) + rglDir[1] = dir->dir[1]; + if (naxes > 2) + rglDir[2] = dir->dir[2]; return 0; case SDL_HAPTIC_SPHERICAL: effect->dwFlags |= DIEFF_SPHERICAL; rglDir[0] = dir->dir[0]; - rglDir[1] = dir->dir[1]; - rglDir[2] = dir->dir[2]; + if (naxes > 1) + rglDir[1] = dir->dir[1]; + if (naxes > 2) + rglDir[2] = dir->dir[2]; return 0; default: