2013-03-03 18:50:38 -05:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 01:50:59 +01:00
|
|
|
* Copyright (C) 2013-2014 - Jason Fetters
|
2015-01-07 17:46:50 +01:00
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
2013-03-03 18:50:38 -05:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-03-31 15:14:39 +02:00
|
|
|
|
2015-01-12 06:28:39 +01:00
|
|
|
#include "../input_autodetect.h"
|
|
|
|
#include "../input_common.h"
|
2014-10-04 16:46:52 +02:00
|
|
|
|
2015-02-15 04:07:22 +01:00
|
|
|
static bool apple_joypad_init(void)
|
|
|
|
{
|
|
|
|
if (!apple_hid_init())
|
|
|
|
return false;
|
2014-10-04 16:46:52 +02:00
|
|
|
|
|
|
|
return true;
|
2013-03-03 18:50:38 -05:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:14:36 -04:00
|
|
|
static bool apple_joypad_query_pad(unsigned pad)
|
2013-03-03 18:50:38 -05:00
|
|
|
{
|
2015-01-05 01:58:00 +01:00
|
|
|
return pad < MAX_USERS;
|
2013-03-03 18:50:38 -05:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:14:36 -04:00
|
|
|
static void apple_joypad_destroy(void)
|
2013-03-03 18:50:38 -05:00
|
|
|
{
|
2015-02-15 04:07:22 +01:00
|
|
|
apple_hid_free();
|
2013-03-03 18:50:38 -05:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:14:36 -04:00
|
|
|
static bool apple_joypad_button(unsigned port, uint16_t joykey)
|
2013-03-03 18:50:38 -05:00
|
|
|
{
|
2015-03-31 15:14:39 +02:00
|
|
|
return apple_hid_joypad_button(port, joykey);
|
2013-03-03 18:50:38 -05:00
|
|
|
}
|
|
|
|
|
2015-02-15 01:57:29 +01:00
|
|
|
static uint64_t apple_joypad_get_buttons(unsigned port)
|
|
|
|
{
|
2015-03-31 15:14:39 +02:00
|
|
|
return apple_hid_joypad_get_buttons(port);
|
2015-02-15 01:57:29 +01:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:14:36 -04:00
|
|
|
static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis)
|
2013-03-03 18:50:38 -05:00
|
|
|
{
|
2015-03-31 15:14:39 +02:00
|
|
|
return apple_hid_joypad_axis(port, joyaxis);
|
2013-03-03 18:50:38 -05:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:14:36 -04:00
|
|
|
static void apple_joypad_poll(void)
|
2013-03-03 18:50:38 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-09-09 18:15:17 +02:00
|
|
|
static bool apple_joypad_rumble(unsigned pad,
|
|
|
|
enum retro_rumble_effect effect, uint16_t strength)
|
2013-10-03 18:04:28 -04:00
|
|
|
{
|
2015-03-31 15:14:39 +02:00
|
|
|
return apple_hid_joypad_rumble(pad, effect, strength);
|
2013-10-03 18:04:28 -04:00
|
|
|
}
|
|
|
|
|
2014-10-04 16:47:44 +02:00
|
|
|
static const char *apple_joypad_name(unsigned pad)
|
2013-04-27 00:08:52 +02:00
|
|
|
{
|
2014-10-04 16:46:52 +02:00
|
|
|
/* TODO/FIXME - implement properly */
|
2015-01-05 01:58:00 +01:00
|
|
|
if (pad >= MAX_USERS)
|
2014-10-04 16:46:52 +02:00
|
|
|
return NULL;
|
|
|
|
|
2013-04-27 00:08:52 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-10-04 15:37:09 +02:00
|
|
|
rarch_joypad_driver_t apple_hid_joypad = {
|
2013-07-08 15:14:36 -04:00
|
|
|
apple_joypad_init,
|
|
|
|
apple_joypad_query_pad,
|
|
|
|
apple_joypad_destroy,
|
|
|
|
apple_joypad_button,
|
2015-02-15 01:57:29 +01:00
|
|
|
apple_joypad_get_buttons,
|
2013-07-08 15:14:36 -04:00
|
|
|
apple_joypad_axis,
|
|
|
|
apple_joypad_poll,
|
2013-10-03 18:04:28 -04:00
|
|
|
apple_joypad_rumble,
|
2013-07-08 15:14:36 -04:00
|
|
|
apple_joypad_name,
|
2014-10-04 15:36:04 +02:00
|
|
|
"apple_hid"
|
2013-03-03 18:50:38 -05:00
|
|
|
};
|