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

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

parent c578aa7c
......@@ -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 );
......
......@@ -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 )
......
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