Commit Graph

3977 Commits

Author SHA1 Message Date
Nathan Strong
01e96585a3 Fix crash when connecting DS3 to Mac
== DETAILS
The OSX HID driver doesn't implement `set_protocol()` and crashes
with an NPE, so we guard it.
2021-10-05 23:57:09 -07:00
twinaphex
55bf2b0083 (input/connect) Style nits 2021-10-06 02:52:19 +02:00
twinaphex
f81a231481 (joypad_connection) Cleanups - get rid of warning for old-style function
definition
2021-10-06 02:28:55 +02:00
Nathan Strong
e8ec65ecf7 squelch format warning 2021-10-05 19:05:12 +00:00
Nathan Strong
3e91e3fbc9 fix up non-wiiu side of ifdefs for ds3 2021-10-05 18:15:19 +00:00
Nathan Strong
002c9a30c0 Implement button() for most HID drivers
== DETAILS
The HID drivers in `input/connect/` were missing an implementation
for button(), so I added it. The only exception is the wii driver,
which is really complicated and more than I wanted to try to tackle--
especially since WIIU has its own wiimote drivers.
2021-10-05 17:43:03 +00:00
Nathan Strong
e02e345a28 Make GCA driver compatible with other HID drivers
== DETAILS
Use a little trickery to ensure the GCA driver continues working
with other HID implementation.

I've expanded the joypad implementation to support multi-pad devices.
However, this requires changes to each HID implementation to actually
function.

I've made the necessary changes for WIIU, but I don't have the means
of making the change in the other HID implementations.

So, I've built in a backwards-compatibilty mode for the driver.

The trick is to have an identifier byte at the top of both data structs
that the driver returns. We can then use that byte to determine which
of the structs has been passed to the pad functions and act accordingly.

In the GCA case, for non-wiiu platforms, it will simply expose port 1
of the GCA and the other 3 ports do nothing.
2021-10-05 09:47:03 -07:00
Nathan Strong
2715b4c9c0 get gamecube adapter working 2021-10-05 09:23:08 -07:00
Nathan Strong
c832828ddb Figured out the cause of crash
== DETAILS
cause of crash: trying to deference init when it's null
the reason it was going into deregister: the HID/VID lookup was
failing because it wasn't getting initialized first
cause of 2nd crash: the "end of pad list" method looked for an entry
with a magic value, so we add an end marker
2021-10-05 09:23:08 -07:00
Nathan Strong
a4d8ce7753 Try to support multi-pad HID devices
== DETAILS
I tried to modify the joypad connection interface to support
multi-pad HID devices ... it doesn't work. I'm not sure why.
2021-10-05 09:23:08 -07:00
Nathan Strong
9846ebb171 enable GCA adapter, minor cleanup
== DETAILS

I'm going to need to re-implement the abstraction between HID device
and gamepad; the changes here lay down some foundation for that work.

