[DINPUT] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-08 13:33:13 +01:00
parent d9b4957fdd
commit 7016dd6d65
18 changed files with 214 additions and 77 deletions

View file

@ -14,7 +14,7 @@ list(APPEND SOURCE
joystick_osx.c joystick_osx.c
keyboard.c keyboard.c
mouse.c mouse.c
dinput_private.h) precomp.h)
add_library(dinput SHARED add_library(dinput SHARED
${SOURCE} ${SOURCE}
@ -27,5 +27,5 @@ add_dependencies(dinput_data_formats psdk)
set_module_type(dinput win32dll) set_module_type(dinput win32dll)
target_link_libraries(dinput dxguid uuid wine) target_link_libraries(dinput dxguid uuid wine)
add_importlibs(dinput comctl32 ole32 user32 advapi32 msvcrt kernel32 ntdll) 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) add_cd_file(TARGET dinput DESTINATION reactos/system32 FOR all)

View file

@ -16,11 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define NONAMELESSUNION
#include "wine/unicode.h"
#include "objbase.h"
#include "dinput_private.h" #include "dinput_private.h"
#include "device_private.h"
#include <winuser.h>
#include <commctrl.h>
#include "resource.h" #include "resource.h"
typedef struct { typedef struct {

View file

@ -16,15 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define WIN32_NO_STATUS #if 0
#define _INC_WINDOWS #pragma makedep implib
#define COM_NO_WINDOWS_H #endif
#include <stdarg.h> #include <stdarg.h>
#include <windef.h> #include "windef.h"
#include <winbase.h> #include "dinput.h"
#include <dinput.h>
#define numObjects(x) (sizeof(x) / sizeof(x[0])) #define numObjects(x) (sizeof(x) / sizeof(x[0]))

View file

@ -24,9 +24,23 @@
It also contains all the helper functions. 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" #include "dinput_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface) static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
{ {
return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface); return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface);
@ -976,9 +990,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
EnterCriticalSection(&This->crit); EnterCriticalSection(&This->crit);
res = This->acquired ? S_FALSE : DI_OK; res = This->acquired ? S_FALSE : DI_OK;
This->acquired = 1; This->acquired = 1;
if (res == DI_OK)
check_dinput_hooks(iface);
LeaveCriticalSection(&This->crit); LeaveCriticalSection(&This->crit);
if (res == DI_OK)
check_dinput_hooks(iface, TRUE);
return res; return res;
} }
@ -1004,9 +1018,9 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
EnterCriticalSection(&This->crit); EnterCriticalSection(&This->crit);
res = !This->acquired ? DI_NOEFFECT : DI_OK; res = !This->acquired ? DI_NOEFFECT : DI_OK;
This->acquired = 0; This->acquired = 0;
if (res == DI_OK)
check_dinput_hooks(iface);
LeaveCriticalSection(&This->crit); LeaveCriticalSection(&This->crit);
if (res == DI_OK)
check_dinput_hooks(iface, FALSE);
return res; return res;
} }

View file

