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

dinput: Allow action formats with no matching actions.

parent b1a95b96
......@@ -1964,8 +1964,8 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
};
WCHAR username_buf[MAX_PATH];
DWORD username_len = MAX_PATH;
int i, index, num_actions = 0;
unsigned int offset = 0;
int i, index;
HRESULT hr;
FIXME( "iface %p, format %p, username %s, flags %#lx stub!\n", iface, format,
......@@ -1973,14 +1973,7 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
if (!format) return DIERR_INVALIDPARAM;
/* Count the actions */
for (i = 0; i < format->dwNumActions; i++)
if (IsEqualGUID( &impl->guid, &format->rgoAction[i].guidInstance ))
num_actions++;
if (num_actions == 0) return DI_NOEFFECT;
if (!(data_format.rgodf = malloc( sizeof(DIOBJECTDATAFORMAT) * num_actions ))) return DIERR_OUTOFMEMORY;
if (!(data_format.rgodf = malloc( sizeof(DIOBJECTDATAFORMAT) * format->dwNumActions ))) return DIERR_OUTOFMEMORY;
data_format.dwDataSize = format->dwDataSize;
for (i = 0; i < format->dwNumActions; i++, offset += sizeof(ULONG))
......@@ -2026,6 +2019,9 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
LeaveCriticalSection( &impl->crit );
free( data_format.rgodf );
if (FAILED(hr)) return hr;
if (!data_format.dwNumObjs) return DI_NOEFFECT;
return hr;
}
......
......@@ -824,9 +824,7 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
memset( prop_username.wsz, 0, sizeof(prop_username.wsz) );
hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
todo_wine
ok( !wcscmp( prop_username.wsz, username ), "got username %s\n", debugstr_w(prop_username.wsz) );
hr = IDirectInputDevice8_SetActionMap( device, &voice_action_format, NULL, DIDSAM_DEFAULT );
......@@ -837,9 +835,7 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
memset( prop_username.wsz, 0, sizeof(prop_username.wsz) );
hr = IDirectInputDevice_GetProperty( device, DIPROP_USERNAME, &prop_username.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
todo_wine
ok( !wcscmp( prop_username.wsz, username ), "got username %s\n", debugstr_w(prop_username.wsz) );
......
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