Availability of game controller API is now determined on runtime

This commit is contained in:
alexey.lysiuk 2014-11-09 17:13:03 +02:00
parent 660ebf2c6c
commit c024b30e9d

View file

@ -33,7 +33,7 @@
#include "m_joy.h"
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#include <CoreServices/CoreServices.h>
#include "HID_Utilities_External.h"
@ -726,7 +726,19 @@ IOKitJoystickManager* s_joystickManager;
void I_StartupJoysticks()
{
SInt32 majorVersion = 0;
SInt32 minorVersion = 0;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Gestalt(gestaltSystemVersionMajor, &majorVersion);
Gestalt(gestaltSystemVersionMinor, &minorVersion);
#pragma clang diagnostic pop
if (majorVersion >= 10 && minorVersion >= 5)
{
s_joystickManager = new IOKitJoystickManager;
}
}
void I_ShutdownJoysticks()
@ -776,37 +788,3 @@ void I_ProcessJoysticks()
s_joystickManager->Update();
}
}
#else // prior to 10.5
void I_StartupJoysticks()
{
}
void I_ShutdownJoysticks()
{
}
void I_GetJoysticks(TArray<IJoystickConfig*>& sticks)
{
sticks.Clear();
}
void I_GetAxes(float axes[NUM_JOYAXIS])
{
for (size_t i = 0; i < NUM_JOYAXIS; ++i)
{
axes[i] = 0.0f;
}
}
IJoystickConfig *I_UpdateDeviceList()
{
return NULL;
}
void I_ProcessJoysticks()
{
}
#endif // 10.5 or higher