Commit befeea42 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

windows.gaming.input: Implement HID simple haptics controllers support.

Adding support for trigger rumble on supported controllers and drivers. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 634d380e
......@@ -217,14 +217,36 @@ DEFINE_IINSPECTABLE_OUTER( gamepad, IGamepad, struct gamepad, IGameController_ou
static HRESULT WINAPI gamepad_get_Vibration( IGamepad *iface, struct GamepadVibration *value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
struct gamepad *impl = impl_from_IGamepad( iface );
struct WineGameControllerVibration vibration;
HRESULT hr;
TRACE( "iface %p, value %p.\n", iface, value );
if (FAILED(hr = IWineGameControllerProvider_get_Vibration( impl->wine_provider, &vibration ))) return hr;
value->LeftMotor = vibration.rumble / 65535.;
value->RightMotor = vibration.buzz / 65535.;
value->LeftTrigger = vibration.left / 65535.;
value->RightTrigger = vibration.right / 65535.;
return S_OK;
}
static HRESULT WINAPI gamepad_put_Vibration( IGamepad *iface, struct GamepadVibration value )
{
FIXME( "iface %p, value %p stub!\n", iface, &value );
return E_NOTIMPL;
struct gamepad *impl = impl_from_IGamepad( iface );
struct WineGameControllerVibration vibration =
{
.rumble = value.LeftMotor * 65535.,
.buzz = value.RightMotor * 65535.,
.left = value.LeftTrigger * 65535.,
.right = value.RightTrigger * 65535.,
};
TRACE( "iface %p, value %p.\n", iface, &value );
return IWineGameControllerProvider_put_Vibration( impl->wine_provider, vibration );
}
static HRESULT WINAPI gamepad_GetCurrentReading( IGamepad *iface, struct GamepadReading *value )
......
......@@ -33,6 +33,7 @@ import "windows.gaming.input.custom.idl";
namespace Windows.Gaming.Input.Custom {
typedef enum WineGameControllerType WineGameControllerType;
typedef struct WineGameControllerState WineGameControllerState;
typedef struct WineGameControllerVibration WineGameControllerVibration;
interface IWineGameControllerProvider;
runtimeclass WineGameControllerProvider;
......@@ -50,6 +51,14 @@ namespace Windows.Gaming.Input.Custom {
Windows.Gaming.Input.GameControllerSwitchPosition switches[4];
};
struct WineGameControllerVibration
{
UINT16 rumble;
UINT16 buzz;
UINT16 left;
UINT16 right;
};
[
uuid(06e58977-7684-4dc5-bad1-cda52a4aa06d)
]
......@@ -73,6 +82,8 @@ namespace Windows.Gaming.Input.Custom {
[propget] HRESULT SwitchCount([out, retval] INT32 *value);
[propget] HRESULT State([out, retval] WineGameControllerState *state);
[propget] HRESULT Vibration([out, retval] WineGameControllerVibration *vibration);
[propput] HRESULT Vibration([in] WineGameControllerVibration vibration);
}
[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment