69 Commits

Author SHA1 Message Date
neil4
b98c53ddb7
Improve haptic feedback for input overlays (#14517)
Repurpose vibrate_on_keypress to enable device's standard keypress feedback on overlay key/button state changes

- Add keypress_vibrate function ptr to input_driver_t (only implemented on Android for now)
- (Android) Remove APP_CMD_VIBRATE_KEYPRESS
- (Android) Add doHapticFeedback, called directly to avoid latency
2022-10-16 09:58:09 +02:00
LibretroAdmin
d0c6dfee0b Cleanup bitmask setting 2022-10-05 18:43:58 +02:00
gblues
1ef78d3e3d
Any pad can control the menu (#13173)
* Any pad can control the menu

== DETAILS
I am not sure I've quite got it so that any pad can *open* the
menu, but I do have it so any pad can control it.

- split out the input processing into a separate method
- track down and squish some hairy bugs that boiled down to
  bad pointer math
- it looks like `menu_driver.c` has a mix of line endings, so I
  ran it through `dos2unix` so it has consistent line endings
  again.
- verified that this change did not impact actual cores

* optimize out cumulative_bits

* Incorporate PR feedback

Many thanks to @jdgleaver for providing these optimizations.

* apply one more optimization
2021-11-03 16:32:15 +01:00
twinaphex
45bef61e36 Cleanups 2020-09-18 02:50:01 +02:00
twinaphex
1c5f4e1dee Start cutting down on input_state - move all joypad driver code up to
higher-level retroarch.c
2020-09-02 15:26:03 +02:00
twinaphex
a72759aba0 (input drivers) Cleanups 2020-09-02 05:26:24 +02:00
twinaphex
2fde8c21a9 Remove set_rumble function from input driver 2020-09-02 00:38:11 +02:00
twinaphex
6f92c56ca3 Simplify input drivers 2020-08-31 02:07:43 +02:00
twinaphex
d4d8b6934a Put keyboard_mapping_blocked into p_rarch / rarch struct
instead
2020-08-30 18:47:29 +02:00
twinaphex
5f08605680 Refactor joypad drivers 2020-08-30 05:29:32 +02:00
twinaphex
84a312535e Cleanup set_rumble functions 2020-08-29 22:22:26 +02:00
twinaphex
b3744c3126 Put input_jpyad_init_driver last in 'input' callback function 2020-08-29 20:46:42 +02:00
twinaphex
bf06d67a30 Cut down on some extra ifdefs 2020-08-29 19:59:04 +02:00
twinaphex
e6b9420a15 (Input) reorder structs, alignment 2020-08-26 15:32:05 +02:00
twinaphex
d97e590aaf Reimplement multi button state functions 2020-07-19 03:18:12 +02:00
twinaphex
689ac432d6 MOve input_joypad_analog call to inside retroarch.c instead of the
input driver itself, and make function static
2020-06-23 18:31:40 +02:00
twinaphex
d03a0a7b51 (WiiU) Buildfix 2020-06-12 19:33:13 +02:00
twinaphex
6092de544c (Wiiu) Buildfix 2020-06-12 07:13:55 +02:00
twinaphex
e40d381f6b (WiiU) Cleanups 2020-06-11 22:05:30 +02:00
twinaphex
a7a03984f1 (input drivers) Cleanups 2020-06-10 04:00:40 +02:00
twinaphex
26b3ccf2e5 Don't pass joypad_info by value 2020-02-27 07:33:14 +01:00
twinaphex
65b4c2595e Update set keyboard mapping code for input driver 2019-07-27 02:21:24 +02:00
twinaphex
02876aecae Cleanups 2019-07-23 14:07:49 +02:00
twinaphex
bee9984745 Update all other input drivers 2019-07-22 01:20:00 +02:00
twinaphex
f4104f5c9a Regression in
9c73d3305d
- joykey needs to be uint64_t and then is later cast to uint16_t -
is apparently important for hotkeys
2019-07-21 16:22:41 +02:00
twinaphex
4c69dad0ce Define DEFAULT_MAX_PADS inside config.def.h - get rid of the messy
MAX_PADS macros everywhere
2019-07-19 12:55:38 +02:00
twinaphex
9c73d3305d Insert input_joypad_pressed into drivers themselves 2019-06-23 18:20:48 +02:00
twinaphex
1e863b0f4d Optimal way of grabbing all button states in a bitmasked value -
should allow us to do only one function call to the RA input
driver's input state callback
2019-06-23 06:09:45 +02:00
twinaphex
51365ed387 (input drivers) More simplifications 2019-06-23 02:34:35 +02:00
orbea
bfc366decc Squeeze extra blank lines with cat(1).
Example:

find . -type f -iname '*.c' | while read -r i; do
  cat -s "$i" > "$i.new"
  mv "$i.new" "$i"
done
2019-01-08 11:04:58 -08:00
gblues
fb5b31faf3 Merge branch 'master' into gblues/hid 2018-04-14 14:18:03 -07:00
twinaphex
a82bb0ec94 Create special type input_bits_t 2018-04-08 20:21:12 +02:00
gblues
8a4c5086fb Finish HID implementation for WiiU GCA adapter
== DETAILS

(I think)

- Uncomment the call in the read loop to start feeding packets to the
  driver
- implement the GCA packet driver
- implement the pad interface
- fix indentations in GCA driver

== TESTING
Compiles. Haven't tested yet.
2018-03-29 23:37:11 -07:00
Ash
aeea0e6ca8
[WiiU] Fix OOB read/write in keyboard driver
This code used a keyboardState size of 256 and indexed it with a
retro_key, which can be any value (RETROK_RALT is 307). This fixes
that by using RETROK_LAST as the array size.

Should fix #6322.
2018-03-17 13:00:47 +11:00
gblues
5b13f85967 Use the right value for BIT256_GET macro
== DETAILS

The BIT256_GET() macro expects a bit number (from 0-255), and we're giving it
a 32-bit mask (0x000080000).

Solution:

- Define VPAD_BUTTON_xxx_BIT macros using the bit number
- Use said macro in wiiu_input.c
- organizational cleanup:

  * put VPAD_BUTTON_TOUCH into the enum in stead of as a hokey define
  * put the touch bits in the right order
  * put in placeholder enums for (currently) unused bits
2018-01-05 20:03:10 -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
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
c1496a8600 WIP - reorganizing input data
== DETAILS

Looking at the apple input driver gave me an idea--moving the
HID driver into the wiiu_input_t data instead of piggy-backing
it off the wiiu_joypad driver.

- Remove changes to wiiu_joypad
- Add equivalent to wiiu_input

This is probably broke as hell. Haven't tried to compile.
2017-12-30 04:40:43 +01:00
twinaphex
69f85556a3 Get rid of meta_key_pressed 2017-12-18 05:59:57 +01:00
twinaphex
7b210ccf37 Don't call meta key pressed if not bound 2017-12-18 05:49:17 +01: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
5f095677a7 fix for wiiu build (#5826) 2017-11-29 15:55:31 -05:00
Ash
a3e4a7612f
[WiiU] Fix DRC touch - proper scaling; press detection
Oops! Didn't do this quite right the first time round.
This commit fixes RETRO_DEVICE_ID_POINTER_PRESSED, which would always
return 0 due to to an implicit case to int16_t. Basically, we'd do
(val & 0x00080000) & 0xFFFF; which would return 0 every time. Fixed that
by wrapping it in a ternary. Yes, I know we could use a rotation, but
for a boolean value it really doesn't matter.
I also rewrote scaleTP to deal entirely in integers. While the
floating-point math was theoretically faster on PowerPC; it gets awkward
to cast -0x7FFF to a float.
Speaking of, the driver now actually conforms to the libretro API. Not
sure how I managed to not see the spec; but hey, now its fixed.
RETRO_DEVICE_POINTER_ID_X/Y will now return values between -0x7FFF and
0x7FFF like they're supposed to.

Big thanks to @r-type for hounding me to fix this.
Partially addresses #5294; we still need mouse emulation.
2017-11-04 15:01:58 +11:00
twinaphex
a3ded01b64 Cleanups 2017-09-27 23:16:37 +02:00
twinaphex
e16371b8a5 Merge input_config.c and input_driver.c 2017-08-31 02:25:04 +02:00
Ash
6b5aef09a1
[WiiU] DRC touch support as pointer device
Allow using the Gamepad's touch screen as a RETRO_DEVICE_POINTER.
Methodology could use some work, had to add an extra axis to
joypad in order to get the data transferred into the input driver.
Feel free to change this.
Needs to emulate RETRO_DEVICE_LIGHTGUN to really be useful.
Potential for Wiimote IR in future.

Partially addresses libretro/RetroArch#5294
2017-08-19 17:40:56 +10:00
twinaphex
ca80f13b2b Try to be somewhat safer here in case of null pointer derefences 2017-08-09 02:42:19 +02:00
twinaphex
060753258a Combine input_driver.c and input_keyboard.c 2017-06-11 17:51:12 +02:00
twinaphex
5ef8b69c9c (wiiu_input.c) Minor style nits 2017-06-07 21:06:24 +02:00