Commit Graph

36 Commits (f2a680ca893f29fc35135986ad56b961205d610e)

Author SHA1 Message Date
Lioncash f2a680ca89 sdl_impl: Make use of std::move on std::string where applicable
Avoids redundant copies.
5 years ago
Lioncash e92164e6a0 sdl_impl: Make use of insert_or_assign() where applicable
Avoids churning ParamPackage instances.
5 years ago
Lioncash f3ac088345 sdl_impl: Prevent type truncation in BuildAnalogParamPackageForButton() default arguments
We need to add the 'f' suffix to make the right hand side a float and
not a double.
5 years ago
Lioncash 2e2dde2f95 sdl_impl: Simplify make_tuple call
The purpose of make_tuple is that you don't need to explicitly type out
the types of the things that comprise said tuple.

Given this just returns default values, we can simplify this a bit.
5 years ago
Lioncash 2680526e6b sdl_impl: Mark FromEvent() as a const member function
This doesn't modify internal member state, so it can be marked as const.
5 years ago
Lioncash 98f5d8a713 input_common/main: Remove unnecessary headers 5 years ago
Morph de79897f04 input_common: Fix directional deadzone values
The hardware tested value is 0.5 which translates to SHRT_MAX / 2
5 years ago
Morph efa0b7a056 Address feedback 5 years ago
Morph f0fac0c7fb Project Mjölnir: Part 1
Co-authored-by: James Rowe <jroweboy@gmail.com>
Co-authored-by: Its-Rei <kupfel@gmail.com>
5 years ago
ameerj d6672501ac Remove UI changes
This PR is now only the Analog devices handling the range value defaulting at 100%
5 years ago
Ameer 8928aa3008 undo unnecessary newlines, slider range 50-150 5 years ago
Ameer ed51c2abda Add range slider for analog sticks 5 years ago
Lioncash 1c340c6efa CMakeLists: Specify -Wextra on linux builds
Allows reporting more cases where logic errors may exist, such as
implicit fallthrough cases, etc.

We currently ignore unused parameters, since we currently have many
cases where this is intentional (virtual interfaces).

While we're at it, we can also tidy up any existing code that causes
warnings. This also uncovered a few bugs as well.
5 years ago
CJBok 635deb70d4 Moved analog direction logic to sdl_impl 5 years ago
Lioncash 5ccf2a7b82 input_common/sdl/sdl_impl: Correct logging string in SDLState constructor
If this path was ever taken, a runtime exception would occur due to the
lack of a formatting specifier to insert the error code into the format
string.
6 years ago
Lioncash cfac942e63 input_common/sdl/sdl_impl: Move documentation comments to header where applicable
Places the documentation comments with the rest of SDLState's member
function documentation.
6 years ago
Lioncash b9b23c98ff input_common/sdl/sdl_impl: Amend names for axes for SDLAnalogPoller
Adds another underscore to clearly indicate the axis names.
6 years ago
Lioncash 50048d9f5a input_common/sdl/sdl_impl: Mark variables const where applicable
Make it explicit that these aren't modified elsewhere (either through
functions by reference, or by other operations).
6 years ago
Lioncash ca7ca2919c input_common/sdl/sdl_impl: Mark SDLEventToButtonParamPackage() as static
Its prototype declared at the top of the translation unit contains the
static qualifier, so the function itself should also contain it to make
it a proper internally linked function.
6 years ago
Lioncash b73ea457cc input_common/sdl/sdl_impl: Convert reinterpret_cast into a static_cast
It's valid to static_cast a void pointer back into its proper type.
6 years ago
Lioncash 2c679cda51 input_common/sdl/sdl_impl: Use insert_or_assign() where applicable
Same behavior, but without a potential need to unnecessarily default
construct a value.
6 years ago
Lioncash b46e615551 input_common/sdl/sdl_impl: Simplify SDL_Joystick deleter handling
The deleter can just be set in the constructor and maintained throughout
the lifetime of the object.

If a contained pointer is null, then the deleter won't execute, so this
is safe to do. We don't need to swap it out with a version of a deleter
that does nothing.
6 years ago
Lioncash 7ea07c6063 input_common/sdl/sdl_impl: Resolve two sign conversion warnings
Silences the final two warnings in SDL code.
6 years ago
Lioncash cf0d01a5d7 input_common/sdl: Remove unused header includes and forward declarations
Gets rid of a few unnecessary inclusion dependencies. It also uncovered
a few indirect inclusion dependencies being relied upon.
6 years ago
Lioncash 00f0827a26 input_common/sdl/sdl_impl: Use nested namespace specifiers where applicable 6 years ago
Lioncash e70f16fff7 input_common/sdl/sdl_impl: Silence sign conversion warnings
Makes the conversions explicit, as opposed to implicit.
6 years ago
Lioncash 781ab8407b 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.
6 years ago
Lioncash eb335f51ca input_common/sdl: Correct return values within implementations of GetPollers()
In both cases, we weren't actually returning anything, which is
undefined behavior.
6 years ago
Lioncash 874826b6dd input_common/sdl: Use a type alias to shorten declaration of GetPollers
Just makes the definitions a little bit more tidy.
6 years ago
Lioncash 114060fd87 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.
6 years ago
Lioncash d74aa13bd3 input_common/sdl_impl: Remove unnecessary std::chrono::duration construction
Specifying the time unit itself is sufficient here.
6 years ago
Lioncash 834d3fe336 input_common/sdl_impl: Remove unused variable in SDLState constructor 6 years ago
B3n30 71817afbe9 fixup! Joystick: Allow for background events; Add deadzone to SDLAnalog 6 years ago
Weiyi Wang 8b98f60e3c 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
6 years ago
James Rowe 09ac66388c 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
6 years ago
James Rowe c8554d218b 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
6 years ago