1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

dinput: Load action map from registry before resetting guid.

This commit is contained in:
Rémi Bernon 2023-03-27 09:40:50 +02:00 committed by Alexandre Julliard
parent 2da8f5d2ac
commit 18b5f7956f

View file

@ -1812,7 +1812,6 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
DIACTIONW *action, *action_end;
DWORD i, username_len = MAX_PATH;
WCHAR username_buf[MAX_PATH];
BOOL load_success = FALSE;
BOOL *mapped;
TRACE( "iface %p, format %p, username %s, flags %#lx\n", iface, format,
@ -1840,12 +1839,7 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
{
if (!action->dwSemantic) return DIERR_INVALIDPARAM;
if (action->dwFlags & DIA_APPMAPPED) action->dwHow = DIAH_APPREQUESTED;
else if (action->dwFlags & DIA_APPNOMAP) continue;
else
{
action->dwHow = 0;
action->guidInstance = GUID_NULL;
}
else action->dwHow = 0;
}
/* Unless asked the contrary by these flags, try to load a previous mapping */
@ -1854,10 +1848,18 @@ static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface,
/* Retrieve logged user name if necessary */
if (username == NULL) GetUserNameW( username_buf, &username_len );
else lstrcpynW( username_buf, username, MAX_PATH );
load_success = load_mapping_settings( impl, format, username_buf );
load_mapping_settings( impl, format, username_buf );
}
action_end = format->rgoAction + format->dwNumActions;
for (action = format->rgoAction; action < action_end; action++)
{
if (action->dwHow == DIAH_APPREQUESTED || action->dwHow == DIAH_USERCONFIG) continue;
if (action->dwFlags & DIA_APPNOMAP) continue;
action->guidInstance = GUID_NULL;
action->dwHow = 0;
}
if (load_success) return DI_OK;
if (!(mapped = calloc( impl->device_format.dwNumObjs, sizeof(*mapped) ))) return DIERR_OUTOFMEMORY;
action_end = format->rgoAction + format->dwNumActions;