Commits

Alex Szpakowski  committed 77058c9

Prefer the Joystick name rather than the GameController name for Joystick:getName

  • Participants
  • Parent commits 3efe7a8

Comments (0)

Files changed (1)

File src/modules/joystick/sdl/Joystick.cpp

 		// See if SDL thinks this is a Game Controller.
 		openGamepad(deviceindex);
 
-		// Prefer the GameController name.
-		if (controller)
-			name = SDL_GameControllerName(controller);
-		else
-			name = SDL_JoystickName(joyhandle);
+		// Prefer the Joystick name for consistency.
+		const char *joyname = SDL_JoystickName(joyhandle);
+		if (!joyname && controller)
+			joyname = SDL_GameControllerName(controller);
+
+		if (joyname)
+			name = joyname;
 	}
 
 	return isConnected();