85 lines
2.1 KiB
C
Raw Normal View History

/* 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
*
* 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/>.
*/
#include "../input_autodetect.h"
#include "../input_common.h"
2014-10-04 16:46:52 +02:00
2015-04-01 20:49:26 +02:00
static void *generic_hid;
static bool hid_joypad_init(void)
2015-02-15 04:07:22 +01:00
{
2015-04-01 20:49:26 +02:00
generic_hid = apple_hid_init();
if (!generic_hid)
2015-02-15 04:07:22 +01:00
return false;
2014-10-04 16:46:52 +02:00
return true;
}
static bool hid_joypad_query_pad(unsigned pad)
{
2015-04-01 20:49:26 +02:00
return apple_hid_joypad_query_pad(generic_hid, pad);
}
static void hid_joypad_destroy(void)
{
2015-04-01 20:49:26 +02:00
apple_hid_free(generic_hid);
generic_hid = NULL;
}
static bool hid_joypad_button(unsigned port, uint16_t joykey)
{
2015-04-01 20:49:26 +02:00
return apple_hid_joypad_button(generic_hid, port, joykey);
}
static uint64_t hid_joypad_get_buttons(unsigned port)
2015-02-15 01:57:29 +01:00
{
2015-04-01 20:49:26 +02:00
return apple_hid_joypad_get_buttons(generic_hid, port);
2015-02-15 01:57:29 +01:00
}
static int16_t hid_joypad_axis(unsigned port, uint32_t joyaxis)
{
2015-04-01 20:49:26 +02:00
return apple_hid_joypad_axis(generic_hid, port, joyaxis);
}
static void hid_joypad_poll(void)
{
2015-04-01 20:49:26 +02:00
apple_hid_poll(generic_hid);
}
static bool hid_joypad_rumble(unsigned pad,
2014-09-09 18:15:17 +02:00
enum retro_rumble_effect effect, uint16_t strength)
{
2015-04-01 20:49:26 +02:00
return apple_hid_joypad_rumble(generic_hid, pad, effect, strength);
}
static const char *hid_joypad_name(unsigned pad)
2013-04-27 00:08:52 +02:00
{
2015-04-01 20:49:26 +02:00
return apple_hid_joypad_name(generic_hid, pad);
2013-04-27 00:08:52 +02:00
}
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"
};