Commit graph

726 commits

Author SHA1 Message Date
Léo Lam
17ef4c8046 StringUtil: Make SplitString return by value
Simpler usage.
2017-06-11 16:48:20 +02:00
Shawn Hoffman
9357cee2ef do not assign in conditional statements 2017-06-07 20:09:44 -07:00
shuffle2
192fec50b9 Merge pull request #5276 from ligfx/macosheadless
Add headless support on macOS
2017-06-05 20:49:02 -07:00
shuffle2
b9b3b1dc19 Merge pull request #5347 from JosJuice/do-not-translate-button-names
Don't translate button names
2017-06-05 19:05:09 -07:00
Léo Lam
d9fd056803 Fix minor formatting issues
These were not caught by the lint script while it was broken.
2017-06-05 02:32:19 +02:00
Shawn Hoffman
397720a9fe might as well update yet some more pointless version numbers.. 2017-06-03 18:20:40 -07:00
Lioncash
5862d1fc41 Device: Provide operator!= counterparts to operator== for DeviceQualifier
Makes comparison logic symmetric
2017-06-03 19:34:35 -04:00
BhaaL
072c161445 upgrade to Windows SDK 10.0.15063.0
this is required for /permissive- to work, because some headers in the
Windows SDK use Microsoft extensions that are not allowed in standards mode
2017-05-28 13:37:31 +02:00
Pierre Bourdon
d592bdd4d4 Migrate to Visual Studio 2017.
Auto-generated by the IDE, I'll trust it knows what it's doing.
2017-05-25 15:58:59 -07:00
JosJuice
0146456af0 Don't translate button names
Since these button names are printed on all real controllers,
we should show them in the same way as they are printed on
the controllers, regardless of the user's language. It seems
like this was intended all along (except for "Start"), but the
_ markers in TASInputDlg.cpp (accidentally?) led to the button
names in the controller configs also becoming translatable.

I'm making exceptions for "L" and "R" because translators
may want to mark them in some way (for instance "L-Digital")
to clarify the difference from "L-Analog" and "R-Analog".

I'm also making an exception for START/PAUSE because it's
referred to as スタート in Japanese games.

