| | |
| | | static int |
| | | DI_SetError(const char *str, HRESULT err) |
| | | { |
| | | /* |
| | | SDL_SetError("Haptic: %s - %s: %s", str, |
| | | DXGetErrorString8A(err), DXGetErrorDescription8A(err)); |
| | | */ |
| | | return SDL_SetError("Haptic error %s", str); |
| | | } |
| | | |
| | |
| | | coinitialized = SDL_TRUE; |
| | | |
| | | ret = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, |
| | | &IID_IDirectInput8, (LPVOID)& dinput); |
| | | &IID_IDirectInput8, (LPVOID *) &dinput); |
| | | if (FAILED(ret)) { |
| | | SDL_SYS_HapticQuit(); |
| | | return DI_SetError("CoCreateInstance", ret); |
| | |
| | | if (naxes > 2) |
| | | rglDir[2] = dir->dir[2]; |
| | | return 0; |
| | | case SDL_HAPTIC_STEERING_AXIS: |
| | | effect->dwFlags |= DIEFF_CARTESIAN; |
| | | rglDir[0] = 0; |
| | | return 0; |
| | | |
| | | default: |
| | | return SDL_SetError("Haptic: Unknown direction type."); |
| | |
| | | envelope->dwSize = sizeof(DIENVELOPE); /* Always should be this. */ |
| | | |
| | | /* Axes. */ |
| | | dest->cAxes = haptic->naxes; |
| | | if (src->constant.direction.type == SDL_HAPTIC_STEERING_AXIS) { |
| | | dest->cAxes = 1; |
| | | } else { |
| | | dest->cAxes = haptic->naxes; |
| | | } |
| | | if (dest->cAxes > 0) { |
| | | axes = SDL_malloc(sizeof(DWORD) * dest->cAxes); |
| | | if (axes == NULL) { |