mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
[DINPUT] Sync with Wine 3.0. CORE-14225
This commit is contained in:
parent
56fc552f24
commit
0b35adc274
5 changed files with 28 additions and 27 deletions
|
@ -976,9 +976,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;
|
||||||
LeaveCriticalSection(&This->crit);
|
|
||||||
if (res == DI_OK)
|
if (res == DI_OK)
|
||||||
check_dinput_hooks(iface, TRUE);
|
check_dinput_hooks(iface);
|
||||||
|
LeaveCriticalSection(&This->crit);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -1004,9 +1004,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;
|
||||||
LeaveCriticalSection(&This->crit);
|
|
||||||
if (res == DI_OK)
|
if (res == DI_OK)
|
||||||
check_dinput_hooks(iface, FALSE);
|
check_dinput_hooks(iface);
|
||||||
|
LeaveCriticalSection(&This->crit);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1637,7 +1637,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(param);
|
SetEvent(*(LPHANDLE)param);
|
||||||
|
|
||||||
while (GetMessageW( &msg, 0, 0, 0 ))
|
while (GetMessageW( &msg, 0, 0, 0 ))
|
||||||
{
|
{
|
||||||
|
@ -1705,7 +1705,6 @@ 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 =
|
||||||
{
|
{
|
||||||
|
@ -1724,21 +1723,24 @@ 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)
|
||||||
{
|
{
|
||||||
hook_thread_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
HANDLE event;
|
||||||
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);
|
||||||
|
@ -1754,7 +1756,7 @@ static BOOL check_hook_thread(void)
|
||||||
return hook_thread_id != 0;
|
return hook_thread_id != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
|
void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface)
|
||||||
{
|
{
|
||||||
static HHOOK callwndproc_hook;
|
static HHOOK callwndproc_hook;
|
||||||
static ULONG foreground_cnt;
|
static ULONG foreground_cnt;
|
||||||
|
@ -1764,7 +1766,7 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
|
||||||
|
|
||||||
if (dev->dwCoopLevel & DISCL_FOREGROUND)
|
if (dev->dwCoopLevel & DISCL_FOREGROUND)
|
||||||
{
|
{
|
||||||
if (acquired)
|
if (dev->acquired)
|
||||||
foreground_cnt++;
|
foreground_cnt++;
|
||||||
else
|
else
|
||||||
foreground_cnt--;
|
foreground_cnt--;
|
||||||
|
@ -1779,13 +1781,6 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
|
||||||
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);
|
||||||
|
|
|
@ -85,7 +85,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, BOOL) DECLSPEC_HIDDEN;
|
extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W) 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);
|
||||||
|
|
||||||
|
|
|
@ -640,14 +640,20 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
|
||||||
{
|
{
|
||||||
IOHIDElementRef element = ( IOHIDElementRef ) CFArrayGetValueAtIndex( elements, idx );
|
IOHIDElementRef element = ( IOHIDElementRef ) CFArrayGetValueAtIndex( elements, idx );
|
||||||
int type = IOHIDElementGetType( element );
|
int type = IOHIDElementGetType( element );
|
||||||
|
int usage_page = IOHIDElementGetUsagePage( element );
|
||||||
|
|
||||||
TRACE("element %s\n", debugstr_element(element));
|
TRACE("element %s\n", debugstr_element(element));
|
||||||
|
|
||||||
|
if (usage_page >= kHIDPage_VendorDefinedStart)
|
||||||
|
{
|
||||||
|
/* vendor pages can repurpose type ids, resulting in incorrect case matches below (e.g. ds4 controllers) */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case kIOHIDElementTypeInput_Button:
|
case kIOHIDElementTypeInput_Button:
|
||||||
{
|
{
|
||||||
int usage_page = IOHIDElementGetUsagePage( element );
|
|
||||||
TRACE("kIOHIDElementTypeInput_Button usage_page %d\n", usage_page);
|
TRACE("kIOHIDElementTypeInput_Button usage_page %d\n", usage_page);
|
||||||
if (usage_page != kHIDPage_Button)
|
if (usage_page != kHIDPage_Button)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to Wine-3.0
|
||||||
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-2.9
|
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-2.9
|
||||||
reactos/dll/directx/wine/ddraw # Synced to Wine-3.0
|
reactos/dll/directx/wine/ddraw # Synced to Wine-3.0
|
||||||
reactos/dll/directx/wine/devenum # Synced to Wine-3.0
|
reactos/dll/directx/wine/devenum # Synced to Wine-3.0
|
||||||
reactos/dll/directx/wine/dinput # Synced to WineStaging-2.16
|
reactos/dll/directx/wine/dinput # Synced to Wine-3.0
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue