20 Commits

Author SHA1 Message Date
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
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
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
gblues
89c1ba7929 Keep HID pads from clobbering gamepad/wiimotes
== DETAILS

Trying to do weird pad math just wasn't working so I bit the bullet and just
let it allocate all 16 pads in the slot list, then just mark 0-4 as
connected so that the slot allocator would start at 5.

I can see it detect the pad, but no idea if it works. Out of time for
today.
2018-03-29 23:37:11 -07:00
gblues
1eea48d0c8 Fix crash on exit bug
== DETAILS

Turns out freeing memory that's already been freed is.. bad.

Fix two double-free instances; one due to over-freeing and the other
due to wrong order-of-operations causing a double free.

Also updated logging a little.

== TESTING

The GC adapter still clobbers slot 0, but the "emergency exit" sequence
works to quit RA cleanly.
2018-03-29 23:37:11 -07: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
gblues
180d6a28bf Fix up HID device driver initialization
== DETAILS
Turns out the cause of the crash was a bad cast, resulting in a
function call to nowhere.

Also, I think the DSI exception handler only works on the primary core;
when this was happening in the background thread, I got a black
screen error instead.

Next up: finishing up the GCA driver.
2018-03-29 23:37:11 -07:00
gblues
dc6f4c23ed Rename hid_driver_instance members for clarity 2018-03-29 23:37:11 -07:00
gblues
4b9d5c0ab7 Start implementing "detach" code path
== DETAILS
We're at a point where we need to do more than just
clean up a local data structure, so I've started
implementing the "detach" part of the code so that
everything gets cleaned up properly.

Also, added error handling inside the polling
thread.

== TESTING

Have not tested yet.
2018-03-29 23:37:11 -07:00
gblues
0100d58ffb WIP: evolve driver implementation
== DETAILS

I've created the concept of a hid_driver_instance_t which is basically
a central place to store the hid pad driver, hid subsystem driver,
the pad list, and the instance data for the above in a central location.

The HID pad device drivers can use it to perform HID operations in a
generic manner.

This is more-or-less a pause point so I can catch up with upstream.

== TESTING

Haven't tested this yet. Compiles without warnings though!
2018-03-29 23:37:11 -07:00
gblues
41ce8853d7 Add name for hid device; implement detect
== DETAILS

- detect() methods in device_* files now check for VID/PID
  instead of just returning false
- add "name" field on hid device, mainly for logging purposes

== TESTING
Verified my WiiU GC adapter detected properly
2018-03-29 23:37:11 -07:00
gblues
ae19eed00f implement hid device search 2018-03-29 23:37:11 -07:00