(Apple) Cleanups

This commit is contained in:
Twinaphex 2014-10-04 17:01:56 +02:00
parent cfdf720614
commit 8b79b12002
5 changed files with 21 additions and 23 deletions

View File

@ -45,15 +45,17 @@ struct apple_pad_connection
uint16_t channels[2]; //0: Control, 1: Interrupt
};
static struct apple_pad_connection g_connections[MAX_PLAYERS];
void apple_pad_send_control(struct apple_pad_connection* connection, uint8_t* data, size_t size)
{
bt_send_l2cap_ptr(connection->channels[0], data, size);
}
static bool inquiry_off;
static bool inquiry_running;
static struct apple_pad_connection g_connections[MAX_PLAYERS];
void apple_pad_send_control(void *data, uint8_t* data_buf, size_t size)
{
struct apple_pad_connection *connection =
(struct apple_pad_connection*)data;
if (connection)
bt_send_l2cap_ptr(connection->channels[0], data_buf, size);
}
void btpad_set_inquiry_state(bool on)
{

View File

@ -333,6 +333,10 @@ INPUT
#endif
#if defined(__APPLE__)
#include "../input/wiimote.c"
#include "../input/apple_joypad_ps3.c"
#include "../input/apple_joypad_ps4.c"
#include "../input/apple_joypad_wii.c"
#ifdef HAVE_HID
#include "../input/apple_joypad_hid.c"

View File

@ -20,14 +20,6 @@
#include "input_common.h"
#include "../general.h"
static void apple_pad_send_control(void *connect_data,
uint8_t* data, size_t size);
#include "wiimote.c"
#include "apple_joypad_ps3.c"
#include "apple_joypad_ps4.c"
#include "apple_joypad_wii.c"
typedef struct
{
bool used;
@ -50,15 +42,14 @@ struct apple_pad_connection
static IOHIDManagerRef g_hid_manager;
static void apple_pad_send_control(void *connect_data,
uint8_t* data, size_t size)
void apple_pad_send_control(void *data, uint8_t* data_buf, size_t size)
{
struct apple_pad_connection* connection =
(struct apple_pad_connection*)connect_data;
(struct apple_pad_connection*)data;
if (connection)
IOHIDDeviceSetReport(connection->device_handle,
kIOHIDReportTypeOutput, 0x01, data + 1, size - 1);
kIOHIDReportTypeOutput, 0x01, data_buf + 1, size - 1);
}
/* NOTE: I pieced this together through trial and error,

View File

@ -23,10 +23,7 @@
#include "../apple/iOS/bluetooth/btpad_queue.c"
#include "../apple/common/apple_gamecontroller.h"
#include "wiimote.c"
#include "apple_joypad_ps3.c"
#include "apple_joypad_ps4.c"
#include "apple_joypad_wii.c"
typedef struct
{

View File

@ -47,6 +47,7 @@
#include "wiimote.h"
/* Forward declarations. */
int wiimote_send(struct wiimote_t* wm, byte report_type, byte* msg, int len);
int wiimote_read_data(struct wiimote_t* wm, unsigned int addr,
@ -62,6 +63,9 @@ int classic_ctrl_handshake(struct wiimote_t* wm,
void classic_ctrl_event(struct classic_ctrl_t* cc, byte* msg);
/* TODO - Get rid of Apple-specific functions. */
void apple_pad_send_control(void *data, uint8_t* data_buf, size_t size);
/**
* @brief Request the wiimote controller status.
*