I'm changing "Home" and "Start" to uppercase for consistency
with how Nintendo refers to those buttons, and because someone
who isn't familiar with the Latin script might not know the
connection between the lowercase and uppercase letters (most
users likely do know the connection, but we shouldn't assume it),
and because leaving "Start" as "Start" makes it "collide" with
unrelated strings, such as the string for the button that starts
a netplay session.

To rename "Start" and "Home" without breaking INI
compatibility, I added a ui_name variable like in f5c82ad.
2017-05-06 16:29:10 +02:00
Anthony
dc4f8dd70b Merge pull request #5345 from JosJuice/consistent-controller-translation
Use _trans consistently for controllers
2017-05-04 09:00:41 -07:00
Mat M
eb8dbe03ad Merge pull request #5349 from JosJuice/more-incorrect-trans
Remove incorrect usage of _trans
2017-04-30 18:20:19 -04:00
JosJuice
8b5980f33e Remove incorrect usage of _trans
It only marks a string for translation. It doesn't actually do anything
at runtime, so the string will always be displayed in English. Even if
we would've had a way to make the translation work, we shouldn't
translate this, because OSD doesn't support non-ASCII characters.
2017-04-30 15:15:08 +02:00
JosJuice
b248016e41 Mark "Recenter" for translation 2017-04-30 14:05:05 +02:00
JosJuice
0e93c18902 Use _trans consistently for controllers
Some strings were marked with _trans in some places but not
others. This commit adds extra _trans markers so that the
usage of _trans is consistent.

This shouldn't have any effect on which strings actually get
translated. (Note that _trans doesn't do anything at runtime.)

I also added a few new i18n comments.
2017-04-30 14:04:21 +02:00
Michael Maltese
5298328cb1 Add headless support on macOS 2017-04-15 19:34:42 -07:00
Lioncash
14c81764df ControllerEmu: Replace includes with forward declarations
Replaces includes with forward declarations where applicable, and moves
includes to where they're actually needed.
2017-04-04 20:38:30 -04:00
Lioncash
0c1d56c16f Core: Hide determinism global
This is only ever queried and not set outside of the Core.cpp, so this
should just be hidden internally and just have a function exposed that
allows querying it.
2017-04-03 14:56:12 -04:00
Lioncash
05872336a9 ExpressionParser: Rename ParseStatus' Success member to Successful
This clashes with X11's preprocessor define named Success (because using
non-prefixed lowercase identifiers in C was apparently a fantastic idea
at some point), causing compilation errors.
2017-04-02 06:13:18 -04:00
Léo Lam
32a1b5068a Revert "Use a single libusb context"
This reverts commit c8a6dc6c23.

libusb on Windows isn't really safe to use from different threads
with a single context.
2017-03-26 15:58:30 +02:00
Anthony
b35bbdfb58 Merge pull request #4856 from ligfx/backgroundinput
Move "Background Input" out of individual controller configurations
2017-03-19 22:31:30 -07:00
Lioncash
f0eeb3c63a SI: Namespace device classes
Places all of the SI code under the SerialInterface namespace instead of
only the main source file. This keeps all SI code under a common name,
as well as out of the global namespace
2017-03-16 04:41:39 -04:00
Lioncash
a728d858b3 SI: Move MAX_SI_CHANNELS into the SerialInterface namespace
Given this constant is related to the serial interface, it shouldn't be
outside of the namespace.
2017-03-16 01:57:57 -04:00
Michael Maltese
1b0701e988 Make ControllerEmu::BooleanSetting non-virtual 2017-03-13 13:47:06 -07:00
Michael Maltese
c4ba046aa3 Remove unused ControllerEmu::BackgroundInputSetting 2017-03-13 13:47:01 -07:00
Lioncash
b914edd441 GCAdapter_Android: Fix an array bounds overrun in Read()
s_controller_payload is 37 bytes long, but Read() would copy 0x37 (a.k.a
55) bytes, overrunning the array.
2017-03-06 23:05:17 -05:00
Lioncash
b592e4887e BooleanSetting: Initialize m_value to default_value in the constructor
Ensures all class state is initialized to valid values on construction.
2017-03-03 14:09:48 -05:00
Lioncash
25e70570b5 NumericSettings: Initialize m_value to default_value in the constructor
Ensures that all class state is initialized to valid values.
2017-03-03 14:06:16 -05:00
Michael Maltese
1539ff6691 InputCommon: move Setting classes out of ControlGroup 2017-03-02 18:08:37 -08:00
Markus Wick
7982ba120f Merge pull request #4995 from lioncash/normalize
CMakeLists: Normalize whitespace
2017-03-02 11:51:06 +01:00
Lioncash
ee61bd6f2e CMakeLists: Normalize whitespace
Normalizes tabs to spaces to follow our codebase's indentation style.
2017-03-01 14:53:23 -05:00
Lioncash
d104e5e916 ExpressionParser: Convert parse state enum into an enum class 2017-02-28 05:07:21 -05:00
Anthony
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
Lioncash
f0203157d4 ExpressionParser: Const-correctness changes 2017-02-26 02:09:34 -05:00
Lioncash
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
Anthony
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
Steven Newbury
02681bc352 Add missing "functional" include
Building fails on GCC7 without an explicit
2017-02-20 14:25:55 +00:00
JosJuice
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
Mat M
5a53763c1a Merge pull request #4892 from lioncash/control
Control: Convert raw pointer parameter into unique_ptr
2017-02-15 11:26:53 -05:00
Lioncash
1a99e70ed7 Force: Use std::array for m_swing 2017-02-11 20:22:50 -05:00
Lioncash
df3a4580ea Tilt: Use std::array for m_tilt 2017-02-11 20:22:42 -05:00
JosJuice
d19aabb55b Merge pull request #4895 from lioncash/const
ControllerEmu: Add const to UpdateReferences() first reference parameter
2017-02-11 09:27:37 +01:00
JosJuice
e568d57022 Merge pull request #4894 from lioncash/private
Cursor: Make m_z private
2017-02-11 09:26:30 +01:00
Lioncash
98145d2160 ControllerEmu: Add const to UpdateReferences() first reference parameter
None of these parameters are modified.
2017-02-11 00:31:49 -05:00
Lioncash
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
Lioncash
fda235b6e3 Buttons: Use a delegating constructor
Basic code deduplication
2017-02-10 19:52:15 -05:00
Lioncash
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
Lioncash
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
Lioncash
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
Lioncash
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
Mat M
73382852b7 Merge pull request #4502 from ligfx/extractcontrolreference
InputCommon: Extract ControlReference from ControllerInterface
2017-02-08 20:01:18 -05:00
JosJuice
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
Michael Maltese
2d51bf579f ControlReference: put parsed_expression in a unique_ptr 2017-02-07 22:59:29 -08:00
Michael Maltese
492d5b6ac7 ControlReference: hide parse_error behind GetParseStatus() 2017-02-07 22:59:26 -08:00
Michael Maltese
9a632ea7b9 ControlReference: hide is_input behind function 2017-02-07 22:59:21 -08:00
Michael Maltese
813a725f68 ControlReference: move function bodies out of header 2017-02-07 22:59:14 -08:00
Michael Maltese
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
Lioncash
31f037b187 InputCommon CMakeLists: Normalize whitespace
Tabs -> Spaces
2017-02-07 22:15:53 -05:00
Lioncash
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
Michael Maltese
fc0d88817f CMake: make option ENABLE_SDL work again
Broken in PR #4755 / commit f978765
2017-02-06 20:59:58 -08:00
Léo Lam
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
Matthew Parlane
d244597b42 Merge pull request #4408 from leoetlino/usb
IOS: USB support (OH0, USB_VEN, USB_HID)
2017-02-07 09:17:05 +13:00
Mat M
f978765bf0 Merge pull request #4755 from Orphis/cmake_sdl
cmake: Modernize SDL discovery
2017-02-06 11:55:03 -05:00
Florent Castelli
a7c4fd9bf0 cmake: Move discovery of SDL to InputCommon 2017-02-06 05:02:45 +01:00
Lioncash
e07383a783 Core: Convert State enum into an enum class 2017-02-05 08:32:23 -05:00
Léo Lam
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
Matthew Parlane
f70a1a27fa Merge pull request #4726 from ligfx/addingwindowsheaders
Fix building without PCH on Windows
2017-01-24 13:47:36 +13:00
Michael Maltese
0bc40cacda No longer need to //clang-format off for Windows headers 2017-01-23 16:23:37 -08:00
Lioncash
a9da2d9e20 ControllerEmu: Add missing virtual destructor to BooleanSetting 2017-01-23 05:08:19 -05:00
Michael Maltese
713ec5ffd5 Add includes for building on Windows without PCH 2017-01-23 01:37:41 -08:00
Matthew Parlane
7ebfd357b5 Merge pull request #4699 from Orphis/cmake_cleanup
CMake cleanup (but wait, there's more!)
2017-01-21 16:38:09 +13:00
Florent Castelli
59fb8042d1 cmake: Add XInput file to the InputCommon target 2017-01-21 02:44:18 +01:00
Florent Castelli
6c197a8f6a cmake: Rename variable for libxi to X11_INPUT 2017-01-21 02:44:18 +01:00
Lioncash
794d0a9d7c Core: Move SI source files to their own directory 2017-01-20 19:33:24 -05:00
Matthew Parlane
753455b379 Merge pull request #4671 from endrift/fix-libusb
InputCommon: Fix FreeBSD 11 libusb incompatibilities
2017-01-17 21:43:08 +13:00
Jeffrey Pfau
c5b3b52d55 InputCommon: Fix FreeBSD 11 libusb incompatibilities 2017-01-17 00:30:08 -08:00
hthh
387164a999 macOS: Add missing includes to fix no-PCH build 2017-01-02 11:45:24 +11:00
Michael Maltese
905750553f ControllerEmu: Fix LoadDefaults to use ciface argument 2016-12-27 17:46:40 -08:00
Tillmann Karras
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
Tillmann Karras
f575902cf3 evdev: set flag in a thread-safe way 2016-12-05 00:47:26 +00:00
Tillmann Karras
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
Anthony
ffe20705dd Merge pull request #4362 from ligfx/osxhotplug
ControllerInterface: enable hotplugging on macOS
2016-12-01 00:29:56 -06:00
Michael Maltese
7ed8fb95c5 ControllerInterface: enable hotplugging on macOS 2016-11-30 22:27:46 -08:00
Michael Maltese
3e69d066f5 ControllerInterface: replace Reinitialize with RefreshDevices
The SDL backend crashes when you close a joystick after SDL_Quit has
been called. Some backends don't need to be shutdown and
re-initialized everytime, we can just ask to enumerate devices again.
2016-11-30 16:07:55 -08:00
Michael Maltese
cebb4d84f2 ControllerInterface: clear devices before shutting down backends
The SDL backend faults if it tries to close a joystick after SDL_Quit
has been called.
2016-11-30 16:07:54 -08:00
aldelaro5
00f680b830 Add flexibility to InputConfigDialog
Removed the unecessary forced tabbed layout, removed the layout part of the constructor and remade some method in preparation for tabbed styled input dialog such as the new hotkey configuration one.  It breaks every inputconfigDialog, but this will get fixed in the next commits.

Also moved to a folder since there will be many more files created in the next commits so it gives better separation.
2016-11-28 08:26:27 -05:00
aldelaro5
7e99d03b7f Add the ability to get partial input group
For hotkeys, changed HotkeyManager to allow to get and make partial groups of hotkeys.

Also preserved the old configuration naming scheme for the ini, this is done to preserve compatibility with the older groups structure.

Add the ability to get GCPad control groups

Used like the HotkeyManager methods, this is used for the new GCPad configuration dialog.

Add the ability to get groups of Keyboard input

Same reasons as the previous ones.

Add ability to get groups of Wiimote input

Add the ability to get extensions group

This needed to pass to 3 classes.  Will be used for their respective dialogs.
2016-11-25 02:37:22 -05:00
Markus Wick
b9e4f67d3a Merge pull request #4405 from xrix4096/mac-unknown-joyaxis
Make analog triggers on PS3 controllers accessible on Mac
2016-10-31 13:01:47 +01:00
Markus Wick
2afa877119 Merge pull request #4376 from leoetlino/warning-fix
Warning fixes
2016-10-31 12:57:03 +01:00
Markus Wick
b9e4370023 Merge pull request #4383 from Sintendo/minor-text-fixes
Fix minor comment typos
2016-10-31 12:51:42 +01:00
Chris Pritchard
9da9ba616b Use the IOHIDElement cookie as a part of the axis name for unknown axis. Previously the 'usage' value was used to identify the axis by name, but this is not unique. For example on a PS3 controller *all* axis other than the well known ones return a usage of '1' so there are 30 or more axis all named "1". This stops things such as analog triggers being usable.
Using the element cookie uniquely identifies each axis and allows them to be assigned successfully as controls
2016-10-30 10:36:53 +00:00
JosJuice
1081497cad DiscIO/SConfig: Rename GetUniqueID to GetGameID
We call this "game ID" everywhere else, and it's not
actually completely unique.
2016-10-29 15:24:02 +02:00
Sintendo
f163bd1048 Fix various comment typos 2016-10-24 18:27:49 +02:00
Léo Lam
68156a02ed Fix -Wunused-result warnings 2016-10-23 00:43:08 +02:00
Léo Lam
39fd6dcd5b Fix missing includes
Aren't indirect includes great?
2016-10-07 23:46:41 +02:00
Léo Lam
fad17246db InputCommon: Fix formatting issues in Quartz
This wasn't caught by the lint script because it was broken (by me) at
some point :(

If it had been rebased, it wouldn't have passed lint
2016-10-03 18:59:52 +02:00
shuffle2
e38ddfd787 Merge pull request #4111 from EmptyChaos/startup-perf-langs
InputCommon: Fix slow startup on some Windows systems with language packs (Issue 9744)
2016-10-03 04:02:54 -07:00
shuffle2
2db2e88620 Merge pull request #4010 from leoetlino/relative-input
Add relative input for the Wiimote IR
2016-10-03 03:26:04 -07:00
shuffle2
2747fd3a0d Merge pull request #4102 from ligfx/quartz_input
Add Quartz/CoreGraphics controller interface for default k&m events
2016-10-03 03:13:58 -07:00
shuffle2
f71966866b Merge pull request #4230 from ligfx/build_vendored_libusb
Build vendored libusb with CMake if on Apple or not available system-wide
2016-10-02 21:17:01 -07:00