mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 07:43:52 +00:00
(Apple) HID - indenting nits
This commit is contained in:
parent
4349ef0311
commit
41f9a47a01
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
struct apple_pad_connection
|
struct apple_pad_connection
|
||||||
{
|
{
|
||||||
int v_id;
|
int v_id;
|
||||||
int p_id;
|
int p_id;
|
||||||
uint32_t slot;
|
uint32_t slot;
|
||||||
IOHIDDeviceRef device_handle;
|
IOHIDDeviceRef device_handle;
|
||||||
uint8_t data[2048];
|
uint8_t data[2048];
|
||||||
};
|
};
|
||||||
|
|
||||||
static IOHIDManagerRef g_hid_manager;
|
static IOHIDManagerRef g_hid_manager;
|
||||||
@ -71,31 +71,31 @@ static void hid_device_input_callback(void* context, IOReturn result,
|
|||||||
case kIOHIDElementTypeInput_Misc:
|
case kIOHIDElementTypeInput_Misc:
|
||||||
switch (use)
|
switch (use)
|
||||||
{
|
{
|
||||||
case kHIDUsage_GD_Hatswitch:
|
case kHIDUsage_GD_Hatswitch:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
static const uint32_t axis_use_ids[4] = { 48, 49, 50, 53 };
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i ++)
|
|
||||||
{
|
|
||||||
if (use == axis_use_ids[i])
|
|
||||||
{
|
{
|
||||||
CFIndex min, max, state;
|
static const uint32_t axis_use_ids[4] = { 48, 49, 50, 53 };
|
||||||
float val;
|
int i;
|
||||||
|
|
||||||
min = IOHIDElementGetPhysicalMin(element);
|
for (i = 0; i < 4; i ++)
|
||||||
max = IOHIDElementGetPhysicalMax(element) - min;
|
{
|
||||||
state = IOHIDValueGetIntegerValue(value) - min;
|
if (use == axis_use_ids[i])
|
||||||
|
{
|
||||||
|
CFIndex min, max, state;
|
||||||
|
float val;
|
||||||
|
|
||||||
val = (float)state / (float)max;
|
min = IOHIDElementGetPhysicalMin(element);
|
||||||
apple->axes[connection->slot][i] =
|
max = IOHIDElementGetPhysicalMax(element) - min;
|
||||||
((val * 2.0f) - 1.0f) * 32767.0f;
|
state = IOHIDValueGetIntegerValue(value) - min;
|
||||||
|
|
||||||
|
val = (float)state / (float)max;
|
||||||
|
apple->axes[connection->slot][i] =
|
||||||
|
((val * 2.0f) - 1.0f) * 32767.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -121,39 +121,39 @@ static void hid_device_input_callback(void* context, IOReturn result,
|
|||||||
|
|
||||||
static void hid_device_removed(void* context, IOReturn result, void* sender)
|
static void hid_device_removed(void* context, IOReturn result, void* sender)
|
||||||
{
|
{
|
||||||
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
|
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
|
||||||
struct apple_pad_connection* connection = (struct apple_pad_connection*)
|
struct apple_pad_connection* connection = (struct apple_pad_connection*)
|
||||||
context;
|
context;
|
||||||
|
|
||||||
if (connection && connection->slot < MAX_PLAYERS)
|
if (connection && connection->slot < MAX_PLAYERS)
|
||||||
{
|
{
|
||||||
char msg[512];
|
char msg[512];
|
||||||
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.",
|
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.",
|
||||||
connection->slot, "N/A");
|
connection->slot, "N/A");
|
||||||
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
|
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
|
||||||
RARCH_LOG("[apple_input]: %s\n", msg);
|
RARCH_LOG("[apple_input]: %s\n", msg);
|
||||||
|
|
||||||
apple->buttons[connection->slot] = 0;
|
apple->buttons[connection->slot] = 0;
|
||||||
memset(apple->axes[connection->slot], 0, sizeof(apple->axes));
|
memset(apple->axes[connection->slot], 0, sizeof(apple->axes));
|
||||||
|
|
||||||
apple_joypad_disconnect(connection->slot);
|
apple_joypad_disconnect(connection->slot);
|
||||||
free(connection);
|
free(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
IOHIDDeviceClose(sender, kIOHIDOptionsTypeSeizeDevice);
|
IOHIDDeviceClose(sender, kIOHIDOptionsTypeSeizeDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hid_device_report(void* context, IOReturn result, void *sender,
|
static void hid_device_report(void* context, IOReturn result, void *sender,
|
||||||
IOHIDReportType type, uint32_t reportID, uint8_t *report,
|
IOHIDReportType type, uint32_t reportID, uint8_t *report,
|
||||||
CFIndex reportLength)
|
CFIndex reportLength)
|
||||||
{
|
{
|
||||||
struct apple_pad_connection* connection = (struct apple_pad_connection*)
|
struct apple_pad_connection* connection = (struct apple_pad_connection*)
|
||||||
context;
|
context;
|
||||||
apple_joypad_packet(connection->slot, connection->data, reportLength + 1);
|
apple_joypad_packet(connection->slot, connection->data, reportLength + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hid_manager_device_attached(void* context, IOReturn result,
|
static void hid_manager_device_attached(void* context, IOReturn result,
|
||||||
void* sender, IOHIDDeviceRef device)
|
void* sender, IOHIDDeviceRef device)
|
||||||
{
|
{
|
||||||
char device_name[PATH_MAX];
|
char device_name[PATH_MAX];
|
||||||
CFStringRef device_name_ref;
|
CFStringRef device_name_ref;
|
||||||
@ -204,7 +204,7 @@ static void hid_manager_device_attached(void* context, IOReturn result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void append_matching_dictionary(CFMutableArrayRef array,
|
static void append_matching_dictionary(CFMutableArrayRef array,
|
||||||
uint32_t page, uint32_t use)
|
uint32_t page, uint32_t use)
|
||||||
{
|
{
|
||||||
CFNumberRef pagen, usen;
|
CFNumberRef pagen, usen;
|
||||||
CFMutableDictionaryRef matcher;
|
CFMutableDictionaryRef matcher;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user