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.
This commit is contained in:
Sam Lantinga 2024-02-17 16:33:45 -08:00
parent f35ede7281
commit 698b7deaa2
6 changed files with 8 additions and 82 deletions

View File

@ -425,7 +425,6 @@
<ClInclude Include="..\..\src\hidapi\hidapi\hidapi.h" />
<ClInclude Include="..\..\src\hidapi\SDL_hidapi_c.h" />
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\gdk\SDL_gameinputjoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />

View File

@ -320,7 +320,6 @@
<ClInclude Include="..\..\src\hidapi\hidapi\hidapi.h" />
<ClInclude Include="..\..\src\hidapi\SDL_hidapi_c.h" />
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\gdk\SDL_gameinputjoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />

View File

@ -347,7 +347,6 @@
<ClInclude Include="..\..\src\hidapi\hidapi\hidapi.h" />
<ClInclude Include="..\..\src\hidapi\SDL_hidapi_c.h" />
<ClInclude Include="..\..\src\joystick\controller_type.h" />
<ClInclude Include="..\..\src\joystick\gdk\SDL_gameinputjoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.h" />
<ClInclude Include="..\..\src\joystick\SDL_gamepad_c.h" />

View File

@ -549,9 +549,6 @@
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h">
<Filter>haptic\windows</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\gdk\SDL_gameinputjoystick_c.h">
<Filter>joystick\gdk</Filter>
</ClInclude>
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h">
<Filter>joystick\hidapi</Filter>
</ClInclude>

View File

@ -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 <stdbool.h>
#define COBJMACROS
#include <GameInput.h>
#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 */

View File

@ -1,49 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
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 <stdbool.h>
#define COBJMACROS
#include <GameInput.h>
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 */