87 Commits

Author SHA1 Message Date
twinaphex
5166eebcaf for loop cleanups - use space after 'for' 2020-08-19 03:06:22 +02:00
gblues
4555481863 WIIU: Fix touchscreen mouse emulation
== DETAILS
The way the mouse emulation worked was to simply return a 3rd axis from the
gamepad, which the polling code updates with the touch state in real time.

Well, the code that figures out if it's a positive or negative axis was
failing because it didn't see that 3rd axis as valid. So, I added values
which allow it to be seen as valid, and voila! the touch screen input
works again.

== TESTING
Tested locally using "Beneath a Steel Sky" in ScummVM.
2020-08-13 23:31:17 -07:00
twinaphex
c3d8c8661f Buildfixes for C89_BUILD --disable-menu 2020-08-06 03:04:21 +02:00
twinaphex
89567dae5d (input hid) Change back to original code 2020-07-28 12:42:33 +02:00
twinaphex
dc14f4150d Cleanup 2020-07-25 00:04:25 +02:00
twinaphex
d92280e20e Cleanups 2020-07-25 00:02:26 +02:00
twinaphex
b9cb8c8890 (device_null) Cleanups 2020-07-24 23:57:15 +02:00
twinaphex
9d76412715 (WiiU) Another buildfix 2020-07-24 23:55:06 +02:00
twinaphex
a49b5b7129 Cleanups 2020-07-24 22:23:52 +02:00
twinaphex
08776496ed Cleanups 2020-07-24 22:12:33 +02:00
twinaphex
0003074cfe (Input HID) Cleanups/buildfixes 2020-07-24 19:11:20 +02:00
twinaphex
1b24c37919 (WiiU) More build fixes 2020-07-24 19:01:35 +02:00
twinaphex
cd2d4f2248 Revert "Remove input_x11_common.c and merge into x11_input.c"
This reverts commit a0948c1d9d7a67bce750dcfba16aa1feec7db710.
2020-07-20 01:46:03 +02:00
twinaphex
a0948c1d9d Remove input_x11_common.c and merge into x11_input.c 2020-07-20 01:39:55 +02:00
twinaphex
d97e590aaf Reimplement multi button state functions 2020-07-19 03:18:12 +02:00
twinaphex
08ad00f5d3 Start preparing for being able to grab multiple buttons at the same time 2020-07-18 19:51:14 +02:00
twinaphex
e8e9a7b1d3 Get rid of multiple definition of wayland show mouse function 2020-07-17 13:59:13 +02:00
twinaphex
748e3dccf2 (wayland) buildfixes 2020-07-14 16:20:15 +02:00
twinaphex
b7c2cbc6b2 Move flush_wayland_fd to input/common/wayland_common.c 2020-07-14 16:17:43 +02:00
twinaphex
3d4a13e5b7 (Wayland) Add missing header 2020-07-14 16:10:01 +02:00
twinaphex
3cb1b7b4bb (Wayland) Move more code 2020-07-14 16:09:13 +02:00
twinaphex
646d627a6c Move more Wayland code 2020-07-14 16:04:10 +02:00
twinaphex
1f4a27abba Split up wayland code 2020-07-14 15:56:52 +02:00
twinaphex
88f742894d Move wayland header to input/common 2020-07-14 14:32:37 +02:00
twinaphex
5790f13798 Add comments 2020-07-07 03:49:54 +02:00
twinaphex
74cd84399f Cleanups - Replace '== NULL' 2020-01-30 16:47:33 +01:00
jdgleaver
3057c31798 (Menu Input) Add mouse/touchscreen gesture support + full gesture support for XMB 2019-09-30 16:55:41 +01:00
Ash Logan
258b9391b7 hid: Uniquely name (more) symbols
5bf8293 missed a few, all good!
2019-05-28 09:06:31 +10:00
twinaphex
e5d13bd32a Rename input_common.c to input_hid_common.c 2019-05-27 15:01:36 +02:00
twinaphex
5bf829339d (HID) Uniquely name symbols 2019-05-27 14:32:40 +02:00
orbea
e062b98088 Remove trailing blank lines.
find . -type f -exec sed -i '${/^[[:space:]]*$/d;}' {} \+
2019-01-17 19:39:38 -08: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
f378e2bfcf Fix WaveBird support for the Wii U GCA
== DETAILS
Thanks to JacobM at GBAtemp for helping me test this.

The WaveBird wasn't being properly picked up due to the port status byte
being different from normal GC controllers. (Why? who knows. Probably
so games could detect the WB and show WB-specific OSDs).

This implementation should be more future-proof, to handle any other
unexpected status bytes.
2018-04-25 21:28:33 -07:00
gblues
f6b33b1d30 missing file 2018-04-24 06:37:02 -07:00
gblues
1d84c0eca1 Fix analog for DS3, plus some cleanups
== DETAILS

- DS3 analog wasn't working mainly because I forgot to actually declare the
  axes in input/input_autoconfig.c when declaring the pad. Whoops.
- I also moved the axis decoding logic to a more central place, because it
  clearly is not Wii U specific.
- Removed some dead commented-out code

== TESTING

Can use analog inputs on both GCA and DS3. Tested in Mario 3 on Nestopia core.

Haven't tested with any actual analog games, but I did confirm via logging
that the correct ranges are produced.
2018-04-23 23:22:27 -07:00
gblues
f7135bcee6 Fix analog reading on GCA
== DETAILS
After a little trial and error, I got analog input working for the
Wii U GC adapter.

