Commit Graph

63 Commits

Author SHA1 Message Date
Sam Lantinga 0dfc829a6b Added simple BLE Steam Controller support on all platforms
This is still disabled by default via the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM
2022-11-10 19:17:04 -08:00
Ozkan Sezer c0baa6bf5e move SDL_windowstaskdialog.h contents into SDL_windowsmessagebox.c
Silences clang -Wpragma warnings:

D:/a/SDL/SDL/src/video/windows/SDL_windowstaskdialog.h:21:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
#include <pshpack1.h>
         ^
D:/a/_temp/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
#pragma pack(push,1)
        ^

In file included from D:/a/SDL/SDL/src/video/windows/SDL_windowsmessagebox.c:35:

D:/a/SDL/SDL/src/video/windows/SDL_windowstaskdialog.h:156:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]

#include <poppack.h>

         ^

note: previous '#pragma pack' directive that modifies alignment is here

2 warnings generated.

Closes: https://github.com/libsdl-org/SDL/issues/6240
2022-09-16 20:03:50 +03:00
Sam Lantinga c72e14e8f4 Added initial support for Wii controllers (thanks @tellowkrinkle!) 2022-09-01 15:29:41 -07:00
Sam Lantinga 7cfef177c1 Added SDL_hidapi_ps3.c to the Windows projects 2022-08-23 22:53:43 -07:00
Ozkan Sezer e69838e745 add SDL_crc16.c to msvc and watcom builds 2022-08-11 20:11:32 +03:00
Sam Lantinga 2fa2f9ff77 Greatly improved Nintendo Joy-Con support using the HIDAPI driver
* Added support for mini-gamepad mode for Joy-Con controllers, matching the mapping for hid-nintendo on Linux and iOS 16
* Added the ability to merge left and right Joy-Con controllers into a single Pro-style controller
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_COMBINE_JOY_CONS to control this merging functionality
* Removed the hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS
2022-07-28 19:22:27 -07:00
Anonymous Maarten 5da85376b9 stdlib: move all mslibc functions to SDL_mslibc.c
This allows disabling LTO on them by only specifying a single file.
2022-07-27 09:07:56 -07:00
Sam Lantinga b299cb3d3c Added a utility function to calculate the next power of 2 for a value 2022-07-17 08:31:16 -07:00
Ethan Lee ae105ae1c7 windows: Move IMMDevice work to common file, implement DirectSound enumeration support 2022-07-11 12:54:34 -04:00
Cameron Gutman 6e712d2440 joystick: Add HIDAPI driver for NVIDIA SHIELD 2017 controller
Basic input already works using the OS HID driver, but this enables
force feedback and battery state reporting.
2022-07-10 10:53:26 -07:00
Cameron Cawley 78089e6598 Remove unused internal header SDL_sysevents.h 2022-07-01 07:39:48 -07:00
Anonymous Maarten ae7446a959 stlib: Extract SDL_memcpy and SDL_memset to its own file respectively
This is done such that we can disable LTO for these 2 functions when
building with MSVC.

