https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7016dd6d65ebc7357fc34c...
commit 7016dd6d65ebc7357fc34ccbf6288dd1869104eb Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Thu Mar 8 13:33:13 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Thu Mar 8 13:33:13 2018 +0100
[DINPUT] Sync with Wine Staging 3.3. CORE-14434 --- dll/directx/wine/dinput/CMakeLists.txt | 4 +- dll/directx/wine/dinput/config.c | 9 +++-- dll/directx/wine/dinput/data_formats.c | 11 +++--- dll/directx/wine/dinput/device.c | 24 +++++++++--- dll/directx/wine/dinput/device_private.h | 8 ++++ dll/directx/wine/dinput/dinput.rc | 5 +-- dll/directx/wine/dinput/dinput_main.c | 56 +++++++++++++++++++-------- dll/directx/wine/dinput/dinput_private.h | 30 +++----------- dll/directx/wine/dinput/joystick.c | 6 ++- dll/directx/wine/dinput/joystick_linux.c | 22 ++++++++++- dll/directx/wine/dinput/joystick_linuxinput.c | 23 ++++++++++- dll/directx/wine/dinput/joystick_osx.c | 22 +++++------ dll/directx/wine/dinput/joystick_private.h | 10 +++++ dll/directx/wine/dinput/keyboard.c | 16 ++++++++ dll/directx/wine/dinput/mouse.c | 19 +++++++++ dll/directx/wine/dinput/precomp.h | 24 ++++++++++++ dll/directx/wine/dinput/resource.h | 2 + media/doc/README.WINE | 2 +- 18 files changed, 215 insertions(+), 78 deletions(-)
diff --git a/dll/directx/wine/dinput/CMakeLists.txt b/dll/directx/wine/dinput/CMakeLists.txt index 7292e15d25..fc215eae90 100644 --- a/dll/directx/wine/dinput/CMakeLists.txt +++ b/dll/directx/wine/dinput/CMakeLists.txt @@ -14,7 +14,7 @@ list(APPEND SOURCE joystick_osx.c keyboard.c mouse.c - dinput_private.h) + precomp.h)
add_library(dinput SHARED ${SOURCE} @@ -27,5 +27,5 @@ add_dependencies(dinput_data_formats psdk) set_module_type(dinput win32dll) target_link_libraries(dinput dxguid uuid wine) add_importlibs(dinput comctl32 ole32 user32 advapi32 msvcrt kernel32 ntdll) -add_pch(dinput dinput_private.h SOURCE) +add_pch(dinput precomp.h SOURCE) add_cd_file(TARGET dinput DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/wine/dinput/config.c b/dll/directx/wine/dinput/config.c index 52a950a943..708f406375 100644 --- a/dll/directx/wine/dinput/config.c +++ b/dll/directx/wine/dinput/config.c @@ -16,11 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "dinput_private.h" - -#include <winuser.h> -#include <commctrl.h> +#define NONAMELESSUNION
+#include "wine/unicode.h" +#include "objbase.h" +#include "dinput_private.h" +#include "device_private.h" #include "resource.h"
typedef struct { diff --git a/dll/directx/wine/dinput/data_formats.c b/dll/directx/wine/dinput/data_formats.c index e1582c0e53..5fac7b7a08 100644 --- a/dll/directx/wine/dinput/data_formats.c +++ b/dll/directx/wine/dinput/data_formats.c @@ -16,15 +16,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H +#if 0 +#pragma makedep implib +#endif
#include <stdarg.h>
-#include <windef.h> -#include <winbase.h> -#include <dinput.h> +#include "windef.h" +#include "dinput.h"
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
diff --git a/dll/directx/wine/dinput/device.c b/dll/directx/wine/dinput/device.c index d9f95b913b..bb2a641719 100644 --- a/dll/directx/wine/dinput/device.c +++ b/dll/directx/wine/dinput/device.c @@ -24,9 +24,23 @@
It also contains all the helper functions. */ - +#include "config.h" + +#include <stdarg.h> +#include <string.h> +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winuser.h" +#include "winerror.h" +#include "dinput.h" +#include "device_private.h" #include "dinput_private.h"
+WINE_DEFAULT_DEBUG_CHANNEL(dinput); + static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) { return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface); @@ -976,9 +990,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface) EnterCriticalSection(&This->crit); res = This->acquired ? S_FALSE : DI_OK; This->acquired = 1; - if (res == DI_OK) - check_dinput_hooks(iface); LeaveCriticalSection(&This->crit); + if (res == DI_OK) + check_dinput_hooks(iface, TRUE);
return res; } @@ -1004,9 +1018,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface) EnterCriticalSection(&This->crit); res = !This->acquired ? DI_NOEFFECT : DI_OK; This->acquired = 0; - if (res == DI_OK) - check_dinput_hooks(iface); LeaveCriticalSection(&This->crit); + if (res == DI_OK) + check_dinput_hooks(iface, FALSE);
return res; } diff --git a/dll/directx/wine/dinput/device_private.h b/dll/directx/wine/dinput/device_private.h index bf227fd7f2..52bbec4490 100644 --- a/dll/directx/wine/dinput/device_private.h +++ b/dll/directx/wine/dinput/device_private.h @@ -20,6 +20,14 @@ #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H #define __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
+#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "dinput.h" +#include "wine/list.h" +#include "dinput_private.h" + typedef struct { int size; diff --git a/dll/directx/wine/dinput/dinput.rc b/dll/directx/wine/dinput/dinput.rc index 0c5dae0110..d2641f31ea 100644 --- a/dll/directx/wine/dinput/dinput.rc +++ b/dll/directx/wine/dinput/dinput.rc @@ -16,9 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <winuser.h> -#include <commctrl.h> - #include "resource.h"
1 WINE_REGISTRY dinput_classes.rgs @@ -30,7 +27,7 @@ #define WINE_PRODUCTVERSION 5,1,2600,881 #define WINE_PRODUCTVERSION_STR "5.1"
-#include <wine/wine_common_ver.rc> +#include "wine/wine_common_ver.rc"
#pragma makedep po
diff --git a/dll/directx/wine/dinput/dinput_main.c b/dll/directx/wine/dinput/dinput_main.c index 8b106808c5..69b9ff0a44 100644 --- a/dll/directx/wine/dinput/dinput_main.c +++ b/dll/directx/wine/dinput/dinput_main.c @@ -30,9 +30,28 @@ * - Fallout : works great in X and DGA mode */
+#include "config.h" +#include <assert.h> +#include <stdarg.h> +#include <string.h> + +#define COBJMACROS +#define NONAMELESSUNION + +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winerror.h" +#include "objbase.h" +#include "rpcproxy.h" +#include "initguid.h" #include "dinput_private.h" +#include "device_private.h" +#include "dinputd.h"
-#include <rpcproxy.h> +WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static const IDirectInput7AVtbl ddi7avt; static const IDirectInput7WVtbl ddi7wvt; @@ -1637,7 +1656,7 @@ static DWORD WINAPI hook_thread_proc(void *param)
/* Force creation of the message queue */ PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); - SetEvent(*(LPHANDLE)param); + SetEvent(param);
while (GetMessageW( &msg, 0, 0, 0 )) { @@ -1705,6 +1724,7 @@ static DWORD WINAPI hook_thread_proc(void *param) }
static DWORD hook_thread_id; +static HANDLE hook_thread_event;
static CRITICAL_SECTION_DEBUG dinput_critsect_debug = { @@ -1723,24 +1743,21 @@ static BOOL check_hook_thread(void) TRACE("IDirectInputs left: %d\n", list_count(&direct_input_list)); if (!list_empty(&direct_input_list) && !hook_thread) { - HANDLE event; - - event = CreateEventW(NULL, FALSE, FALSE, NULL); - hook_thread = CreateThread(NULL, 0, hook_thread_proc, &event, 0, &hook_thread_id); - if (event && hook_thread) - { - HANDLE handles[2]; - handles[0] = event; - handles[1] = hook_thread; - WaitForMultipleObjects(2, handles, FALSE, INFINITE); - } + hook_thread_event = CreateEventW(NULL, FALSE, FALSE, NULL); + hook_thread = CreateThread(NULL, 0, hook_thread_proc, hook_thread_event, 0, &hook_thread_id); LeaveCriticalSection(&dinput_hook_crit); - CloseHandle(event); } else if (list_empty(&direct_input_list) && hook_thread) { DWORD tid = hook_thread_id;
+ if (hook_thread_event) /* if thread is not started yet */ + { + WaitForSingleObject(hook_thread_event, INFINITE); + CloseHandle(hook_thread_event); + hook_thread_event = NULL; + } + hook_thread_id = 0; PostThreadMessageW(tid, WM_USER+0x10, 0, 0); LeaveCriticalSection(&dinput_hook_crit); @@ -1756,7 +1773,7 @@ static BOOL check_hook_thread(void) return hook_thread_id != 0; }
-void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface) +void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) { static HHOOK callwndproc_hook; static ULONG foreground_cnt; @@ -1766,7 +1783,7 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface)
if (dev->dwCoopLevel & DISCL_FOREGROUND) { - if (dev->acquired) + if (acquired) foreground_cnt++; else foreground_cnt--; @@ -1781,6 +1798,13 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface) callwndproc_hook = NULL; }
+ if (hook_thread_event) /* if thread is not started yet */ + { + WaitForSingleObject(hook_thread_event, INFINITE); + CloseHandle(hook_thread_event); + hook_thread_event = NULL; + } + PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, 0 );
LeaveCriticalSection(&dinput_hook_crit); diff --git a/dll/directx/wine/dinput/dinput_private.h b/dll/directx/wine/dinput/dinput_private.h index fb8c32ef17..3ed68f2264 100644 --- a/dll/directx/wine/dinput/dinput_private.h +++ b/dll/directx/wine/dinput/dinput_private.h @@ -19,29 +19,13 @@ #ifndef __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H #define __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H
-#include <wine/config.h> - #include <stdarg.h>
-#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#define COBJMACROS -#define NONAMELESSUNION - -#include <windef.h> -#include <winbase.h> -#include <winreg.h> -#include <winuser.h> -#include <dinput.h> -#include <dinputd.h> - -#include <wine/debug.h> -#include <wine/list.h> -#include <wine/unicode.h> - -WINE_DEFAULT_DEBUG_CHANNEL(dinput); +#include "windef.h" +#include "winbase.h" +#include "dinput.h" +#include "dinputd.h" +#include "wine/list.h"
/* Implementation specification */ typedef struct IDirectInputImpl IDirectInputImpl; @@ -85,7 +69,7 @@ extern const struct dinput_device joystick_linux_device DECLSPEC_HIDDEN; extern const struct dinput_device joystick_linuxinput_device DECLSPEC_HIDDEN; extern const struct dinput_device joystick_osx_device DECLSPEC_HIDDEN;
-extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W) DECLSPEC_HIDDEN; +extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN; extern void check_dinput_events(void) DECLSPEC_HIDDEN; typedef int (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);
@@ -102,6 +86,4 @@ extern WCHAR* get_mapping_path(const WCHAR *device, const WCHAR *username) DECLS #define DIMOUSE_MASK 0x82000000 #define DIGENRE_ANY 0xFF000000
-#include "device_private.h" - #endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */ diff --git a/dll/directx/wine/dinput/joystick.c b/dll/directx/wine/dinput/joystick.c index ef21faf809..45c361809e 100644 --- a/dll/directx/wine/dinput/joystick.c +++ b/dll/directx/wine/dinput/joystick.c @@ -26,11 +26,13 @@ * force feedback */
-#include "dinput_private.h" - #include <stdio.h>
#include "joystick_private.h" +#include "wine/debug.h" +#include "winreg.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static inline JoystickGenericImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) { diff --git a/dll/directx/wine/dinput/joystick_linux.c b/dll/directx/wine/dinput/joystick_linux.c index 673fb1b19e..963e62f017 100644 --- a/dll/directx/wine/dinput/joystick_linux.c +++ b/dll/directx/wine/dinput/joystick_linux.c @@ -25,17 +25,24 @@ * force feedback */
-#include "dinput_private.h" +#include "config.h" +#include "wine/port.h"
+#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include <time.h> #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #ifdef HAVE_SYS_TIME_H # include <sys/time.h> #endif +#include <fcntl.h> #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif +#include <errno.h> #ifdef HAVE_LINUX_IOCTL_H # include <linux/ioctl.h> #endif @@ -47,8 +54,21 @@ # include <sys/poll.h> #endif
+#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "dinput.h" + +#include "dinput_private.h" +#include "device_private.h" +#include "joystick_private.h" + #ifdef HAVE_LINUX_22_JOYSTICK_API
+WINE_DEFAULT_DEBUG_CHANNEL(dinput); + #define JOYDEV_NEW "/dev/input/js" #define JOYDEV_OLD "/dev/js" #define JOYDEVDRIVER " (js)" diff --git a/dll/directx/wine/dinput/joystick_linuxinput.c b/dll/directx/wine/dinput/joystick_linuxinput.c index 2cd01e831a..910e755d3e 100644 --- a/dll/directx/wine/dinput/joystick_linuxinput.c +++ b/dll/directx/wine/dinput/joystick_linuxinput.c @@ -20,8 +20,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "dinput_private.h" - +#include "config.h" +#include "wine/port.h" + +#include <assert.h> +#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include <time.h> #ifdef HAVE_UNISTD_H # include <unistd.h> #endif @@ -44,10 +50,23 @@ # include <sys/poll.h> #endif
+#include "wine/debug.h" +#include "wine/unicode.h" +#include "wine/list.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winreg.h" +#include "dinput.h" + +#include "dinput_private.h" #include "device_private.h" +#include "joystick_private.h"
#ifdef HAS_PROPER_HEADER
+WINE_DEFAULT_DEBUG_CHANNEL(dinput); + #define EVDEVPREFIX "/dev/input/event" #define EVDEVDRIVER " (event)"
diff --git a/dll/directx/wine/dinput/joystick_osx.c b/dll/directx/wine/dinput/joystick_osx.c index 67b1d63320..b0dcdd99d5 100644 --- a/dll/directx/wine/dinput/joystick_osx.c +++ b/dll/directx/wine/dinput/joystick_osx.c @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <config.h> -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h"
#if defined(HAVE_IOKIT_HID_IOHIDLIB_H) #define DWORD UInt32 @@ -79,17 +79,17 @@ #undef E_PENDING #endif /* HAVE_IOKIT_HID_IOHIDLIB_H */
-//#include "wine/debug.h" -//#include "wine/unicode.h" -//#include "windef.h" -//#include "winbase.h" -//#include "winerror.h" -//#include "winreg.h" -//#include "dinput.h" +#include "wine/debug.h" +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winreg.h" +#include "dinput.h"
#include "dinput_private.h" -//#include "device_private.h" -//#include "joystick_private.h" +#include "device_private.h" +#include "joystick_private.h"
#ifdef HAVE_IOHIDMANAGERCREATE
diff --git a/dll/directx/wine/dinput/joystick_private.h b/dll/directx/wine/dinput/joystick_private.h index 3e24dee5de..e758cacf6d 100644 --- a/dll/directx/wine/dinput/joystick_private.h +++ b/dll/directx/wine/dinput/joystick_private.h @@ -19,6 +19,16 @@ #ifndef __WINE_DLLS_DINPUT_JOYSTICK_PRIVATE_H #define __WINE_DLLS_DINPUT_JOYSTICK_PRIVATE_H
+#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "dinput.h" +#include "wine/list.h" +#include "wine/unicode.h" +#include "dinput_private.h" +#include "device_private.h" + /* Number of objects in the default data format */ #define MAX_PROPS 164 struct JoystickGenericImpl; diff --git a/dll/directx/wine/dinput/keyboard.c b/dll/directx/wine/dinput/keyboard.c index ec7a58ade7..4c3c38e7fc 100644 --- a/dll/directx/wine/dinput/keyboard.c +++ b/dll/directx/wine/dinput/keyboard.c @@ -20,7 +20,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include "config.h" +#include "wine/port.h" + +#include <stdarg.h> +#include <string.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winerror.h" +#include "dinput.h" + #include "dinput_private.h" +#include "device_private.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
diff --git a/dll/directx/wine/dinput/mouse.c b/dll/directx/wine/dinput/mouse.c index bcf9e13be5..eaec6b17dc 100644 --- a/dll/directx/wine/dinput/mouse.c +++ b/dll/directx/wine/dinput/mouse.c @@ -19,7 +19,26 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include "config.h" +#include "wine/port.h" + +#include <stdarg.h> +#include <string.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "winreg.h" +#include "dinput.h" + #include "dinput_private.h" +#include "device_private.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dinput);
/* Wine mouse driver object instances */ #define WINE_MOUSE_X_AXIS_INSTANCE 0 diff --git a/dll/directx/wine/dinput/precomp.h b/dll/directx/wine/dinput/precomp.h new file mode 100644 index 0000000000..9504beb696 --- /dev/null +++ b/dll/directx/wine/dinput/precomp.h @@ -0,0 +1,24 @@ + +#ifndef __WINE_DINPUT_PRECOMP_H +#define __WINE_DINPUT_PRECOMP_H + +#include <wine/config.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS +#define NONAMELESSUNION + +#include "dinput_private.h" + +#include <winreg.h> +#include <winuser.h> + +#include <wine/debug.h> +#include <wine/unicode.h> + +#include "device_private.h" + +#endif /* !__WINE_DINPUT_PRECOMP_H */ diff --git a/dll/directx/wine/dinput/resource.h b/dll/directx/wine/dinput/resource.h index fa0376fa7e..1f28fc51ef 100644 --- a/dll/directx/wine/dinput/resource.h +++ b/dll/directx/wine/dinput/resource.h @@ -18,6 +18,8 @@
#pragma once
+#include "shlobj.h" + #define IDD_CONFIGUREDEVICES 1
#define IDC_DEVICETEXT 20 diff --git a/media/doc/README.WINE b/media/doc/README.WINE index f41e4884d8..ef1c4aca21 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -30,7 +30,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-3.3 reactos/dll/directx/wine/d3dxof # Synced to WineStaging-3.3 reactos/dll/directx/wine/ddraw # Synced to WineStaging-3.3 reactos/dll/directx/wine/devenum # Synced to WineStaging-3.3 -reactos/dll/directx/wine/dinput # Synced to Wine-3.0 +reactos/dll/directx/wine/dinput # Synced to WineStaging-3.3 reactos/dll/directx/wine/dinput8 # Synced to WineStaging-2.9 reactos/dll/directx/wine/dmusic # Synced to WineStaging-2.9 reactos/dll/directx/wine/dplay # Synced to WineStaging-2.9