mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(input/drivers_joypad) Add TODO/FIXME notes
This commit is contained in:
parent
e91e548f13
commit
4676e102d0
@ -28,8 +28,11 @@
|
||||
#include "string.h"
|
||||
#include "3ds.h"
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static uint32_t pad_state;
|
||||
static int16_t analog_state[DEFAULT_MAX_PADS][2][2];
|
||||
|
||||
/* TODO/FIXME - global referenced outside */
|
||||
extern uint64_t lifecycle_state;
|
||||
|
||||
static const char *ctr_joypad_name(unsigned pad)
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "../../verbosity.h"
|
||||
#include "dinput_joypad.h"
|
||||
|
||||
/* TODO/FIXME - globals */
|
||||
/* TODO/FIXME - globals referenced outside */
|
||||
struct dinput_joypad_data g_pads[MAX_USERS];
|
||||
unsigned g_joypad_cnt;
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "../../verbosity.h"
|
||||
#include "dinput_joypad.h"
|
||||
|
||||
/* TODO/FIXME - globals */
|
||||
/* TODO/FIXME - globals referenced outside */
|
||||
struct dinput_joypad_data g_pads[MAX_USERS];
|
||||
unsigned g_joypad_cnt;
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
||||
#define LOCK_VAR(x) LockData((void*)&x, sizeof(x))
|
||||
#define LOCK_FUNC(x) LockCode(x, (int)x##_End - (int)x)
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static uint16_t normal_keys[LAST_KEYCODE + 1];
|
||||
|
||||
static _go32_dpmi_seginfo old_kbd_int;
|
||||
static _go32_dpmi_seginfo kbd_int;
|
||||
|
||||
|
@ -61,6 +61,7 @@ struct gx_mousedata
|
||||
bool valid;
|
||||
};
|
||||
|
||||
/* TODO/FIXME - static global */
|
||||
static struct gx_mousedata gx_mouse[2];
|
||||
#endif
|
||||
|
||||
@ -119,14 +120,14 @@ enum
|
||||
#define GC_JOYSTICK_THRESHOLD (48 * 256)
|
||||
#define WII_JOYSTICK_THRESHOLD (40 * 256)
|
||||
|
||||
/* TODO/FIXME - global referenced outside */
|
||||
extern uint64_t lifecycle_state;
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static uint64_t pad_state[DEFAULT_MAX_PADS];
|
||||
static uint32_t pad_type[DEFAULT_MAX_PADS] = { WPAD_EXP_NOCONTROLLER, WPAD_EXP_NOCONTROLLER, WPAD_EXP_NOCONTROLLER, WPAD_EXP_NOCONTROLLER };
|
||||
static int16_t analog_state[DEFAULT_MAX_PADS][2][2];
|
||||
static bool g_menu = false;
|
||||
|
||||
static bool gx_joypad_query_pad(unsigned pad);
|
||||
|
||||
#ifdef HW_RVL
|
||||
static bool g_quit = false;
|
||||
|
||||
@ -435,6 +436,11 @@ static int16_t WPAD_StickY(WPADData *data, u8 right)
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool gx_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS && pad_type[pad] != WPAD_EXP_NOCONTROLLER;
|
||||
}
|
||||
|
||||
static void gx_joypad_poll(void)
|
||||
{
|
||||
unsigned i, j, port;
|
||||
@ -637,11 +643,6 @@ static bool gx_joypad_init(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool gx_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
return pad < MAX_USERS && pad_type[pad] != WPAD_EXP_NOCONTROLLER;
|
||||
}
|
||||
|
||||
static void gx_joypad_destroy(void)
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
#include "../input_driver.h"
|
||||
|
||||
/* TODO/FIXME - static global */
|
||||
static const hid_driver_t *generic_hid = NULL;
|
||||
|
||||
static bool hid_joypad_init(void *data)
|
||||
@ -24,9 +25,6 @@ static bool hid_joypad_init(void *data)
|
||||
generic_hid = input_hid_init_first();
|
||||
if (!generic_hid)
|
||||
return false;
|
||||
|
||||
(void)data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ struct linuxraw_joypad
|
||||
char *ident;
|
||||
};
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static struct linuxraw_joypad linuxraw_pads[MAX_USERS];
|
||||
static int linuxraw_epoll = 0;
|
||||
static int linuxraw_inotify = 0;
|
||||
|
@ -31,18 +31,17 @@
|
||||
#define MAX_MFI_CONTROLLERS 4
|
||||
#endif
|
||||
|
||||
static uint32_t mfi_buttons[MAX_USERS];
|
||||
static int16_t mfi_axes[MAX_USERS][4];
|
||||
|
||||
static uint32_t mfi_controllers[MAX_MFI_CONTROLLERS];
|
||||
|
||||
static NSMutableArray *mfiControllers;
|
||||
|
||||
enum
|
||||
{
|
||||
GCCONTROLLER_PLAYER_INDEX_UNSET = -1,
|
||||
};
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static uint32_t mfi_buttons[MAX_USERS];
|
||||
static int16_t mfi_axes[MAX_USERS][4];
|
||||
static uint32_t mfi_controllers[MAX_MFI_CONTROLLERS];
|
||||
static NSMutableArray *mfiControllers;
|
||||
|
||||
static bool apple_gamecontroller_available(void)
|
||||
{
|
||||
int major, minor;
|
||||
|
@ -48,6 +48,7 @@ struct parport_joypad
|
||||
char *ident;
|
||||
};
|
||||
|
||||
/* TODO/FIXME - static global */
|
||||
static struct parport_joypad parport_pads[MAX_USERS];
|
||||
|
||||
static void parport_poll_pad(struct parport_joypad *pad)
|
||||
|
@ -27,8 +27,8 @@
|
||||
#define PS2_ANALOG_STICKS 2
|
||||
#define PS2_ANALOG_AXIS 2
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static unsigned char padBuf[2][256] ALIGNED(64);
|
||||
|
||||
static uint64_t pad_state[DEFAULT_MAX_PADS];
|
||||
static int16_t analog_state[DEFAULT_MAX_PADS][PS2_ANALOG_STICKS][PS2_ANALOG_AXIS];
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static uint64_t pad_state[DEFAULT_MAX_PADS];
|
||||
static int16_t analog_state[DEFAULT_MAX_PADS][2][2];
|
||||
static uint64_t pads_connected[DEFAULT_MAX_PADS];
|
||||
|
@ -49,11 +49,13 @@
|
||||
#define ORBISPAD_TOUCH_PAD 0x00100000
|
||||
#define ORBISPAD_INTERCEPTED 0x80000000
|
||||
|
||||
typedef struct SceUserServiceLoginUserIdList {
|
||||
int32_t userId[SCE_USER_SERVICE_MAX_LOGIN_USERS];
|
||||
typedef struct SceUserServiceLoginUserIdList
|
||||
{
|
||||
int32_t userId[SCE_USER_SERVICE_MAX_LOGIN_USERS];
|
||||
} SceUserServiceLoginUserIdList;
|
||||
|
||||
int sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList);
|
||||
int sceUserServiceGetLoginUserIdList(
|
||||
SceUserServiceLoginUserIdList* userIdList);
|
||||
|
||||
/*
|
||||
* Global var's
|
||||
@ -65,6 +67,7 @@ typedef struct
|
||||
bool connected;
|
||||
} ds_joypad_state;
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static ds_joypad_state ds_joypad_states[PS4_MAX_ORBISPADS];
|
||||
static uint64_t pad_state[PS4_MAX_ORBISPADS];
|
||||
static int16_t analog_state[PS4_MAX_ORBISPADS][2][2];
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include <psp2/kernel/sysmem.h>
|
||||
#include <psp2/ctrl.h>
|
||||
#include <psp2/touch.h>
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static int psp2_model;
|
||||
static SceCtrlPortInfo old_ctrl_info, curr_ctrl_info;
|
||||
static SceCtrlActuator actuators[DEFAULT_MAX_PADS] = {0};
|
||||
@ -53,9 +55,11 @@ static SceCtrlActuator actuators[DEFAULT_MAX_PADS] = {0};
|
||||
#define SE_AREA(x, y) AREA(SCREEN_HALF_WIDTH, SCREEN_HALF_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, (x), (y))
|
||||
#endif
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static uint64_t pad_state[DEFAULT_MAX_PADS];
|
||||
static int16_t analog_state[DEFAULT_MAX_PADS][2][2];
|
||||
|
||||
/* TODO/FIXME - global referenced outside */
|
||||
extern uint64_t lifecycle_state;
|
||||
|
||||
static const char *psp_joypad_name(unsigned pad)
|
||||
|
@ -33,10 +33,6 @@ static EM_BOOL rwebpad_gamepad_cb(int event_type,
|
||||
unsigned vid = 0;
|
||||
unsigned pid = 0;
|
||||
|
||||
(void)event_type;
|
||||
(void)gamepad_event;
|
||||
(void)user_data;
|
||||
|
||||
if (strncmp(gamepad_event->mapping, "standard",
|
||||
sizeof(gamepad_event->mapping)) == 0)
|
||||
{
|
||||
@ -45,46 +41,40 @@ static EM_BOOL rwebpad_gamepad_cb(int event_type,
|
||||
pid = 1;
|
||||
}
|
||||
|
||||
if (event_type == EMSCRIPTEN_EVENT_GAMEPADCONNECTED)
|
||||
input_autoconfigure_connect(
|
||||
switch (event_type)
|
||||
{
|
||||
case EMSCRIPTEN_EVENT_GAMEPADCONNECTED:
|
||||
input_autoconfigure_connect(
|
||||
gamepad_event->id, /* name */
|
||||
NULL, /* display name */
|
||||
rwebpad_joypad.ident, /* driver */
|
||||
gamepad_event->index, /* idx */
|
||||
vid, /* vid */
|
||||
pid); /* pid */
|
||||
else if (event_type == EMSCRIPTEN_EVENT_GAMEPADDISCONNECTED)
|
||||
input_autoconfigure_disconnect(gamepad_event->index,
|
||||
rwebpad_joypad.ident);
|
||||
break;
|
||||
case EMSCRIPTEN_EVENT_GAMEPADDISCONNECTED:
|
||||
input_autoconfigure_disconnect(gamepad_event->index,
|
||||
rwebpad_joypad.ident);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return EM_TRUE;
|
||||
}
|
||||
|
||||
static bool rwebpad_joypad_init(void *data)
|
||||
{
|
||||
EMSCRIPTEN_RESULT r;
|
||||
(void)data;
|
||||
|
||||
r = emscripten_sample_gamepad_data();
|
||||
EMSCRIPTEN_RESULT r = emscripten_sample_gamepad_data();
|
||||
if (r == EMSCRIPTEN_RESULT_NOT_SUPPORTED)
|
||||
return false;
|
||||
|
||||
/* callbacks needs to be registered for gamepads to connect */
|
||||
r = emscripten_set_gamepadconnected_callback(NULL, false,
|
||||
rwebpad_gamepad_cb);
|
||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"[EMSCRIPTEN/PAD] failed to create connect callback: %d\n", r);
|
||||
}
|
||||
|
||||
r = emscripten_set_gamepaddisconnected_callback(NULL, false,
|
||||
rwebpad_gamepad_cb);
|
||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"[EMSCRIPTEN/PAD] failed to create disconnect callback: %d\n", r);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -93,7 +83,6 @@ static const char *rwebpad_joypad_name(unsigned pad)
|
||||
{
|
||||
static EmscriptenGamepadEvent gamepad_state;
|
||||
EMSCRIPTEN_RESULT r = emscripten_get_gamepad_status(pad, &gamepad_state);
|
||||
|
||||
if (r == EMSCRIPTEN_RESULT_SUCCESS)
|
||||
return gamepad_state.id;
|
||||
return "";
|
||||
@ -215,13 +204,10 @@ static bool rwebpad_joypad_query_pad(unsigned pad)
|
||||
|
||||
if (r == EMSCRIPTEN_RESULT_SUCCESS)
|
||||
return gamepad_state.connected == EM_TRUE;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void rwebpad_joypad_destroy(void)
|
||||
{
|
||||
}
|
||||
static void rwebpad_joypad_destroy(void) { }
|
||||
|
||||
input_device_driver_t rwebpad_joypad = {
|
||||
rwebpad_joypad_init,
|
||||
|
@ -42,15 +42,10 @@ typedef struct _sdl_joypad
|
||||
#endif
|
||||
} sdl_joypad_t;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
const int g_subsystem = SDL_INIT_GAMECONTROLLER;
|
||||
#else
|
||||
const int g_subsystem = SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static sdl_joypad_t sdl_pads[MAX_USERS];
|
||||
#ifdef HAVE_SDL2
|
||||
static bool g_has_haptic;
|
||||
static bool g_has_haptic = false;
|
||||
#endif
|
||||
|
||||
static const char *sdl_joypad_name(unsigned pad)
|
||||
@ -182,11 +177,16 @@ static void sdl_pad_connect(unsigned id)
|
||||
pad->num_balls = SDL_JoystickNumBalls(pad->joypad);
|
||||
}
|
||||
|
||||
pad->haptic = g_has_haptic ? SDL_HapticOpenFromJoystick(pad->joypad) : NULL;
|
||||
pad->haptic = NULL;
|
||||
|
||||
if (g_has_haptic)
|
||||
{
|
||||
pad->haptic = SDL_HapticOpenFromJoystick(pad->joypad);
|
||||
|
||||
if (g_has_haptic && !pad->haptic)
|
||||
RARCH_WARN("[SDL]: Couldn't open haptic device of the joypad #%u: %s\n",
|
||||
id, SDL_GetError());
|
||||
if (!pad->haptic)
|
||||
RARCH_WARN("[SDL]: Couldn't open haptic device of the joypad #%u: %s\n",
|
||||
id, SDL_GetError());
|
||||
}
|
||||
|
||||
pad->rumble_effect = -1;
|
||||
|
||||
@ -236,25 +236,33 @@ static void sdl_pad_disconnect(unsigned id)
|
||||
static void sdl_joypad_destroy(void)
|
||||
{
|
||||
unsigned i;
|
||||
#ifdef HAVE_SDL2
|
||||
int subsystem = SDL_INIT_GAMECONTROLLER;
|
||||
#else
|
||||
int subsystem = SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
sdl_pad_disconnect(i);
|
||||
|
||||
SDL_QuitSubSystem(g_subsystem);
|
||||
SDL_QuitSubSystem(subsystem);
|
||||
memset(sdl_pads, 0, sizeof(sdl_pads));
|
||||
}
|
||||
|
||||
static bool sdl_joypad_init(void *data)
|
||||
{
|
||||
unsigned i, num_sticks;
|
||||
|
||||
(void)data;
|
||||
#ifdef HAVE_SDL2
|
||||
int subsystem = SDL_INIT_GAMECONTROLLER;
|
||||
#else
|
||||
int subsystem = SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
|
||||
if (SDL_WasInit(0) == 0)
|
||||
{
|
||||
if (SDL_Init(g_subsystem) < 0)
|
||||
if (SDL_Init(subsystem) < 0)
|
||||
return false;
|
||||
}
|
||||
else if (SDL_InitSubSystem(g_subsystem) < 0)
|
||||
else if (SDL_InitSubSystem(subsystem) < 0)
|
||||
return false;
|
||||
|
||||
#if HAVE_SDL2
|
||||
|
@ -19,6 +19,7 @@
|
||||
/* TODO/FIXME - weird header include */
|
||||
#include "string.h"
|
||||
|
||||
/* TODO/FIXME - global referenced outside */
|
||||
extern uint64_t lifecycle_state;
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
|
@ -95,6 +95,7 @@ struct joypad_udev_entry
|
||||
struct udev_list_entry *item;
|
||||
};
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static struct udev *udev_joypad_fd = NULL;
|
||||
static struct udev_monitor *udev_joypad_mon = NULL;
|
||||
static struct udev_joypad udev_pads[MAX_USERS];
|
||||
|
@ -27,6 +27,7 @@ typedef struct
|
||||
bool connected;
|
||||
} xinput_joypad_state;
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static xinput_joypad_state g_xinput_states[DEFAULT_MAX_PADS];
|
||||
static HANDLE gamepads[DEFAULT_MAX_PADS];
|
||||
|
||||
|
@ -60,26 +60,6 @@
|
||||
* For each pad index, the appropriate entry will be set to -1 if it is not
|
||||
* a 360 pad, or the correct XInput user number (0..3 inclusive) if it is.
|
||||
*/
|
||||
static int g_xinput_pad_indexes[MAX_USERS];
|
||||
static unsigned g_last_xinput_pad_idx;
|
||||
static bool g_xinput_block_pads;
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/* For xinput1_n.dll */
|
||||
static dylib_t g_xinput_dll = NULL;
|
||||
#endif
|
||||
|
||||
/* Function pointer, to be assigned with dylib_proc */
|
||||
typedef uint32_t (__stdcall *XInputGetStateEx_t)(uint32_t, XINPUT_STATE*);
|
||||
static XInputGetStateEx_t g_XInputGetStateEx;
|
||||
|
||||
typedef uint32_t (__stdcall *XInputSetState_t)(uint32_t, XINPUT_VIBRATION*);
|
||||
static XInputSetState_t g_XInputSetState;
|
||||
|
||||
/* Guide button may or may not be available */
|
||||
static bool g_xinput_guide_button_supported = false;
|
||||
static unsigned g_xinput_num_buttons = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XINPUT_STATE xstate;
|
||||
@ -87,6 +67,21 @@ typedef struct
|
||||
} xinput_joypad_state;
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
static int g_xinput_pad_indexes[MAX_USERS];
|
||||
static unsigned g_last_xinput_pad_idx;
|
||||
static bool g_xinput_block_pads;
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/* For xinput1_n.dll */
|
||||
static dylib_t g_xinput_dll = NULL;
|
||||
#endif
|
||||
/* Function pointer, to be assigned with dylib_proc */
|
||||
typedef uint32_t (__stdcall *XInputGetStateEx_t)(uint32_t, XINPUT_STATE*);
|
||||
typedef uint32_t (__stdcall *XInputSetState_t)(uint32_t, XINPUT_VIBRATION*);
|
||||
/* Guide button may or may not be available */
|
||||
static bool g_xinput_guide_button_supported = false;
|
||||
static unsigned g_xinput_num_buttons = 0;
|
||||
static XInputSetState_t g_XInputSetState;
|
||||
static XInputGetStateEx_t g_XInputGetStateEx;
|
||||
static XINPUT_VIBRATION g_xinput_rumble_states[4];
|
||||
static xinput_joypad_state g_xinput_states[4];
|
||||
|
||||
|
@ -44,29 +44,26 @@
|
||||
|
||||
#include "xinput_joypad.h"
|
||||
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/* For xinput1_n.dll */
|
||||
static dylib_t g_xinput_dll = NULL;
|
||||
#endif
|
||||
|
||||
/* Function pointer, to be assigned with dylib_proc */
|
||||
typedef uint32_t (__stdcall *XInputGetStateEx_t)(uint32_t, XINPUT_STATE*);
|
||||
static XInputGetStateEx_t g_XInputGetStateEx;
|
||||
|
||||
typedef uint32_t (__stdcall *XInputSetState_t)(uint32_t, XINPUT_VIBRATION*);
|
||||
static XInputSetState_t g_XInputSetState;
|
||||
|
||||
/* Guide button may or may not be available */
|
||||
static bool g_xinput_guide_button_supported = false;
|
||||
static unsigned g_xinput_num_buttons = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XINPUT_STATE xstate;
|
||||
bool connected;
|
||||
} xinput_joypad_state;
|
||||
|
||||
/* Function pointer, to be assigned with dylib_proc */
|
||||
typedef uint32_t (__stdcall *XInputGetStateEx_t)(uint32_t, XINPUT_STATE*);
|
||||
typedef uint32_t (__stdcall *XInputSetState_t)(uint32_t, XINPUT_VIBRATION*);
|
||||
|
||||
/* TODO/FIXME - static globals */
|
||||
#ifdef HAVE_DYNAMIC
|
||||
/* For xinput1_n.dll */
|
||||
static dylib_t g_xinput_dll = NULL;
|
||||
#endif
|
||||
/* Guide button may or may not be available */
|
||||
static bool g_xinput_guide_button_supported = false;
|
||||
static unsigned g_xinput_num_buttons = 0;
|
||||
static XInputSetState_t g_XInputSetState;
|
||||
static XInputGetStateEx_t g_XInputGetStateEx;
|
||||
static XINPUT_VIBRATION g_xinput_rumble_states[4];
|
||||
static xinput_joypad_state g_xinput_states[4];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user