78 Commits

Author SHA1 Message Date
Nathan Strong
5da1cd08ff Unify the HID driver architecture
== DETAILS
When I first implemented the Wii U HID architecture, I ended up
having to design my own implementation because, at the time, I did
not have a way to read the HID device string to allow the existing
code to successfully detect the gamepad.

After spending some time experimenting, I've figured out how to
do this. And that means I can better align the HID driver with other
platforms.

change summary:

- create a single state structure for all three sub-types of wiiu pads
  (kpad, wpad, and hid)
- eliminate confusing duplicate pad lists
- eliminate confusing duplicate HID pad drivers (ds3, gamecube
  adapter, etc)
- ensure the ds3 driver still works
2021-10-05 09:23:08 -07:00
Adie
ce4fce12c0 Implement changes to fix macOS controller duplication bug 2021-08-06 22:02:43 -05:00
James Montgomerie
5c58c6969e Allow controllers with no/empty names to work. 2020-09-06 18:24:32 -07:00
Sergei Nikitin
7475f6230a [Wii] Added HID support for HORI mini wired ps4 gamepad 2020-09-04 17:50:10 +06:00
twinaphex
93f9d69742 Cleanups 2020-08-28 20:42:55 +02:00
revvv
976e4672b4 add Retrode support 2019-08-11 20:13:38 +02:00
twinaphex
a82bb0ec94 Create special type input_bits_t 2018-04-08 20:21:12 +02:00
twinaphex
b57f0d95c2 Try to fix Apple iOS build - error: initializer element is not a compile-time constant 2018-01-01 15:27:52 +01:00
Alcaro
7fd4d5013d C89 2017-12-31 23:46:11 +01:00
twinaphex
5aa159431e Prevent potential crash 2017-12-31 07:15:18 +01:00
gblues
11fed40c79 Fix another crash bug in joypad_connect
== DETAILS

I fixed a similar bug in a past commit, with the same root cause: making
assumptions about the length of the array.

- Add validation to joypad_connection_init() so that if >MAX_USERS is
  requested, a warning is logged and only MAX_USERS is allocated.
- Rewrote the iteration routines so they strictly use the
  joypad_is_end_of_list() method to detect the end.
2017-12-30 16:36:54 -08:00
gblues
0ae7ffe0d3 Clean up dumb compile warnings, fix crash bug
== DETAILS

- the free() method of the hid_driver_t interface needs its
  parameter defined as const in order for the compiler to stop
  complaining about losing const-ness.
- if a joypad list is created with <MAX_USERS slots in it, the
  destroy() function will crash because it assumes there are MAX_USERS
  entries.

  To do this, the allocate function creates n+1 slots, and gives the
  last slot a canary value that the destroy() method can then watch for
  when iterating through the list.
2017-12-30 04:43:27 +01:00
gblues
8f900de65e Clean up USB VID/PID declarations
== DETAILS

USB Vendor and Product IDs are in little-endian byte order, and they
need to be byteswapped on big-endian systems.

This approach allows us to use the standard hex notation for the VID/HID
values, and give them meaningful names, and only swap on the platforms
that need it. Also prevents having to abuse SWAP16() in the platform-
specific code.
2017-12-30 04:43:03 +01:00
gblues
5b37ced196 Update HID pad driver architecture
== DETAILS

The current HID implementation assumes a very low-level USB library
is being used. This causes a problem on Wii U, because the Cafe OS
only exposes a high-level interface.

To get these functions exposed to the HID pad drivers, I had to make
three changes:

1. I added the legacy "send_control" function to the HID driver
   interface
2. I modified the signature of pad_connection_pad_init() to send the
   driver pointer instead of the function pointer
3. I updated the HID pad drivers to keep the pointer to the driver
   instead of the function pointer, and updated the calls into the
   send_control function as appropriate
4. I updated the HID drivers to use the new pad init signature

== TESTING
Untested, in theory it should work without a hitch because at this
point all I've done is abstract things a little. I still need to
update the HID pad drivers to use the Wii U-specific calls as
appropriate.
2017-12-30 04:41:01 +01:00
gblues
d0adbd194e Revert changes to joypad API
== DETAILS

Premature. Still learning my way around the codebase.
2017-12-30 04:40:53 +01:00
gblues
5804233ca8 Start fleshing out wiiu_hid driver
== DETAILS

- Added entrypoints into `input/connect/joypad_connection.c` to allow
  a max value to be passed in, instead of using single macro value
- Created a hand-off between the HID attach handler and the worker thread
- Created a pad initializer in `wiiu_hid.c` leveraging the new functionality
  added to `joypad_connection.c`

