Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Many typo and silly mistake fixes.
  • Loading branch information
bobbens committed Jul 15, 2008
1 parent f4d1d67 commit 9452bd2
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/haptic/darwin/SDL_syshaptic.c
Expand Up @@ -29,6 +29,7 @@
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
/*#include "../../joystick/dawrin/SDL_sysjoystick_c.h"*/ /* For joystick hwdata */

#include <IOKit/IOTypes.h>
#include <ForceFeedback/ForceFeedback.h>
#include <ForceFeedback/ForceFeedbackConstants.h>

Expand Down Expand Up @@ -75,7 +76,7 @@ SDL_SYS_HapticInit(void)
IOReturn result;
io_iterator_t iter;
CFDictionaryRef match;
io_sercive_t device;
io_service_t device;

/* Get HID devices. */
match = IOServiceMatching(kIOHIDDeviceKey);
Expand Down Expand Up @@ -172,7 +173,7 @@ GetSupportedFeatures(FFDeviceObjectReference device,
}

/* Checks if supports autocenter. */
ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_FFAUTOCENTER,
ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_AUTOCENTER,
val, sizeof(val));
if (ret == FF_OK) supported |= SDL_HAPTIC_AUTOCENTER;
else if (ret != FFERR_UNSUPPORTED) {
Expand Down Expand Up @@ -339,31 +340,31 @@ SDL_SYS_HapticQuit(void)
static int
SDL_SYS_SetDirection( FFEFFECT * effect, SDL_HapticDirection *dir, int axes )
{
LONG *dir;
LONG *rglDir;
dir = SDL_malloc( sizeof(LONG) * axes );
if (dir == NULL) {
SDL_OutOfMemory();
return -1;
}
SDL_memset( dir, 0, sizeof(LONG) * axes );
effect->rglDirection = dir;
effect->rglDirection = rglDir;

switch (dir->type) {
case SDL_HAPTIC_POLAR:
effect->dwFlags |= FFEFF_POLAR;
dir[0] = dir->dir[0];
rglDir[0] = dir->dir[0];
return 0;
case SDL_HAPTIC_CARTESIAN:
effects->dwFlags |= FFEFF_CARTESIAN;
dir[0] = dir->dir[0];
dir[1] = dir->dir[1];
dir[2] = dir->dir[2];
rglDir[0] = dir->dir[0];
rglDir[1] = dir->dir[1];
rglDir[2] = dir->dir[2];
return 0;
case SDL_HAPTIC_SHPERICAL:
case SDL_HAPTIC_SPHERICAL:
effects->dwFlags |= FFEFF_SPHERICAL;
dir[0] = dir->dir[0];
dir[1] = dir->dir[1];
dir[2] = dir->dir[2];
rglDir[0] = dir->dir[0];
rglDir[1] = dir->dir[1];
rglDir[2] = dir->dir[2];
return 0;

default:
Expand All @@ -385,7 +386,7 @@ SDL_SYS_ToFFEFFECT( FFEFFECT * dest, SDL_HapticEffect * src )
FFRAMPFORCE *ramp;
FFCUSTOMFORCE *custom;
SDL_HapticConstant *hap_constant;
SDL_HapticPeriodic *hap-periodic;
SDL_HapticPeriodic *hap_periodic;
SDL_HapticCondition *hap_condition;
SDL_HapticRamp *hap_ramp;

Expand All @@ -407,10 +408,10 @@ SDL_SYS_ToFFEFFECT( FFEFFECT * dest, SDL_HapticEffect * src )
dest->lpvTypeSpecificParams = constant;

/* Generics */
dest->dwDuration = src->length * 1000; /* In microseconds. */
dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */
dest->dwTriggerButton = FFJOFS_BUTTON(hap_constant->button);
dest->dwTriggerRepeatInterval = hap_constant->interval;
dest->dwStartDelay = src->delay * 1000; /* In microseconds. */
dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */

/* Axes */
dest->cAxes = 2; /* TODO handle */
Expand Down Expand Up @@ -468,7 +469,7 @@ SDL_SYS_ToFFEFFECT( FFEFFECT * dest, SDL_HapticEffect * src )
*/
CFUUIDRef SDL_SYS_HapticEffectType(struct haptic_effect * effect)
{
switch (effect->effect->type) {
switch (effect->effect.type) {
case SDL_HAPTIC_CONSTANT:
return kFFEffectType_ConstantForce_ID;

Expand All @@ -481,7 +482,7 @@ CFUUIDRef SDL_SYS_HapticEffectType(struct haptic_effect * effect)
case SDL_HAPTIC_SINE:
return kFFEffectType_Sine_ID;

case SDL_HAPTIC_TRIANGLE;
case SDL_HAPTIC_TRIANGLE:
return kFFEffectType_Triangle_ID;

case SDL_HAPTIC_SAWTOOTHUP:
Expand Down Expand Up @@ -539,7 +540,7 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect * effect,
}

/* Get the effect. */
if (SDL_SYS_ToFFEFFECT( &effect->hweffect->effect, &haptic_effect->effect ) < 0) {
if (SDL_SYS_ToFFEFFECT( &effect->hweffect->effect, &effect->effect ) < 0) {
/* TODO cleanup alloced stuff. */
return -1;
}
Expand Down Expand Up @@ -572,7 +573,7 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect,

/* Check if it's infinite. */
if (iterations == SDL_HAPTIC_INFINITY) {
iter = INFINITE;
iter = FF_INFINITE;
}
else
iter = iterations;
Expand Down Expand Up @@ -634,7 +635,7 @@ SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect * effect
HRESULT ret;
FFEffectStatusFlag status;

ret = FFEffectGetEffectStatus(effect->hweffect.ref, &status);
ret = FFEffectGetEffectStatus(effect->hweffect->ref, &status);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to get effect status.");
return -1;
Expand Down Expand Up @@ -679,7 +680,7 @@ SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
else val = 1;

ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
FFPROP_FFAUTOCENTER, &val);
FFPROP_AUTOCENTER, &val);
if (ret != FF_OK) {
SDL_SetError("Haptic: Error setting autocenter.");
return -1;
Expand Down

0 comments on commit 9452bd2

Please sign in to comment.