DS3 might work, but it's untested.
2018-04-22 23:47:07 -07:00
gblues
ed742c48e0 Fix hotplugging
== DETAILS
So, it turns out that there *is* a autoconfig disconnect handler. Took digging
through tasks/task_autodetect.c to find it!

So, I added a call to the handler when the pad gets disconnected.

This seems to solve the problem of the pad not disappearing from the menu.

(At the very least, the user's pad index reverts to "none" which is still
an improvement)

== TESTING
Tested manually, made sure it didn't crash or leak slots.
2018-04-22 17:34:20 -07:00
gblues
0c92fab0b9 Fix GameCube button detection
This should fix the issue where R/L buttons didn't register when doing
input detection.

This also brings the GC pad in line with the rest of the gamepads in
input_autodetect_builtin.c.

Also fixed a really stupid bug that was part of why analog inputs aren't
being read. Analog still isn't working, mind, but it's a lot closer to
working now that it's actually getting down into the pad driver level!
2018-04-20 00:00:33 -07:00
gblues
53738e4a0d Allow Wii U GCA to work without 2nd cable attached
=== DETAILS

So, the GCA has 2 USB connections; one is the data connection, and the
second is used to drive rumble.

Due to a driver bug, if the second cable wasn't attached, the pads wouldn't
get detected.

I fixed that bug.
2018-04-18 23:12:45 -07:00
gblues
4cd301bd92 Add pad unregistration
== DETAILS

I think this will fix the problem with duplicate pads--pads weren't properly
de-initializing and registering as disconnected. When a pad is disconnected,
the slot should properly release now.
2018-04-14 21:30:44 -07:00
gblues
6ab91a422e Small cleanup to adapt to upstream code changes
retro_bits_t turned into input_bits_t and there were parts of my
code that needed to update.

== TESTING
No idea if upstream changes broke anything, but it compiles cleanly
now.
2018-04-14 14:34:13 -07:00
gblues
97e09d179f Fix deadlocks when device is unplugged
== DETAILS
TIL that it's bad to call synchronization code from callbacks.

To avoid that, I made the following changes:

- Implemented an atomic swap (see previous commit) to avoid explicit
  locking when working with the event list
- ensure locks are only acquired in either the main thread or the
  I/O polling thread
- use an explicit polling loop; we still use async reads, but the
  read doesn't immediately re-invoke itself.
- remove the sleep in the polling thread.
- remove unnecessary locking in the thread cleanup call--verified that
  the list can't be modified while it is being executed.

== TESTING
I tested locally, and was able to disconnect/reconnect USB devices several times without the worker thread getting deadlocked.
2018-04-14 13:30:34 -07:00
gblues
dca36ebaf8 Add small snippet for atomic value swapping
Fortunately, the gcc port implements the builtins and, from basic
testing, they seem to work.

This is only really useful on Wii U--other platforms have more
robust atomic operations, or aren't using gcc to build.
2018-04-14 01:26:26 -07:00
gblues
4433cbebc6 Get digital inputs for Sony DualShock 3 working
== DETAILS

- fix the bitshift math
- read the right bytes out of the ds3 data packet
- remove verbose logging in critical path
- stop caring about errors in the hid read loop -- seems to just
  be benign "device not ready" -- or at least, that's what I'm assuming
  given that the read eventually succeeds.

== TESTING
Played Mario 3 with the DS3 with no issues.
2018-04-05 23:03:38 -07:00
gblues
af08e5015a More work on Dual Shock 3 driver
== DETAILS

- update to not try starting the read loop until after the device
  is successfully initialized
- add new HID wrapper macros needed by ds3 driver
- add some debug logging to help with troubleshooting
- add button map for DS3

== TESTING
Tested with local build. DS3 init is not working.
2018-04-02 23:16:49 -07:00
gblues
9bc5a15c2d Enable pads to register in any order
== DETAILS

Whereas the last commit had a hack (that disabled the wiimote
driver in the process), this has.. well, a *different* hack that
allows pads to register in any order.

Note that due to the initialization routines, the gamepad will still
likely always get slot 0. Not sure if this can be overridden via config
or not.

== TESTING

Tested locally with GC adapter
2018-04-01 18:52:26 -07:00
gblues
2cf89feb86 Code clean-up
== DETAILS

Now that I have a working implementation, it's time to tidy up a bit:

- there was no need for the HID subsystem's object data to have a reference
  to the global hid state (since it's global), so removed it.
- refactored the users of that member to use the global state, defining
  reusable macros.
- reorganized the information in *.h files
- removing the hid state also made the constructor changes to the hid driver
  unneeded, so I reverted those changes.

== TESTING
Confirmed clean build. Haven't tested the build yet to make sure everything
still works, though.
2018-03-31 22:25:30 -07:00
gblues
39e4167df6 Start work on DualShock 3 driver
== DETAILS

The WiiU GC adapter is working!

Next up: DualShock 3

I have the skeleton of the driver started, need to work out the
activation packet.

== TESTING

The DS3 driver is broke as hell right now.
2018-03-30 23:00:14 -07:00
gblues
d65bd90e67 Fix GC pad button mapping 2018-03-30 18:57:34 -07:00
gblues
5060c2aac4 More fixes, GC pad kinda sorta works
== DETAILS

- Added a new method to the joypad_connection_t interface for
  getting a single button
- wired everything into the hidpad driver
- for testing purposes, hacking the top-level joypad driver
  so that kpad isn't used
- add a new RARCH_LOG_BUFFER method to verbosity for logging the
  contents of a binary buffer (useful for writing/debugging pad drivers)
- fix a few bugs in the wiiu GC pad driver

The button mapping isn't quite right, and I'm not sure what's
going wrong.
2018-03-29 23:37:11 -07:00