Hi all, With this patch, Tribes1 now likes our DInput driver. Lionel (who waits for his beer when he will visit Sweden :-) ) Changelog: Implement EnumObjects for the keyboard device -- Lionel Ulmer - http://www.bbrox.org/
--- ../wine_base/dlls/dinput/device.c Sun Feb 2 12:44:55 2003 +++ dlls/dinput/device.c Mon Feb 10 23:13:41 2003 @@ -102,8 +102,8 @@ void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) { if (TRACE_ON(dinput)) { - DPRINTF(" - enumerating : 0x%08lx - %2ld - 0x%08lx - %s\n", - ddoi->guidType.Data1, ddoi->dwOfs, ddoi->dwType, ddoi->tszName); + DPRINTF(" - enumerating : %s - %2ld - 0x%08lx - %s\n", + debugstr_guid(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName); } } --- ../wine_base/dlls/dinput/keyboard/main.c Sat Feb 1 18:04:44 2003 +++ dlls/dinput/keyboard/main.c Mon Feb 10 23:16:39 2003 @@ -166,7 +166,7 @@ EnterCriticalSection(&keyboard_crit); if (!keyboard_users++) - keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 ); + keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 ); LeaveCriticalSection(&keyboard_crit); return newDevice; @@ -326,6 +326,40 @@ return ret; } +static HRESULT WINAPI SysKeyboardAImpl_EnumObjects( + LPDIRECTINPUTDEVICE8A iface, + LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback, + LPVOID lpvRef, + DWORD dwFlags) +{ + ICOM_THIS(SysKeyboardAImpl,iface); + DIDEVICEOBJECTINSTANCEA ddoi; + int i; + + TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags); + if (TRACE_ON(dinput)) { + DPRINTF(" - flags = "); + _dump_EnumObjects_flags(dwFlags); + DPRINTF("\n"); + } + + /* Only the fields till dwFFMaxForce are relevant */ + memset(&ddoi, 0, sizeof(ddoi)); + ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); + + for (i = 0; i < 256; i++) { + /* Report 255 keys :-) */ + ddoi.guidType = GUID_Key; + ddoi.dwOfs = i; + ddoi.dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_BUTTON; + strcpy(ddoi.tszName, "a"); /* This should be better handled :-/ */ + _dump_OBJECTINSTANCEA(&ddoi); + if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK; + } + + return DI_OK; +} + static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface); static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) @@ -412,7 +446,7 @@ lpDIDevCaps->dwFlags = DIDC_ATTACHED; lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD; lpDIDevCaps->dwAxes = 0; - lpDIDevCaps->dwButtons = 0; + lpDIDevCaps->dwButtons = 256; lpDIDevCaps->dwPOVs = 0; lpDIDevCaps->dwFFSamplePeriod = 0; lpDIDevCaps->dwFFMinTimeResolution = 0; @@ -434,7 +468,7 @@ IDirectInputDevice2AImpl_AddRef, SysKeyboardAImpl_Release, SysKeyboardAImpl_GetCapabilities, - IDirectInputDevice2AImpl_EnumObjects, + SysKeyboardAImpl_EnumObjects, IDirectInputDevice2AImpl_GetProperty, SysKeyboardAImpl_SetProperty, SysKeyboardAImpl_Acquire, --- ../wine_base/dlls/dinput/mouse/main.c Sun Feb 2 12:44:55 2003 +++ dlls/dinput/mouse/main.c Mon Feb 10 23:08:33 2003 @@ -874,6 +874,7 @@ } /* Only the fields till dwFFMaxForce are relevant */ + memset(&ddoi, 0, sizeof(ddoi)); ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); /* In a mouse, we have : two relative axis and three buttons */