Lucas Zawacki : dinput: BuildActionMap should not fail if mapping has no pre-stored settings.
Alexandre Julliard
julliard at winehq.org
Tue Aug 28 14:44:40 CDT 2012
Module: wine
Branch: master
Commit: d5e9cedaf5c598cf4411ffecb4fff7678f3832ef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d5e9cedaf5c598cf4411ffecb4fff7678f3832ef
Author: Lucas Zawacki <lfzawacki at gmail.com>
Date: Tue Aug 28 02:23:03 2012 -0300
dinput: BuildActionMap should not fail if mapping has no pre-stored settings.
---
dlls/dinput/device.c | 7 ++++---
dlls/dinput8/tests/device.c | 8 ++++----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 098efb7..b3875a8 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -674,7 +674,7 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT
HKEY hkey;
WCHAR *guid_str;
DIDEVICEINSTANCEW didev;
- int i;
+ int i, mapped = 0;
didev.dwSize = sizeof(didev);
IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
@@ -703,14 +703,15 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT
{
lpdiaf->rgoAction[i].dwObjID = id;
lpdiaf->rgoAction[i].guidInstance = didev.guidInstance;
- lpdiaf->rgoAction[i].dwHow = DIAH_USERCONFIG;
+ lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
+ mapped += 1;
}
}
RegCloseKey(hkey);
CoTaskMemFree(guid_str);
- return TRUE;
+ return mapped > 0;
}
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 2140388..c211594 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -447,13 +447,13 @@ static void test_save_settings(void)
hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0);
ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
- todo_wine ok (results[0] == af.rgoAction[0].dwObjID,
+ ok (results[0] == af.rgoAction[0].dwObjID,
"Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
- todo_wine ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
+ ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
- todo_wine ok (results[1] == af.rgoAction[1].dwObjID,
+ ok (results[1] == af.rgoAction[1].dwObjID,
"Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
- todo_wine ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
+ ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
af.guidActionMap = mapping_guid;
/* Hard case. Customized mapping, save, ask for previous map and read it back */
More information about the wine-cvs
mailing list