windows.gaming.input: Implement IForceFeedbackEffect_(get|put)_Gain.

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-05-12 15:58:05 +02:00 committed by Alexandre Julliard
parent c578aa7cd3
commit bc6df7ca57
2 changed files with 24 additions and 11 deletions

View File

@ -5572,7 +5572,7 @@ static void test_windows_gaming_input(void)
.code = IOCTL_HID_WRITE_REPORT,
.report_id = 3,
.report_len = 18,
.report_buf = {3,0x01,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5a,0x00,0x00,0x00},
.report_buf = {3,0x01,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x7f,0x5a,0x00,0x00,0x00},
.wine_only = TRUE,
.todo = TRUE,
},
@ -6061,12 +6061,9 @@ static void test_windows_gaming_input(void)
gain = 12345.6;
hr = IForceFeedbackEffect_get_Gain( effect, &gain );
todo_wine
ok( hr == S_OK, "get_Gain returned %#lx\n", hr );
todo_wine
ok( gain == 1.0, "got gain %f\n", gain );
hr = IForceFeedbackEffect_put_Gain( effect, 0.5 );
todo_wine
ok( hr == S_FALSE, "put_Gain returned %#lx\n", hr );
state = 0xdeadbeef;
hr = IForceFeedbackEffect_get_State( effect, &state );
@ -6317,12 +6314,9 @@ static void test_windows_gaming_input(void)
gain = 12345.6;
hr = IForceFeedbackEffect_get_Gain( effect, &gain );
todo_wine
ok( hr == S_OK, "get_Gain returned %#lx\n", hr );
todo_wine
ok( gain == 1.0, "get_MasterGain returned %f\n", gain );
hr = IForceFeedbackEffect_put_Gain( effect, 0.5 );
todo_wine
ok( hr == S_FALSE, "put_Gain returned %#lx\n", hr );
state = 0xdeadbeef;
hr = IForceFeedbackEffect_get_State( effect, &state );

View File

@ -19,6 +19,8 @@
#include "private.h"
#include "math.h"
#include "ddk/hidsdi.h"
#include "dinput.h"
#include "hidusage.h"
@ -117,14 +119,31 @@ DEFINE_IINSPECTABLE_OUTER( effect, IForceFeedbackEffect, struct effect, IInspect
static HRESULT WINAPI effect_get_Gain( IForceFeedbackEffect *iface, DOUBLE *value )
{
FIXME( "iface %p, value %p stub!\n", iface, value );
return E_NOTIMPL;
struct effect *impl = impl_from_IForceFeedbackEffect( iface );
TRACE( "iface %p, value %p.\n", iface, value );
EnterCriticalSection( &impl->cs );
*value = impl->params.dwGain / 10000.;
LeaveCriticalSection( &impl->cs );
return S_OK;
}
static HRESULT WINAPI effect_put_Gain( IForceFeedbackEffect *iface, DOUBLE value )
{
FIXME( "iface %p, value %f stub!\n", iface, value );
return E_NOTIMPL;
struct effect *impl = impl_from_IForceFeedbackEffect( iface );
HRESULT hr;
TRACE( "iface %p, value %f.\n", iface, value );
EnterCriticalSection( &impl->cs );
impl->params.dwGain = round( value * 10000 );
if (!impl->effect) hr = S_FALSE;
else hr = IDirectInputEffect_SetParameters( impl->effect, &impl->params, DIEP_GAIN );
LeaveCriticalSection( &impl->cs );
return hr;
}
static HRESULT WINAPI effect_get_State( IForceFeedbackEffect *iface, ForceFeedbackEffectState *value )