mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Rebase against 580413032c61bc142078d08efb1d1167fe385a97.
This commit is contained in:
parent
3790a70510
commit
acc0de4def
@ -1,4 +1,4 @@
|
||||
From bce769d9179ffbcbc634e73ad124528e28c5c7a8 Mon Sep 17 00:00:00 2001
|
||||
From ccc18e41eb660dbbe3d08fd478aefbc6e7701adf 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.
|
||||
@ -12,7 +12,7 @@ Subject: [PATCH] dinput: Allow empty Joystick mappings.
|
||||
5 files changed, 125 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index d1bf934a827..6107ab26538 100644
|
||||
index 289c3a0ec6a..22dcfde7021 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -30,6 +30,7 @@
|
||||
@ -23,7 +23,7 @@ index d1bf934a827..6107ab26538 100644
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
@@ -643,12 +644,29 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
||||
@@ -659,12 +660,29 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
||||
return type | (0x0000ff00 & (obj_instance << 8));
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ index d1bf934a827..6107ab26538 100644
|
||||
{
|
||||
static const WCHAR subkey[] = {
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
@@ -663,8 +681,11 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
|
||||
@@ -679,8 +697,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 +68,7 @@ index d1bf934a827..6107ab26538 100644
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, keyname);
|
||||
|
||||
@@ -684,7 +705,9 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
|
||||
@@ -700,7 +721,9 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
|
||||
if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
|
||||
return DI_SETTINGSNOTSAVED;
|
||||
|
||||
@ -79,7 +79,7 @@ index d1bf934a827..6107ab26538 100644
|
||||
|
||||
if (!hkey)
|
||||
{
|
||||
@@ -719,7 +742,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
@@ -735,7 +758,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
HKEY hkey;
|
||||
WCHAR *guid_str;
|
||||
DIDEVICEINSTANCEW didev;
|
||||
@ -88,7 +88,7 @@ index d1bf934a827..6107ab26538 100644
|
||||
|
||||
didev.dwSize = sizeof(didev);
|
||||
IDirectInputDevice8_GetDeviceInfo(&This->IDirectInputDevice8W_iface, &didev);
|
||||
@@ -727,7 +750,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
@@ -743,7 +766,7 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
if (StringFromCLSID(&lpdiaf->guidActionMap, &guid_str) != S_OK)
|
||||
return FALSE;
|
||||
|
||||
@ -97,19 +97,19 @@ index d1bf934a827..6107ab26538 100644
|
||||
|
||||
if (!hkey)
|
||||
{
|
||||
@@ -748,15 +771,21 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
@@ -764,15 +787,21 @@ BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdia
|
||||
{
|
||||
lpdiaf->rgoAction[i].dwObjID = id;
|
||||
lpdiaf->rgoAction[i].guidInstance = didev.guidInstance;
|
||||
- lpdiaf->rgoAction[i].dwHow = DIAH_DEFAULT;
|
||||
- mapped += 1;
|
||||
+ lpdiaf->rgoAction[i].dwHow = DIAH_USERCONFIG;
|
||||
+ }
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ memset(&lpdiaf->rgoAction[i].guidInstance, 0, sizeof(GUID));
|
||||
+ lpdiaf->rgoAction[i].dwHow = DIAH_UNMAPPED;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
@ -121,8 +121,8 @@ index d1bf934a827..6107ab26538 100644
|
||||
+ return TRUE;
|
||||
}
|
||||
|
||||
HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df)
|
||||
@@ -779,13 +808,18 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
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,
|
||||
load_success = load_mapping_settings(This, lpdiaf, username);
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ index d1bf934a827..6107ab26538 100644
|
||||
if ((lpdiaf->rgoAction[i].dwSemantic & devMask) == devMask)
|
||||
{
|
||||
DWORD obj_id = semantic_to_obj_id(This, lpdiaf->rgoAction[i].dwSemantic);
|
||||
@@ -816,6 +850,14 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
@@ -872,6 +906,14 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,15 +160,15 @@ index d1bf934a827..6107ab26538 100644
|
||||
if (!has_actions) return DI_NOEFFECT;
|
||||
|
||||
return IDirectInputDevice8WImpl_BuildActionMap(iface, lpdiaf, lpszUserName, dwFlags);
|
||||
@@ -831,6 +873,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
@@ -887,6 +929,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
DIPROPSTRING dps;
|
||||
WCHAR username[MAX_PATH];
|
||||
DWORD username_size = MAX_PATH;
|
||||
+ DWORD new_crc = 0;
|
||||
int i, action = 0, num_actions = 0;
|
||||
unsigned int offset = 0;
|
||||
|
||||
@@ -841,12 +884,23 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
ActionMap *action_map;
|
||||
@@ -898,12 +941,23 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
data_format.dwFlags = DIDF_RELAXIS;
|
||||
data_format.dwDataSize = lpdiaf->dwDataSize;
|
||||
|
||||
@ -191,13 +191,13 @@ index d1bf934a827..6107ab26538 100644
|
||||
+ /* update dwCRC to track if action format has changed */
|
||||
+ lpdiaf->dwCRC = new_crc;
|
||||
|
||||
This->num_actions = num_actions;
|
||||
|
||||
/* 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 66d6cfdffb9..73215dac0d5 100644
|
||||
index 1986e610d08..a5ad0d4def2 100644
|
||||
--- a/dlls/dinput/joystick.c
|
||||
+++ b/dlls/dinput/joystick.c
|
||||
@@ -847,7 +847,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
@@ -861,7 +861,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
else
|
||||
lstrcpynW(username, lpszUserName, size);
|
||||
|
||||
@ -206,7 +206,7 @@ index 66d6cfdffb9..73215dac0d5 100644
|
||||
heap_free(username);
|
||||
}
|
||||
|
||||
@@ -957,6 +957,8 @@ HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
@@ -971,6 +971,8 @@ HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = JoystickWGenericImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
@ -216,10 +216,10 @@ index 66d6cfdffb9..73215dac0d5 100644
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
|
||||
index b5e665933ec..0747f5d8c8b 100644
|
||||
index 9981372d957..ec7d8985079 100644
|
||||
--- a/dlls/dinput/keyboard.c
|
||||
+++ b/dlls/dinput/keyboard.c
|
||||
@@ -690,6 +690,8 @@ static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
@@ -686,6 +686,8 @@ static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = SysKeyboardWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
@ -229,10 +229,10 @@ index b5e665933ec..0747f5d8c8b 100644
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index 52a766b2a1a..796f1fa2977 100644
|
||||
index e50731fda41..9e2154ea463 100644
|
||||
--- a/dlls/dinput/mouse.c
|
||||
+++ b/dlls/dinput/mouse.c
|
||||
@@ -862,6 +862,8 @@ static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
@@ -946,6 +946,8 @@ static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
@ -242,7 +242,7 @@ index 52a766b2a1a..796f1fa2977 100644
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index f3e7b542355..bec2a6b863c 100644
|
||||
index 3e6da23b4ab..445d98e3887 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -38,6 +38,8 @@ struct enum_data {
|
||||
@ -254,7 +254,7 @@ index f3e7b542355..bec2a6b863c 100644
|
||||
enum {
|
||||
DITEST_AXIS,
|
||||
DITEST_BUTTON,
|
||||
@@ -365,6 +367,17 @@ static void test_action_mapping(void)
|
||||
@@ -429,6 +431,17 @@ static void test_action_mapping(void)
|
||||
hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
|
||||
ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr);
|
||||
|
||||
@ -272,7 +272,7 @@ index f3e7b542355..bec2a6b863c 100644
|
||||
af.dwDataSize = 4 * ARRAY_SIZE(actionMapping);
|
||||
af.dwNumActions = ARRAY_SIZE(actionMapping);
|
||||
|
||||
@@ -556,6 +569,43 @@ static void test_save_settings(void)
|
||||
@@ -620,6 +633,43 @@ static void test_save_settings(void)
|
||||
"Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[1], af.rgoAction[1].dwObjID);
|
||||
ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
|
||||
|
||||
@ -317,5 +317,5 @@ index f3e7b542355..bec2a6b863c 100644
|
||||
IDirectInput_Release(pDI);
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
2.20.1
|
||||
|
||||
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "9107f591d3d73a3b4040db2e13ef51d9846591c9"
|
||||
echo "580413032c61bc142078d08efb1d1167fe385a97"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
|
@ -1 +1 @@
|
||||
9107f591d3d73a3b4040db2e13ef51d9846591c9
|
||||
580413032c61bc142078d08efb1d1167fe385a97
|
||||
|
Loading…
Reference in New Issue
Block a user