WINRAW: Invert mouse order (#17376)

This commit is contained in:
sonninnos 2025-01-10 13:21:33 +02:00 committed by GitHub
parent 95dd1d8449
commit 17e9aabd25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,14 +128,14 @@ static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
char name[256];
UINT name_size = sizeof(name);
name[0] = '\0';
name[0] = '\0';
for (i = 0; i < mouse_cnt; ++i)
{
UINT r = GetRawInputDeviceInfoA(mice[i].hnd, RIDI_DEVICENAME,
name, &name_size);
if (r == (UINT)-1 || r == 0)
name[0] = '\0';
name[0] = '\0';
if (name[0])
{
@ -146,7 +146,7 @@ static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
if (hhid != INVALID_HANDLE_VALUE)
{
wchar_t prod_buf[128];
prod_buf[0] = '\0';
prod_buf[0] = '\0';
if (HidD_GetProductString(hhid, prod_buf, sizeof(prod_buf)))
wcstombs(name, prod_buf, sizeof(name));
}
@ -158,7 +158,7 @@ static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
input_config_set_mouse_display_name(i, name);
RARCH_LOG("[WinRaw]: Mouse #%u: \"%s\".\n", i, name);
RARCH_LOG("[WinRaw]: Mouse #%u: \"%s\".\n", i + 1, name);
}
}
@ -203,19 +203,23 @@ static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt)
}
}
*mouse_cnt = mouse_cnt_r;
/* count is already checked, so this is safe */
for (i = mouse_cnt_r = 0; i < dev_cnt; ++i)
{
if (devs[i].dwType == RIM_TYPEMOUSE)
mice_r[mouse_cnt_r++].hnd = devs[i].hDevice;
{
mouse_cnt_r++;
mice_r[*mouse_cnt - mouse_cnt_r].hnd = devs[i].hDevice;
}
}
*mice = mice_r;
winraw_log_mice_info(mice_r, mouse_cnt_r);
free(devs);
*mice = mice_r;
*mouse_cnt = mouse_cnt_r;
return true;
error: