2019-10-10 19:30:46 -07:00
|
|
|
From 290d6b2b773e9729c38495ec8c1291b40678bc31 Mon Sep 17 00:00:00 2001
|
2019-05-02 17:37:32 -07:00
|
|
|
From: Jetro Jormalainen <jje-wine@jv.jetro.fi>
|
|
|
|
Date: Tue, 30 Apr 2019 09:20:20 +1000
|
2019-10-10 19:30:46 -07:00
|
|
|
Subject: [PATCH 1/3] dinput: Load users Joystick mappings.
|
2019-05-02 17:37:32 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
dlls/dinput/device.c | 2 +-
|
|
|
|
dlls/dinput/device_private.h | 2 ++
|
2019-10-10 19:30:46 -07:00
|
|
|
dlls/dinput/joystick.c | 25 +++++++++++++++++++++++++
|
|
|
|
3 files changed, 28 insertions(+), 1 deletion(-)
|
2019-05-02 17:37:32 -07:00
|
|
|
|
|
|
|
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
2019-10-10 19:30:46 -07:00
|
|
|
index 28329d03b5..d1bf934a82 100644
|
2019-05-02 17:37:32 -07:00
|
|
|
--- a/dlls/dinput/device.c
|
|
|
|
+++ b/dlls/dinput/device.c
|
|
|
|
@@ -714,7 +714,7 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
|
|
|
|
+BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username)
|
|
|
|
{
|
|
|
|
HKEY hkey;
|
|
|
|
WCHAR *guid_str;
|
|
|
|
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
2019-10-10 19:30:46 -07:00
|
|
|
index 27e9c26286..ea794d7396 100644
|
2019-05-02 17:37:32 -07:00
|
|
|
--- a/dlls/dinput/device_private.h
|
|
|
|
+++ b/dlls/dinput/device_private.h
|
2019-10-10 19:30:46 -07:00
|
|
|
@@ -125,6 +125,8 @@ extern const char *_dump_dinput_GUID(const GUID *guid) DECLSPEC_HIDDEN;
|
2019-05-02 17:37:32 -07:00
|
|
|
|
|
|
|
extern LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD type) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
+extern BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username) DECLSPEC_HIDDEN;
|
|
|
|
+
|
|
|
|
extern HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, DWORD devMask, LPCDIDATAFORMAT df) DECLSPEC_HIDDEN;
|
|
|
|
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
|
2019-10-10 19:30:46 -07:00
|
|
|
index 2220b5d576..8341e0313a 100644
|
2019-05-02 17:37:32 -07:00
|
|
|
--- a/dlls/dinput/joystick.c
|
|
|
|
+++ b/dlls/dinput/joystick.c
|
2019-10-10 19:30:46 -07:00
|
|
|
@@ -28,8 +28,10 @@
|
2019-05-02 17:37:32 -07:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
+#include "device_private.h"
|
|
|
|
#include "joystick_private.h"
|
|
|
|
#include "wine/debug.h"
|
2019-10-10 19:30:46 -07:00
|
|
|
+#include "wine/heap.h"
|
2019-05-02 17:37:32 -07:00
|
|
|
#include "winreg.h"
|
2019-10-10 19:30:46 -07:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
|
|
|
@@ -825,9 +827,32 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
|
2019-05-02 17:37:32 -07:00
|
|
|
JoystickGenericImpl *This = impl_from_IDirectInputDevice8W(iface);
|
|
|
|
unsigned int i, j;
|
|
|
|
BOOL has_actions = FALSE;
|
2019-10-10 19:30:46 -07:00
|
|
|
+ WCHAR *username;
|
|
|
|
+ DWORD size;
|
2019-05-02 17:37:32 -07:00
|
|
|
+ BOOL load_success = FALSE;
|
|
|
|
|
2019-05-09 15:53:33 -07:00
|
|
|
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", This, lpdiaf, debugstr_w(lpszUserName), dwFlags);
|
2019-05-02 17:37:32 -07:00
|
|
|
|
|
|
|
+ /* Unless asked the contrary by these flags, try to load a previous mapping */
|
|
|
|
+ if (!(dwFlags & DIDBAM_HWDEFAULTS))
|
|
|
|
+ {
|
2019-10-10 19:30:46 -07:00
|
|
|
+ if (!lpszUserName)
|
|
|
|
+ GetUserNameW(NULL, &size);
|
|
|
|
+ else
|
|
|
|
+ size = lstrlenW(lpszUserName) + 1;
|
|
|
|
+
|
|
|
|
+ username = heap_alloc(size * sizeof(WCHAR));
|
|
|
|
+ if (!lpszUserName)
|
|
|
|
+ GetUserNameW(username, &size);
|
2019-05-02 17:37:32 -07:00
|
|
|
+ else
|
2019-10-10 19:30:46 -07:00
|
|
|
+ lstrcpynW(username, lpszUserName, size);
|
2019-05-02 17:37:32 -07:00
|
|
|
+
|
|
|
|
+ load_success = load_mapping_settings((IDirectInputDeviceImpl *) This, lpdiaf, username);
|
2019-10-10 19:30:46 -07:00
|
|
|
+ heap_free(username);
|
2019-05-02 17:37:32 -07:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (load_success) return DI_OK;
|
|
|
|
+
|
|
|
|
for (i=0; i < lpdiaf->dwNumActions; i++)
|
|
|
|
{
|
|
|
|
DWORD inst = (0x000000ff & (lpdiaf->rgoAction[i].dwSemantic)) - 1;
|
|
|
|
--
|
2019-10-10 19:30:46 -07:00
|
|
|
2.17.1
|
2019-05-02 17:37:32 -07:00
|
|
|
|