Commit graph

19 commits

Author SHA1 Message Date
Steveice10 81d24dd7fb
input_common: Allow disabling GCAdapter on platforms without libusb. (#6448) 2023-04-22 17:10:12 +02:00
Ameer J f44c95d638
Add "Separate Windows" LayoutOption (#6177) 2022-11-17 16:37:30 +01:00
Tobias 14924e9db3
Backport review comments from yuzu-emu/yuzu#4382: "yuzu: Add motion and touch configuration from Citra" (#5543) 2022-11-04 20:25:50 +01:00
ameerj a80e566464 gcadapter: Implement auto map feature
Implements the auto map functionality for the GC adapter.
The controls map nicely to the original 3ds controls, with the select button being mapped to the Z button on GC.
The ZL/ZR buttons are not mapped by this feature.
2021-04-24 02:03:40 -04:00
ameerj 05e28a53e8 input_common: Add support for GameCube Adapter
This is a port of the initial GameCube adapter input support i added into yuzu emulator.
It requires the same setup as when it was first introduced in yuzu, requiring the Zadig driver be installed for the adapter to allow it to interface with libusb.
2021-04-24 02:02:45 -04:00
Vitor K ce16653cc8
Automatic Controller Binding (#5100)
* Implement the basics of controller auto mapping. From testing doesn't currenlty work.
Opening the controller requires the device index, but it is only known and guaranteed
at boot time or when a controller is connected.

* Use the SDL_INIT_GAMECONTROLLER flag to initialize the controller
subsystem. It automatically initializes the joystick subsystem too,
so SDL_INIT_JOYSTICK is not needed.

* Implement the SDLGameController class to handle open game controllers.
Based on the SDLJoystick implementation.

* Address review comments

* Changes SDLJoystick and SDLGameController to use a custom default
constructible destructor, to improve readability. The only deleters
used previously were SDL_JoystickClose and SDL_GameControllerClose,
respectively, plus null lambdas. Given that both SDL functions
accept null pointers with just an early return, this should be
functionally the same.
with just an early return

* warn the user when a controller mapping is not found

* Get axis direction and threshold from SDL_ExtendedGameControllerBind

* Reject analog bind if it's not axis, for the couple of examples present in SDL2.0.10's db.
Also add SDL_CONTROLLER_BINDTYPE_NONE for the button bind switch, with a better log message.

* sdl_impl.cpp: Log the error returned by SDL_GetError upon failure to open joystick

* sdl: only use extended binding on SDL2.0.6 and up

* sdl_impl.cpp: minor changes
2021-01-01 10:01:07 +01:00
z87 41facaece3 input_common: add TouchFromButtonDevice 2020-05-04 13:51:37 +03:00
bunnei dd31be16d9 input_common: main: Remove unnecessary HAVE_SDL2 check. 2019-07-07 11:01:00 -04:00
Tobias 623b0621ab
Port various minor changes from yuzu PRs (#4725)
* common/thread: Remove unused functions

Many of these functions are carried over from Dolphin (where they aren't
used anymore). Given these have no use (and we really shouldn't be
screwing around with OS-specific thread scheduler handling from the
emulator, these can be removed.

The function for setting the thread name is left, however, since it can
have debugging utility usages.

* input_common/sdl: Use a type alias to shorten declaration of GetPollers

Just makes the definitions a little bit more tidy.

* input_common/sdl: Correct return values within implementations of GetPollers()

In both cases, we weren't actually returning anything, which is
undefined behavior.

* yuzu/debugger/graphics_surface: Fill in missing surface format listings

Fills in the missing surface types that were marked as unknown. The
order corresponds with the TextureFormat enum within
video_core/texture.h.

We also don't need to all of these strings as translatable (only the
first string, as it's an English word).

* yuzu/debugger/graphics_surface: Clean up connection overload deduction

We can utilize qOverload with the signal connections to make the
function deducing a little less ugly.

* yuzu/debugger/graphics_surface: Tidy up SaveSurface

- Use QStringLiteral where applicable.

- Use const where applicable

- Remove unnecessary precondition check (we already assert the pixbuf
  being non null)

* yuzu/debugger/graphics_surface: Display error messages for file I/O errors

* core: Add missing override specifiers where applicable

Applies the override specifier where applicable. In the case of
destructors that are  defaulted in their definition, they can
simply be removed.

This also removes the unnecessary inclusions being done in audin_u and
audrec_u, given their close proximity.

* kernel/thread: Make parameter of GetWaitObjectIndex() const qualified

The pointed to member is never actually modified, so it can be made
const.

* kernel/thread: Avoid sign conversion within GetCommandBufferAddress()

Previously this was performing a u64 + int sign conversion. When dealing
with addresses, we should generally be keeping the arithmetic in the
same signedness type.

This also gets rid of the static lifetime of the constant, as there's no
need to make a trivial type like this potentially live for the entire
duration of the program.

* kernel/codeset: Make CodeSet's memory data member a regular std::vector

The use of a shared_ptr is an implementation detail of the VMManager
itself when mapping memory. Because of that, we shouldn't require all
users of the CodeSet to have to allocate the shared_ptr ahead of time.
It's intended that CodeSet simply pass in the required direct data, and
that the memory manager takes care of it from that point on.

This means we just do the shared pointer allocation in a single place,
when loading modules, as opposed to in each loader.

* kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const

Given this is intended as a querying function, it doesn't make sense to
allow the implementer to modify the state of the given thread.
2019-05-01 14:28:49 +02:00
James Rowe 3f4a7f8f58 Input: Remove global variables from SDL Input
Changes the interface as well to remove any unique methods that
frontends needed to call such as StartJoystickEventHandler by
conditionally starting the polling thread only if the frontend hasn't
started it already. Additionally, moves all global state into a single
SDLState class in order to guarantee that the destructors are called in
the proper order
2018-09-22 14:13:50 -06:00
Ben 17978cf758
Joystick hotplug support (#4141)
* use SDL_PollEvent instead of SDL_JoystickUpdate

Register hot plugged controller by GUID if they were configured in a previous session

* Move SDL_PollEvent into its own thread

* Don't store SDLJoystick pointer in Input Device; Get pointer on each GetStatus call

* Fix that joystick_list gets cleared after SDL_Quit

* Add VirtualJoystick for InputDevices thats never nullptr

* fixup! Add VirtualJoystick for InputDevices thats never nullptr

* fixup! fixup! Add VirtualJoystick for InputDevices thats never nullptr

* Remove SDL_GameController, make SDL_Joystick* unique_ptr

* fixup! Remove SDL_GameController, make SDL_Joystick* unique_ptr

* Adressed feedback; fixed handling of same guid reconnects

* fixup! Adressed feedback; fixed handling of same guid reconnects

* merge the two joystick_lists into one

* make SDLJoystick a member of VirtualJoystick

* fixup! make SDLJoystick a member of VirtualJoystick

* fixup! make SDLJoystick a member of VirtualJoystick

* fixup! fixup! make SDLJoystick a member of VirtualJoystick
2018-09-08 19:01:30 +02:00
zhupengfei 8af89b6979
input_common, common: Add a few functions
These functions include reloading udp client, testing communication and configuring calibration. I also added a function to common/thread.h to use WaitFor.
2018-08-11 14:09:35 +08:00
James Rowe 6bcbda5ab2 Input: UDP Client to provide motion and touch controls
An implementation of the cemuhook motion/touch protocol, this adds the
ability for users to connect several different devices to citra to send
direct motion and touch data to citra.
2018-08-07 21:05:09 -06:00
James Rowe f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
muemart e784434a25 Allow input configuration with SDL joysticks (#3116)
* Add infrastructure to poll joystick input and get ParamPackages

* Generalize the callbacks in configure_input.cpp and add buttons for analog sticks

* Use the polling classes in the input dialog

* Fix includes

* Formatting fix

* Include real header instead of forward declaring, to fix compiler error

* Split up pair and add deadzone for joystick configuration

* Pass ParamPackages by reference to callback

* fix formatting

* getPollers -> GetPollers

* Add forward declarations and simplify code a bit

* Update joysticks before opening them

* Fix mixup between joystick IDs and device indices
2017-12-05 23:26:29 -05:00
wwylele 188194908c move MotionEmu from core/frontend to input_common as a InputDevice 2017-08-11 11:05:08 +03:00
wwylele 51b1c1f211 InputCommon: add SDL joystick support 2017-03-01 23:30:57 +02:00
wwylele a6bd7917cb InputCommon: add AnalogFromButton 2017-03-01 23:30:57 +02:00
wwylele 38e800f70d InputCommon: add Keyboard 2017-03-01 23:30:57 +02:00