Rebase against d62e2268d77c237e8430e158bb337958d88486ba.

This commit is contained in:
Alistair Leslie-Hughes 2023-03-28 18:40:22 +11:00
parent 7bcf1f6358
commit df3886edb6
2 changed files with 1 additions and 75 deletions

View File

@ -1,74 +0,0 @@
From f1c2e802d382007f8b4de0ddb9f8d23b24073747 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 24 May 2019 16:16:13 +1000
Subject: [PATCH] dinput: Allow mapping of controls based of Genre type.
---
dlls/dinput/device.c | 41 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index b010dc8dbf0..ed7bd5ae64a 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -2020,8 +2020,15 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
/* Count the actions */
for (i = 0; i < format->dwNumActions; i++)
- if (IsEqualGUID( &impl->guid, &format->rgoAction[i].guidInstance ))
+ {
+ if (IsEqualGUID(&impl->guid, &format->rgoAction[i].guidInstance) ||
+ (IsEqualGUID(&IID_NULL, &format->rgoAction[i].guidInstance) &&
+ ((format->rgoAction[i].dwSemantic & format->dwGenre) == format->dwGenre ||
+ (format->rgoAction[i].dwSemantic & 0xff000000) == 0xff000000 /* Any Axis */) ))
+ {
num_actions++;
+ }
+ }
if (num_actions == 0) return DI_NOEFFECT;
@@ -2054,8 +2061,40 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
action++;
}
+ else if ((format->rgoAction[i].dwSemantic & format->dwGenre) == format->dwGenre ||
+ (format->rgoAction[i].dwSemantic & 0xff000000) == 0xff000000 /* Any Axis */)
+ {
+ DWORD obj_id = semantic_to_obj_id(impl, format->rgoAction[i].dwSemantic);
+ DWORD type = DIDFT_GETTYPE(obj_id);
+ DWORD inst = DIDFT_GETINSTANCE(obj_id);
+ LPDIOBJECTDATAFORMAT obj;
+
+ if (type == DIDFT_PSHBUTTON) type = DIDFT_BUTTON;
+ else if (type == DIDFT_RELAXIS) type = DIDFT_AXIS;
+
+ obj = dataformat_to_odf_by_type(df, inst, type);
+ TRACE("obj %p, inst 0x%08lx, type 0x%08lx\n", obj, inst, type);
+ if(obj)
+ {
+ memcpy(&obj_df[action], obj, df->dwObjSize);
+
+ impl->action_map[action].uAppData = format->rgoAction[i].uAppData;
+ impl->action_map[action].offset = offset;
+ obj_df[action].dwOfs = offset;
+ offset += (type & DIDFT_BUTTON) ? 1 : 4;
+
+ action++;
+ }
+ }
}
+ if (action == 0)
+ {
+ free( obj_df );
+ return DI_NOEFFECT;
+ }
+ data_format.dwNumObjs = action;
+
IDirectInputDevice8_SetDataFormat( iface, &data_format );
impl->action_map = action_map;
--
2.39.0

View File

@ -1 +1 @@
3149d27220acaf276bfa651e040ff006edcd6944
d62e2268d77c237e8430e158bb337958d88486ba