From 75f3eede599ef2d45a0749610448e95b7eef7c04 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 11 Aug 2024 14:59:14 +1000 Subject: [PATCH] Added dinput-regression-fix patchset --- ...orrect-array-index-in-keyboard_creat.patch | 29 +++++++++++++++++++ patches/dinput-regression-fix/definition | 5 ++++ 2 files changed, 34 insertions(+) create mode 100644 patches/dinput-regression-fix/0001-dinput-Use-the-correct-array-index-in-keyboard_creat.patch create mode 100644 patches/dinput-regression-fix/definition diff --git a/patches/dinput-regression-fix/0001-dinput-Use-the-correct-array-index-in-keyboard_creat.patch b/patches/dinput-regression-fix/0001-dinput-Use-the-correct-array-index-in-keyboard_creat.patch new file mode 100644 index 00000000..17807a7a --- /dev/null +++ b/patches/dinput-regression-fix/0001-dinput-Use-the-correct-array-index-in-keyboard_creat.patch @@ -0,0 +1,29 @@ +From 434df65f9023ec64c175825e5b38cd9daf744565 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Aida=20Jonikien=C4=97?= +Date: Sat, 10 Aug 2024 22:20:30 +0300 +Subject: [PATCH] dinput: Use the correct array index in + keyboard_create_device(). + +This fixes a segfault when launching NFS Underground. + +Fixes: f434ea12b83 ("dinput: Implement DIPROP_SCANCODE.") +--- + dlls/dinput/keyboard.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c +index a83f825e97d..aee1d996dde 100644 +--- a/dlls/dinput/keyboard.c ++++ b/dlls/dinput/keyboard.c +@@ -211,7 +211,7 @@ HRESULT keyboard_create_device( struct dinput *dinput, const GUID *guid, IDirect + + if (FAILED(hr = dinput_device_init_device_format( &impl->base.IDirectInputDevice8W_iface ))) goto failed; + +- for (i = 0, index = 0; i < 512; ++i) ++ for (i = 0, index = 0; i < impl->base.device_format.dwNumObjs; ++i) + { + if (!GetKeyNameTextW( i << 16, instance.tszName, ARRAY_SIZE(instance.tszName) )) continue; + if (!(dik = map_dik_code( i, 0, subtype, impl->base.dinput->dwVersion ))) continue; +-- +2.43.0 + diff --git a/patches/dinput-regression-fix/definition b/patches/dinput-regression-fix/definition new file mode 100644 index 00000000..307361ac --- /dev/null +++ b/patches/dinput-regression-fix/definition @@ -0,0 +1,5 @@ +Fixes: Fix crash in NFS Underground +#Depends: dinput-joy-mappings +Depends: dinput-scancode + +# PR 6249