Commit Graph

51 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 e3b2830f99 updated VS project file 2022-10-06 18:03:28 +03: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
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
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
Ozkan Sezer ba87876ef7 fix syntax error in SDL.vcxproj.filters
Noticed by Markvy.
Fixes https://github.com/libsdl-org/SDL/issues/4787
2021-09-27 14:10:02 +03: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
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
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
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 4a25a099a0 Fixed the location of controller_type.h in the Visual Studio project 2019-10-22 10:26:49 -07: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
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
Ethan Lee 11c348b4d7 SDL_log10 2018-01-17 11:53:09 -05:00
Ryan C. Gordon 351d6d4784 audio: Port WASAPI to WinRT, remove XAudio2 backend.
XAudio2 doesn't have capture support, so WASAPI was to replace it; the holdout
was WinRT, which still needed it as its primary audio target until the WASAPI
code code be made to work.

The support matrix now looks like:

WinXP: directsound by default, winmm as a fallback for buggy drivers.
Vista+: WASAPI (directsound and winmm as fallbacks for debugging).
WinRT: WASAPI
2017-12-06 12:24:32 -05:00
Sam Lantinga a6a4e27ae8 Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga bcdf8b916b Added SDL_fmod() and SDL_fmodf() 2017-11-04 17:35:03 -07:00
Sam Lantinga 1f2e151b44 Added Vulkan support to the Visual Studio 2010 solution 2017-08-27 22:20:17 -07:00
Ryan C. Gordon a0e003eebb Refactored the audio queueing code to a generic SDL_DataQueue interface.
This is not a public API (at the moment), but we will be needing this for
other internal things soon.
2016-12-06 02:23:54 -05:00
Sam Lantinga af7f30de02 Fixed SDL always being built because of missing headers in the project. 2016-12-05 21:28:27 -08:00
Ryan C. Gordon 979de761c9 audio: Removed internal SDL_audiomem.h and macros.
I think this was important for SDL 1.2 because some targets needed
special device memory for DMA buffers or locked memory buffers for use in
hardware interrupts or something, but since it just defines to SDL_malloc
and SDL_free now, I took it out for clarity's sake.
2016-08-05 01:44:15 -04:00