1.1 --- a/src/haptic/windows/SDL_syshaptic.c Mon Jan 24 17:47:18 2011 -0800
1.2 +++ b/src/haptic/windows/SDL_syshaptic.c Mon Jan 24 21:20:30 2011 -0800
1.3 @@ -39,6 +39,7 @@
1.4 static struct
1.5 {
1.6 DIDEVICEINSTANCE instance;
1.7 + char *name;
1.8 SDL_Haptic *haptic;
1.9 DIDEVCAPS capabilities;
1.10 } SDL_hapticlist[MAX_HAPTICS];
1.11 @@ -220,6 +221,9 @@
1.12 return DIENUM_CONTINUE;
1.13 }
1.14
1.15 + /* Copy the name */
1.16 + SDL_hapticlist[SDL_numhaptics].name = WIN_StringToUTF8(SDL_hapticlist[SDL_numhaptics].instance.tszProductName);
1.17 +
1.18 /* Close up device and count it. */
1.19 IDirectInputDevice_Release(device);
1.20 SDL_numhaptics++;
1.21 @@ -238,7 +242,7 @@
1.22 const char *
1.23 SDL_SYS_HapticName(int index)
1.24 {
1.25 - return SDL_hapticlist[index].instance.tszProductName;
1.26 + return SDL_hapticlist[index].name;
1.27 }
1.28
1.29
1.30 @@ -630,6 +634,15 @@
1.31 void
1.32 SDL_SYS_HapticQuit(void)
1.33 {
1.34 + int i;
1.35 +
1.36 + for (i = 0; i < SDL_arraysize(SDL_hapticlist); ++i) {
1.37 + if (SDL_hapticlist[i].name) {
1.38 + SDL_free(SDL_hapticlist[i].name);
1.39 + SDL_hapticlist[i].name = NULL;
1.40 + }
1.41 + }
1.42 +
1.43 IDirectInput_Release(dinput);
1.44 dinput = NULL;
1.45 }