2016-10-27 01:34:10 +01:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2017-01-22 13:40:32 +01:00
|
|
|
* Copyright (C) 2014-2017 - Ali Bouhlel
|
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2016-10-27 01:34:10 +01: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../../config.h"
|
|
|
|
#endif
|
|
|
|
|
2017-01-23 15:59:44 +01:00
|
|
|
#include <wiiu/vpad.h>
|
|
|
|
#include <wiiu/kpad.h>
|
2016-10-29 02:56:40 +01:00
|
|
|
|
2017-05-08 12:24:06 +02:00
|
|
|
#include "wiiu/controller_patcher/ControllerPatcherWrapper.h"
|
|
|
|
|
2016-10-27 01:34:10 +01:00
|
|
|
#include "../input_driver.h"
|
2017-01-13 10:00:33 +01:00
|
|
|
|
2016-12-01 20:38:20 +01:00
|
|
|
#include "../../tasks/tasks_internal.h"
|
2016-10-27 01:34:10 +01:00
|
|
|
#include "../../retroarch.h"
|
|
|
|
#include "../../command.h"
|
2017-08-19 17:40:56 +10:00
|
|
|
#include "../../gfx/video_driver.h"
|
2016-10-27 01:34:10 +01:00
|
|
|
#include "string.h"
|
|
|
|
|
2016-10-27 15:33:40 +01:00
|
|
|
#include "wiiu_dbg.h"
|
2016-10-27 01:34:10 +01:00
|
|
|
|
|
|
|
#ifndef MAX_PADS
|
2017-05-08 21:46:34 +02:00
|
|
|
#define MAX_PADS 16
|
2016-10-27 01:34:10 +01:00
|
|
|
#endif
|
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
#define WIIUINPUT_TYPE_WIIMOTE 0x00
|
|
|
|
#define WIIUINPUT_TYPE_NUNCHUK 0x01
|
|
|
|
#define WIIUINPUT_TYPE_CLASSIC_CONTROLLER 0x02
|
|
|
|
#define WIIUINPUT_TYPE_PRO_CONTROLLER 0x1F
|
|
|
|
#define WIIUINPUT_TYPE_NONE 0xFD
|
|
|
|
|
2017-05-08 21:46:34 +02:00
|
|
|
#define GAMEPAD_COUNT 1
|
|
|
|
#define KPAD_COUNT 4
|
|
|
|
#define HID_COUNT (MAX_PADS - GAMEPAD_COUNT - KPAD_COUNT)
|
|
|
|
#define GAMEPAD_OFFSET 0
|
|
|
|
#define KPAD_OFFSET (GAMEPAD_OFFSET + GAMEPAD_COUNT)
|
|
|
|
#define HID_OFFSET (KPAD_OFFSET + KPAD_COUNT)
|
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
extern uint64_t lifecycle_state;
|
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
static uint64_t pad_state[MAX_PADS];
|
2017-06-07 21:04:13 +02:00
|
|
|
static uint8_t pad_type[KPAD_COUNT] = {WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE};
|
2017-05-08 21:46:34 +02:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
static uint8_t hid_status[HID_COUNT];
|
2017-05-20 19:26:12 +02:00
|
|
|
static InputData hid_data[HID_COUNT];
|
2017-08-19 17:40:56 +10:00
|
|
|
/* 3 axis - one for touch/future IR support? */
|
|
|
|
static int16_t analog_state[MAX_PADS][3][2];
|
2016-11-07 02:42:12 +01:00
|
|
|
static bool wiiu_pad_inited = false;
|
2016-10-27 01:34:10 +01:00
|
|
|
|
2017-05-20 19:26:12 +02:00
|
|
|
static char hidName[HID_COUNT][255];
|
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
static const char* wiiu_joypad_name(unsigned pad)
|
2016-10-27 01:34:10 +01:00
|
|
|
{
|
2017-01-16 18:52:39 +01:00
|
|
|
if (pad == 0)
|
|
|
|
return "WIIU Gamepad";
|
|
|
|
|
2017-05-08 21:46:34 +02:00
|
|
|
if (pad < MAX_PADS && pad < (HID_OFFSET) && pad > GAMEPAD_OFFSET)
|
2017-01-16 18:52:39 +01:00
|
|
|
{
|
2017-05-08 21:46:34 +02:00
|
|
|
int i = pad - KPAD_OFFSET;
|
|
|
|
switch (pad_type[i])
|
2017-01-16 18:52:39 +01:00
|
|
|
{
|
2017-06-07 21:04:13 +02:00
|
|
|
case WIIUINPUT_TYPE_NONE:
|
|
|
|
return "N/A";
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case WIIUINPUT_TYPE_PRO_CONTROLLER:
|
|
|
|
return "WIIU Pro Controller";
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case WIIUINPUT_TYPE_WIIMOTE:
|
|
|
|
return "Wiimote Controller";
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case WIIUINPUT_TYPE_NUNCHUK:
|
|
|
|
return "Nunchuk Controller";
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case WIIUINPUT_TYPE_CLASSIC_CONTROLLER:
|
|
|
|
return "Classic Controller";
|
2017-01-16 18:52:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
if (pad < MAX_PADS)
|
|
|
|
{
|
|
|
|
s32 hid_index = pad-HID_OFFSET;
|
2017-10-17 21:38:42 +02:00
|
|
|
sprintf(hidName[hid_index],"HID %04X/%04X(%02X)",hid_data[hid_index].device_info.vidpid.vid,hid_data[hid_index].device_info.vidpid.pid,hid_data[hid_index].pad);
|
2017-06-07 21:04:13 +02:00
|
|
|
return hidName[hid_index];
|
2017-05-08 21:46:34 +02:00
|
|
|
}
|
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
return "unknown";
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wiiu_joypad_autodetect_add(unsigned autoconf_pad)
|
|
|
|
{
|
2017-01-13 05:00:13 +01:00
|
|
|
if (!input_autoconfigure_connect(
|
2017-01-16 18:52:39 +01:00
|
|
|
wiiu_joypad_name(autoconf_pad),
|
|
|
|
NULL,
|
|
|
|
wiiu_joypad.ident,
|
|
|
|
autoconf_pad,
|
|
|
|
0,
|
|
|
|
0
|
2017-06-07 21:04:13 +02:00
|
|
|
))
|
|
|
|
input_config_set_device_name(autoconf_pad, wiiu_joypad_name(autoconf_pad));
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool wiiu_joypad_button(unsigned port_num, uint16_t key)
|
|
|
|
{
|
|
|
|
if (port_num >= MAX_PADS)
|
|
|
|
return false;
|
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
return (pad_state[port_num] & (UINT64_C(1) << key));
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t wiiu_joypad_get_buttons(unsigned port_num)
|
|
|
|
{
|
2017-01-16 18:52:39 +01:00
|
|
|
return pad_state[port_num];
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int16_t wiiu_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
|
|
|
{
|
|
|
|
int val = 0;
|
|
|
|
int axis = -1;
|
|
|
|
bool is_neg = false;
|
|
|
|
bool is_pos = false;
|
|
|
|
|
|
|
|
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
|
|
|
return 0;
|
|
|
|
|
2017-08-19 17:40:56 +10:00
|
|
|
if (AXIS_NEG_GET(joyaxis) < 6)
|
2016-10-27 01:34:10 +01:00
|
|
|
{
|
|
|
|
axis = AXIS_NEG_GET(joyaxis);
|
|
|
|
is_neg = true;
|
|
|
|
}
|
2017-08-19 17:40:56 +10:00
|
|
|
else if (AXIS_POS_GET(joyaxis) < 6)
|
2016-10-27 01:34:10 +01:00
|
|
|
{
|
|
|
|
axis = AXIS_POS_GET(joyaxis);
|
|
|
|
is_pos = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (axis)
|
|
|
|
{
|
2017-06-07 21:04:13 +02:00
|
|
|
case 0:
|
|
|
|
val = analog_state[port_num][0][0];
|
|
|
|
break;
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case 1:
|
|
|
|
val = analog_state[port_num][0][1];
|
|
|
|
break;
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case 2:
|
|
|
|
val = analog_state[port_num][1][0];
|
|
|
|
break;
|
2017-01-16 18:52:39 +01:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
case 3:
|
|
|
|
val = analog_state[port_num][1][1];
|
|
|
|
break;
|
2017-08-19 17:40:56 +10:00
|
|
|
|
|
|
|
case 4:
|
|
|
|
val = analog_state[port_num][2][0];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
val = analog_state[port_num][2][1];
|
|
|
|
break;
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_neg && val > 0)
|
|
|
|
val = 0;
|
|
|
|
else if (is_pos && val < 0)
|
|
|
|
val = 0;
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-08-19 17:40:56 +10:00
|
|
|
static float scaleTP(float oldMin, float oldMax, float newMin, float newMax, float val) {
|
|
|
|
float oldRange = (oldMax - oldMin);
|
|
|
|
float newRange = (newMax - newMin);
|
|
|
|
return (((val - oldMin) * newRange) / oldRange) + newMin;
|
|
|
|
}
|
|
|
|
|
2016-10-27 01:34:10 +01:00
|
|
|
static void wiiu_joypad_poll(void)
|
|
|
|
{
|
2017-06-07 21:04:13 +02:00
|
|
|
int i, c, result;
|
2016-10-29 02:56:40 +01:00
|
|
|
VPADStatus vpad;
|
|
|
|
VPADReadError vpadError;
|
2017-06-07 21:04:13 +02:00
|
|
|
|
2016-10-27 01:34:10 +01:00
|
|
|
VPADRead(0, &vpad, 1, &vpadError);
|
2017-06-07 21:04:13 +02:00
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
if (!vpadError)
|
|
|
|
{
|
2017-08-19 17:40:56 +10:00
|
|
|
pad_state[0] = vpad.hold & VPAD_MASK_BUTTONS; /* buttons only */
|
2017-01-17 12:41:55 +01:00
|
|
|
analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = vpad.leftStick.x * 0x7FF0;
|
|
|
|
analog_state[0][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = vpad.leftStick.y * 0x7FF0;
|
|
|
|
analog_state[0][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = vpad.rightStick.x * 0x7FF0;
|
|
|
|
analog_state[0][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = vpad.rightStick.y * 0x7FF0;
|
2017-01-16 18:52:39 +01:00
|
|
|
|
|
|
|
BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE);
|
|
|
|
|
2017-08-19 17:40:56 +10:00
|
|
|
/* You can only call VPADData once every loop, else the second one
|
|
|
|
won't get any data. Thus; I had to hack touch support into the existing
|
|
|
|
joystick API. Woo-hoo? Misplaced requests for touch axis are filtered
|
|
|
|
out in wiiu_input.
|
|
|
|
*/
|
|
|
|
if (vpad.tpNormal.touched && vpad.tpNormal.validity == VPAD_VALID) {
|
|
|
|
struct video_viewport vp = {0};
|
|
|
|
video_driver_get_viewport_info(&vp);
|
|
|
|
VPADTouchData cal = {0};
|
|
|
|
/* Calibrates data to a 720p screen, seems to clamp outer 12px */
|
|
|
|
VPADGetTPCalibratedPoint(0, &cal, &(vpad.tpNormal));
|
|
|
|
/* Calibrate to viewport and save as axis 2 (idx 4,5) */
|
|
|
|
analog_state[0][2][0] = (int16_t)scaleTP(12.0f, 1268.0f, 0.0f, (float)(vp.full_width), (float)cal.x);
|
|
|
|
analog_state[0][2][1] = (int16_t)scaleTP(12.0f, 708.0f, 0.0f, (float)(vp.full_height), (float)cal.y);
|
|
|
|
|
|
|
|
/* Emulating a button for touch; lets people assign it to menu
|
|
|
|
for that traditional RetroArch Wii U feel */
|
|
|
|
pad_state[0] |= VPAD_BUTTON_TOUCH;
|
|
|
|
} else {
|
|
|
|
/* This is probably 0 anyway */
|
|
|
|
pad_state[0] &= ~VPAD_BUTTON_TOUCH;
|
|
|
|
}
|
2017-01-16 18:52:39 +01:00
|
|
|
|
|
|
|
/* panic button */
|
2017-01-17 12:41:55 +01:00
|
|
|
if ((vpad.hold & (VPAD_BUTTON_R | VPAD_BUTTON_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_STICK_L))
|
|
|
|
== (VPAD_BUTTON_R | VPAD_BUTTON_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_STICK_L))
|
2017-01-16 18:52:39 +01:00
|
|
|
command_event(CMD_EVENT_QUIT, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (c = 0; c < 4; c++)
|
|
|
|
{
|
|
|
|
KPADData kpad;
|
|
|
|
|
2017-01-17 12:41:55 +01:00
|
|
|
if (!KPADRead(c, &kpad, 1))
|
2017-01-16 18:52:39 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (pad_type[c] != kpad.device_type)
|
|
|
|
{
|
|
|
|
pad_type[c] = kpad.device_type;
|
|
|
|
wiiu_joypad_autodetect_add(c + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (kpad.device_type)
|
|
|
|
{
|
|
|
|
case WIIUINPUT_TYPE_WIIMOTE:
|
2017-01-17 12:41:55 +01:00
|
|
|
pad_state[c + 1] = kpad.btns_h;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = 0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = 0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = 0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = 0;
|
2017-01-16 18:52:39 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WIIUINPUT_TYPE_NUNCHUK:
|
2017-01-17 12:41:55 +01:00
|
|
|
pad_state[c + 1] = kpad.btns_h;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.nunchuck.stick_x * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.nunchuck.stick_y * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = 0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = 0;
|
2017-01-16 18:52:39 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WIIUINPUT_TYPE_PRO_CONTROLLER:
|
2017-01-17 12:41:55 +01:00
|
|
|
pad_state[c + 1] = kpad.classic.btns_h & ~0x3FC0000; /* clear out emulated analog sticks */
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.lstick_x * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.lstick_y * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.rstick_x * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.rstick_y * 0x7FF0;
|
|
|
|
break;
|
2017-01-16 18:52:39 +01:00
|
|
|
|
|
|
|
case WIIUINPUT_TYPE_CLASSIC_CONTROLLER:
|
2017-01-17 12:41:55 +01:00
|
|
|
pad_state[c + 1] = kpad.classic.btns_h & ~0xFF0000; /* clear out emulated analog sticks */
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.lstick_x * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.lstick_y * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = kpad.classic.rstick_x * 0x7FF0;
|
|
|
|
analog_state[c + 1][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = kpad.classic.rstick_y * 0x7FF0;
|
2017-01-16 18:52:39 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-05-08 21:46:34 +02:00
|
|
|
|
|
|
|
memset(hid_data,0,sizeof(hid_data));
|
2017-06-07 21:04:13 +02:00
|
|
|
result = gettingInputAllDevices(hid_data,HID_COUNT);
|
2017-05-08 21:46:34 +02:00
|
|
|
|
2017-06-07 21:04:13 +02:00
|
|
|
if (result + HID_OFFSET > MAX_PADS)
|
2017-05-08 21:46:34 +02:00
|
|
|
result = MAX_PADS - HID_OFFSET;
|
2017-06-07 21:04:13 +02:00
|
|
|
|
|
|
|
for(i = HID_OFFSET;i < result + HID_OFFSET; i++)
|
|
|
|
{
|
|
|
|
int hid_index = i-HID_OFFSET;
|
|
|
|
uint8_t old_status = hid_status[hid_index];
|
|
|
|
uint8_t new_status = hid_data[hid_index].status;/* TODO: defines for the status. */
|
|
|
|
|
|
|
|
if (old_status == 1 || new_status == 1)
|
|
|
|
{
|
|
|
|
hid_status[hid_index] = new_status;
|
|
|
|
if (old_status == 0 && new_status == 1) /* Pad was attached */
|
|
|
|
wiiu_joypad_autodetect_add(i);
|
|
|
|
else if (old_status == 1 && new_status == 0) /* Pad was detached */
|
|
|
|
input_autoconfigure_disconnect(i, wiiu_joypad.ident);
|
|
|
|
else if (old_status == 1 && new_status == 1) /* Pad still connected */
|
|
|
|
{
|
|
|
|
pad_state[i] = hid_data[hid_index].button_data.hold & ~0x7F800000; /* clear out emulated analog sticks */
|
|
|
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_X] = hid_data[hid_index].stick_data.leftStickX * 0x7FF0;
|
|
|
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_LEFT] [RETRO_DEVICE_ID_ANALOG_Y] = hid_data[hid_index].stick_data.leftStickY * 0x7FF0;
|
|
|
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_X] = hid_data[hid_index].stick_data.rightStickX * 0x7FF0;
|
|
|
|
analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT] [RETRO_DEVICE_ID_ANALOG_Y] = hid_data[hid_index].stick_data.rightStickY * 0x7FF0;
|
|
|
|
}
|
|
|
|
}
|
2017-05-08 21:46:34 +02:00
|
|
|
}
|
2016-11-07 02:42:12 +01:00
|
|
|
}
|
2016-10-27 01:34:10 +01:00
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
static bool wiiu_joypad_init(void* data)
|
2016-11-07 02:42:12 +01:00
|
|
|
{
|
|
|
|
wiiu_joypad_autodetect_add(0);
|
2017-05-08 21:46:34 +02:00
|
|
|
memset(hid_status,0,sizeof(hid_status));
|
|
|
|
|
2016-11-07 02:42:12 +01:00
|
|
|
wiiu_joypad_poll();
|
|
|
|
wiiu_pad_inited = true;
|
|
|
|
(void)data;
|
|
|
|
|
|
|
|
return true;
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool wiiu_joypad_query_pad(unsigned pad)
|
|
|
|
{
|
2017-01-16 18:52:39 +01:00
|
|
|
return pad < MAX_PADS && wiiu_pad_inited;
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wiiu_joypad_destroy(void)
|
|
|
|
{
|
2016-11-07 02:42:12 +01:00
|
|
|
wiiu_pad_inited = false;
|
2016-10-27 01:34:10 +01:00
|
|
|
}
|
|
|
|
|
2017-01-16 18:52:39 +01:00
|
|
|
input_device_driver_t wiiu_joypad =
|
|
|
|
{
|
2016-10-27 01:34:10 +01:00
|
|
|
wiiu_joypad_init,
|
|
|
|
wiiu_joypad_query_pad,
|
|
|
|
wiiu_joypad_destroy,
|
|
|
|
wiiu_joypad_button,
|
|
|
|
wiiu_joypad_get_buttons,
|
|
|
|
wiiu_joypad_axis,
|
|
|
|
wiiu_joypad_poll,
|
|
|
|
NULL,
|
|
|
|
wiiu_joypad_name,
|
|
|
|
"wiiu",
|
|
|
|
};
|