From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/force_feedback.c | 4 ---- dlls/windows.gaming.input/force_feedback.c | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 182bb9919bb..c7498e45727 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -6020,9 +6020,7 @@ static void test_windows_gaming_input(void) ok( hr == S_FALSE, "put_Gain returned %#lx\n", hr ); state = 0xdeadbeef; hr = IForceFeedbackEffect_get_State( effect, &state ); - todo_wine ok( hr == S_OK, "get_State returned %#lx\n", hr ); - todo_wine ok( state == ForceFeedbackEffectState_Stopped, "got state %#x\n", state ); hr = IForceFeedbackEffect_Start( effect ); todo_wine @@ -6260,9 +6258,7 @@ static void test_windows_gaming_input(void) ok( hr == S_FALSE, "put_Gain returned %#lx\n", hr ); state = 0xdeadbeef; hr = IForceFeedbackEffect_get_State( effect, &state ); - todo_wine ok( hr == S_OK, "get_State returned %#lx\n", hr ); - todo_wine ok( state == ForceFeedbackEffectState_Stopped, "get_State returned %#lx\n", hr ); hr = IForceFeedbackEffect_Start( effect ); todo_wine diff --git a/dlls/windows.gaming.input/force_feedback.c b/dlls/windows.gaming.input/force_feedback.c index 51d02171001..198268eac24 100644 --- a/dlls/windows.gaming.input/force_feedback.c +++ b/dlls/windows.gaming.input/force_feedback.c @@ -236,8 +236,25 @@ static HRESULT WINAPI effect_put_Gain( IForceFeedbackEffect *iface, DOUBLE value
static HRESULT WINAPI effect_get_State( IForceFeedbackEffect *iface, ForceFeedbackEffectState *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + struct effect *impl = impl_from_IForceFeedbackEffect( iface ); + DWORD status; + HRESULT hr; + + TRACE( "iface %p, value %p.\n", iface, value ); + + EnterCriticalSection( &impl->cs ); + if (!impl->effect) + *value = ForceFeedbackEffectState_Stopped; + else if (FAILED(hr = IDirectInputEffect_GetEffectStatus( impl->effect, &status ))) + *value = ForceFeedbackEffectState_Faulted; + else + { + if (status == DIEGES_PLAYING) *value = ForceFeedbackEffectState_Running; + else *value = ForceFeedbackEffectState_Stopped; + } + LeaveCriticalSection( &impl->cs ); + + return S_OK; }
static HRESULT WINAPI effect_Start( IForceFeedbackEffect *iface )