xinput: check for valid function pointers before calling them

This commit is contained in:
Brad Parker 2017-12-23 23:02:29 -05:00
parent 9cd3746702
commit 6d484b7724
2 changed files with 5 additions and 1 deletions

View File

@ -40,6 +40,7 @@
- WINDOWS: Raw input driver now supports new lightgun code.
- WINDOWS: Use configured OSD/text message color on GDI driver.
- WINDOWS/XINPUT: Populate XInput VID/PID from DInput so autoconfig doesn't rely solely on joypad names
- WINDOWS/XINPUT: Fix crash that occurs in some situations with Steam running and a Steam Controller plugged in.
- WINDOWS: Improve version reporting under System Information.
- WINDOWS: Support window transparency.

View File

@ -475,7 +475,7 @@ static void xinput_joypad_poll(void)
{
if (g_xinput_states[i].connected)
{
if (g_XInputGetStateEx(i,
if (g_XInputGetStateEx && g_XInputGetStateEx(i,
&(g_xinput_states[i].xstate))
== ERROR_DEVICE_NOT_CONNECTED)
g_xinput_states[i].connected = false;
@ -507,6 +507,9 @@ static bool xinput_joypad_rumble(unsigned pad,
else if (effect == RETRO_RUMBLE_WEAK)
g_xinput_rumble_states[xuser].wRightMotorSpeed = strength;
if (!g_XInputSetState)
return false;
return (g_XInputSetState(xuser, &g_xinput_rumble_states[xuser])
== 0);
}