Small cleanup by using std::shared_ptr and getting rid of
ciface.Devices() which just returned the m_devices (which defeats the
point of making m_devices protected).
Incidentally, this should make the code safer when we have
different threads accessing devices in the future (for hotplug?).
A lot of code use Device references directly so there is
no easy way to remove FindDevice() and make those unique_ptrs.
Previously, the devices vector would be passed to all backends. They
would then manually push_back to it to add new devices. This was fine
but caused issues when trying to add synchronisation.
Instead, backends now call AddDevice() to fill m_devices so that it is
not accessible from the outside.
make sure Reset() can’t be run concurrently with AddGCAdapter() or
ResetRumble() (which is called on other threads) which can cause
crashes (issue #9462)
Disclaimer: I can't test if this works on xbox one controllers, i don't have one. But i have conformed that this UpdateMotors() is related to rumble for emulated wiimotes.
This partially reverts commit "XInput: Apply immediately as well" (1958a10b6f) from pr # https://github.com/dolphin-emu/dolphin/pull/1560
Hopefully this fixes the xbox one controller rumble issue:
https://bugs.dolphin-emu.org/issues/9071
And in theory it might reduce the used usb bandwidth, as it was originally intended before pr 1560.
@JMC47: Please do a good amount of testing, to see if this breaks rumble for wiimotes or gamecube controllers emulated with xinput devices.
Under failure conditions of the GC Adapter, When interface count is zero and we can't open the device.
Then there were race conditions on shutdown of the threads which could result in crashing.
Make adapter opening more robust like the Mayflash DolphinBar.
Make shutdown more robust by making the read thread control the write thread.
Make sure that there is actual data to be written when kicking the write thread. So it doesn't attempt a write a shutdown.
Make a toast on screen to tell the user that the adapter needs to be unplugged and plugged back in again for it to work.
Previously we would iterate through every GC adapter plugged in to the PC and steal ownership of it.
This causes issues all over the place in the implementation if this happens.
Break on the first adapter we can get access to.
No way to properly enable it from an end user perspective yet.
Doesn't require root.
This same sort of system can be used for the Dolphinbar in the future for real wiimote support.
The Wii U Gamecube controller adapter setup has always been a bit weird. It tries to be as automatic as possible to make the user experience as easy
as possible.
The problem with this approach is that it brings a large disconnect in the user experience because you have the Gamecube controller setup with regular
gamepads and then for some reason below that you have a "direct connect" option which will cause the Gamecube Adapter to overwrite the regular inputs
if something was connected.
While this works and allows the user to only click one checkbox to get the device working, it breaks the user's experience because they don't really
know what "direct connect" means and won't look it up to figure out what it is. Just expecting the device to work (At least one occurence of this in
the IRC channel in the last week).
This way around also had the terrible nature of making the code more filthy than it needed to be. The GCAdapter namespace was parasitic and hooked in
to the regular GC Controller SI class to overwrite the data that it was getting from the default configuration.
Now instead we have a specific SIDevice class for the Wii U Gamecube adapter. This class is fairly simple and is a child of the regular SI Gamecube
Pad device and only reimplements what it needs to.
This also gives the ability to configure controllers individually, which allows the user to configure rumble individually per pad input.
Overall the code is cleaner, and it fits more in line with how the rest of Dolphin works.
Lets the user set the following in intervals of 10 between 10 and 100;
- Stick/Radius (default 100,000000)
- Triggers/Threshold (default 90,000000)
- Tilt/Modifier/Range (default 50,000000) + mapped Tilt/Modifier button
to the configurations for wiimotes & nunchuks
If there were two commands in the buffer at once, it would only run the
first because of an error in UpdateInput.
If you sent the command "SET C" it would segfault because of a logic
issue in ParseCommand.
Currently only works on unix, but can be extended to other systems. Can
also be extended to do wiimotes.
Searches the Pipes folder for readable named pipes and creates a dolphin
input device out of them. Send controller inputs to the game by writing
to the file. Commands are described in Pipes.h.
Main Stick is changed to Control Stick and C-Stick is changed to C Stick.
A new ui_name variable is added to ControlGroup so that the UI strings
in DolphinWX can be updated without breaking backwards compatibility
with config INIs and other things that use names as IDs.