comparison src/joystick/darwin/SDL_sysjoystick.c @ 427:027ae30b867f

Date: Mon, 29 Jul 2002 15:07:22 +1000 From: screwtape@froup.com The attached patch lets SDL_Init(SDL_INIT_JOYSTICK) succeed on Mac OS X when there are no joysticks attached, in line with SDL's behaviour on Linux.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 Jul 2002 22:26:43 +0000
parents f6ffac90895c
children 429fe382fe4f
comparison
equal deleted inserted replaced
426:33712e5d1ec8 427:027ae30b867f
607 } 607 }
608 608
609 /*/ Now search I/O Registry for matching devices. */ 609 /*/ Now search I/O Registry for matching devices. */
610 result = IOServiceGetMatchingServices (masterPort, hidMatchDictionary, &hidObjectIterator); 610 result = IOServiceGetMatchingServices (masterPort, hidMatchDictionary, &hidObjectIterator);
611 /* Check for errors */ 611 /* Check for errors */
612 if ((kIOReturnSuccess != result) || (NULL == hidObjectIterator)) 612 if (kIOReturnSuccess != result)
613 { 613 {
614 SDL_SetError("Joystick: Couldn't create a HID object iterator."); 614 SDL_SetError("Joystick: Couldn't create a HID object iterator.");
615 return -1; 615 return -1;
616 }
617 if (NULL == hidObjectIterator) /* there are no joysticks */
618 {
619 gpDeviceList = NULL;
620 SDL_numjoysticks = 0;
621 return 0;
616 } 622 }
617 /* IOServiceGetMatchingServices consumes a reference to the dictionary, so we don't need to release the dictionary ref. */ 623 /* IOServiceGetMatchingServices consumes a reference to the dictionary, so we don't need to release the dictionary ref. */
618 624
619 /* build flat linked list of devices from device iterator */ 625 /* build flat linked list of devices from device iterator */
620 626