mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 08:52:41 +00:00
(iOS) Get rid of apple_ios_joypad - refactored into btstack HID driver
This commit is contained in:
parent
9bfe575a90
commit
c73377857b
@ -105,7 +105,6 @@ enum
|
||||
JOYPAD_ANDROID,
|
||||
JOYPAD_SDL,
|
||||
JOYPAD_HID,
|
||||
JOYPAD_APPLE_IOS,
|
||||
JOYPAD_QNX,
|
||||
JOYPAD_NULL,
|
||||
|
||||
|
@ -290,8 +290,6 @@ const char *config_get_default_joypad(void)
|
||||
#endif
|
||||
case JOYPAD_HID:
|
||||
return "hid";
|
||||
case JOYPAD_APPLE_IOS:
|
||||
return "apple_ios";
|
||||
case JOYPAD_QNX:
|
||||
return "qnx";
|
||||
default:
|
||||
|
@ -334,10 +334,6 @@ INPUT
|
||||
#include "../input/drivers/rwebinput_input.c"
|
||||
#endif
|
||||
|
||||
#ifdef IOS
|
||||
#include "../input/drivers_joypad/ios_joypad.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DINPUT
|
||||
#include "../input/drivers/dinput.c"
|
||||
#endif
|
||||
|
@ -1,127 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2013-2014 - Jason Fetters
|
||||
* 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 "../drivers/apple_input.h"
|
||||
#include "../input_autodetect.h"
|
||||
#include "../input_common.h"
|
||||
#include "../../general.h"
|
||||
#ifdef HAVE_MFI
|
||||
#include "../../apple/common/apple_gamecontroller.h"
|
||||
#endif
|
||||
#include "../connect/joypad_connection.h"
|
||||
|
||||
joypad_connection_t *slots;
|
||||
|
||||
static bool apple_joypad_init(void)
|
||||
{
|
||||
slots = (joypad_connection_t*)pad_connection_init(MAX_USERS);
|
||||
|
||||
if (!slots)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool apple_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS;
|
||||
}
|
||||
|
||||
static void apple_joypad_destroy(void)
|
||||
{
|
||||
pad_connection_destroy(slots);
|
||||
}
|
||||
|
||||
static bool apple_joypad_button(unsigned port, uint16_t joykey)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
|
||||
uint64_t buttons = pad_connection_get_buttons(&slots[port], port);
|
||||
if (!apple || joykey == NO_BTN)
|
||||
return false;
|
||||
|
||||
/* Check hat. */
|
||||
if (GET_HAT_DIR(joykey))
|
||||
return false;
|
||||
/* Check the button */
|
||||
if ((port < MAX_USERS) && (joykey < 32))
|
||||
return ((apple->buttons[port] & (1 << joykey)) != 0) ||
|
||||
((buttons & (1 << joykey)) != 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint64_t apple_joypad_get_buttons(unsigned port)
|
||||
{
|
||||
return pad_connection_get_buttons(&slots[port], port);
|
||||
}
|
||||
|
||||
static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
|
||||
int16_t val = 0;
|
||||
|
||||
if (!apple || joyaxis == AXIS_NONE)
|
||||
return 0;
|
||||
|
||||
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||
{
|
||||
val = apple->axes[port][AXIS_NEG_GET(joyaxis)];
|
||||
val += pad_connection_get_axis(&slots[port], port, AXIS_NEG_GET(joyaxis));
|
||||
if (val >= 0)
|
||||
val = 0;
|
||||
}
|
||||
else if(AXIS_POS_GET(joyaxis) < 4)
|
||||
{
|
||||
val = apple->axes[port][AXIS_POS_GET(joyaxis)];
|
||||
val += pad_connection_get_axis(&slots[port], port, AXIS_POS_GET(joyaxis));
|
||||
if (val <= 0)
|
||||
val = 0;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static void apple_joypad_poll(void)
|
||||
{
|
||||
#ifdef HAVE_MFI
|
||||
apple_gamecontroller_poll_all();
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool apple_joypad_rumble(unsigned pad,
|
||||
enum retro_rumble_effect effect, uint16_t strength)
|
||||
{
|
||||
return pad_connection_rumble(&slots[pad], pad, effect, strength);
|
||||
}
|
||||
|
||||
static const char *apple_joypad_name(unsigned joypad)
|
||||
{
|
||||
(void)joypad;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rarch_joypad_driver_t apple_ios_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_ios"
|
||||
};
|
@ -59,11 +59,6 @@ static rarch_joypad_driver_t *joypad_drivers[] = {
|
||||
#if defined(HAVE_SDL) || defined(HAVE_SDL2)
|
||||
&sdl_joypad,
|
||||
#endif
|
||||
#ifdef __MACH__
|
||||
#ifdef IOS
|
||||
&apple_ios_joypad,
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __QNX__
|
||||
&qnx_joypad,
|
||||
#endif
|
||||
|
@ -56,7 +56,6 @@ extern rarch_joypad_driver_t ctr_joypad;
|
||||
extern rarch_joypad_driver_t xdk_joypad;
|
||||
extern rarch_joypad_driver_t gx_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;
|
||||
extern rarch_joypad_driver_t null_joypad;
|
||||
|
Loading…
x
Reference in New Issue
Block a user