Fix: NRage plugin gets stuck in initialization in certain cases
The function wscanf was incorrectly used to parse VID_ and PID_ values from a string, causing failures in device detection. wscanf expects input from stdin, whereas in this case, the device ID string is stored in memory. Using swscanf ensures correct parsing from memory instead of waiting for stdin This fixes the issue where XInput devices not being detected properly at plugin init.
This commit is contained in:
parent
5e029ecf6a
commit
f25e86792d
|
@ -105,10 +105,10 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
// If it does, then get the VID/PID from var.bstrVal
|
||||
DWORD dwPid = 0, dwVid = 0;
|
||||
WCHAR* strVid = wcsstr( var.bstrVal, L"VID_" );
|
||||
if (strVid && wscanf(strVid, L"VID_%4X", &dwVid) != 1)
|
||||
if (strVid && swscanf(strVid, L"VID_%4X", &dwVid) != 1)
|
||||
dwVid = 0;
|
||||
WCHAR* strPid = wcsstr( var.bstrVal, L"PID_" );
|
||||
if (strPid && wscanf(strPid, L"PID_%4X", &dwPid) != 1)
|
||||
if (strPid && swscanf(strPid, L"PID_%4X", &dwPid) != 1)
|
||||
dwPid = 0;
|
||||
|
||||
// Compare the VID/PID to the DInput device
|
||||
|
|
Loading…
Reference in New Issue