Commit Graph

3077 Commits

Author SHA1 Message Date
radius 7b82c8a9bc fix #6644 2018-04-28 11:56:21 -05:00
radius 5e1a698fa2 fix #6644 2018-04-28 11:42:48 -05: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
Twinaphex 6ac4032735
Merge pull request #6580 from gblues/gblues/hid
Working HID driver for Wii U [TESTING NEEDED]
2018-04-25 23:10:39 +02: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
radius 8198e5c0b2 fix #6596 2018-04-19 09:54:16 -05:00
gblues 6eebbe4213 Build fix for PC
== DETAILS
Hooray for conditional compile directives.

Moving things around broke things in unexpected ways on non-WiiU builds.

Well, not *completely* unexpected. But still.

Changes:

- Move some typedefs around to avoid circular include dependencies
- Include the file where the HID driver definition got moved to

== TESTING
- verified build for Wii U still runs successfully
- did a local build without any errors (some weird warnings, but since they
  happen in code I didn't change, I'm assuming they're pre-existing?)
2018-04-15 00:04:49 -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 fb5b31faf3 Merge branch 'master' into gblues/hid 2018-04-14 14:18:03 -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
twinaphex 6761ec471d Silence some Coverity warnings 2018-04-12 21:39:31 +02:00
twinaphex 0fb766b921 Move variables 2018-04-09 16:15:31 +02:00
twinaphex be5057eafc Cleanups 2018-04-09 00:38:44 +02:00
twinaphex a5c7b79842 Move BIT256_CLEAR_ALL_PTR outside of function 2018-04-09 00:34:07 +02:00
twinaphex 7b5a0bf706 Move clear operation outside of keys_pressed functions 2018-04-09 00:31:03 +02:00
Andrés 47a528801d
Merge pull request #6547 from fr500/master
add comment
2018-04-08 17:22:32 -05:00
twinaphex 2cb14e730f Initialize to false by default 2018-04-09 00:21:22 +02:00
radius 215868f755 add comment 2018-04-08 17:21:17 -05:00
radius 066d181535 cleanup 2018-04-08 16:58:48 -05:00
twinaphex 4cd4de3bd3 Simplify input_overlay_add_inputs_inner 2018-04-08 23:20:06 +02:00
Twinaphex 8dc63653e5 Remove unused variables 2018-04-08 23:17:45 +02:00
twinaphex 3a4d094277 MSVC buildfix 2018-04-08 23:13:20 +02:00
twinaphex bc70477005 (input_mapper.c) Some more refactors 2018-04-08 23:08:21 +02:00
twinaphex a646fd3e65 (input_mapper.c) Small non-functional cleanups 2018-04-08 22:36:48 +02:00
radius 968c692a04 remap-redux: allow the menu to display manual keybinds 2018-04-08 14:50:30 -05:00
twinaphex 1dd73f86b7 Simplify this code somewhat 2018-04-08 21:45:10 +02:00
twinaphex 9bcaac1abc Simplify input_mapper_state 2018-04-08 21:38:57 +02:00
twinaphex 24b694d674 Grab joypad_driver only once 2018-04-08 21:07:04 +02:00
twinaphex 30090db941 Simplify input_get_state_for_port for analogs 2018-04-08 21:04:42 +02:00
twinaphex 0ed69fd170 Simplify input_state analog code remapping somewhat 2018-04-08 20:49:02 +02:00
twinaphex a82bb0ec94 Create special type input_bits_t 2018-04-08 20:21:12 +02:00
radius 2b9b829459 remap-redux part2: fix saving, loading and set defaults 2018-04-08 12:13:51 -05:00
radius f517ca3b56 remap-redux part2: fix right stick 2018-04-08 12:13:50 -05:00
radius 72065aee0b remap-redux part2: analog to analog input rules are working for left stick to left stick and left stick to right, for some reason not for right stick to right
stick
(inverting axes) or right stick to left...
2018-04-08 12:13:50 -05:00
radius c608951ff8 remap-redux part2:
- remapping analogs to buttons works 100%
    - remapping to analogs needs the "new input rules written" based on the value and the new axis
2018-04-08 12:13:50 -05:00
radius 0ed9f05571 remap-redux part2:
- remapping analogs to buttons works 100%
- remapping analogs to other analogs still messed up for some reason
- need to reset input of the original axis in input_driver.c still
2018-04-08 12:13:49 -05:00
radius f662d9f65f remap-redux part2: start adding analog remapping 2018-04-08 12:13:49 -05:00
radius 06860bf704 remap-redux part2: rewrite keymapper to work like gamepad mapper 2018-04-08 12:13:49 -05:00
radius 3792a5e502 remap-redux part2: cleanup 2018-04-08 12:13:49 -05:00
radius fa3dfd5f63 remap-redux part2: finally user 2 mapping works! 2018-04-08 12:13:48 -05:00
radius 4260423e48 remap-redux part2: let's use this function instead, add logging 2018-04-08 12:13:48 -05:00
radius 1fa28f0e31 remap-redux part2: let's use this function instead, add logging 2018-04-08 12:13:47 -05:00
radius d8d22a9c40 remap-redux part2: simplify this code a bit, still not working 2018-04-08 12:13:47 -05:00