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

dinput: Implement HID joystick IDirectInputEffect_Initialize.

parent 20b55e87
......@@ -144,6 +144,7 @@ struct hid_joystick_effect
{
IDirectInputEffect IDirectInputEffect_iface;
LONG ref;
USAGE type;
struct list entry;
struct hid_joystick *joystick;
......@@ -2061,7 +2062,29 @@ static ULONG WINAPI hid_joystick_effect_Release( IDirectInputEffect *iface )
static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface, HINSTANCE inst,
DWORD version, REFGUID guid )
{
FIXME( "iface %p, inst %p, version %u, guid %s stub!\n", iface, inst, version, debugstr_guid( guid ) );
struct hid_joystick_effect *impl = impl_from_IDirectInputEffect( iface );
struct hid_joystick *joystick = impl->joystick;
ULONG report_len = joystick->caps.OutputReportByteLength;
NTSTATUS status;
ULONG count;
USAGE type;
TRACE( "iface %p, inst %p, version %u, guid %s\n", iface, inst, version, debugstr_guid( guid ) );
if (!inst) return DIERR_INVALIDPARAM;
if (!guid) return E_POINTER;
if (!(type = effect_guid_to_usage( guid ))) return DIERR_DEVICENOTREG;
status = HidP_InitializeReportForID( HidP_Output, joystick->pid_effect_update.id,
joystick->preparsed, impl->effect_update_buf, report_len );
if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG;
count = 1;
status = HidP_SetUsages( HidP_Output, HID_USAGE_PAGE_PID, joystick->pid_effect_update.type_coll,
&type, &count, joystick->preparsed, impl->effect_update_buf, report_len );
if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG;
impl->type = type;
return DI_OK;
}
......
......@@ -5159,13 +5159,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL );
ok( hr == E_POINTER, "CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL );
todo_wine
ok( hr == E_POINTER, "CreateEffect returned %#x\n", hr );
if (hr == DI_OK) IDirectInputEffect_Release( effect );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL );
todo_wine
ok( hr == DIERR_DEVICENOTREG, "CreateEffect returned %#x\n", hr );
if (hr == DI_OK) IDirectInputEffect_Release( effect );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
......@@ -5179,17 +5175,14 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count );
hr = IDirectInputEffect_Initialize( effect, NULL, DIRECTINPUT_VERSION, &GUID_Sine );
todo_wine
ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#x\n", hr );
hr = IDirectInputEffect_Initialize( effect, instance, 0, &GUID_Sine );
todo_wine
ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#x\n", hr );
hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, NULL );
todo_wine
ok( hr == E_POINTER, "Initialize returned %#x\n", hr );
hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, &GUID_NULL );
todo_wine
ok( hr == DIERR_DEVICENOTREG, "Initialize returned %#x\n", hr );
hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, &GUID_Sine );
ok( hr == DI_OK, "Initialize returned %#x\n", hr );
......
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