Browse Source

Revert commit a502906: let haxe manage sdl device id (#631)

Yuxiao Mao 1 year ago
parent
commit
8a63b99eca
1 changed files with 2 additions and 4 deletions
  1. 2 4
      libs/sdl/sdl.c

+ 2 - 4
libs/sdl/sdl.c

@@ -275,13 +275,11 @@ HL_PRIM bool HL_NAME(event_loop)( event_data *event ) {
 			break;
 		case SDL_CONTROLLERDEVICEADDED:
 			event->type = GControllerAdded;
-			SDL_GameController * controller = SDL_GameControllerOpen(e.cdevice.which);
-            SDL_Joystick* j = SDL_GameControllerGetJoystick(controller);
-			event->controller = SDL_JoystickInstanceID(j);
+			event->controller = e.jdevice.which;
 			break;
 		case SDL_CONTROLLERDEVICEREMOVED:
 			event->type = GControllerRemoved;
-			event->controller = e.cdevice.which;
+			event->controller = e.jdevice.which;
 			break;
 		case SDL_CONTROLLERBUTTONDOWN:
 			event->type = GControllerDown;