2012-04-21 23:13:50 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 01:50:59 +01:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2017-01-22 13:40:32 +01:00
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2017-12-11 23:55:31 -08:00
|
|
|
*
|
2012-04-21 23:13:50 +02:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2011-12-14 01:35:17 +01:00
|
|
|
* 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.
|
|
|
|
*
|
2012-04-21 23:13:50 +02:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2011-12-14 01:35:17 +01:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 23:31:57 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2011-12-14 01:35:17 +01:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2011-12-14 08:36:04 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2011-12-14 01:35:17 +01:00
|
|
|
#include <input/input.h>
|
|
|
|
#include <usb/usbmain.h>
|
|
|
|
|
2016-05-10 19:03:53 +02:00
|
|
|
#include <libretro.h>
|
|
|
|
|
2019-07-19 12:55:38 +02:00
|
|
|
#include "../input_driver.h"
|
2013-03-16 17:51:45 +01:00
|
|
|
|
2020-09-02 15:26:03 +02:00
|
|
|
/* TODO/FIXME - add joypad driver */
|
|
|
|
|
2020-08-26 15:32:05 +02:00
|
|
|
/* TODO/FIXME - static global variable */
|
2019-07-19 12:55:38 +02:00
|
|
|
static uint64_t state[DEFAULT_MAX_PADS];
|
2013-01-10 03:34:43 +01:00
|
|
|
|
2020-09-01 21:43:19 +02:00
|
|
|
static void xenon360_input_poll(void *data)
|
2011-12-14 01:35:17 +01:00
|
|
|
{
|
2020-08-31 02:07:43 +02:00
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for (i = 0; i < DEFAULT_MAX_PADS; i++)
|
2011-12-14 01:35:17 +01:00
|
|
|
{
|
2013-01-13 20:58:52 +01:00
|
|
|
struct controller_data_s pad;
|
2020-06-10 04:00:40 +02:00
|
|
|
uint64_t *cur_state;
|
|
|
|
|
2011-12-14 08:36:04 +01:00
|
|
|
usb_do_poll();
|
2013-01-13 20:58:52 +01:00
|
|
|
get_controller_data(&pad, i);
|
|
|
|
|
2020-06-10 04:00:40 +02:00
|
|
|
cur_state = &state[i];
|
|
|
|
|
|
|
|
*cur_state |= pad.b ? RETRO_DEVICE_ID_JOYPAD_A : 0;
|
|
|
|
*cur_state |= pad.a ? RETRO_DEVICE_ID_JOYPAD_B : 0;
|
|
|
|
*cur_state |= pad.y ? RETRO_DEVICE_ID_JOYPAD_X : 0;
|
|
|
|
*cur_state |= pad.x ? RETRO_DEVICE_ID_JOYPAD_Y : 0;
|
|
|
|
*cur_state |= pad.left ? RETRO_DEVICE_ID_JOYPAD_LEFT : 0;
|
|
|
|
*cur_state |= pad.right ? RETRO_DEVICE_ID_JOYPAD_RIGHT : 0;
|
|
|
|
*cur_state |= pad.up ? RETRO_DEVICE_ID_JOYPAD_UP : 0;
|
|
|
|
*cur_state |= pad.down ? RETRO_DEVICE_ID_JOYPAD_DOWN : 0;
|
|
|
|
*cur_state |= pad.start ? RETRO_DEVICE_ID_JOYPAD_START : 0;
|
|
|
|
*cur_state |= pad.back ? RETRO_DEVICE_ID_JOYPAD_SELECT : 0;
|
|
|
|
*cur_state |= pad.lt ? RETRO_DEVICE_ID_JOYPAD_L : 0;
|
|
|
|
*cur_state |= pad.rt ? RETRO_DEVICE_ID_JOYPAD_R : 0;
|
2011-12-14 01:35:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-11 11:50:00 +02:00
|
|
|
static void xenon360_input_free_input(void *data) { }
|
|
|
|
static void* xenon360_input_init(const char *a) { return (void*)-1; }
|
2013-01-13 21:20:43 +01:00
|
|
|
|
2015-09-28 22:03:05 +02:00
|
|
|
static uint64_t xenon360_input_get_capabilities(void *data)
|
2013-11-02 21:16:57 +01:00
|
|
|
{
|
2020-08-30 05:29:32 +02:00
|
|
|
return (1 << RETRO_DEVICE_JOYPAD);
|
2020-06-23 17:35:39 +02:00
|
|
|
}
|
|
|
|
|
2014-09-11 07:06:20 +02:00
|
|
|
input_driver_t input_xenon360 = {
|
2013-11-02 21:16:57 +01:00
|
|
|
xenon360_input_init,
|
|
|
|
xenon360_input_poll,
|
2020-09-02 17:37:01 +02:00
|
|
|
NULL, /* input_state */
|
2013-11-02 21:16:57 +01:00
|
|
|
xenon360_input_free_input,
|
2014-06-10 01:30:25 +02:00
|
|
|
NULL,
|
2013-11-03 00:27:58 +01:00
|
|
|
NULL,
|
2014-01-20 14:52:53 +01:00
|
|
|
NULL,
|
2013-11-02 21:16:57 +01:00
|
|
|
xenon360_input_get_capabilities,
|
|
|
|
"xenon360",
|
2020-08-30 05:29:32 +02:00
|
|
|
NULL, /* grab_mouse */
|
2022-10-16 02:58:09 -05:00
|
|
|
NULL,
|
2020-09-02 00:38:11 +02:00
|
|
|
NULL
|
2011-12-14 01:35:17 +01:00
|
|
|
};
|