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. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40428
This commit is contained in:
parent
fd6a9a929b
commit
7a17d3a08b
1 changed files with 7 additions and 1 deletions
|
@ -609,11 +609,17 @@ int SDL_SYS_JoystickInit(void)
|
|||
/*/ Now search I/O Registry for matching devices. */
|
||||
result = IOServiceGetMatchingServices (masterPort, hidMatchDictionary, &hidObjectIterator);
|
||||
/* Check for errors */
|
||||
if ((kIOReturnSuccess != result) || (NULL == hidObjectIterator))
|
||||
if (kIOReturnSuccess != result)
|
||||
{
|
||||
SDL_SetError("Joystick: Couldn't create a HID object iterator.");
|
||||
return -1;
|
||||
}
|
||||
if (NULL == hidObjectIterator) /* there are no joysticks */
|
||||
{
|
||||
gpDeviceList = NULL;
|
||||
SDL_numjoysticks = 0;
|
||||
return 0;
|
||||
}
|
||||
/* IOServiceGetMatchingServices consumes a reference to the dictionary, so we don't need to release the dictionary ref. */
|
||||
|
||||
/* build flat linked list of devices from device iterator */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue