RetroArch
joypad_connection.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2013-2014 - Jason Fetters
3  * Copyright (C) 2011-2017 - Daniel De Matteis
4  *
5  * RetroArch is free software: you can redistribute it and/or modify it under the terms
6  * of the GNU General Public License as published by the Free Software Found-
7  * ation, either version 3 of the License, or (at your option) any later version.
8  *
9  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with RetroArch.
14  * If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _JOYPAD_CONNECTION_H
18 #define _JOYPAD_CONNECTION_H
19 
20 #include <stdint.h>
21 #include <stddef.h>
22 
23 #include <libretro.h>
24 #include <retro_miscellaneous.h>
25 #include <retro_endianness.h>
26 #include "../input_driver.h"
27 
28 #define VID_NONE 0x0000
29 #define VID_NINTENDO swap_if_big16(0x057e)
30 #define VID_SONY swap_if_big16(0x054c)
31 #define VID_MICRONTEK swap_if_big16(0x0079)
32 #define VID_PCS swap_if_big16(0x0810)
33 #define VID_PS3_CLONE swap_if_big16(0x0313)
34 #define VID_SNES_CLONE swap_if_big16(0x081f)
35 
36 #define PID_NONE 0x0000
37 #define PID_NINTENDO_PRO swap_if_big16(0x0330)
38 #define PID_SONY_DS3 swap_if_big16(0x0268)
39 #define PID_SONY_DS4 swap_if_big16(0x05c4)
40 #define PID_DS3_CLONE swap_if_big16(0x20d6)
41 #define PID_SNES_CLONE swap_if_big16(0xe401)
42 #define PID_MICRONTEK_NES swap_if_big16(0x0011)
43 #define PID_NINTENDO_GCA swap_if_big16(0x0337)
44 #define PID_PCS_PS2PSX swap_if_big16(0x0001)
45 #define PID_PCS_PSX2PS3 swap_if_big16(0x0003)
46 
48 {
49  bool connected;
51  void* data;
52 };
53 
55 {
56  void* (*init)(void *data, uint32_t slot, hid_driver_t *driver);
57  void (*deinit)(void* device);
59  void (*set_rumble)(void* device, enum retro_rumble_effect effect,
60  uint16_t strength);
62  int16_t (*get_axis)(void *data, unsigned axis);
63  const char* (*get_name)(void *data);
64  bool (*button)(void *data, uint16_t joykey);
66 
76 
78  const char* name, uint16_t vid, uint16_t pid,
79  void *data, hid_driver_t *driver);
80 
82 
84 
86  uint32_t idx);
87 
90 
92  unsigned idx, input_bits_t* state);
93 
95  unsigned idx, unsigned i);
96 
97 /* Determine if connected joypad is a hidpad backed device.
98  * If false, pad_connection_packet cannot be used */
99 
101  unsigned idx);
102 
104 
106  unsigned pad, enum retro_rumble_effect effect, uint16_t strength);
107 
108 const char* pad_connection_get_name(joypad_connection_t *joyconn,
109  unsigned idx);
110 
111 #endif
GLuint const GLchar * name
Definition: glext.h:6671
void pad_connection_get_buttons(joypad_connection_t *joyconn, unsigned idx, input_bits_t *state)
Definition: joypad_connection.c:231
joypad_connection_t * pad_connection_init(unsigned pads)
Definition: joypad_connection.c:62
pad_connection_interface_t pad_connection_wiiupro
Definition: connect_wiiupro.c:256
pad_connection_interface_t pad_connection_ps3
Definition: connect_ps3.c:233
GLsizeiptr size
Definition: glext.h:6559
void(* packet_handler)(void *device, uint8_t *packet, uint16_t size)
Definition: joypad_connection.h:58
GLdouble s
Definition: glext.h:6390
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
int32_t pad_connection_pad_init(joypad_connection_t *joyconn, const char *name, uint16_t vid, uint16_t pid, void *data, hid_driver_t *driver)
Definition: joypad_connection.c:93
void(* set_rumble)(void *device, enum retro_rumble_effect effect, uint16_t strength)
Definition: joypad_connection.h:59
Definition: ibxm.h:9
int16_t(* get_axis)(void *data, unsigned axis)
Definition: joypad_connection.h:62
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:6303
pad_connection_interface_t pad_connection_snesusb
Definition: connect_snesusb.c:141
typedef bool(RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index
Definition: input_types.h:25
struct pad_connection_interface pad_connection_interface_t
int16_t pad_connection_get_axis(joypad_connection_t *joyconn, unsigned idx, unsigned i)
Definition: joypad_connection.c:240
pad_connection_interface_t pad_connection_wiiugca
Definition: connect_wiiugca.c:150
pad_connection_interface_t pad_connection_wii
Definition: connect_wii.c:726
void * data
Definition: joypad_connection.h:51
pad_connection_interface_t pad_connection_ps2adapter
Definition: connect_ps2adapter.c:175
void pad_connection_packet(joypad_connection_t *joyconn, uint32_t idx, uint8_t *data, uint32_t length)
Definition: joypad_connection.c:222
bool pad_connection_has_interface(joypad_connection_t *joyconn, unsigned idx)
Definition: joypad_connection.c:248
void(* deinit)(void *device)
Definition: joypad_connection.h:57
int pad_connection_find_vacant_pad(joypad_connection_t *joyconn)
Definition: joypad_connection.c:29
Definition: joypad_connection.h:54
signed short int16_t
Definition: stdint.h:122
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
retro_rumble_effect
Definition: libretro.h:1851
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
signed int int32_t
Definition: stdint.h:123
bool(* button)(void *data, uint16_t joykey)
Definition: joypad_connection.h:64
Definition: joypad_connection.h:47
void(* get_buttons)(void *data, input_bits_t *state)
Definition: joypad_connection.h:61
pad_connection_interface_t pad_connection_nesusb
Definition: connect_nesusb.c:140
void pad_connection_destroy(joypad_connection_t *joyconn)
Definition: joypad_connection.c:257
Definition: hid_driver.h:36
struct pad_connection_interface * iface
Definition: joypad_connection.h:50
pad_connection_interface_t pad_connection_ps4
Definition: connect_ps4.c:286
void pad_connection_pad_deinit(joypad_connection_t *joyconn, uint32_t idx)
Definition: joypad_connection.c:204
bool connected
Definition: joypad_connection.h:49
pad_connection_interface_t pad_connection_psxadapter
Definition: connect_psxadapter.c:183
bool pad_connection_rumble(joypad_connection_t *s, unsigned pad, enum retro_rumble_effect effect, uint16_t strength)
Definition: joypad_connection.c:267
const char * pad_connection_get_name(joypad_connection_t *joyconn, unsigned idx)
Definition: joypad_connection.c:279
unsigned short uint16_t
Definition: stdint.h:125
struct nk_device device
Definition: nk_common.c:44
GLenum GLuint GLenum GLsizei length
Definition: glext.h:6233
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126