Module: wine Branch: master Commit: b53df5dffbbc21ed0428f8fa41ebfb8e718f9816 URL: https://gitlab.winehq.org/wine/wine/-/commit/b53df5dffbbc21ed0428f8fa41ebfb8...
Author: Rémi Bernon rbernon@codeweavers.com Date: Sat Nov 26 20:43:09 2022 +0100
joy.cpl: Read the device instance name instead of storing it.
---
dlls/joy.cpl/main.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c index 43ffec51461..1a4286a6b92 100644 --- a/dlls/joy.cpl/main.c +++ b/dlls/joy.cpl/main.c @@ -78,7 +78,6 @@ struct effect struct Joystick { IDirectInputDevice8W *device; - DIDEVICEINSTANCEW instance; int num_buttons; int num_axes; BOOL forcefeedback; @@ -247,8 +246,6 @@ static BOOL CALLBACK enum_callback(const DIDEVICEINSTANCEW *instance, void *cont IDirectInput8_CreateDevice(data->di, &instance->guidInstance, &joystick->device, NULL); IDirectInputDevice8_SetDataFormat(joystick->device, &c_dfDIJoystick);
- joystick->instance = *instance; - caps.dwSize = sizeof(caps); IDirectInputDevice8_GetCapabilities(joystick->device, &caps);
@@ -400,8 +397,10 @@ static void refresh_joystick_list(HWND hwnd, struct JoystickData *data)
for (joy = data->joysticks, joy_end = joy + data->num_joysticks; joy != joy_end; ++joy) { - if (joy->is_xinput) SendDlgItemMessageW(hwnd, IDC_XINPUTLIST, LB_ADDSTRING, 0, (LPARAM) joy->instance.tszInstanceName); - else SendDlgItemMessageW(hwnd, IDC_JOYSTICKLIST, LB_ADDSTRING, 0, (LPARAM) joy->instance.tszInstanceName); + DIDEVICEINSTANCEW info = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + if (FAILED(IDirectInputDevice8_GetDeviceInfo( joy->device, &info ))) continue; + if (joy->is_xinput) SendDlgItemMessageW( hwnd, IDC_XINPUTLIST, LB_ADDSTRING, 0, (LPARAM)info.tszInstanceName ); + else SendDlgItemMessageW( hwnd, IDC_JOYSTICKLIST, LB_ADDSTRING, 0, (LPARAM)info.tszInstanceName ); }
/* Search for disabled joysticks */ @@ -760,7 +759,11 @@ static void refresh_test_joystick_list(HWND hwnd, struct JoystickData *data) struct Joystick *joy, *joy_end; SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_RESETCONTENT, 0, 0); for (joy = data->joysticks, joy_end = joy + data->num_joysticks; joy != joy_end; ++joy) - SendDlgItemMessageW(hwnd, IDC_TESTSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM)joy->instance.tszInstanceName); + { + DIDEVICEINSTANCEW info = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + if (FAILED(IDirectInputDevice8_GetDeviceInfo( joy->device, &info ))) continue; + SendDlgItemMessageW( hwnd, IDC_TESTSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM)info.tszInstanceName ); + } }
static INT_PTR CALLBACK test_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) @@ -956,7 +959,11 @@ static void refresh_ff_joystick_list(HWND hwnd, struct JoystickData *data) struct Joystick *joy, *joy_end; SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_RESETCONTENT, 0, 0); for (joy = data->joysticks, joy_end = joy + data->num_joysticks; joy != joy_end; ++joy) - SendDlgItemMessageW(hwnd, IDC_FFSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM)joy->instance.tszInstanceName); + { + DIDEVICEINSTANCEW info = {.dwSize = sizeof(DIDEVICEINSTANCEW)}; + if (FAILED(IDirectInputDevice8_GetDeviceInfo( joy->device, &info ))) continue; + SendDlgItemMessageW( hwnd, IDC_FFSELECTCOMBO, CB_ADDSTRING, 0, (LPARAM)info.tszInstanceName ); + } }
static INT_PTR CALLBACK ff_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)