This is due to a limitation of Link Time Code Generation (LTCG).
Code generation might generate a new reference to memset after linking
has started. The LTCG must make assumptions about where memset is
defined which is normally the C runtime.
2022-06-15 14:17:35 -07:00
chalonverse 4082821822
DirectX 12 Renderer (#5761)
* DirectX 12 Renderer (27 squashed commits)

* Add missing SDL_hidapi.h of merge of SDL.vcxproj.filters

* Fixed OpenWatcom build failure

* Dynapi fix

Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2022-06-06 17:42:30 -07:00
Christoph Reichenbach 3a20274ddf Refactoring: move GUID operations out of Joystick
- SDL_JoystickGUID -> SDL_GUID (though we retain a type alias)
- Operations for GUID <-> String ops are now in
  src/SDL_guid.c and include/SDL_guid.h
- The corresponding Joystick operations delegate to SDL_guid.c
- Added test/testguid.c
2022-06-04 17:22:13 -07:00
Sam Lantinga 17410887d0 Separated controller type data into a C file 2022-06-03 15:03:08 -07:00
Sam Lantinga a0cdc1fc30 Added declaration of SDL_LogInit() and SDL_LogQuit()
Fixes compile warning on Android
2022-04-28 15:01:34 -07:00
Sylvain ad6bc521bd
Move SDL_List functions to SDL_list.c to avoid more merge with eventual PR 2022-04-01 07:59:16 +02:00
Ozkan Sezer f8900583e5 removed windows winmm joystick driver 2021-11-23 17:04:40 +03:00
Sam Lantinga 5b646cd19e Build hidapi code into SDL as a new public API
This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
2021-11-07 23:00:59 -08:00
Cameron Gutman 5dccffd7e4 Allow usage of the new Condition Variable code with Critical Sections
Vista and later provide the SleepConditionVariableCS() function for this.

Since SDL_syscond_srw.c doesn't require SRW locks anymore, rename it to
SDL_syscond_cv.c which better reflects the implementation of condition
variables rather than the implementation of mutexes.

Fixes #4051.
2021-09-17 19:38:09 -04:00
Sylvain a2cd4255c9 Update VisualC projects 2021-08-19 00:10:59 +02:00
Sam Lantinga 3ababa09c5 Don't explicitly use any C runtime library with Visual Studio
Visual Studio will still use Multi-threaded DLL by default, but since we don't link with a C runtime we won't end up with any Visual Studio runtime dependency.

This fixes https://github.com/libsdl-org/SDL/issues/4328
2021-07-29 15:17:42 -07:00
Cameron Cawley b0daa9f1db Automatically select the default platform toolset for MSVC builds 2021-07-24 16:06:54 -07:00
Cameron Cawley 6c92bf540c Add more filters to the MSVC project 2021-07-24 14:11:36 -07:00
Dimitriy Ryazantcev 17ed8d8085 Added HIDAPI backend for Amazon Luna Controller Model T28B69 connected via Bluetooth LE (VID:0171, PID:0419).
To enter Bluetooth pairing mode hold B and Action (button with circle) buttons for 3 seconds.

It works via usual HIDAPI if special filter driver is not installed:
https://www.amazon.com/gp/help/customer/display.html?nodeId=GZCT4CTFHXLHEB9T

With that driver installed it mimics Xbox One controller and works via XInput under Windows.

Under DInput this controller is not usable at all.
2021-07-07 08:31:12 -07:00
Sam Lantinga 360e04dd23 Added Stadia controller source file to Visual Studio and Xcode projects 2021-01-24 00:51:26 -05:00
Joel Linn 8fc0baad98 Add SDL_cond implementation using Windows Condition Variables
Is automatically used when the SRW SDL_mutex implementation is active.
Otherwise falls back to the generic implementation.

v2: - Rebase onto master fa3ea1051a4b
2020-12-28 11:43:11 -08:00
Joel Linn 2443e51e0e Add optional suffix `_generic` to generic SDL_cond impl
Allows for runtime selectable implementation
2020-12-28 11:42:49 -08:00
Ozkan Sezer 250a055727 fix bug #5384 -- define DLL_EXPORT in DLL builds and adjust begin_code.h 2020-12-09 12:01:10 +03:00
Sam Lantinga 5b3616c325 Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices
This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
2020-11-23 18:24:05 -08:00
Sam Lantinga 71e32f5e1b Added SDL_crc32() 2020-11-16 15:00:15 -08:00
Sam Lantinga a22beef402 Moved the PS5 controller driver to a separate file, as the advanced feature protocol is very different from that of the PS4 2020-11-05 17:03:28 -08:00
Ryan C. Gordon b7b2995fbe url: Added to Visual Studio project files. 2020-10-05 15:27:32 -04:00
Ryan C. Gordon fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Sam Lantinga aba2792896 Added a Windows Gaming Input joystick driver
This driver supports the Razer Atrox Arcade Stick

Some of the quirks of this driver, inherent in Windows Gaming Input:
* There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers.
* You can't read the state of the guide button
* You can't get controller events in the background
2020-04-18 21:41:37 -07:00
Sam Lantinga 3180ba81af First pass at Windows sensor implementation 2020-04-08 08:34:27 -07:00
Sam Lantinga 4dea340ca7 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows
Jimb Esser

Add new RawInput controller API, and improved correlation with XInput/WGI

Reorder joystick init so drivers can ask the others if they handle a device reliably
Do not poll disconnected XInput devices (major perf issue)
Fix various cases where incorrect correlation could happen
Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation
Correlate by axis motion as well as button presses
Fix failing to zero other trigger
Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init()
Add missing device to device names
Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices

Updated to SDL 2.0.13 code with the following notes:
New HID driver: xbox360w - no idea what that is, hopefully urelated
SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data.
SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem.
Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason.
Something changed in how devices get names, so getting generic names.
Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
2020-03-16 12:23:38 -07:00
David Ludwig 40625c4e79 virtual joysticks: MSVC support part 2/2, add file refs to MSVC projects (bug 5028) 2020-03-15 16:01:19 -04:00
Sam Lantinga 7c7ae00294 Added SDL_hidapi_rumble.c to the Visual Studio project 2020-02-04 15:35:01 -08:00
Sam Lantinga 8d742d4745 Added new HIDAPI driver files to the Visual Studio project 2019-12-19 15:12:36 -08:00
Ozkan Sezer eb8f14bb6a added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
Sam Lantinga 7bf6c887c7 Fixed the location of controller_type.h in the Visual Studio project 2019-10-22 10:25:55 -07:00
Ryan C. Gordon 16dee35cfe windows: Remove /ARCH:SSE option from x64 Visual Studio builds.
Fixes Bugzilla #4561.
2019-10-15 09:07:12 -04:00
Sam Lantinga be6cda9f95 Rolling back GameCube HIDAPI support
It causes the HIDAPI devices to always be opened on enumeration, which causes crashes in the Windows drivers when multiple applications are reading and writing at the same time. We can revisit this after 2.0.10 release.
2019-06-19 15:54:21 -07:00
Sam Lantinga 82ebe63f9a Fixed Visual Studio build 2019-03-16 19:46:37 -07:00
Cameron Gutman 6a9f45f2de Remove machine-specific IncludePath from SDL.vcxproj
These IncludePath values seem to not actually be needed since nobody
noticed they were wrong for the past couple months.
2018-10-12 22:05:58 -07:00
Sam Lantinga de5367a612 Added display event files to the Visual Studio projects 2018-08-23 02:48:47 -07:00
Sam Lantinga 7749ee2a43 Added the dummy sensor driver to the Visual Studio projects 2018-08-21 13:42:44 -07:00
Sam Lantinga d2042e1ed4 Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
2018-08-09 16:00:17 -07:00
Ethan Lee b4fe7412f9 SDL_exp 2018-08-04 11:52:46 -04:00