From 698b7deaa269e3ad1751226b7d9ab4b112f30f1f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 17 Feb 2024 16:33:45 -0800 Subject: [PATCH] Removed GAMEINPUT_JoystickEffectDataType_HapticFeedback This refers to the HID Simple Haptics spec, which is currently only implemented by the Surface Dial accessory and WMR game controllers, which aren't currently exposed by the GameInput API. We can add support for other effects in the future, but for now we don't need this or the SDL_gameinputjoystick_c.h header. --- VisualC-GDK/SDL/SDL.vcxproj | 1 - VisualC-GDK/SDL/SDL.vcxproj.filters | 1 - VisualC/SDL/SDL.vcxproj | 1 - VisualC/SDL/SDL.vcxproj.filters | 3 -- src/joystick/gdk/SDL_gameinputjoystick.c | 35 ++++------------ src/joystick/gdk/SDL_gameinputjoystick_c.h | 49 ---------------------- 6 files changed, 8 insertions(+), 82 deletions(-) delete mode 100644 src/joystick/gdk/SDL_gameinputjoystick_c.h diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index 9d4ecf0da5..19f0a244f1 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -425,7 +425,6 @@ - diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index c59af5d0a5..c656f29be8 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -320,7 +320,6 @@ - diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index c5a508b827..52563669f0 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -347,7 +347,6 @@ - diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 679a2bc552..4b685e50a6 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -549,9 +549,6 @@ haptic\windows - - joystick\gdk - joystick\hidapi diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index c90635e661..d1e605b993 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -20,14 +20,14 @@ */ #include "SDL_internal.h" -#include "SDL_gameinputjoystick_c.h" +#ifdef SDL_JOYSTICK_GAMEINPUT -#if defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT +#include "../SDL_sysjoystick.h" -/* Public APIs: GAMEINPUT_Joystick... */ -/* Private APIs: GAMEINPUT_InternalJoystick... */ +#include +#define COBJMACROS +#include -#include "../usb_ids.h" typedef struct GAMEINPUT_InternalDevice { @@ -115,7 +115,7 @@ static int GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice) } vendor = devinfo->vendorId; product = devinfo->productId; - version = (devinfo->major << 8) | devinfo->minor; + version = (devinfo->firmwareVersion.major << 8) | devinfo->firmwareVersion.minor; g_GameInputList.devices = devicelist; IGameInputDevice_AddRef(pDevice); @@ -434,26 +434,7 @@ static int GAMEINPUT_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 gre static int GAMEINPUT_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) { - HRESULT hR = S_OK; - const GAMEINPUT_JoystickEffectData *effect = NULL; - GAMEINPUT_InternalJoystickHwdata *hwdata = joystick->hwdata; - - if (!data || size != sizeof(GAMEINPUT_JoystickEffectData)) { - return SDL_SetError("GAMEINPUT_JoystickSendEffect invalid data or size"); - } - - effect = (const GAMEINPUT_JoystickEffectData *)data; - if (effect->type == GAMEINPUT_JoystickEffectDataType_HapticFeedback) { - hR = IGameInputDevice_SetHapticMotorState(hwdata->devref->device, - effect->hapticFeedbackMotorIndex, - &effect->hapticFeedbackParams - ); - if (FAILED(hR)) { - return SDL_SetError("IGameInputDevice::SetHapticMotorState failure with HRESULT of %08X", hR); - } - } - - return 0; + return SDL_Unsupported(); } static int GAMEINPUT_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) @@ -603,4 +584,4 @@ SDL_JoystickDriver SDL_GAMEINPUT_JoystickDriver = }; -#endif /* defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT */ +#endif /* SDL_JOYSTICK_GAMEINPUT */ diff --git a/src/joystick/gdk/SDL_gameinputjoystick_c.h b/src/joystick/gdk/SDL_gameinputjoystick_c.h deleted file mode 100644 index 0b3bc51a63..0000000000 --- a/src/joystick/gdk/SDL_gameinputjoystick_c.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2024 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_internal.h" -#include "../SDL_sysjoystick.h" - -#if defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT - -#include -#define COBJMACROS -#include - -typedef enum GAMEINPUT_JoystickEffectDataType -{ - GAMEINPUT_JoystickEffectDataType_HapticFeedback -} GAMEINPUT_JoystickEffectDataType; - -typedef struct GAMEINPUT_JoystickEffectData -{ - GAMEINPUT_JoystickEffectDataType type; - - union - { - struct /* type == GAMEINPUT_JoystickEffectDataType_HapticFeedback */ - { - uint32_t hapticFeedbackMotorIndex; - GameInputHapticFeedbackParams hapticFeedbackParams; - }; - }; -} GAMEINPUT_JoystickEffectData; - -#endif /* defined(SDL_JOYSTICK_GAMEINPUT) && SDL_JOYSTICK_GAMEINPUT */