You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against ce151dd681fe5ee80daba96dce12e37d6846e152.
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
From ccc18e41eb660dbbe3d08fd478aefbc6e7701adf Mon Sep 17 00:00:00 2001
|
||||
From 2ff7da682aa87e09966fa0fb7c8846cd82bd1eea Mon Sep 17 00:00:00 2001
|
||||
From: Jetro Jormalainen <jje-wine@jv.jetro.fi>
|
||||
Date: Tue, 30 Apr 2019 09:20:54 +1000
|
||||
Subject: [PATCH] dinput: Allow empty Joystick mappings.
|
||||
|
||||
---
|
||||
dlls/dinput/device.c | 82 ++++++++++++++++++++++++++++++-------
|
||||
dlls/dinput/joystick.c | 4 +-
|
||||
dlls/dinput/keyboard.c | 2 +
|
||||
dlls/dinput/mouse.c | 2 +
|
||||
dlls/dinput/joystick.c | 2 +-
|
||||
dlls/dinput8/tests/device.c | 50 ++++++++++++++++++++++
|
||||
5 files changed, 125 insertions(+), 15 deletions(-)
|
||||
3 files changed, 119 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index 289c3a0ec6a..22dcfde7021 100644
|
||||
index e99d14b4cff..540034de1e9 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -30,6 +30,7 @@
|
||||
@@ -23,7 +21,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
@@ -659,12 +660,29 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
||||
@@ -655,12 +656,29 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
||||
return type | (0x0000ff00 & (obj_instance << 8));
|
||||
}
|
||||
|
||||
@@ -54,7 +52,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
{
|
||||
static const WCHAR subkey[] = {
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
@@ -679,8 +697,11 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
|
||||
@@ -675,8 +693,11 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
|
||||
sprintfW(keyname, subkey, username, device, guid);
|
||||
|
||||
/* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
|
||||
@@ -68,7 +66,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, keyname);
|
||||
|
||||
@@ -700,7 +721,9 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
|
||||
@@ -696,7 +717,9 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
|
||||
if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
|
||||
return DI_SETTINGSNOTSAVED;
|
||||
|
||||
@@ -79,7 +77,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
|
||||
if (!hkey)
|
||||
{
|
||||
@@ -735,7 +758,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
@@ -731,7 +754,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
HKEY hkey;
|
||||
WCHAR *guid_str;
|
||||
DIDEVICEINSTANCEW didev;
|
||||
@@ -88,7 +86,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
|
||||
didev.dwSize = sizeof(didev);
|
||||
IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
|
||||
@@ -743,7 +766,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
@@ -739,7 +762,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
|
||||
return FALSE;
|
||||
|
||||
@@ -97,7 +95,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
|
||||
if (!hkey)
|
||||
{
|
||||
@@ -764,15 +787,21 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
@@ -760,15 +783,21 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
{
|
||||
lpdiaf->rgoAction[i].dwObjID = id;
|
||||
lpdiaf->rgoAction[i].guidInstance = didev.guidInstance;
|
||||
@@ -122,7 +120,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
}
|
||||
|
||||
static BOOL set_app_data(IDirectInputDeviceImpl *dev, int offset, UINT_PTR app_data)
|
||||
@@ -835,13 +864,18 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
@@ -831,13 +860,18 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
load_success = load_mapping_settings(This, lpdiaf, username);
|
||||
}
|
||||
|
||||
@@ -145,7 +143,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
if ((lpdiaf->rgoAction[i].dwSemantic & devMask) == devMask)
|
||||
{
|
||||
DWORD obj_id = semantic_to_obj_id(This, lpdiaf->rgoAction[i].dwSemantic);
|
||||
@@ -872,6 +906,14 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
@@ -868,6 +902,14 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +158,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
if (!has_actions) return DI_NOEFFECT;
|
||||
|
||||
return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags);
|
||||
@@ -887,6 +929,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
@@ -883,6 +925,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
DIPROPSTRING dps;
|
||||
WCHAR username[MAX_PATH];
|
||||
DWORD username_size = MAX_PATH;
|
||||
@@ -168,7 +166,7 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
int i, action = 0, num_actions = 0;
|
||||
unsigned int offset = 0;
|
||||
ActionMap *action_map;
|
||||
@@ -898,12 +941,23 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
@@ -894,12 +937,23 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
data_format.dwFlags = DIDF_RELAXIS;
|
||||
data_format.dwDataSize = lpdiaf->dwDataSize;
|
||||
|
||||
@@ -194,10 +192,10 @@ index 289c3a0ec6a..22dcfde7021 100644
|
||||
/* Construct the dataformat and actionmap */
|
||||
obj_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DIOBJECTDATAFORMAT)*num_actions);
|
||||
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c
|
||||
index 1986e610d08..a5ad0d4def2 100644
|
||||
index 0cddfbc634b..93211ea13a6 100644
|
||||
--- a/dlls/dinput/joystick.c
|
||||
+++ b/dlls/dinput/joystick.c
|
||||
@@ -861,7 +861,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
@@ -749,7 +749,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
else
|
||||
lstrcpynW(username, lpszUserName, size);
|
||||
|
||||
@@ -206,43 +204,8 @@ index 1986e610d08..a5ad0d4def2 100644
|
||||
heap_free(username);
|
||||
}
|
||||
|
||||
@@ -971,6 +971,8 @@ HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = JoystickWGenericImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
+ lpdiaf->dwCRC = diafW.dwCRC;
|
||||
+
|
||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
|
||||
index 9981372d957..ec7d8985079 100644
|
||||
--- a/dlls/dinput/keyboard.c
|
||||
+++ b/dlls/dinput/keyboard.c
|
||||
@@ -686,6 +686,8 @@ static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = SysKeyboardWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
+ lpdiaf->dwCRC = diafW.dwCRC;
|
||||
+
|
||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index e50731fda41..9e2154ea463 100644
|
||||
--- a/dlls/dinput/mouse.c
|
||||
+++ b/dlls/dinput/mouse.c
|
||||
@@ -946,6 +946,8 @@ static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
+ lpdiaf->dwCRC = diafW.dwCRC;
|
||||
+
|
||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index 3e6da23b4ab..445d98e3887 100644
|
||||
index 17deed193dd..3bfb34eb2ca 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -38,6 +38,8 @@ struct enum_data {
|
||||
@@ -317,5 +280,5 @@ index 3e6da23b4ab..445d98e3887 100644
|
||||
IDirectInput_Release(pDI);
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
2.30.2
|
||||
|
||||
|
Reference in New Issue
Block a user