Mercurial > sdl-ios-xcode
comparison src/haptic/windows/SDL_syshaptic.c @ 5092:327f181542f1
Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 24 Jan 2011 21:20:30 -0800 |
parents | e8916fe9cfc8 |
children |
comparison
equal
deleted
inserted
replaced
5091:79bd1e289005 | 5092:327f181542f1 |
---|---|
37 * List of available haptic devices. | 37 * List of available haptic devices. |
38 */ | 38 */ |
39 static struct | 39 static struct |
40 { | 40 { |
41 DIDEVICEINSTANCE instance; | 41 DIDEVICEINSTANCE instance; |
42 char *name; | |
42 SDL_Haptic *haptic; | 43 SDL_Haptic *haptic; |
43 DIDEVCAPS capabilities; | 44 DIDEVCAPS capabilities; |
44 } SDL_hapticlist[MAX_HAPTICS]; | 45 } SDL_hapticlist[MAX_HAPTICS]; |
45 | 46 |
46 | 47 |
218 /* DI_SetError("Getting device capabilities",ret); */ | 219 /* DI_SetError("Getting device capabilities",ret); */ |
219 IDirectInputDevice_Release(device); | 220 IDirectInputDevice_Release(device); |
220 return DIENUM_CONTINUE; | 221 return DIENUM_CONTINUE; |
221 } | 222 } |
222 | 223 |
224 /* Copy the name */ | |
225 SDL_hapticlist[SDL_numhaptics].name = WIN_StringToUTF8(SDL_hapticlist[SDL_numhaptics].instance.tszProductName); | |
226 | |
223 /* Close up device and count it. */ | 227 /* Close up device and count it. */ |
224 IDirectInputDevice_Release(device); | 228 IDirectInputDevice_Release(device); |
225 SDL_numhaptics++; | 229 SDL_numhaptics++; |
226 | 230 |
227 /* Watch out for hard limit. */ | 231 /* Watch out for hard limit. */ |
236 * Return the name of a haptic device, does not need to be opened. | 240 * Return the name of a haptic device, does not need to be opened. |
237 */ | 241 */ |
238 const char * | 242 const char * |
239 SDL_SYS_HapticName(int index) | 243 SDL_SYS_HapticName(int index) |
240 { | 244 { |
241 return SDL_hapticlist[index].instance.tszProductName; | 245 return SDL_hapticlist[index].name; |
242 } | 246 } |
243 | 247 |
244 | 248 |
245 /* | 249 /* |
246 * Callback to get all supported effects. | 250 * Callback to get all supported effects. |
628 * Clean up after system specific haptic stuff | 632 * Clean up after system specific haptic stuff |
629 */ | 633 */ |
630 void | 634 void |
631 SDL_SYS_HapticQuit(void) | 635 SDL_SYS_HapticQuit(void) |
632 { | 636 { |
637 int i; | |
638 | |
639 for (i = 0; i < SDL_arraysize(SDL_hapticlist); ++i) { | |
640 if (SDL_hapticlist[i].name) { | |
641 SDL_free(SDL_hapticlist[i].name); | |
642 SDL_hapticlist[i].name = NULL; | |
643 } | |
644 } | |
645 | |
633 IDirectInput_Release(dinput); | 646 IDirectInput_Release(dinput); |
634 dinput = NULL; | 647 dinput = NULL; |
635 } | 648 } |
636 | 649 |
637 | 650 |