Skip to content

Commit f9a2920

Browse files
committed
HACK: win32u: Report underlying VID/PID in Steam Input hooks emulation.
CW-Bug-Id: #23185
1 parent 2e778c6 commit f9a2920

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

dlls/win32u/rawinput.c

+29-3
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,30 @@ UINT WINAPI NtUserGetRawInputDeviceList( RAWINPUTDEVICELIST *device_list, UINT *
531531
return count;
532532
}
533533

534+
static BOOL steam_input_get_vid_pid( UINT slot, UINT16 *vid, UINT16 *pid )
535+
{
536+
const char *info = getenv( "SteamVirtualGamepadInfo" );
537+
char buffer[256];
538+
UINT current;
539+
FILE *file;
540+
541+
TRACE( "reading SteamVirtualGamepadInfo %s\n", debugstr_a(info) );
542+
543+
if (!info || !(file = fopen( info, "r" ))) return FALSE;
544+
while (fscanf( file, "%255[^\n]\n", buffer ) == 1)
545+
{
546+
if (sscanf( buffer, "[slot %d]", &current )) continue;
547+
if (current < slot) continue;
548+
if (current > slot) break;
549+
if (sscanf( buffer, "VID=0x%hx", vid )) continue;
550+
if (sscanf( buffer, "PID=0x%hx", pid )) continue;
551+
}
552+
553+
fclose( file );
554+
555+
return TRUE;
556+
}
557+
534558
/**********************************************************************
535559
* NtUserGetRawInputDeviceInfo (win32u.@)
536560
*/
@@ -590,9 +614,11 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data
590614
buffer[size] = 0;
591615
if (sscanf( buffer, "%02u", &slot ) != 1) slot = 0;
592616

593-
/* FIXME: Return the actual underlying device VID / PID somehow */
594-
vid = 0x045e;
595-
pid = 0x028e;
617+
if (!steam_input_get_vid_pid( slot, &vid, &pid ))
618+
{
619+
vid = 0x045e;
620+
pid = 0x028e;
621+
}
596622

597623
size = snprintf( buffer, ARRAY_SIZE(buffer), "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%04X&%04X", vid, pid );
598624
if ((tmpW = wcschr( device->path + 29, '&' )))

0 commit comments

Comments
 (0)