There is no reason to prevent the user from closing the config dialog
if the device is not found. It's not very good UX…
Also fixes ExpressionParser to return NO_DEVICE if the device doesn't
exist instead of SUCCESS.
This adds hotplugging support to the evdev input backend. We use
libudev to monitor changes to input devices in a separate thread.
Removed devices are removed from the devices list, and new devices
are added to the list.
The effect is that controllers are usable immediately after plugging
them without having to manually refresh devices (if they were
configured to be used, of course).
Changes UpdateInput() to skip if we can't lock the mutex, instead of
potentially blocking the CPU thread and causing a short but noticeable
frame drop.
This adds RemoveDevice() to ControllerInterface, fixes ExpressionParser
and some other code to support device removals without crashing,
and adds an IsValid() method to Device, to prepare for hotplugging.
This adds RegisterHotplugCallback() to register a callback which will
be invoked by the input backends' hotplug threads when there is a new
device, so that Core (GCKeyboard, GCPad, Wiimote, Hotkey) can reload
the configuration without adding a dependency to Core from InputCommon.
This fixes warnings in:
- Source/Core/InputCommon/ControllerEmu.h: avoid shadowing other
variables (my fault)
- Source/Core/Core/IPC_HLE/WII_IPC_HLE.h: made
SDIO_EventNotify_CPUThread static as it's not used anywhere else
This makes the device ID assigning code common to all backends, by
moving it to AddDevice() instead of copy-pasting or replicating
the logic in the backends.
Also, to prepare for hotplugging, instead of relying on a name usage
count, the new ID assigning system always starts from ID 0 and tries
to assign the first ID that is not used.
The Setting class was used for both numeric values and booleans, and
other parts of the code had hacks to make it work with booleans.
By splitting Setting into NumericSetting and BooleanSetting, it is
clear which settings are numeric, and which are boolean, so there is
no need to guess by checking the default values or anything like that.
Also, booleans are stored as booleans in config files, instead of 1.0.
The values are expected to be in the 0.0-1.0 range (as indicated by the
comment), and other parts of Dolphin also expect it to be in that range
since the "full" axis has a -1.0 to 1.0 range. However, this is not
always the case and fvalue can end up being outside of the range. This
clamps fvalue to always be in the 0.0 and 1.0 range.
Small cleanup by using std::shared_ptr and getting rid of
ciface.Devices() which just returned the m_devices (which defeats the
point of making m_devices protected).
Incidentally, this should make the code safer when we have
different threads accessing devices in the future (for hotplug?).
A lot of code use Device references directly so there is
no easy way to remove FindDevice() and make those unique_ptrs.
Previously, the devices vector would be passed to all backends. They
would then manually push_back to it to add new devices. This was fine
but caused issues when trying to add synchronisation.
Instead, backends now call AddDevice() to fill m_devices so that it is
not accessible from the outside.
make sure Reset() can’t be run concurrently with AddGCAdapter() or
ResetRumble() (which is called on other threads) which can cause
crashes (issue #9462)
Disclaimer: I can't test if this works on xbox one controllers, i don't have one. But i have conformed that this UpdateMotors() is related to rumble for emulated wiimotes.
This partially reverts commit "XInput: Apply immediately as well" (1958a10b6f) from pr # https://github.com/dolphin-emu/dolphin/pull/1560
Hopefully this fixes the xbox one controller rumble issue:
https://bugs.dolphin-emu.org/issues/9071
And in theory it might reduce the used usb bandwidth, as it was originally intended before pr 1560.
@JMC47: Please do a good amount of testing, to see if this breaks rumble for wiimotes or gamecube controllers emulated with xinput devices.
Under failure conditions of the GC Adapter, When interface count is zero and we can't open the device.
Then there were race conditions on shutdown of the threads which could result in crashing.
Make adapter opening more robust like the Mayflash DolphinBar.
Make shutdown more robust by making the read thread control the write thread.
Make sure that there is actual data to be written when kicking the write thread. So it doesn't attempt a write a shutdown.
Make a toast on screen to tell the user that the adapter needs to be unplugged and plugged back in again for it to work.
Previously we would iterate through every GC adapter plugged in to the PC and steal ownership of it.
This causes issues all over the place in the implementation if this happens.
Break on the first adapter we can get access to.
No way to properly enable it from an end user perspective yet.
Doesn't require root.
This same sort of system can be used for the Dolphinbar in the future for real wiimote support.
The Wii U Gamecube controller adapter setup has always been a bit weird. It tries to be as automatic as possible to make the user experience as easy
as possible.
The problem with this approach is that it brings a large disconnect in the user experience because you have the Gamecube controller setup with regular
gamepads and then for some reason below that you have a "direct connect" option which will cause the Gamecube Adapter to overwrite the regular inputs
if something was connected.
While this works and allows the user to only click one checkbox to get the device working, it breaks the user's experience because they don't really
know what "direct connect" means and won't look it up to figure out what it is. Just expecting the device to work (At least one occurence of this in
the IRC channel in the last week).
This way around also had the terrible nature of making the code more filthy than it needed to be. The GCAdapter namespace was parasitic and hooked in
to the regular GC Controller SI class to overwrite the data that it was getting from the default configuration.
Now instead we have a specific SIDevice class for the Wii U Gamecube adapter. This class is fairly simple and is a child of the regular SI Gamecube
Pad device and only reimplements what it needs to.
This also gives the ability to configure controllers individually, which allows the user to configure rumble individually per pad input.
Overall the code is cleaner, and it fits more in line with how the rest of Dolphin works.
Lets the user set the following in intervals of 10 between 10 and 100;
- Stick/Radius (default 100,000000)
- Triggers/Threshold (default 90,000000)
- Tilt/Modifier/Range (default 50,000000) + mapped Tilt/Modifier button
to the configurations for wiimotes & nunchuks
If there were two commands in the buffer at once, it would only run the
first because of an error in UpdateInput.
If you sent the command "SET C" it would segfault because of a logic
issue in ParseCommand.
Currently only works on unix, but can be extended to other systems. Can
also be extended to do wiimotes.
Searches the Pipes folder for readable named pipes and creates a dolphin
input device out of them. Send controller inputs to the game by writing
to the file. Commands are described in Pipes.h.
Main Stick is changed to Control Stick and C-Stick is changed to C Stick.
A new ui_name variable is added to ControlGroup so that the UI strings
in DolphinWX can be updated without breaking backwards compatibility
with config INIs and other things that use names as IDs.
Previously, MacOpenFile only overrode anything on OS X; otherwise it was
just a useless method, which is presumably why it wasn't marked override
in the first place. Address this more sanely by wrapping it in #ifdef
__APPLE__.
Using SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS which installs a signal
handler for SIGINT and SIGTERM. There will be a way to prevent this in
2.0.4 but for now we'll need to handle SDL_QUIT.
- Simplified the locking mechanism when controllers were updated
- Reloaded the config of the controls instead of re-initialising the control plugins
- Fixed controls being unresponsive after the Refresh button was pressed
- Disables the hotkeys while the controller config is open
My keyboard layout does not have Alt_R but ISO_Level3_Shift. As a
consequence any control expression containing Alt_R fails to evaluate
completely and is unusable. This modification replace the missing term
of the expression by a dummy expression which always evaluate to
0. This way, the keybinding can work even if some keys are not
available.
We can compile with haptic support, and then not initialize due to haptics not being available.
So if we are compiling with haptics, test initializing with haptics and if that fails attempt to initialize without haptics before bailing out.
I'm not sure when this nonsense of forcing locking the mutex when it's
already taken should have ever taken effect, but let's be thankful it
isn't now. That was a badly worded sentence.
This is good hygiene, and also happens to be required to build Dolphin
using Clang modules.
(Under this setup, each header file becomes a module, and each #include
is automatically translated to a module import. Recursive includes
still leak through (by default), but modules are compiled independently,
and can't depend on defines or types having previously been set up. The
main reason to retrofit it onto Dolphin is compilation performance - no
more textual includes whatsoever, rather than putting a few blessed
common headers into a PCH. Unfortunately, I found multiple Clang bugs
while trying to build Dolphin this way, so it's not ready yet, but I can
start with this prerequisite.)
Initialize now just takes the handle directly. Reinitialize is added because it is much more straightforward in comparison to doing the Shutdown-Initialize manually.
Added the option to handle whether the user wants to iterate through the
assignment of button mappings or assign them one at a time.
fixed formatting issues and code style.
I excluded this option from the config file. This stopped the check box value and the boolean from becoming offset. Since the option should always start as false.
This still causes an issue with the Wiimote input, since the class variable that keeps the state will be wiped, but the check box value will stay the same after closing/reopening without closing the entire Wiimote configuration. I am looking for a way to resolve this.
I also reduced wait time to 2.5 seconds vs. the 5 seconds previously. Seemed to be a little long.
These changes apparently did not go through.
This should fix the Wiimote issue.
strictStrings is not supported by debug libraries, and indeed breaks the build.
Drop wbemidl.h (incompatible with strictStrings) dependency by using SDL-style search for XInput GUIDs.
Yes, this is a fancy new feature, but our Wayland support was
particularly bitrotten, and ideally this would be handled by a platform
layer like SDL. If not, we can always add this back in when GLInterface
has caught up. We might be able to even support wxWidgets and GL
together with subsurfaces!
It was broken by e15ec56bf0 because it wasn't deemed important. However chances are people will eventually start using Dolphin on that configuration, so we shouldn't frivolously drop compatibility without good reason.
It was only used for Windows XP and lower.
This also bumps the _WIN32_WINNT define in the stdafx precompiled headers to set the minimum version as Windows Vista.
We can't use RendererHasFocus for this purpose because of some issues
with exclusive fullscreen, and the new RendererHasFocus implementation
didn't work for non-Render to Main Window cases, since the renderer
window wasn't managed by wx.
This will allow us to simplify the checks for background input and push
them further down into the architecture, into the ControllerEmu layer.
The new setting isn't actually used yet, though.
Do the scaling in the code that interprets the results.
This also removes the templatization of things and changes the interface
to always take a double.
This does add a bit more code to the users of GetState, especially when
having to deal with focus management, but this will be cleaned up very
soon, as focus and focus-related options will be centralized inside the
input platforms themselves, rather than spread out across all the input
plugins.
Most users will have something in the radius or deadzone fields, so
don't bother filtering out 'extra' work. This also lets us clean up
the modifier implementation.
It was only used for really old joypads which we really don't want to
support. If users have these joypads, they should look into using
something at the OS level, as games shouldn't need to have this
transformation; it should be done by the OS and driver.
It substantially complicates the code and doesn't really provide any
functionality. According to the forums, the Android app is out of date
and has been broken for quite a while.
If we want to add this back, I'd write an app that speaks a more native
Wiimote protocol, and we can hook that up to the backend quite easily.
It could even be over our NetPlay protocol!
Looking at the old code for the ButtonManager was a brainfsck. This fixes a ton of bugs I kept uncovering as I was moving along.
Fixes the gamepad configuration file being incorrect.
No longer treats touchscreen in a special way. Ends up as a regular device with a "Touchscreen" device name.
Was incorrectly converting a index from integer to ButtonType. Wouldn't work due to the addition of some unused(in JNI) enumerators in ButtonType.
Fixes an issue where a map had a key as an axis which was causing its binding to be overwritten for every axis that was used twice (eg main stick left and right);
Fixes Triggers not working at all.
Fixes DPad not working at all.
Fixes C-Stick only half working.
Removes touch screen specific nativelibrary types onTouchAxisEvent and onTouchEvent.
Adds a configuration version configuration option. Allows easy configuration overwriting if the options need to be changed during updating.
Supersedes github PR #291.
- remove unused variables
- reduce the scope where it makes sense
- correct limits (did you know that strcat()'s last parameter does not
include the \0 that is always added?)
- set some free()'d pointers to NULL
* Currently there is no DEBUGFAST configuration. Defining DEBUGFAST as a preprocessor definition in Base.props (or a global header) enables it for now, pending a better method. This was done to make managing the build harder to screw up. However it may not even be an issue anymore with the new .props usage.
* D3DX11SaveTextureToFile usage is dropped and not replaced.
* If you have $(DXSDK_DIR) in your global property sheets (Microsoft.Cpp.$(PlatformName).user), you need to remove it. The build will error out with a message if it's configured incorrectly.
* If you are on Windows 8 or above, you no longer need the June 2010 DirectX SDK installed to build dolphin. If you are in this situation, it is still required if you want your built binaries to be able to use XAudio2 and XInput on previous Windows versions.
* GLew updated to 1.10.0
* compiler switches added: /volatile:iso, /d2Zi+
* LTCG available via msbuild property: DolphinRelease
* SDL updated to 2.0.0
* All Externals (excl. OpenAL and SDL) are built from source.
* Now uses STL version of std::{mutex,condition_variable,thread}
* Now uses Build as root directory for *all* intermediate files
* Binary directory is populated as post-build msbuild action
* .gitignore is simplified
* UnitTests project is no longer compiled
SDL2.0 removed SDL_HAPTIC_SQUARE because of ABI issues (see comment #7 on issue
6491 by Ryan C. Gordon from the SDL project). It will be reintroduced again in
2.1, so keep the code and #ifdef it away.
This reverts commit cce809ac90.
The code was actually correct: "expr" is never allocated when an error is
returned. This means when the expression parser fails, deleting "expr" means
deleting an uninitialized pointer.
Without clearing out the "accumulator" for the backtick parsing,
our control name was full of junk (the previous device name) causing
us to not correctly find the control.
Ensure that always we clear the "accumulator" string during backtick
parsing.
Otherwise, valid control names like "Cursor X+" would be incorrectly
tokenized as "`Cursor` `X` +", causing the parser to first abort trying to
find a control named `Cursor` rather than aborting with invalid syntax on
the bad binop.
We could also do this by resolving devices lazily, but since simple
control name bindings are going to be 90% of usecases, just look for these
first.
Yeah, yeah, it's possible that some guy would try to build DInput
without XInput, but they're crazy, and I doubt it would have worked
since the header file mess was so fragile anyway. Always exclude
DInput devices when we don't have XInput.
If an expression can't be parsed normally, we then look to see if it's a
simple device name. This keeps backwards compatibility with simple input
ocnfigurations, where people just used the Detect button.
This contains a new, hand-written expression parser to replace the old
hack language based on string munging. The new approach is a simple
AST-based evaluation approach, instead of the "list of operations"
infix-based hack that there was before.
The new language for configuration has support for parentheses, and
counts "!" as a unary operator instead of the binary "NOT OR" operator
it was before. A simple example:
(X & Y) | !B
Explicit device references, and complex device names ("Right Y+") are
handled with backticks and colons:
(`SDL/0/6 axis joystick:Right X+` & `DInput/0/Keyboard Mouse:A`)
The basic editor UI that inserts tokens has not been updated to reflect
the new language.
Some indentations were also too far for some things. Fixed this.
Also update the license header to show Git instead of SVN.
Got rid of some trailing spaces/tabs too.
* Changed the mapping of the steering wheel to:
Main Stick Left/Right = Steer Left/Right
Main Stick Up = Accelerate
Main Stick Down = Brake
* Fixed non-force feedback controllers that were not detected
This adds support for drivers supporting sine, square and triangle
periodic haptic effects. This allows rumble to work on devices/drivers
supporting these effects, such as an xbox controller using the xpad
driver under Linux.
Dolphin code already builds against SDL2 but the build system never
checks for SDL2, which is the what latest SDL is called now. SDL2
replaces SDL 1.3. This allows Dolphin to be build against SDL2, which
activates certain new features such as the haptic interface.
Judging by the feedback provided by other OSX users, this appears to fix the crash when starting Dolphin on OSX with devices that have an empty name.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7598 8ced0084-cf51-0410-be5f-012b33b47a6e
Add the option to clear a title from the NANDContentLoader and attempt to reload it
This allows the using the system menu immediately after installing rather than requiring a relaunch
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7290 8ced0084-cf51-0410-be5f-012b33b47a6e
that cause IOHIDValueGetIntegerValue() to smash the stack when trying
to convert them.
In practice, all relevant axes seem to also be available as either
8 or 16-bit values, so just ignore anything that doesn't look like
that (or a button).
Fixes issue 3931.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7255 8ced0084-cf51-0410-be5f-012b33b47a6e
Changes:
* Allow events to be scheduled when the emulator is not running. This allows the save state event to be added before the emulator starts.
* Removed the Audio back-end init flag from the save state. This value should not be saved as it is not data relevant to guest machine.
* Allow a recording to be started at any time (apart from when a recording is already being made).
* Updated the status bar and title bar when an on-screen message is shown
* Removed the saving of PEToken from the save state as the FIFO will save this information
* Added a couple Pixel Engine interrupt states to the save state
* Added the copyright notice to the GCPadStatus.h file.
This function is preliminary. Let us know of any bugs you find or any UI quirks.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7175 8ced0084-cf51-0410-be5f-012b33b47a6e
buildfix
move much of the build settings to .props files
-please use them as much as possible in the future, instead of changing individual projects
NOTE: to avoid left over blobs, clean your builds *before* applying these changes.
TODO: add DebugFast target for projects that are lacking it. Lack of DebugFast targets cause the linker to use LTCG when we don't want it.
please test for regressions which could be caused by being too happy with compiler flags :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7109 8ced0084-cf51-0410-be5f-012b33b47a6e
and just operate on lists of object files instead.
This helps with LTO since LLVM/clang LTO is completely broken
by static libraries. It also helps identify symbol clashes
between components like the former plugins.
Many linkers also expect static libraries to form a strict DAG
which turns out be a difficult rule to uphold in practice,
especially since some of our platforms aren't picky about this.
LTO builds currently appears to crash at runtime because of
the static wx libs.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7056 8ced0084-cf51-0410-be5f-012b33b47a6e
fix all build targets (they've all built here - you may have to manually delete the intermediate directories if you have conflicts after this commit).
set the debug path to $(TargetDir)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7022 8ced0084-cf51-0410-be5f-012b33b47a6e