Rémi Bernon : windows.gaming.input: Implement IForceFeedbackMotor_(Pause|Resume|StopAll)Effects.
Alexandre Julliard
julliard at winehq.org
Mon Apr 25 16:30:33 CDT 2022
Module: wine
Branch: master
Commit: 78261e08bfd437145f5658c409ceeb61fdb68cdf
URL: https://source.winehq.org/git/wine.git/?a=commit;h=78261e08bfd437145f5658c409ceeb61fdb68cdf
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Apr 25 14:56:20 2022 +0200
windows.gaming.input: Implement IForceFeedbackMotor_(Pause|Resume|StopAll)Effects.
And IForceFeedbackMotor_get_AreEffectsPaused.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/tests/force_feedback.c | 8 -------
dlls/windows.gaming.input/force_feedback.c | 34 +++++++++++++++++++++++-------
2 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index f9538f5f56d..6d8701a8c24 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -5070,7 +5070,6 @@ static void test_windows_gaming_input(void)
.report_id = 1,
.report_len = 2,
.report_buf = {1, 0x02},
- .todo = TRUE,
};
static struct hid_expect expect_resume =
{
@@ -5078,7 +5077,6 @@ static void test_windows_gaming_input(void)
.report_id = 1,
.report_len = 2,
.report_buf = {1, 0x03},
- .todo = TRUE,
};
static struct hid_expect expect_stop =
{
@@ -5086,7 +5084,6 @@ static void test_windows_gaming_input(void)
.report_id = 1,
.report_len = 2,
.report_buf = {1, 0x06},
- .todo = TRUE,
};
static struct hid_expect expect_disable =
{
@@ -5298,9 +5295,7 @@ static void test_windows_gaming_input(void)
paused = TRUE;
hr = IForceFeedbackMotor_get_AreEffectsPaused( motor, &paused );
- todo_wine
ok( hr == S_OK, "get_AreEffectsPaused returned %#lx\n", hr );
- todo_wine
ok( paused == FALSE, "got paused %u\n", paused );
gain = 12345.6;
@@ -5328,15 +5323,12 @@ static void test_windows_gaming_input(void)
set_hid_expect( file, &expect_pause, sizeof(expect_pause) );
hr = IForceFeedbackMotor_PauseAllEffects( motor );
- todo_wine
ok( hr == S_OK, "PauseAllEffects returned %#lx\n", hr );
set_hid_expect( file, &expect_resume, sizeof(expect_resume) );
hr = IForceFeedbackMotor_ResumeAllEffects( motor );
- todo_wine
ok( hr == S_OK, "ResumeAllEffects returned %#lx\n", hr );
set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
hr = IForceFeedbackMotor_StopAllEffects( motor );
- todo_wine
ok( hr == S_OK, "StopAllEffects returned %#lx\n", hr );
set_hid_expect( file, NULL, 0 );
diff --git a/dlls/windows.gaming.input/force_feedback.c b/dlls/windows.gaming.input/force_feedback.c
index 6d4e533bc77..fad5ade402c 100644
--- a/dlls/windows.gaming.input/force_feedback.c
+++ b/dlls/windows.gaming.input/force_feedback.c
@@ -105,8 +105,17 @@ static HRESULT WINAPI motor_GetTrustLevel( IForceFeedbackMotor *iface, TrustLeve
static HRESULT WINAPI motor_get_AreEffectsPaused( IForceFeedbackMotor *iface, BOOLEAN *value )
{
- FIXME( "iface %p, value %p stub!\n", iface, value );
- return E_NOTIMPL;
+ struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+ DWORD state;
+ HRESULT hr;
+
+ TRACE( "iface %p, value %p.\n", iface, value );
+
+ if (FAILED(hr = IDirectInputDevice8_GetForceFeedbackState( impl->device, &state )))
+ return hr;
+
+ *value = (state & DIGFFS_PAUSED);
+ return S_OK;
}
static HRESULT WINAPI motor_get_MasterGain( IForceFeedbackMotor *iface, double *value )
@@ -171,20 +180,29 @@ static HRESULT WINAPI motor_LoadEffectAsync( IForceFeedbackMotor *iface, IForceF
static HRESULT WINAPI motor_PauseAllEffects( IForceFeedbackMotor *iface )
{
- FIXME( "iface %p stub!\n", iface );
- return E_NOTIMPL;
+ struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+
+ TRACE( "iface %p.\n", iface );
+
+ return IDirectInputDevice8_SendForceFeedbackCommand( impl->device, DISFFC_PAUSE );
}
static HRESULT WINAPI motor_ResumeAllEffects( IForceFeedbackMotor *iface )
{
- FIXME( "iface %p stub!\n", iface );
- return E_NOTIMPL;
+ struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+
+ TRACE( "iface %p.\n", iface );
+
+ return IDirectInputDevice8_SendForceFeedbackCommand( impl->device, DISFFC_CONTINUE );
}
static HRESULT WINAPI motor_StopAllEffects( IForceFeedbackMotor *iface )
{
- FIXME( "iface %p stub!\n", iface );
- return E_NOTIMPL;
+ struct motor *impl = impl_from_IForceFeedbackMotor( iface );
+
+ TRACE( "iface %p.\n", iface );
+
+ return IDirectInputDevice8_SendForceFeedbackCommand( impl->device, DISFFC_STOPALL );
}
static HRESULT WINAPI motor_TryDisableAsync( IForceFeedbackMotor *iface, IAsyncOperation_boolean **async_op )
More information about the wine-cvs
mailing list