- reduce logging priority of some statements I modified while debugging
- factor out the pad driver lookup into its own method
- fix so the pad driver list isn't re-initialized every invocation
- add the button() method for the GCA driver
2021-10-05 09:23:08 -07:00
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
Nathan Strong
9edb449471 wip commit 2021-10-05 09:10:41 -07:00
p-sam
54d2ac9f43 libnx: Splitted Joycons button mapping
- Minus/Plus is always Plus when splitted (JOYPAD_START)
- StickR/StickL is always StickL when splitted (JOYPAD_L3)
2021-10-01 20:18:54 +02:00
twinaphex
fde3406d1b Get rid of input_event_get_osk_ptr/get_osk_grid 2021-10-01 07:37:33 +02:00
Autechre
8807e2957e
Input refactors pt3 (#13053)
* Move more internal state over to input_driver.c and menu_driver.c -
retroarch.c now down to 893kb
- Remove now unused p_rarch pointers in functions
2021-10-01 07:18:30 +02:00
twinaphex
e9a4e811ac Move more code and variables from rarch_state out to input_driver
and menu_driver
2021-10-01 00:41:50 +02:00
twinaphex
49fbed2423 Get rid of input_mouse_grabbed - move retroarch types to
retroarch_types.h
2021-09-30 23:22:50 +02:00
twinaphex
12c81bc073 Replace input_state_get_ptr call 2021-09-30 21:31:37 +02:00
twinaphex
dbe414e1e1 move input_poll_overlay to input_driver.c 2021-09-30 21:29:35 +02:00
twinaphex
ddceb51f89 Get rid of some needless getters/setters 2021-09-30 21:10:12 +02:00
twinaphex
ef875f6102 Create input_state_get_ptr - move to input_driver.c -
also moved over the functions that had a dependence on this
state - retroarch.c reduced to 979kb now
2021-09-30 20:54:56 +02:00
twinaphex
e886e908d5 Create consistent naming conventions - use retroarch_ instead
of rarch_ for some functions for all functions coming from retroarch.h
2021-09-28 12:56:10 +02:00
twinaphex
8ef9065c86 Get rid of menu_driver_is_alive - we don't want these one/two-line getters/setters anymore 2021-09-28 10:27:00 +02:00
grant2258
a327fdb6fe
add mouse relative check and set appropiatley to fix issue (#12994)
* re add this after failed rebase

* update

* temp fix for device friendly naming as it is for testing

* add device friendly names in the appropiate place

* add/remove hotplug dev to ra input mouse port list

Co-authored-by: grant2258 <you@example.com>
2021-09-24 18:31:20 +02:00
Ben Hamilton (Ben Gertzfield)
1970786932
New feature: Use gamepad combo to quit Retroarch (#13017)
* Refactor menu toggle combo button logic to allow quit combo button

* Quit gamepad combo

* Fixes from @jdgleaver
2021-09-24 18:30:46 +02:00
M4xw
931eb3221b [LIBNX] Fix Split Joycon 2021-09-23 13:45:22 +02:00
twinaphex
d2af43d457 Cleanups 2021-09-20 21:08:53 +02:00
twinaphex
eb895f9947 move more code out of retroarch.c 2021-09-18 21:14:15 +02:00
gblues
78858a9474
Fix analog inputs on HID devices (#12991)
== DETAILS

File this one under "I'm not sure how this ever worked."

I mean, it did (in 1.8.8). I'm not sure what changed, but ultimately what I did was
a bunch of comparative testing against 1.8.8:

- I confirmed the packet data was still being read successfully
- I confirmed that the axis value being passed into pad->get_axis() had
  not changed
- I confirmed the work done in `gamepad_read_axis_data()` was working the same
  between 1.8.8 and master

With the only difference between 1.8.8 and current being the return value from
`gamepad_read_axis_data()`, I just rewrote the method to work properly, and
also fixed up the default axis mapping.

I tested this with a sixaxis controller and GCA, configuring the analog-to-digital
control override to use the right stick.
2021-09-15 03:30:05 +02:00
twinaphex
90775e7306 Silence warnings/errors 2021-09-13 20:30:22 +02:00
twinaphex
3c69a941da Move code over to input_driver.c 2021-09-13 18:33:53 +02:00
jdgleaver
12f787547c
Add workaround to fix keyboard input when using x11+udev (#12981) 2021-09-13 18:02:40 +02:00
Autechre
e24440d4a9
Merge pull request #12976 from grant2258/mouse_index
this function is called more than once dont use static
2021-09-13 11:44:28 +02:00
grant2258
88b15c1b1d this function is called more than once dont use static 2021-09-12 20:58:49 +01:00
twinaphex
ad4b51b903 Move cde from retroarch.c to input_driver.c 2021-09-12 19:27:12 +02:00
twinaphex
b5138b6122 Move input_config_get_bind_string to input_driver.c 2021-09-12 17:41:00 +02:00
twinaphex
6c79cebc6e Move input_overlay_auto_rotate_ out of retroarch.c and into
input_driver.c
2021-09-09 14:24:42 +02:00
twinaphex
81e7dab159 Move code out of retroarch.c and into input_driver.c 2021-09-09 14:11:46 +02:00
Michael Burgardt
303d17e2e6 Rebase 'Add generic rumble gain to input settings' by davidgfnet 2021-09-08 19:52:32 +02:00
twinaphex
c9e587a5a7 Move more input code over to input_driver.c from retroarch.c 2021-09-07 14:55:37 +02:00
twinaphex
276b4fd72c Move more code over from retroarch.c to input_driver.c 2021-09-07 13:08:31 +02:00
twinaphex
67defbcf26 Transfer code over from retroarch.c to input_driver.c 2021-09-07 12:42:03 +02:00
twinaphex
3a78b46862 Move code to input_driver.c 2021-09-07 10:17:06 +02:00
twinaphex
722166cb15 Move functions from retroarch.c to input_driver.c 2021-09-07 07:11:42 +02:00
twinaphex
7c665702a8 Move input_driver_toggle_button_combo to input_driver.c 2021-09-07 06:50:18 +02:00
bulzipke
8adc24ecbc
(3DS) Add bottom screen menu (#12470)
* (3DS) Add bottom screen menu
 -> User can save/load state on botom screen with thumbnail.
 -> Call a save_state_to_file() when RAM state has data to write a disk.
 -> If the bottom screen needs updating, swap the bottom framebuffers.

Add: SAVE/LODE STATE TO RAM
 -> This is useful for devices with slow I/O
 -> 3DS bottom save state use CMD_EVENT_SAVE_STATE_TO_RAM
 -> 3DS bottom load state use CMD_EVENT_LOAD_STATE when RAM state has no data
 -> 3DS bottom load state use CMD_EVENT_LOAD_STATE_FROM_RAM when RAM sate has data

* Rewrite path_get_state to retroarch_get_current_savestate_path

* Fix unterminated state_path
2021-09-03 18:14:03 +02:00
twinaphex
220dfe4dbf Move code in retroarch.c over to configuration file 2021-08-30 16:52:05 +02:00
twinaphex
0194ce91bf Get rid of getters/setters in big driver files from now 2021-08-26 13:27:44 +02:00
sonninnos
ca311246b1 C89 buildfix 2021-08-24 22:32:47 +03:00