Hmm, this should work a little better. :)
authorSam Lantinga <slouken@libsdl.org>
Sat, 21 Aug 2004 03:55:12 +0000
changeset 938fa2ce068b0b6
parent 937 1e6366bde299
child 939 c7c04f811994
Hmm, this should work a little better. :)
src/joystick/win32/SDL_mmjoystick.c
     1.1 --- a/src/joystick/win32/SDL_mmjoystick.c	Sat Aug 21 03:45:58 2004 +0000
     1.2 +++ b/src/joystick/win32/SDL_mmjoystick.c	Sat Aug 21 03:55:12 2004 +0000
     1.3 @@ -52,7 +52,7 @@
     1.4  /* array to hold joystick ID values */
     1.5  static UINT	SYS_JoystickID[MAX_JOYSTICKS];
     1.6  static JOYCAPS	SYS_Joystick[MAX_JOYSTICKS];
     1.7 -static char	*SYS_JoystickNames[MAX_JOYSTICKS];
     1.8 +static char	*SYS_JoystickName[MAX_JOYSTICKS];
     1.9  
    1.10  /* The private structure used to keep track of a joystick */
    1.11  struct joystick_hwdata
    1.12 @@ -72,7 +72,7 @@
    1.13  static void SetMMerror(char *function, int code);
    1.14  
    1.15  
    1.16 -static char *GetJoystickName(const char *szRegKey)
    1.17 +static char *GetJoystickName(int index, const char *szRegKey)
    1.18  {
    1.19  	/* added 7/24/2004 by Eckhard Stolberg */
    1.20  	/*
    1.21 @@ -101,7 +101,7 @@
    1.22  		*/
    1.23  		regsize = sizeof(regname);
    1.24  		sprintf(regvalue,
    1.25 -			"Joystick%d%s", i+1,
    1.26 +			"Joystick%d%s", index+1,
    1.27  			REGSTR_VAL_JOYOEMNAME);
    1.28  		regresult = RegQueryValueExA(hKey,
    1.29  			regvalue, 0, 0, (LPBYTE) &regname,
    1.30 @@ -168,7 +168,7 @@
    1.31  
    1.32  	for ( i = 0; i < MAX_JOYSTICKS; i++ ) {
    1.33  		SYS_JoystickID[i] = JOYSTICKID1 + i;
    1.34 -		SYS_JoystickNames[i] = NULL;
    1.35 +		SYS_JoystickName[i] = NULL;
    1.36  	}
    1.37  
    1.38  
    1.39 @@ -185,7 +185,7 @@
    1.40  			if ( result == JOYERR_NOERROR ) {
    1.41  				SYS_JoystickID[numdevs] = SYS_JoystickID[i];
    1.42  				SYS_Joystick[numdevs] = joycaps;
    1.43 -				SYS_JoystickName[numdevs] = GetJoystickName(joycaps.szRegKey);
    1.44 +				SYS_JoystickName[numdevs] = GetJoystickName(numdevs, joycaps.szRegKey);
    1.45  				numdevs++;
    1.46  			}
    1.47  		}
    1.48 @@ -196,8 +196,8 @@
    1.49  /* Function to get the device-dependent name of a joystick */
    1.50  const char *SDL_SYS_JoystickName(int index)
    1.51  {
    1.52 -	if ( SYS_JoystickNames[index] != NULL ) {
    1.53 -		return(SYS_JoystickNames[index]);
    1.54 +	if ( SYS_JoystickName[index] != NULL ) {
    1.55 +		return(SYS_JoystickName[index]);
    1.56  	} else {
    1.57  		return(SYS_Joystick[index].szPname);
    1.58  	}
    1.59 @@ -373,8 +373,8 @@
    1.60  {
    1.61  	int i;
    1.62  	for (i = 0; i < MAX_JOYSTICKS; i++) {
    1.63 -		if ( SYS_JoystickNames[i] != NULL ) {
    1.64 -			free(SYS_JoystickNames[i]);
    1.65 +		if ( SYS_JoystickName[i] != NULL ) {
    1.66 +			free(SYS_JoystickName[i]);
    1.67  		}
    1.68  	}
    1.69  }