@ -20,6 +20,14 @@
#ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H #ifndef __WINE_DLLS_DINPUT_DINPUTDEVICE_PRIVATE_H
#define __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 typedef struct
{ {
int size; int size;

View file

@ -16,9 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <winuser.h>
#include <commctrl.h>
#include "resource.h" #include "resource.h"
1 WINE_REGISTRY dinput_classes.rgs 1 WINE_REGISTRY dinput_classes.rgs
@ -30,7 +27,7 @@
#define WINE_PRODUCTVERSION 5,1,2600,881 #define WINE_PRODUCTVERSION 5,1,2600,881
#define WINE_PRODUCTVERSION_STR "5.1" #define WINE_PRODUCTVERSION_STR "5.1"
#include <wine/wine_common_ver.rc> #include "wine/wine_common_ver.rc"
#pragma makedep po #pragma makedep po

View file

@ -30,9 +30,28 @@
* - Fallout : works great in X and DGA mode * - Fallout : works great in X and DGA mode
*/ */
#include "dinput_private.h" #include "config.h"
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include <rpcproxy.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"
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static const IDirectInput7AVtbl ddi7avt; static const IDirectInput7AVtbl ddi7avt;
static const IDirectInput7WVtbl ddi7wvt; static const IDirectInput7WVtbl ddi7wvt;
@ -1637,7 +1656,7 @@ static DWORD WINAPI hook_thread_proc(void *param)
/* Force creation of the message queue */ /* Force creation of the message queue */
PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE );
SetEvent(*(LPHANDLE)param); SetEvent(param);
while (GetMessageW( &msg, 0, 0, 0 )) while (GetMessageW( &msg, 0, 0, 0 ))
{ {
@ -1705,6 +1724,7 @@ static DWORD WINAPI hook_thread_proc(void *param)
} }
static DWORD hook_thread_id; static DWORD hook_thread_id;
static HANDLE hook_thread_event;
static CRITICAL_SECTION_DEBUG dinput_critsect_debug = 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)); TRACE("IDirectInputs left: %d\n", list_count(&direct_input_list));
if (!list_empty(&direct_input_list) && !hook_thread) if (!list_empty(&direct_input_list) && !hook_thread)
{ {
HANDLE event; hook_thread_event = CreateEventW(NULL, FALSE, FALSE, NULL);
hook_thread = CreateThread(NULL, 0, hook_thread_proc, hook_thread_event, 0, &hook_thread_id);
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);
}
LeaveCriticalSection(&dinput_hook_crit); LeaveCriticalSection(&dinput_hook_crit);
CloseHandle(event);
} }
else if (list_empty(&direct_input_list) && hook_thread) else if (list_empty(&direct_input_list) && hook_thread)
{ {
DWORD tid = hook_thread_id; 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; hook_thread_id = 0;
PostThreadMessageW(tid, WM_USER+0x10, 0, 0); PostThreadMessageW(tid, WM_USER+0x10, 0, 0);
LeaveCriticalSection(&dinput_hook_crit); LeaveCriticalSection(&dinput_hook_crit);
@ -1756,7 +1773,7 @@ static BOOL check_hook_thread(void)
return hook_thread_id != 0; return hook_thread_id != 0;
} }
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface) void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
{ {
static HHOOK callwndproc_hook; static HHOOK callwndproc_hook;
static ULONG foreground_cnt; static ULONG foreground_cnt;
@ -1766,7 +1783,7 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface)
if (dev->dwCoopLevel & DISCL_FOREGROUND) if (dev->dwCoopLevel & DISCL_FOREGROUND)
{ {
if (dev->acquired) if (acquired)
foreground_cnt++; foreground_cnt++;
else else
foreground_cnt--; foreground_cnt--;
@ -1781,6 +1798,13 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface)
callwndproc_hook = NULL; 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 ); PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, 0 );
LeaveCriticalSection(&dinput_hook_crit); LeaveCriticalSection(&dinput_hook_crit);

View file

@ -19,29 +19,13 @@
#ifndef __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H #ifndef __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H
#define __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H #define __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H
#include <wine/config.h>
#include <stdarg.h> #include <stdarg.h>
#define WIN32_NO_STATUS #include "windef.h"
#define _INC_WINDOWS #include "winbase.h"
#define COM_NO_WINDOWS_H #include "dinput.h"
#include "dinputd.h"
#define COBJMACROS #include "wine/list.h"
#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);
/* Implementation specification */ /* Implementation specification */
typedef struct IDirectInputImpl IDirectInputImpl; 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_linuxinput_device DECLSPEC_HIDDEN;
extern const struct dinput_device joystick_osx_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; extern void check_dinput_events(void) DECLSPEC_HIDDEN;
typedef int (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM); 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 DIMOUSE_MASK 0x82000000
#define DIGENRE_ANY 0xFF000000 #define DIGENRE_ANY 0xFF000000
#include "device_private.h"
#endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */ #endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */

View file

