Commit graph

58 commits

Author SHA1 Message Date
bunnei
dd31be16d9 input_common: main: Remove unnecessary HAVE_SDL2 check. 2019-07-07 11:01:00 -04:00
Lioncash
79439fc556 input_common/sdl/sdl_impl: Silence sign conversion warnings
Makes the conversions explicit, as opposed to implicit.
2019-06-01 02:10:46 +02: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
Lioncash
21c71d21ae general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities
means that we no longer need to hardcode the mutex type into the locks
themselves, making it easier to switch mutex types, should it ever be
necessary in the future.
2019-04-07 15:14:29 +02:00
Lioncash
bf4b0dd1f4 input_common/sdl_impl: Make lambda capture more specific in SDLState constructor
We don't need to universally capture by reference. We specifically just
need to capture the this pointer.
2019-03-19 23:55:38 +01:00
Lioncash
ed31197402 input_common/sdl_impl: Remove unnecessary std::chrono::duration construction
Specifying the time unit itself is sufficient here.
2019-03-19 23:55:31 +01:00
Lioncash
a5c087f5de input_common/sdl_impl: Remove unused variable in SDLState constructor 2019-03-19 23:55:23 +01:00
Lioncash
e1a4912ade common/math_util: Move contents into the Common namespace
These types are within the common library, so they should be within the
Common namespace.
2019-03-02 18:13:10 +01:00
Lioncash
643472e24a common/vector_math: Move Vec[x] types into the Common namespace
These types are within the common library, so they should be using the
Common namespace.
2019-03-02 15:04:13 +01:00
Lioncash
db58652680 common/quaternion: Move Quaternion into the Common namespace
Quaternion is within the common library, so it should be using the
Common namespace.
2019-03-02 14:44:09 +01:00
Weiyi Wang
104829ae58 remove all occurance of specifying endianness inside BitField
This commit it automatically generated by command in zsh:
sed -i -- 's/BitField<\(.*\)_le>/BitField<\1>/g' **/*(D.)

BitField is now aware to endianness and default to little endian. It expects a value representation type without storage specification for its template parameter.
2019-01-28 22:09:43 -05:00
Valentin Vanelslande
8e614c3eb0 clang-format; address one comment 2018-12-28 23:31:55 -05:00
Weiyi Wang
53a3498aee
Merge pull request #4193 from B3n30/controller5
Joystick: Allow for background events; Add deadzone to SDLAnalog
2018-10-17 10:49:21 -04:00
Weiyi Wang
9adc407112
Merge pull request #4304 from B3n30/std_optional
Replace boost::optional with std::optional where possible
2018-10-11 12:40:00 -04:00
B3n30
ca77be3ac2 remove std::tie in sdl_impl 2018-10-09 23:19:24 +02:00
B3n30
2b46b838f1 fix deadzone max value 2018-10-09 21:23:50 +02:00
B3n30
2306af3600 Handle cases when std::optional does not contain a value 2018-10-05 16:51:33 +02:00
B3n30
d37a2270d6 Replace boost::optional with std::optional where possible 2018-10-05 13:51:09 +02:00
Weiyi Wang
22df17c303 input/sdl: lock map mutex after SDL call
Any SDL invocation can call the even callback on the same thread, which can call GetSDLJoystickBySDLID and eventually cause double lock on joystick_map_mutex. To avoid this, lock guard should be placed as closer as possible to the object accessing code, so that any SDL invocation is with the mutex unlocked
2018-10-02 11:22:20 -04:00
B3n30
4831095610 fixup! Joystick: Allow for background events; Add deadzone to SDLAnalog 2018-10-01 16:02:19 +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
James Rowe
bfcc712132 Input: Copy current SDL.h/cpp files to impl
This should make reviewing much easier as you can then see what changed
happened between the old file and the new one
2018-09-22 14:11:15 -06:00
B3n30
0238cf52b7 SDLJoystick: Addressed review comments 2018-09-11 14:50:41 +02: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
Weiyi Wang
7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
James Rowe
50270fd791
Merge pull request #4059 from zhaowenlan1779/udp-input-ui
citra_qt: add motion/touch config
2018-08-26 11:56:50 -06:00
CodingKoopa
8cbb60c281 Change level of invalid UDP packet log message from Error to Debug. 2018-08-12 22:17:34 -04: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
zhupengfei
e1ae14d508
input_common/udp: allow changing pad index 2018-08-11 13:23:10 +08:00
Lioncash
384c9e5382 input_common: Use std::move where applicable
Avoids unnecessary atomic reference count increments and decrements
2018-08-10 10:12:30 +08:00
Lioncash
8ce104f0a0 input_common: Add missing override specifiers 2018-08-10 10:12:29 +08:00
James Rowe
169bb29a54 Correct direction vectors for cemuhook motion input 2018-08-07 21:05:09 -06: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
fearlessTobi
71e1d6e25d Fix compile errors 2018-07-26 13:23:25 +02:00
fearlessTobi
7a3e126a4f Replace MathUtil::Clamp with its std counterpart 2018-07-24 19:08:17 +02:00
wwylele
7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
Daniel Lim Wee Soong
4617fec970 input_common: Migrate logging macros
Follow-up of #3533

Replace logging to use NGLOG instead of LOG
2018-03-25 17:46:02 +08:00
James Rowe
f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
Adityarup Laha
93cca23dd6 Variable tilt clamp (#3366)
* Add tilt clamp setting

* Updated `clamp` to use variable

* Fixed a minor typo

* Include possibly necessary header

* expose setting in sdl2

* expose setting in qt

* incorporate @wwylele 's suggestion in sdl2

* Incorporate @wwylele 's suggestion (?)

Please review the code, this is the first time I'm working with `ParamPackage`s so I may just screw up the code.

* Forgot to change in qt

* Fixed an fatal error

* fixed clang format error

* remove the old setting

* fixed typos cusing errors

* removed old setting

* Changed init style

* Forgot this one

* Removed unnecessary header inclusion

* Update config.cpp

* update qt-config

* Update motion_emu.cpp

* Update motion_emu.cpp
2018-01-17 17:30:50 -05:00
wwylele
80ed0f03ac cmake: add missing ${...} for variables inside generator expressions 2017-12-23 03:00:15 +02:00
Lioncash
761101f64c input_common: Remove redundant target_sources in CMakeLists 2017-12-14 19:21:02 -05:00
bunnei
4695f12a08
Merge pull request #3264 from lioncash/cmake-target
CMakeLists: Derive the source directory grouping from targets themselves
2017-12-12 14:34:51 -05:00
Lioncash
ab021d163e CMakeLists: Derive the source directory grouping from targets themselves
Removes the need to store to separate SRC and HEADER variables,
and then construct the target in most cases.
2017-12-11 21:11:52 -05:00
Lioncash
1f186be030 input_common/sdl: Silence a -Wpessimizing-move warning
Moving when returning by value can inhibit copy elision.
2017-12-10 19:53:57 -05: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
4d058cfb76 motion_emu: fix initialization order 2017-08-22 11:43:44 +03:00
James Rowe
bbfa9d0635 Merge pull request #2861 from wwylele/motion-refactor
Refactor MotionEmu into a InputDevice
2017-08-19 23:43:01 -06:00
wwylele
223bd35450 motion_emu: no need to include thread in header 2017-08-19 07:21:02 +03:00
Dave Leaver
bf71fc0342 Fix Spelling/English mistakes 2017-08-14 09:15:39 +12:00
wwylele
188194908c move MotionEmu from core/frontend to input_common as a InputDevice 2017-08-11 11:05:08 +03:00