mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Updated dinput-joy-mappings patchset
- Use heap_alloc/free - Remove use of const buffers. - Add "dinput: Dont allow Fixed actions to be changed."
This commit is contained in:
parent
a246130f81
commit
da73254259
@ -1,16 +1,16 @@
|
||||
From 3d90cc93c56571a6c1d7d25054094106595e7c03 Mon Sep 17 00:00:00 2001
|
||||
From 290d6b2b773e9729c38495ec8c1291b40678bc31 Mon Sep 17 00:00:00 2001
|
||||
From: Jetro Jormalainen <jje-wine@jv.jetro.fi>
|
||||
Date: Tue, 30 Apr 2019 09:20:20 +1000
|
||||
Subject: [PATCH] dinput: Load users Joystick mappings.
|
||||
Subject: [PATCH 1/3] dinput: Load users Joystick mappings.
|
||||
|
||||
---
|
||||
dlls/dinput/device.c | 2 +-
|
||||
dlls/dinput/device_private.h | 2 ++
|
||||
dlls/dinput/joystick.c | 18 ++++++++++++++++++
|
||||
3 files changed, 21 insertions(+), 1 deletion(-)
|
||||
dlls/dinput/joystick.c | 25 +++++++++++++++++++++++++
|
||||
3 files changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index ade7947..648a4cc 100644
|
||||
index 28329d03b5..d1bf934a82 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -714,7 +714,7 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
|
||||
@ -23,10 +23,10 @@ index ade7947..648a4cc 100644
|
||||
HKEY hkey;
|
||||
WCHAR *guid_str;
|
||||
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
||||
index d9e2997..af8d99d 100644
|
||||
index 27e9c26286..ea794d7396 100644
|
||||
--- a/dlls/dinput/device_private.h
|
||||
+++ b/dlls/dinput/device_private.h
|
||||
@@ -123,6 +123,8 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
||||
@@ -125,6 +125,8 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
||||
|
||||
extern LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type) DECLSPEC_HIDDEN;
|
||||
|
||||
@ -36,23 +36,26 @@ index d9e2997..af8d99d 100644
|
||||
extern HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
||||
|
||||
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c
|
||||
index 20d9ee4..62b57bc 100644
|
||||
index 2220b5d576..8341e0313a 100644
|
||||
--- a/dlls/dinput/joystick.c
|
||||
+++ b/dlls/dinput/joystick.c
|
||||
@@ -28,6 +28,7 @@
|
||||
@@ -28,8 +28,10 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
+#include "device_private.h"
|
||||
#include "joystick_private.h"
|
||||
#include "wine/debug.h"
|
||||
+#include "wine/heap.h"
|
||||
#include "winreg.h"
|
||||
@@ -792,9 +793,26 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
||||
@@ -825,9 +827,32 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||
unsigned int i, j;
|
||||
BOOL has_actions = FALSE;
|
||||
+ WCHAR username[MAX_PATH];
|
||||
+ DWORD username_size = MAX_PATH;
|
||||
+ WCHAR *username;
|
||||
+ DWORD size;
|
||||
+ BOOL load_success = FALSE;
|
||||
|
||||
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", This, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
||||
@ -60,13 +63,19 @@ index 20d9ee4..62b57bc 100644
|
||||
+ /* Unless asked the contrary by these flags, try to load a previous mapping */
|
||||
+ if (!(dwFlags & DIDBAM_HWDEFAULTS))
|
||||
+ {
|
||||
+ /* Retrieve logged user name if necessary */
|
||||
+ if (lpszUserName == NULL)
|
||||
+ GetUserNameW(username, &username_size);
|
||||
+ if (!lpszUserName)
|
||||
+ GetUserNameW(NULL, &size);
|
||||
+ else
|
||||
+ lstrcpynW(username, lpszUserName, MAX_PATH);
|
||||
+ size = lstrlenW(lpszUserName) + 1;
|
||||
+
|
||||
+ username = heap_alloc(size * sizeof(WCHAR));
|
||||
+ if (!lpszUserName)
|
||||
+ GetUserNameW(username, &size);
|
||||
+ else
|
||||
+ lstrcpynW(username, lpszUserName, size);
|
||||
+
|
||||
+ load_success = load_mapping_settings((IDirectInputDeviceImpl *) This, lpdiaf, username);
|
||||
+ heap_free(username);
|
||||
+ }
|
||||
+
|
||||
+ if (load_success) return DI_OK;
|
||||
@ -75,5 +84,5 @@ index 20d9ee4..62b57bc 100644
|
||||
{
|
||||
DWORD inst = (0x000000ff & (lpdiaf->rgoAction[i].dwSemantic)) - 1;
|
||||
--
|
||||
1.9.1
|
||||
2.17.1
|
||||
|
||||
|
@ -1,21 +1,29 @@
|
||||
From 920014b62ddd2218477e3d82f45c4515742f9e28 Mon Sep 17 00:00:00 2001
|
||||
From 2d063452209d8b531a2b13ded0ea9b0eac8925fa 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 2/3] dinput: Allow empty Joystick mappings.
|
||||
|
||||
---
|
||||
dlls/dinput/device.c | 82 +++++++++++++++++++++++++++++++++++++--------
|
||||
dlls/dinput/joystick.c | 2 ++
|
||||
dlls/dinput/keyboard.c | 2 ++
|
||||
dlls/dinput/mouse.c | 2 ++
|
||||
dlls/dinput8/tests/device.c | 50 +++++++++++++++++++++++++++
|
||||
5 files changed, 124 insertions(+), 14 deletions(-)
|
||||
dlls/dinput/device.c | 82 ++++++++++++++++++++++++++++++-------
|
||||
dlls/dinput/joystick.c | 4 +-
|
||||
dlls/dinput/keyboard.c | 2 +
|
||||
dlls/dinput/mouse.c | 2 +
|
||||
dlls/dinput8/tests/device.c | 50 ++++++++++++++++++++++
|
||||
5 files changed, 125 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index 2150db7..a7cfe36 100644
|
||||
index d1bf934a82..6107ab2653 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -643,12 +643,30 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
+#include "wine/heap.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
@@ -643,12 +644,29 @@ static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic)
|
||||
return type | (0x0000ff00 & (obj_instance << 8));
|
||||
}
|
||||
|
||||
@ -27,14 +35,13 @@ index 2150db7..a7cfe36 100644
|
||||
+ 'M','a','p','p','i','n','g','s','\\','%','s','\\','%','s','\\','%','s','\0'};
|
||||
+ WCHAR *keyname;
|
||||
+
|
||||
+ keyname = HeapAlloc(GetProcessHeap(), 0,
|
||||
+ sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
|
||||
+ keyname = heap_alloc(sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
|
||||
+ sprintfW(keyname, subkey, username, device, guid);
|
||||
+
|
||||
+ /* Remove old key mappings so there will be no overlapping mappings */
|
||||
+ RegDeleteKeyW(HKEY_CURRENT_USER, keyname);
|
||||
+
|
||||
+ HeapFree(GetProcessHeap(), 0, keyname);
|
||||
+ heap_free(keyname);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
@ -97,12 +104,12 @@ index 2150db7..a7cfe36 100644
|
||||
- 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;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
}
|
||||
|
||||
@ -187,10 +194,19 @@ index 2150db7..a7cfe36 100644
|
||||
This->num_actions = num_actions;
|
||||
|
||||
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c
|
||||
index b146712..267f932 100644
|
||||
index 8341e0313a..d9f9c59be0 100644
|
||||
--- a/dlls/dinput/joystick.c
|
||||
+++ b/dlls/dinput/joystick.c
|
||||
@@ -907,6 +907,8 @@ HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
@@ -847,7 +847,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
||||
else
|
||||
lstrcpynW(username, lpszUserName, MAX_PATH);
|
||||
|
||||
- load_success = load_mapping_settings((IDirectInputDeviceImpl *) This, lpdiaf, username);
|
||||
+ load_success = load_mapping_settings(&This->base, lpdiaf, username);
|
||||
heap_free(username);
|
||||
}
|
||||
|
||||
@@ -957,6 +957,8 @@ HRESULT WINAPI JoystickAGenericImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = JoystickWGenericImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
@ -200,10 +216,10 @@ index b146712..267f932 100644
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
|
||||
index 42c0759..5c5aa14 100644
|
||||
index b5e665933e..0747f5d8c8 100644
|
||||
--- a/dlls/dinput/keyboard.c
|
||||
+++ b/dlls/dinput/keyboard.c
|
||||
@@ -693,6 +693,8 @@ static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
@@ -690,6 +690,8 @@ static HRESULT WINAPI SysKeyboardAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = SysKeyboardWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
@ -213,10 +229,10 @@ index 42c0759..5c5aa14 100644
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index f3ec8e4..0adba03 100644
|
||||
index 52a766b2a1..796f1fa297 100644
|
||||
--- a/dlls/dinput/mouse.c
|
||||
+++ b/dlls/dinput/mouse.c
|
||||
@@ -863,6 +863,8 @@ static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
@@ -862,6 +862,8 @@ static HRESULT WINAPI SysMouseAImpl_SetActionMap(LPDIRECTINPUTDEVICE8A iface,
|
||||
|
||||
hr = SysMouseWImpl_SetActionMap(&This->base.IDirectInputDevice8W_iface, &diafW, lpszUserNameW, dwFlags);
|
||||
|
||||
@ -226,7 +242,7 @@ index f3ec8e4..0adba03 100644
|
||||
HeapFree(GetProcessHeap(), 0, lpszUserNameW);
|
||||
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index 1bfb34a..46a1e4a 100644
|
||||
index f3e7b54235..bec2a6b863 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -38,6 +38,8 @@ struct enum_data {
|
||||
@ -301,5 +317,5 @@ index 1bfb34a..46a1e4a 100644
|
||||
IDirectInput_Release(pDI);
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
2.17.1
|
||||
|
||||
|
@ -1,20 +1,34 @@
|
||||
From af785463a8e9fc8ff47ead4143151e9831cbbddf Mon Sep 17 00:00:00 2001
|
||||
From 5fb416432e892bed7c216f57f7caf6e6503ca96c Mon Sep 17 00:00:00 2001
|
||||
From: Jetro Jormalainen <jje-wine@jv.jetro.fi>
|
||||
Date: Tue, 30 Apr 2019 09:21:24 +1000
|
||||
Subject: [PATCH] dinput: Support username in Config dialog.
|
||||
Subject: [PATCH 3/3] dinput: Support username in Config dialog.
|
||||
|
||||
---
|
||||
dlls/dinput/config.c | 183 ++++++++++++++++++++++++++++++-------------
|
||||
dlls/dinput/config.c | 187 ++++++++++++++++++++++++-----------
|
||||
dlls/dinput/device.c | 2 +-
|
||||
dlls/dinput/device_private.h | 1 +
|
||||
dlls/dinput/dinput_main.c | 27 +++++++
|
||||
4 files changed, 156 insertions(+), 57 deletions(-)
|
||||
dlls/dinput/dinput_main.c | 27 +++++
|
||||
4 files changed, 160 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/config.c b/dlls/dinput/config.c
|
||||
index bf44898..cd2c4b9 100644
|
||||
index bf44898589..c7a33d2da0 100644
|
||||
--- a/dlls/dinput/config.c
|
||||
+++ b/dlls/dinput/config.c
|
||||
@@ -29,6 +29,9 @@ typedef struct {
|
||||
@@ -18,17 +18,23 @@
|
||||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
+
|
||||
#include "wine/unicode.h"
|
||||
#include "objbase.h"
|
||||
#include "dinput_private.h"
|
||||
#include "device_private.h"
|
||||
#include "resource.h"
|
||||
|
||||
+#include "wine/heap.h"
|
||||
+
|
||||
typedef struct {
|
||||
int nobjects;
|
||||
IDirectInputDevice8W *lpdid;
|
||||
DIDEVICEINSTANCEW ddi;
|
||||
DIDEVICEOBJECTINSTANCEW ddo[256];
|
||||
@ -24,7 +38,7 @@ index bf44898..cd2c4b9 100644
|
||||
} DeviceData;
|
||||
|
||||
typedef struct {
|
||||
@@ -38,10 +41,11 @@ typedef struct {
|
||||
@@ -38,10 +44,11 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
IDirectInput8W *lpDI;
|
||||
@ -37,7 +51,7 @@ index bf44898..cd2c4b9 100644
|
||||
} ConfigureDevicesData;
|
||||
|
||||
/*
|
||||
@@ -57,27 +61,42 @@ static BOOL CALLBACK collect_objects(LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pv
|
||||
@@ -57,27 +64,42 @@ static BOOL CALLBACK collect_objects(LPCDIDEVICEOBJECTINSTANCEW lpddo, LPVOID pv
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
@ -71,15 +85,15 @@ index bf44898..cd2c4b9 100644
|
||||
IDirectInputDevice_EnumObjects(lpdid, collect_objects, (LPVOID) device, DIDFT_ALL);
|
||||
|
||||
- data->ndevices++;
|
||||
+ device->user_afs = HeapAlloc(GetProcessHeap(), 0, sizeof(*device->user_afs)*data->nusernames);
|
||||
+ memset(device->user_afs, 0, sizeof(*device->user_afs)*data->nusernames);
|
||||
+ device->user_afs = heap_alloc(sizeof(*device->user_afs) * data->nusernames);
|
||||
+ memset(device->user_afs, 0, sizeof(*device->user_afs) * data->nusernames);
|
||||
+ for (i = 0; i < data->nusernames; i++)
|
||||
+ {
|
||||
+ DIACTIONFORMATW *user_af = &device->user_afs[i];
|
||||
+ user_af->dwNumActions = data->original_lpdiaf->dwNumActions;
|
||||
+ user_af->guidActionMap = data->original_lpdiaf->guidActionMap;
|
||||
+ user_af->rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*data->original_lpdiaf->dwNumActions);
|
||||
+ memset(user_af->rgoAction, 0, sizeof(DIACTIONW)*data->original_lpdiaf->dwNumActions);
|
||||
+ user_af->rgoAction = heap_alloc(sizeof(DIACTIONW) * data->original_lpdiaf->dwNumActions);
|
||||
+ memset(user_af->rgoAction, 0, sizeof(DIACTIONW) * data->original_lpdiaf->dwNumActions);
|
||||
+ for (j = 0; j < user_af->dwNumActions; j++)
|
||||
+ {
|
||||
+ user_af->rgoAction[j].dwSemantic = data->original_lpdiaf->rgoAction[j].dwSemantic;
|
||||
@ -92,7 +106,7 @@ index bf44898..cd2c4b9 100644
|
||||
return DIENUM_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -170,10 +189,18 @@ static DeviceData* get_cur_device(HWND dialog)
|
||||
@@ -170,10 +192,18 @@ static DeviceData* get_cur_device(HWND dialog)
|
||||
return &data->devices_data.devices[sel];
|
||||
}
|
||||
|
||||
@ -113,7 +127,7 @@ index bf44898..cd2c4b9 100644
|
||||
}
|
||||
|
||||
static int dialog_display_only(HWND dialog)
|
||||
@@ -182,40 +209,36 @@ static int dialog_display_only(HWND dialog)
|
||||
@@ -182,40 +212,36 @@ static int dialog_display_only(HWND dialog)
|
||||
return data->display_only;
|
||||
}
|
||||
|
||||
@ -155,8 +169,8 @@ index bf44898..cd2c4b9 100644
|
||||
+ {
|
||||
IDirectInputDevice8_Release(devices_data->devices[i].lpdid);
|
||||
+ for (j=0; j < data->nusernames; j++)
|
||||
+ HeapFree(GetProcessHeap(), 0, devices_data->devices[i].user_afs[j].rgoAction);
|
||||
+ HeapFree(GetProcessHeap(), 0, devices_data->devices[i].user_afs);
|
||||
+ heap_free(devices_data->devices[i].user_afs[j].rgoAction);
|
||||
+ heap_free(devices_data->devices[i].user_afs);
|
||||
+ }
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, devices_data->devices);
|
||||
@ -167,7 +181,7 @@ index bf44898..cd2c4b9 100644
|
||||
}
|
||||
|
||||
static void fill_device_object_list(HWND dialog)
|
||||
@@ -231,6 +254,7 @@ static void fill_device_object_list(HWND dialog)
|
||||
@@ -231,6 +257,7 @@ static void fill_device_object_list(HWND dialog)
|
||||
/* Add each object */
|
||||
for (i=0; i < device->nobjects; i++)
|
||||
{
|
||||
@ -175,7 +189,7 @@ index bf44898..cd2c4b9 100644
|
||||
int action = -1;
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
@@ -241,12 +265,20 @@ static void fill_device_object_list(HWND dialog)
|
||||
@@ -241,12 +268,20 @@ static void fill_device_object_list(HWND dialog)
|
||||
|
||||
/* Add the item */
|
||||
SendDlgItemMessageW(dialog, IDC_DEVICEOBJECTSLIST, LVM_INSERTITEMW, 0, (LPARAM) &item);
|
||||
@ -198,7 +212,7 @@ index bf44898..cd2c4b9 100644
|
||||
{
|
||||
action = j;
|
||||
break;
|
||||
@@ -260,7 +292,7 @@ static void fill_device_object_list(HWND dialog)
|
||||
@@ -260,7 +295,7 @@ static void fill_device_object_list(HWND dialog)
|
||||
static void show_suitable_actions(HWND dialog)
|
||||
{
|
||||
DeviceData *device = get_cur_device(dialog);
|
||||
@ -207,7 +221,7 @@ index bf44898..cd2c4b9 100644
|
||||
int i, added = 0;
|
||||
int obj = lv_get_cur_item(dialog);
|
||||
|
||||
@@ -329,24 +361,35 @@ static void assign_action(HWND dialog)
|
||||
@@ -329,24 +364,35 @@ static void assign_action(HWND dialog)
|
||||
lv_set_action(dialog, obj, action, lpdiaf);
|
||||
}
|
||||
|
||||
@ -255,7 +269,7 @@ index bf44898..cd2c4b9 100644
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
@@ -358,21 +401,16 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
|
||||
@@ -358,21 +404,16 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
|
||||
ConfigureDevicesData *data = (ConfigureDevicesData*) lParam;
|
||||
|
||||
/* Initialize action format and enumerate devices */
|
||||
@ -279,7 +293,7 @@ index bf44898..cd2c4b9 100644
|
||||
fill_device_object_list(dialog);
|
||||
|
||||
ShowCursor(TRUE);
|
||||
@@ -414,6 +452,7 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
|
||||
@@ -414,6 +455,7 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
|
||||
break;
|
||||
|
||||
case IDC_CONTROLLERCOMBO:
|
||||
@ -287,7 +301,7 @@ index bf44898..cd2c4b9 100644
|
||||
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
@@ -424,12 +463,12 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
|
||||
@@ -424,12 +466,12 @@ static INT_PTR CALLBACK ConfigureDevicesDlgProc(HWND dialog, UINT uMsg, WPARAM w
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
@ -301,13 +315,13 @@ index bf44898..cd2c4b9 100644
|
||||
EndDialog(dialog, 0);
|
||||
destroy_data(dialog);
|
||||
break;
|
||||
@@ -452,15 +491,47 @@ HRESULT _configure_devices(IDirectInput8W *iface,
|
||||
@@ -452,15 +494,48 @@ HRESULT _configure_devices(IDirectInput8W *iface,
|
||||
LPVOID pvRefData
|
||||
)
|
||||
{
|
||||
+ int i;
|
||||
+ DWORD default_username_size = MAX_PATH;
|
||||
+ WCHAR *default_username = 0;
|
||||
+ DWORD size;
|
||||
+ WCHAR *username = NULL;
|
||||
ConfigureDevicesData data;
|
||||
data.lpDI = iface;
|
||||
- data.lpdiaf = lpdiCDParams->lprgFormats;
|
||||
@ -317,16 +331,17 @@ index bf44898..cd2c4b9 100644
|
||||
+ if (lpdiCDParams->lptszUserNames == NULL)
|
||||
+ {
|
||||
+ /* Get default user name */
|
||||
+ default_username = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*MAX_PATH);
|
||||
+ GetUserNameW(NULL, &size);
|
||||
+ username = heap_alloc(size * sizeof(WCHAR) );
|
||||
+ GetUserNameW(username, &size);
|
||||
+ data.nusernames = 1;
|
||||
+ data.usernames = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR *));
|
||||
+ data.usernames[0] = default_username;
|
||||
+ GetUserNameW(default_username, &default_username_size);
|
||||
+ data.usernames = heap_alloc(sizeof(WCHAR *));
|
||||
+ data.usernames[0] = username;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ WCHAR *p = lpdiCDParams->lptszUserNames;
|
||||
+ data.usernames = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR *)*data.nusernames);
|
||||
+ data.usernames = heap_alloc(sizeof(WCHAR *) * data.nusernames);
|
||||
+ for (i = 0; i < data.nusernames; i++)
|
||||
+ {
|
||||
+ if (*p)
|
||||
@ -345,13 +360,13 @@ index bf44898..cd2c4b9 100644
|
||||
DialogBoxParamW(DINPUT_instance, (const WCHAR *)MAKEINTRESOURCE(IDD_CONFIGUREDEVICES),
|
||||
lpdiCDParams->hwnd, ConfigureDevicesDlgProc, (LPARAM)&data);
|
||||
|
||||
+ HeapFree(GetProcessHeap(), 0, default_username);
|
||||
+ HeapFree(GetProcessHeap(), 0, data.usernames);
|
||||
+ heap_free(username);
|
||||
+ heap_free(data.usernames);
|
||||
+
|
||||
return DI_OK;
|
||||
}
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index b441743..0c94326 100644
|
||||
index 6107ab2653..30483fe691 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -692,7 +692,7 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
|
||||
@ -364,10 +379,10 @@ index b441743..0c94326 100644
|
||||
WCHAR *guid_str = NULL;
|
||||
DIDEVICEINSTANCEW didev;
|
||||
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
||||
index af8d99d..36b71f7 100644
|
||||
index ea794d7396..114e3971ed 100644
|
||||
--- a/dlls/dinput/device_private.h
|
||||
+++ b/dlls/dinput/device_private.h
|
||||
@@ -123,6 +123,7 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
||||
@@ -125,6 +125,7 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
||||
|
||||
extern LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type) DECLSPEC_HIDDEN;
|
||||
|
||||
@ -376,10 +391,10 @@ index af8d99d..36b71f7 100644
|
||||
|
||||
extern HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
|
||||
index 198c6a8..ee319f0 100644
|
||||
index 0855cb41cd..6eb7c64c0e 100644
|
||||
--- a/dlls/dinput/dinput_main.c
|
||||
+++ b/dlls/dinput/dinput_main.c
|
||||
@@ -1251,9 +1251,34 @@ static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
|
||||
@@ -1253,9 +1253,34 @@ static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
|
||||
|
||||
/* Copy parameters */
|
||||
diCDParamsW.dwSize = sizeof(DICONFIGUREDEVICESPARAMSW);
|
||||
@ -414,15 +429,15 @@ index 198c6a8..ee319f0 100644
|
||||
|
||||
diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, sizeof(DIACTIONW)*lpdiCDParams->lprgFormats->dwNumActions);
|
||||
_copy_diactionformatAtoW(&diafW, lpdiCDParams->lprgFormats);
|
||||
@@ -1281,6 +1306,8 @@ static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
|
||||
@@ -1283,6 +1308,8 @@ static HRESULT WINAPI IDirectInput8AImpl_ConfigureDevices(
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, diafW.rgoAction);
|
||||
|
||||
+ HeapFree(GetProcessHeap(), 0, (void*) diCDParamsW.lptszUserNames);
|
||||
+ heap_free((void*) diCDParamsW.lptszUserNames);
|
||||
+
|
||||
return hr;
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
2.17.1
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
From 629a5f7eea3b17f56606d3b588a5fd96ded99fef Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 4 Oct 2019 16:24:06 +1000
|
||||
Subject: [PATCH] dinput: Dont allow Fixed actions to be changed.
|
||||
|
||||
---
|
||||
dlls/dinput/config.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/dlls/dinput/config.c b/dlls/dinput/config.c
|
||||
index cd2c4b921e7..bfb535c9b2a 100644
|
||||
--- a/dlls/dinput/config.c
|
||||
+++ b/dlls/dinput/config.c
|
||||
@@ -91,6 +91,7 @@ static BOOL CALLBACK collect_devices(LPCDIDEVICEINSTANCEW lpddi, IDirectInputDev
|
||||
for (j = 0; j < user_af->dwNumActions; j++)
|
||||
{
|
||||
user_af->rgoAction[j].dwSemantic = data->original_lpdiaf->rgoAction[j].dwSemantic;
|
||||
+ user_af->rgoAction[j].dwFlags = data->original_lpdiaf->rgoAction[j].dwFlags;
|
||||
user_af->rgoAction[j].u.lptszActionName = data->original_lpdiaf->rgoAction[j].u.lptszActionName;
|
||||
}
|
||||
IDirectInputDevice8_BuildActionMap(lpdid, user_af, data->usernames[i], 0);
|
||||
@@ -334,6 +335,8 @@ static void assign_action(HWND dialog)
|
||||
|
||||
if (old_action == action) return;
|
||||
if (obj < 0) return;
|
||||
+ if (lpdiaf->rgoAction[old_action].dwFlags & DIA_APPFIXED) return;
|
||||
+
|
||||
type = device->ddo[obj].dwType;
|
||||
|
||||
/* Clear old action */
|
||||
--
|
||||
2.23.0
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "89d9bcb1f19a03ffafa9a93a5f32049b4bfdaa00"
|
||||
echo "71e96bd3b757a2b058b6a769c341d81f82329d79"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -2970,10 +2970,12 @@ if test "$enable_dinput_joy_mappings" -eq 1; then
|
||||
patch_apply dinput-joy-mappings/0001-dinput-Load-users-Joystick-mappings.patch
|
||||
patch_apply dinput-joy-mappings/0002-dinput-Allow-empty-Joystick-mappings.patch
|
||||
patch_apply dinput-joy-mappings/0003-dinput-Support-username-in-Config-dialog.patch
|
||||
patch_apply dinput-joy-mappings/0004-dinput-Dont-allow-Fixed-actions-to-be-changed.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Jetro Jormalainen", "dinput: Load users Joystick mappings.", 1 },';
|
||||
printf '%s\n' '+ { "Jetro Jormalainen", "dinput: Allow empty Joystick mappings.", 1 },';
|
||||
printf '%s\n' '+ { "Jetro Jormalainen", "dinput: Support username in Config dialog.", 1 },';
|
||||
printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Dont allow Fixed actions to be changed.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user