@ -26,11 +26,13 @@
* force feedback * force feedback
*/ */
#include "dinput_private.h"
#include <stdio.h> #include <stdio.h>
#include "joystick_private.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) static inline JoystickGenericImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
{ {

View file

@ -25,17 +25,24 @@
* force feedback * 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 #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <fcntl.h>
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h> # include <sys/ioctl.h>
#endif #endif
#include <errno.h>
#ifdef HAVE_LINUX_IOCTL_H #ifdef HAVE_LINUX_IOCTL_H
# include <linux/ioctl.h> # include <linux/ioctl.h>
#endif #endif
@ -47,8 +54,21 @@
# include <sys/poll.h> # include <sys/poll.h>
#endif #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 #ifdef HAVE_LINUX_22_JOYSTICK_API
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#define JOYDEV_NEW "/dev/input/js" #define JOYDEV_NEW "/dev/input/js"
#define JOYDEV_OLD "/dev/js" #define JOYDEV_OLD "/dev/js"
#define JOYDEVDRIVER " (js)" #define JOYDEVDRIVER " (js)"

View file

@ -20,8 +20,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 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 #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -44,10 +50,23 @@
# include <sys/poll.h> # include <sys/poll.h>
#endif #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 "device_private.h"
#include "joystick_private.h"
#ifdef HAS_PROPER_HEADER #ifdef HAS_PROPER_HEADER
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#define EVDEVPREFIX "/dev/input/event" #define EVDEVPREFIX "/dev/input/event"
#define EVDEVDRIVER " (event)" #define EVDEVDRIVER " (event)"

View file

@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <config.h> #include "config.h"
//#include "wine/port.h" #include "wine/port.h"
#if defined(HAVE_IOKIT_HID_IOHIDLIB_H) #if defined(HAVE_IOKIT_HID_IOHIDLIB_H)
#define DWORD UInt32 #define DWORD UInt32
@ -79,17 +79,17 @@
#undef E_PENDING #undef E_PENDING
#endif /* HAVE_IOKIT_HID_IOHIDLIB_H */ #endif /* HAVE_IOKIT_HID_IOHIDLIB_H */
//#include "wine/debug.h" #include "wine/debug.h"
//#include "wine/unicode.h" #include "wine/unicode.h"
//#include "windef.h" #include "windef.h"
//#include "winbase.h" #include "winbase.h"
//#include "winerror.h" #include "winerror.h"
//#include "winreg.h" #include "winreg.h"
//#include "dinput.h" #include "dinput.h"
#include "dinput_private.h" #include "dinput_private.h"
//#include "device_private.h" #include "device_private.h"
//#include "joystick_private.h" #include "joystick_private.h"
#ifdef HAVE_IOHIDMANAGERCREATE #ifdef HAVE_IOHIDMANAGERCREATE

View file

@ -19,6 +19,16 @@
#ifndef __WINE_DLLS_DINPUT_JOYSTICK_PRIVATE_H #ifndef __WINE_DLLS_DINPUT_JOYSTICK_PRIVATE_H
#define __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 */ /* Number of objects in the default data format */
#define MAX_PROPS 164 #define MAX_PROPS 164
struct JoystickGenericImpl; struct JoystickGenericImpl;

View file

@ -20,7 +20,23 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 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 "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 #define WINE_DINPUT_KEYBOARD_MAX_KEYS 256

View file

@ -19,7 +19,26 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 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 "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 */ /* Wine mouse driver object instances */
#define WINE_MOUSE_X_AXIS_INSTANCE 0 #define WINE_MOUSE_X_AXIS_INSTANCE 0

View file

@ -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 */

View file

@ -18,6 +18,8 @@
#pragma once #pragma once
#include "shlobj.h"
#define IDD_CONFIGUREDEVICES 1 #define IDD_CONFIGUREDEVICES 1
#define IDC_DEVICETEXT 20 #define IDC_DEVICETEXT 20

View file

@ -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/d3dxof # Synced to WineStaging-3.3
reactos/dll/directx/wine/ddraw # 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/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/dinput8 # Synced to WineStaging-2.9
reactos/dll/directx/wine/dmusic # 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 reactos/dll/directx/wine/dplay # Synced to WineStaging-2.9