diff --git a/config.def.h b/config.def.h index 37a9b1ce6d..eaafab1289 100644 --- a/config.def.h +++ b/config.def.h @@ -100,7 +100,7 @@ enum JOYPAD_LINUXRAW, JOYPAD_ANDROID, JOYPAD_SDL, - JOYPAD_APPLE_HID, + JOYPAD_HID, JOYPAD_APPLE_IOS, JOYPAD_QNX, JOYPAD_NULL, @@ -262,8 +262,8 @@ enum #define JOYPAD_DEFAULT_DRIVER JOYPAD_SDL #elif defined(__MACH__) && defined(IOS) #define JOYPAD_DEFAULT_DRIVER JOYPAD_APPLE_IOS -#elif defined(__MACH__) && defined(HAVE_HID) -#define JOYPAD_DEFAULT_DRIVER JOYPAD_APPLE_HID +#elif defined(HAVE_HID) +#define JOYPAD_DEFAULT_DRIVER JOYPAD_HID #elif defined(__QNX__) #define JOYPAD_DEFAULT_DRIVER JOYPAD_QNX #else diff --git a/configuration.c b/configuration.c index d0758f2142..f5b75b77db 100644 --- a/configuration.c +++ b/configuration.c @@ -280,8 +280,8 @@ const char *config_get_default_joypad(void) #else return "sdl"; #endif - case JOYPAD_APPLE_HID: - return "apple_hid"; + case JOYPAD_HID: + return "hid"; case JOYPAD_APPLE_IOS: return "apple_ios"; case JOYPAD_QNX: diff --git a/griffin/griffin.c b/griffin/griffin.c index 1ca0b3a192..251607f1ac 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -343,7 +343,10 @@ INPUT #ifdef HAVE_HID #include "../input/drivers_hid/apple_hid.c" -#include "../input/drivers_joypad/apple_joypad_hid.c" +#endif + +#ifdef HAVE_HID +#include "../input/drivers_joypad/hid_joypad.c" #endif #ifdef IOS diff --git a/input/drivers_hid/apple_hid.c b/input/drivers_hid/apple_hid.c index 63d7a97550..0d5952d3d4 100644 --- a/input/drivers_hid/apple_hid.c +++ b/input/drivers_hid/apple_hid.c @@ -35,6 +35,20 @@ struct pad_connection uint8_t data[2048]; }; +static bool apple_hid_joypad_query_pad(unsigned pad) +{ + return pad < MAX_USERS; +} + +static const char *apple_hid_joypad_name(unsigned pad) +{ + /* TODO/FIXME - implement properly */ + if (pad >= MAX_USERS) + return NULL; + + return NULL; +} + static bool apple_hid_joypad_button(unsigned port, uint16_t joykey) { driver_t *driver = driver_get_ptr(); @@ -432,3 +446,7 @@ static void apple_hid_free(void) free(hid_apple); hid_apple = NULL; } + +static void apple_hid_poll(void) +{ +} diff --git a/input/drivers_joypad/apple_joypad_hid.c b/input/drivers_joypad/hid_joypad.c similarity index 59% rename from input/drivers_joypad/apple_joypad_hid.c rename to input/drivers_joypad/hid_joypad.c index 0a03ca2c11..5792bc64f6 100644 --- a/input/drivers_joypad/apple_joypad_hid.c +++ b/input/drivers_joypad/hid_joypad.c @@ -14,11 +14,10 @@ * If not, see . */ - #include "../input_autodetect.h" #include "../input_common.h" -static bool apple_joypad_init(void) +static bool hid_joypad_init(void) { if (!apple_hid_init()) return false; @@ -26,59 +25,56 @@ static bool apple_joypad_init(void) return true; } -static bool apple_joypad_query_pad(unsigned pad) +static bool hid_joypad_query_pad(unsigned pad) { - return pad < MAX_USERS; + return apple_hid_joypad_query_pad(pad); } -static void apple_joypad_destroy(void) +static void hid_joypad_destroy(void) { apple_hid_free(); } -static bool apple_joypad_button(unsigned port, uint16_t joykey) +static bool hid_joypad_button(unsigned port, uint16_t joykey) { return apple_hid_joypad_button(port, joykey); } -static uint64_t apple_joypad_get_buttons(unsigned port) +static uint64_t hid_joypad_get_buttons(unsigned port) { return apple_hid_joypad_get_buttons(port); } -static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis) +static int16_t hid_joypad_axis(unsigned port, uint32_t joyaxis) { return apple_hid_joypad_axis(port, joyaxis); } -static void apple_joypad_poll(void) +static void hid_joypad_poll(void) { + apple_hid_poll(); } -static bool apple_joypad_rumble(unsigned pad, +static bool hid_joypad_rumble(unsigned pad, enum retro_rumble_effect effect, uint16_t strength) { return apple_hid_joypad_rumble(pad, effect, strength); } -static const char *apple_joypad_name(unsigned pad) +static const char *hid_joypad_name(unsigned pad) { - /* TODO/FIXME - implement properly */ - if (pad >= MAX_USERS) - return NULL; - - return NULL; + return apple_hid_joypad_name(pad); } -rarch_joypad_driver_t apple_hid_joypad = { - apple_joypad_init, - apple_joypad_query_pad, - apple_joypad_destroy, - apple_joypad_button, - apple_joypad_get_buttons, - apple_joypad_axis, - apple_joypad_poll, - apple_joypad_rumble, - apple_joypad_name, - "apple_hid" +rarch_joypad_driver_t hid_joypad = { + hid_joypad_init, + hid_joypad_query_pad, + hid_joypad_destroy, + hid_joypad_button, + hid_joypad_get_buttons, + hid_joypad_axis, + hid_joypad_poll, + hid_joypad_rumble, + hid_joypad_name, + "hid" }; diff --git a/input/input_joypad_driver.c b/input/input_joypad_driver.c index eb012703e4..fe061ce33a 100644 --- a/input/input_joypad_driver.c +++ b/input/input_joypad_driver.c @@ -56,10 +56,10 @@ static rarch_joypad_driver_t *joypad_drivers[] = { #if defined(HAVE_SDL) || defined(HAVE_SDL2) &sdl_joypad, #endif -#ifdef __MACH__ #ifdef HAVE_HID - &apple_hid_joypad, + &hid_joypad, #endif +#ifdef __MACH__ #ifdef IOS &apple_ios_joypad, #endif diff --git a/input/input_joypad_driver.h b/input/input_joypad_driver.h index b46e48386c..8a5db1dfd1 100644 --- a/input/input_joypad_driver.h +++ b/input/input_joypad_driver.h @@ -54,7 +54,7 @@ extern rarch_joypad_driver_t ps3_joypad; extern rarch_joypad_driver_t psp_joypad; extern rarch_joypad_driver_t xdk_joypad; extern rarch_joypad_driver_t gx_joypad; -extern rarch_joypad_driver_t apple_hid_joypad; +extern rarch_joypad_driver_t hid_joypad; extern rarch_joypad_driver_t apple_ios_joypad; extern rarch_joypad_driver_t android_joypad; extern rarch_joypad_driver_t qnx_joypad;