소스 검색

Fixed Joystick:getName to be more consistent

Alex Szpakowski 12 년 전
부모
커밋
25caa188ba
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      src/modules/joystick/sdl/Joystick.cpp

+ 6 - 4
src/modules/joystick/sdl/Joystick.cpp

@@ -124,11 +124,13 @@ const char *Joystick::getName() const
 	if (!isConnected())
 		return name.c_str();
 
-	// Prefer SDL's GameController name, if possible.
-	if (isGamepad())
-		return SDL_GameControllerName(controller);
+	// Prefer the Joystick name for consistency.
+	const char *joyname = SDL_JoystickName(joyhandle);
+
+	if (!joyname && isGamepad())
+		joyname = SDL_GameControllerName(controller);
 
-	return SDL_JoystickName(joyhandle);
+	return joyname;
 }
 
 int Joystick::getAxisCount() const