== TESTING
Compiles cleanly. At best, doesn't do anything. Might crash--not ready
to test quite yet.
2017-12-30 04:40:39 +01:00
David Walters
124ddcd27a Add dolphin bar VID/PID - treat like a wii over bluetooth connection 2017-12-07 23:44:29 +00:00
twinaphex
f0c143766e Change to 256bit macros 2017-12-05 12:07:35 +01:00
twinaphex
e94300a581 Get rid of a lot of RARCH_INPUT_STATE_BIT_ macros - replace them
with BIT128_ equivalents instead
2017-12-05 09:22:56 +01:00
David Walters
c5bdc02d6f replace uint64_t with retro_bits_t* for pad buttons state 2017-11-28 10:04:34 +00:00
twinaphex
e16371b8a5 Merge input_config.c and input_driver.c 2017-08-31 02:25:04 +02:00
twinaphex
5c973b6649 Add another entry to debug logging 2017-06-18 15:52:17 +02:00
twinaphex
2d76e98c22 Add debug logging 2017-06-18 15:48:44 +02:00
Daniel Jimenez
5267b630f8 Added code for single port psx to ps3 adapter
On branch master
 Changes to be committed:
	modified:   ../griffin/griffin.c
	modified:   ../input/connect/connect_ps2adapter.c
	new file:   ../input/connect/connect_psxadapter.c
	modified:   ../input/connect/joypad_connection.c
	modified:   ../input/connect/joypad_connection.h
2017-06-17 14:19:09 -07:00
twinaphex
96c8ca5a09 Header update #1 2017-01-22 13:40:32 +01:00
twinaphex
a5e4ea2f33 C89_BUILD fix 2016-12-24 01:47:01 +01:00
Dave Leaver
f7c6574b37 Correctly handle adding controllers if we fail to match them to the known pad_map. 2016-12-16 20:16:55 +13:00
twinaphex
974d3245d2 Fix logically dead code warnings 2016-05-23 22:04:00 +02:00
Ernesto Ramirez
c4f2de321a (GX) Added PS2/PSX Controller Adapter for HID driver. 2016-04-16 19:33:17 -05:00
twinaphex
24f5275001 Use wiiugca for non-Wii too 2016-02-04 23:49:04 +01:00
twinaphex
407d85f604 Use nesusb/snesusb for non-Wii too 2016-02-04 23:43:33 +01:00
netux79
bca4ccb155 (GX) Refactor of the Wii USB HID support. Now it's working!
In order to have a controller working you need:
1) Have a matching HID autoconfig file in autoconfig/hid for your controller.
2) Create a "connect" driver for the pad in "input/connect" folder (source code of RA).
3) Once you are in RA, change the joystick driver to HID and restart.
4) You may be now able to use you USB HID compatible pad in RA.

I included some "connect" drivers as an example. It also need to include them for compilation.
2016-02-04 17:01:03 -05:00
twinaphex
2e8f015de3 Cleanups 2016-02-04 21:07:02 +01:00
twinaphex
454abdee48 stdstring - create string_is_equal 2016-01-20 04:07:24 +01:00
twinaphex
2caa529347 Change VID/PID again 2016-01-14 09:56:07 +01:00
twinaphex
5dd10f1d45 pad_connection_pad_init - cleanup 2016-01-14 09:53:00 +01:00
twinaphex
144b6aed9e Cleanup 2016-01-14 09:52:20 +01:00
twinaphex
974e8d6ce2 (joypad_connection.c) Cleanups 2016-01-14 09:51:17 +01:00
twinaphex
ec6f70603b Add PID/VID for PS3 pad knockoff 2016-01-14 09:03:04 +01:00
twinaphex
347a18cb30 Update input headers 2016-01-10 04:33:01 +01:00
twinaphex
d76d857166 Turn into C89-compatible comment 2015-12-13 00:01:44 +01:00
dibas
0c749a6181 Implemented additional checks for Nintendo controllers. 2015-12-12 20:41:52 +01:00
Twinaphex
d85595ca67 Put Wii-U Pro pad on top of Wii Classic pad in list 2015-12-12 20:06:10 +01:00
twinaphex
9394294956 (joypad_connection) Stub Wii U Pro implementation - untested 2015-12-12 18:30:17 +01:00
twinaphex
cbb3535854 joypad_connection.c - include stdlib.h for calloc 2015-12-05 13:24:15 +01:00
twinaphex
a3c34a7813 Cleanups 2015-11-28 02:31:19 +01:00
twinaphex
790bb0d0d6 Minor code cleanups based on static code analysis 2015-09-28 22:07:40 +02:00
slotek
7431529e89 Restore generic Mac OS X joypad functionality 2015-07-29 10:12:31 -06:00
twinaphex
d61ad058b4 Some CXX_BUILD fixes 2015-06-26 12:38:33 +02:00
twinaphex
0d50840749 (joypad_connection.c) Cleanups 2015-06-25 18:25:20 +02:00