1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

mfi: left/right pressure sensitive triggers (#16385)

This commit is contained in:
Eric Warmenhoven 2024-03-28 15:58:26 -04:00 committed by GitHub
parent 87b9d0328e
commit ed33eb70a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -30,6 +30,9 @@
#ifndef MAX_MFI_CONTROLLERS
#define MAX_MFI_CONTROLLERS 4
#endif
#ifndef MAX_MFI_AXES
#define MAX_MFI_AXES 6
#endif
#if TARGET_OS_IOS
#include "../../configuration.h"
@ -48,7 +51,7 @@ enum
/* TODO/FIXME - static globals */
static uint32_t mfi_buttons[MAX_USERS];
static int16_t mfi_axes[MAX_USERS][4];
static int16_t mfi_axes[MAX_USERS][MAX_MFI_AXES];
static uint32_t mfi_controllers[MAX_MFI_CONTROLLERS];
static MFIRumbleController *mfi_rumblers[MAX_MFI_CONTROLLERS];
static NSMutableArray *mfiControllers;
@ -143,6 +146,8 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller,
mfi_axes[slot][1] = gp.leftThumbstick.yAxis.value * 32767.0f;
mfi_axes[slot][2] = gp.rightThumbstick.xAxis.value * 32767.0f;
mfi_axes[slot][3] = gp.rightThumbstick.yAxis.value * 32767.0f;
mfi_axes[slot][4] = gp.leftTrigger.value * 32767.0f;
mfi_axes[slot][5] = gp.rightTrigger.value * 32767.0f;
}
else if (controller.microGamepad)
@ -633,14 +638,14 @@ static void apple_gamecontroller_joypad_get_buttons(unsigned port,
static int16_t apple_gamecontroller_joypad_axis(
unsigned port, uint32_t joyaxis)
{
if (AXIS_NEG_GET(joyaxis) < 4)
if (AXIS_NEG_GET(joyaxis) < MAX_MFI_AXES)
{
int16_t axis = AXIS_NEG_GET(joyaxis);
int16_t val = mfi_axes[port][axis];
if (val < 0)
return val;
}
else if (AXIS_POS_GET(joyaxis) < 4)
else if (AXIS_POS_GET(joyaxis) < MAX_MFI_AXES)
{
int16_t axis = AXIS_POS_GET(joyaxis);
int16_t val = mfi_axes[port][axis];

View File

@ -716,8 +716,6 @@ DECL_BTN(l, 10) \
DECL_BTN(r, 11) \
DECL_BTN(start, 3) \
DECL_BTN(select, 2) \
DECL_BTN(l2, 12) \
DECL_BTN(r2, 13) \
DECL_BTN(l3, 14) \
DECL_BTN(r3, 15) \
DECL_AXIS(l_x_plus, +0) \
@ -727,7 +725,9 @@ DECL_AXIS(l_y_minus, +1) \
DECL_AXIS(r_x_plus, +2) \
DECL_AXIS(r_x_minus, -2) \
DECL_AXIS(r_y_plus, -3) \
DECL_AXIS(r_y_minus, +3)
DECL_AXIS(r_y_minus, +3) \
DECL_AXIS(l2, +4) \
DECL_AXIS(r2, +5)
const char* const input_builtin_autoconfs[] =
{