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

windows.gaming.input: Implement Windows.Gaming.Input.PeriodicForceEffect runtimeclass.

parent 569036b1
...@@ -6017,10 +6017,8 @@ static void test_windows_gaming_input(void) ...@@ -6017,10 +6017,8 @@ static void test_windows_gaming_input(void)
hr = pWindowsCreateString( periodic_effect_class_name, wcslen( periodic_effect_class_name ), &str ); hr = pWindowsCreateString( periodic_effect_class_name, wcslen( periodic_effect_class_name ), &str );
ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr );
hr = pRoGetActivationFactory( str, &IID_IPeriodicForceEffectFactory, (void **)&periodic_factory ); hr = pRoGetActivationFactory( str, &IID_IPeriodicForceEffectFactory, (void **)&periodic_factory );
todo_wine
ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr );
pWindowsDeleteString( str ); pWindowsDeleteString( str );
if (hr != S_OK) goto skip_periodic;
check_interface( periodic_factory, &IID_IUnknown, TRUE ); check_interface( periodic_factory, &IID_IUnknown, TRUE );
check_interface( periodic_factory, &IID_IInspectable, TRUE ); check_interface( periodic_factory, &IID_IInspectable, TRUE );
...@@ -6196,7 +6194,6 @@ static void test_windows_gaming_input(void) ...@@ -6196,7 +6194,6 @@ static void test_windows_gaming_input(void)
IPeriodicForceEffectFactory_Release( periodic_factory ); IPeriodicForceEffectFactory_Release( periodic_factory );
skip_periodic:
hr = pWindowsCreateString( condition_effect_class_name, wcslen( condition_effect_class_name ), &str ); hr = pWindowsCreateString( condition_effect_class_name, wcslen( condition_effect_class_name ), &str );
ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr );
hr = pRoGetActivationFactory( str, &IID_IConditionForceEffectFactory, (void **)&condition_factory ); hr = pRoGetActivationFactory( str, &IID_IConditionForceEffectFactory, (void **)&condition_factory );
......
...@@ -10,6 +10,7 @@ C_SRCS = \ ...@@ -10,6 +10,7 @@ C_SRCS = \
gamepad.c \ gamepad.c \
main.c \ main.c \
manager.c \ manager.c \
periodic_effect.c \
provider.c \ provider.c \
racing_wheel.c \ racing_wheel.c \
ramp_effect.c \ ramp_effect.c \
......
...@@ -43,6 +43,7 @@ struct effect ...@@ -43,6 +43,7 @@ struct effect
LONG directions[3]; LONG directions[3];
DICONSTANTFORCE constant_force; DICONSTANTFORCE constant_force;
DIRAMPFORCE ramp_force; DIRAMPFORCE ramp_force;
DIPERIODIC periodic;
DIEFFECT params; DIEFFECT params;
}; };
...@@ -185,6 +186,26 @@ HRESULT force_feedback_effect_create( enum WineForceFeedbackEffectType type, IIn ...@@ -185,6 +186,26 @@ HRESULT force_feedback_effect_create( enum WineForceFeedbackEffectType type, IIn
impl->params.lpvTypeSpecificParams = &impl->ramp_force; impl->params.lpvTypeSpecificParams = &impl->ramp_force;
impl->params.cbTypeSpecificParams = sizeof(impl->ramp_force); impl->params.cbTypeSpecificParams = sizeof(impl->ramp_force);
break; break;
case WineForceFeedbackEffectType_Periodic_SineWave:
impl->type = GUID_Sine;
goto WineForceFeedbackEffectType_Periodic;
case WineForceFeedbackEffectType_Periodic_TriangleWave:
impl->type = GUID_Triangle;
goto WineForceFeedbackEffectType_Periodic;
case WineForceFeedbackEffectType_Periodic_SquareWave:
impl->type = GUID_Square;
goto WineForceFeedbackEffectType_Periodic;
case WineForceFeedbackEffectType_Periodic_SawtoothWaveDown:
impl->type = GUID_SawtoothDown;
goto WineForceFeedbackEffectType_Periodic;
case WineForceFeedbackEffectType_Periodic_SawtoothWaveUp:
impl->type = GUID_SawtoothUp;
goto WineForceFeedbackEffectType_Periodic;
WineForceFeedbackEffectType_Periodic:
impl->params.lpvTypeSpecificParams = &impl->periodic;
impl->params.cbTypeSpecificParams = sizeof(impl->periodic);
break;
} }
impl->params.dwSize = sizeof(DIEFFECT); impl->params.dwSize = sizeof(DIEFFECT);
......
...@@ -189,6 +189,8 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory ** ...@@ -189,6 +189,8 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory **
IInspectable_QueryInterface( constant_effect_factory, &IID_IActivationFactory, (void **)factory ); IInspectable_QueryInterface( constant_effect_factory, &IID_IActivationFactory, (void **)factory );
if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_ForceFeedback_RampForceEffect )) if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_ForceFeedback_RampForceEffect ))
IInspectable_QueryInterface( ramp_effect_factory, &IID_IActivationFactory, (void **)factory ); IInspectable_QueryInterface( ramp_effect_factory, &IID_IActivationFactory, (void **)factory );
if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_ForceFeedback_PeriodicForceEffect ))
IInspectable_QueryInterface( periodic_effect_factory, &IID_IActivationFactory, (void **)factory );
if (*factory) return S_OK; if (*factory) return S_OK;
return CLASS_E_CLASSNOTAVAILABLE; return CLASS_E_CLASSNOTAVAILABLE;
......
...@@ -51,6 +51,7 @@ extern ICustomGameControllerFactory *racing_wheel_factory; ...@@ -51,6 +51,7 @@ extern ICustomGameControllerFactory *racing_wheel_factory;
extern IGameControllerFactoryManagerStatics2 *manager_factory; extern IGameControllerFactoryManagerStatics2 *manager_factory;
extern IInspectable *constant_effect_factory; extern IInspectable *constant_effect_factory;
extern IInspectable *ramp_effect_factory; extern IInspectable *ramp_effect_factory;
extern IInspectable *periodic_effect_factory;
struct vector_iids struct vector_iids
{ {
......
...@@ -54,6 +54,14 @@ namespace Windows.Gaming.Input.Custom { ...@@ -54,6 +54,14 @@ namespace Windows.Gaming.Input.Custom {
{ {
Constant = 1, Constant = 1,
Ramp = 2, Ramp = 2,
Periodic = 10,
/* same order as PeriodicForceEffectKind */
Periodic_SquareWave = 10,
Periodic_SineWave = 11,
Periodic_TriangleWave = 12,
Periodic_SawtoothWaveUp = 13,
Periodic_SawtoothWaveDown = 14,
}; };
struct WineGameControllerState struct WineGameControllerState
......
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