windows.gaming.input: Implement IForceFeedbackMotor_(get|put)_MasterGain.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-04-25 14:56:19 +02:00 committed by Alexandre Julliard
parent cd24005266
commit fec8aae236
2 changed files with 34 additions and 9 deletions

View File

@ -5063,7 +5063,6 @@ static void test_windows_gaming_input(void)
.report_id = 6,
.report_len = 2,
.report_buf = {6, 0x7f},
.todo = TRUE,
};
static struct hid_expect expect_pause =
{
@ -5306,15 +5305,12 @@ static void test_windows_gaming_input(void)
gain = 12345.6;
hr = IForceFeedbackMotor_get_MasterGain( motor, &gain );
todo_wine
ok( hr == S_OK, "get_MasterGain returned %#lx\n", hr );
todo_wine
ok( gain == 1.0, "got gain %f\n", gain );
set_hid_expect( file, &expect_set_gain, sizeof(expect_set_gain) );
hr = IForceFeedbackMotor_put_MasterGain( motor, 0.5 );
todo_wine
ok( hr == S_OK, "put_MasterGain returned %#lx\n", hr );
wait_hid_expect_( __FILE__, __LINE__, file, 100, TRUE ); /* device gain reports are written asynchronously */
wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
enabled = FALSE;
hr = IForceFeedbackMotor_get_IsEnabled( motor, &enabled );

View File

@ -111,14 +111,43 @@ static HRESULT WINAPI motor_get_AreEffectsPaused( IForceFeedbackMotor *iface, BO
static HRESULT WINAPI motor_get_MasterGain( IForceFeedbackMotor *iface, double *value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
struct motor *impl = impl_from_IForceFeedbackMotor( iface );
DIPROPDWORD gain =
{
.diph =
{
.dwSize = sizeof(DIPROPDWORD),
.dwHeaderSize = sizeof(DIPROPHEADER),
.dwHow = DIPH_DEVICE,
},
};
HRESULT hr;
TRACE( "iface %p, value %p.\n", iface, value );
if (FAILED(hr = IDirectInputDevice8_GetProperty( impl->device, DIPROP_FFGAIN, &gain.diph ))) *value = 1.;
else *value = gain.dwData / 10000.;
return hr;
}
static HRESULT WINAPI motor_put_MasterGain( IForceFeedbackMotor *iface, double value )
{
FIXME( "iface %p, value %#I64x stub!\n", iface, *(UINT64 *)&value );
return E_NOTIMPL;
struct motor *impl = impl_from_IForceFeedbackMotor( iface );
DIPROPDWORD gain =
{
.diph =
{
.dwSize = sizeof(DIPROPDWORD),
.dwHeaderSize = sizeof(DIPROPHEADER),
.dwHow = DIPH_DEVICE,
},
};
TRACE( "iface %p, value %f.\n", iface, value );
gain.dwData = 10000 * value;
return IDirectInputDevice8_SetProperty( impl->device, DIPROP_FFGAIN, &gain.diph );
}
static HRESULT WINAPI motor_get_IsEnabled( IForceFeedbackMotor *iface, BOOLEAN *value )