Commit Graph

945 Commits

Author SHA1 Message Date
d104e5e916 ExpressionParser: Convert parse state enum into an enum class 2017-02-28 05:07:21 -05:00
832e0501db Merge pull request #4960 from lioncash/type
ControlGroup: Convert group type enum into an enum class
2017-02-26 15:56:34 -08:00
f0203157d4 ExpressionParser: Const-correctness changes 2017-02-26 02:09:34 -05:00
26f17a1723 ControlGroup: Convert group type enum into an enum class
Gets some constants out of the ControllerEmu namespace, and modifies
ControlGroup so that it uses the enum type itself to represent the
underlying type, rather than a u32 value.
2017-02-25 01:15:04 -05:00
e9850382e3 Merge pull request #4930 from JosJuice/sideways-wiimote-name
Change INI keys containing "Wii Remote" back to "Wiimote"
2017-02-23 13:13:43 -08:00
02681bc352 Add missing "functional" include
Building fails on GCC7 without an explicit
2017-02-20 14:25:55 +00:00
f5c82adc59 Change INI keys containing "Wii Remote" back to "Wiimote"
4bd5674 changed "Wiimote" to "Wii Remote" in the GUI
(intentionally) but also did the same change for two INI
keys (seemingly unintentional, breaks backwards compatibility,
and is inconsistent with the INI's filename). This commit
reverts the INI keys but not the GUI strings.

This commit uses the same approach as cbd539e used for GameCube
sticks (but I made sure to avoid the bug that 56531a0 fixed).
2017-02-18 12:59:36 +01:00
5a53763c1a Merge pull request #4892 from lioncash/control
Control: Convert raw pointer parameter into unique_ptr
2017-02-15 11:26:53 -05:00
1a99e70ed7 Force: Use std::array for m_swing 2017-02-11 20:22:50 -05:00
df3a4580ea Tilt: Use std::array for m_tilt 2017-02-11 20:22:42 -05:00
d19aabb55b Merge pull request #4895 from lioncash/const
ControllerEmu: Add const to UpdateReferences() first reference parameter
2017-02-11 09:27:37 +01:00
e568d57022 Merge pull request #4894 from lioncash/private
Cursor: Make m_z private
2017-02-11 09:26:30 +01:00
98145d2160 ControllerEmu: Add const to UpdateReferences() first reference parameter
None of these parameters are modified.
2017-02-11 00:31:49 -05:00
e4bdc88494 Cursor: Make m_z private
This isn't used directly anywhere (and really shouldn't be public
anyways).
2017-02-10 23:57:50 -05:00
fda235b6e3 Buttons: Use a delegating constructor
Basic code deduplication
2017-02-10 19:52:15 -05:00
d07d9f3110 Control: Convert raw pointer parameter into unique_ptr
Raw pointers shouldn't be used as boundaries in scenarios where ownership
is being taken.
2017-02-10 19:35:02 -05:00
68dcb0f195 ControlReference: Add missing virtual destructor
ControllerEmu::Control instances have a unique_ptr<ControlReference>
member, which is passed either an InputReference or OutputReference.

Without this virtual destructor, deleting a derived class through a
pointer to the base class is undefined behavior.
2017-02-10 13:58:44 -05:00
6a75ea5653 ControllerEmu: Separate ControlGroup from ControllerEmu
ControllerEmu, the class, is essentially acting like a namespace for
ControlGroup. This makes it impossible to forward declare any of the
internals. It also globs a bunch of classes together which is kind of a
pain to manage.

This splits ControlGroup and the classes it contains into their own source
files and situates them all within a namespace, which gets them out of
global scope.

Since this allows forward declarations for the once-internal classes, it
now requires significantly less files to be rebuilt if anything is changed
in the ControllerEmu portion of code.

It does not split out the settings classes yet, however, as it
would be preferable to make a settings base class that all settings derive
from, but this would be a functional change -- this commit only intends to
move around existing code. Extracting the settings class will be done in
another commit.
2017-02-09 18:18:52 -05:00
56531a0b7f ControllerEmu: Fix incorrect default radius being set in AnalogStick
The three parameter AnalogStick constructor takes an internal name, a
display name, and a default radius argument. The delegated constructor is
the one that calls the ControlGroup constructor, setting the group type,
so passing the group type here is a logic bug.

