SDL_GetHaptics() follows the SDL_GetStringRule

This commit is contained in:
Sam Lantinga 2024-07-18 17:08:30 -07:00
parent 9de8cb888a
commit b32c9615a7
7 changed files with 12 additions and 23 deletions

View file

@ -40,7 +40,7 @@ int main(int argc, char **argv)
int id[9];
int nefx;
unsigned int supported;
SDL_HapticID *haptics;
const SDL_HapticID *haptics;
int num_haptics;
/* Initialize test framework */
@ -91,7 +91,6 @@ int main(int argc, char **argv)
if (haptics) {
if (num_haptics == 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n");
SDL_free(haptics);
return 1;
}
@ -101,7 +100,6 @@ int main(int argc, char **argv)
if (i >= num_haptics) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index out of range, aborting.\n");
SDL_free(haptics);
return 1;
}
}
@ -115,7 +113,6 @@ int main(int argc, char **argv)
if (i >= num_haptics) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", name);
SDL_free(haptics);
return 1;
}
}
@ -123,12 +120,10 @@ int main(int argc, char **argv)
haptic = SDL_OpenHaptic(haptics[i]);
if (!haptic) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError());
SDL_free(haptics);
return 1;
}
SDL_Log("Device: %s\n", SDL_GetHapticName(haptic));
HapticPrintSupported(haptic);
SDL_free(haptics);
}
/* We only want force feedback errors. */