The only reason this appeared to work despite this bug is because
GROUP_TYPE_STICK has a value of 1, and the default radius value used for
attachment sticks is 1.0.
2017-02-08 23:08:13 -05:00
73382852b7 Merge pull request #4502 from ligfx/extractcontrolreference
InputCommon: Extract ControlReference from ControllerInterface
2017-02-08 20:01:18 -05:00
99492c22a6 Merge pull request #4839 from leoetlino/better-warnings
Be less annoying when usbdk is not installed
2017-02-08 14:00:12 +01:00
2d51bf579f ControlReference: put parsed_expression in a unique_ptr 2017-02-07 22:59:29 -08:00
492d5b6ac7 ControlReference: hide parse_error behind GetParseStatus() 2017-02-07 22:59:26 -08:00
9a632ea7b9 ControlReference: hide is_input behind function 2017-02-07 22:59:21 -08:00
813a725f68 ControlReference: move function bodies out of header 2017-02-07 22:59:14 -08:00
a509f56116 InputCommon: Extract ControlReference from ControllerInterface
Better separation of concerns. Relegates `ControllerInterface` to
enumerating input controls, and the new `ControlReference` deals with
combining inputs and configuration expression parsing.
2017-02-07 22:59:10 -08:00
31f037b187 InputCommon CMakeLists: Normalize whitespace
Tabs -> Spaces
2017-02-07 22:15:53 -05:00
3a66f2c008 ControllerEmu: Move into its own directory
ControllerEmu is a massive class with a lot of nested public classes.

The only reason these are nested is because the outer class acts as a
namespace. There's no reason to keep these classes nested just for that.

Keeping these classes nested makes it impossible to forward declare them, which leads to quite a few includes in other headers, making compilation take
longer.

This moves the source files to their own directory so classes can be
separated as necessary to their own source files, and be namespaced under the
ControllerEmu namespace.
2017-02-07 22:12:06 -05:00
fc0d88817f CMake: make option ENABLE_SDL work again
Broken in PR #4755 / commit f978765
2017-02-06 20:59:58 -08:00
6a0bf24e0b Move libusb context initialization to on first use
This prevents libusb warnings from showing up even when the user is
not using Bluetooth or USB passthrough, or the Wii U GC adapter.
2017-02-07 00:47:21 +01:00
d244597b42 Merge pull request #4408 from leoetlino/usb
IOS: USB support (OH0, USB_VEN, USB_HID)
2017-02-07 09:17:05 +13:00
f978765bf0 Merge pull request #4755 from Orphis/cmake_sdl
cmake: Modernize SDL discovery
2017-02-06 11:55:03 -05:00
a7c4fd9bf0 cmake: Move discovery of SDL to InputCommon 2017-02-06 05:02:45 +01:00
e07383a783 Core: Convert State enum into an enum class 2017-02-05 08:32:23 -05:00
c8a6dc6c23 Use a single libusb context
libusb on Windows is limited to only a single context. Trying to open
more than one can cause device enumerations to fail randomly.

libusb is thread-safe and we don't use the manual polling support (with
`poll()`) so this should be safe.
2017-02-05 11:36:48 +01:00
f70a1a27fa Merge pull request #4726 from ligfx/addingwindowsheaders
Fix building without PCH on Windows
2017-01-24 13:47:36 +13:00
0bc40cacda No longer need to //clang-format off for Windows headers 2017-01-23 16:23:37 -08:00
a9da2d9e20 ControllerEmu: Add missing virtual destructor to BooleanSetting 2017-01-23 05:08:19 -05:00
713ec5ffd5 Add includes for building on Windows without PCH 2017-01-23 01:37:41 -08:00
7ebfd357b5 Merge pull request #4699 from Orphis/cmake_cleanup
CMake cleanup (but wait, there's more!)
2017-01-21 16:38:09 +13:00
59fb8042d1 cmake: Add XInput file to the InputCommon target 2017-01-21 02:44:18 +01:00
6c197a8f6a cmake: Rename variable for libxi to X11_INPUT 2017-01-21 02:44:18 +01:00
794d0a9d7c Core: Move SI source files to their own directory 2017-01-20 19:33:24 -05:00
753455b379 Merge pull request #4671 from endrift/fix-libusb
InputCommon: Fix FreeBSD 11 libusb incompatibilities
2017-01-17 21:43:08 +13:00
c5b3b52d55 InputCommon: Fix FreeBSD 11 libusb incompatibilities 2017-01-17 00:30:08 -08:00
387164a999 macOS: Add missing includes to fix no-PCH build 2017-01-02 11:45:24 +11:00
905750553f ControllerEmu: Fix LoadDefaults to use ciface argument 2016-12-27 17:46:40 -08:00
57a005ff3e evdev: reduce startup time
GetName() creates a new evdev device which calls tons of ioctls. But the
main culprit is close() which for input devices appears to be a slow
path in the kernel.

This commit reduces PopulateDevices() by 50% on my laptop, but ~730 ms
is still ridiculously slow for something that isn't needed right away.
2016-12-26 01:24:35 +01:00
f575902cf3 evdev: set flag in a thread-safe way 2016-12-05 00:47:26 +00:00
3c090a37d4 evdev: fix shutdown hang
Note: This probably means our approach of populating from udev isn't
safe to be called multiple times.
2016-12-05 00:47:26 +00:00