win32: detect gamepad changes

This commit is contained in:
OV2 2013-05-03 20:18:51 +02:00
parent 532a76ddc0
commit 5b4df91b41
2 changed files with 13 additions and 3 deletions

View File

@ -980,6 +980,13 @@ void S9xWinScanJoypads ()
#endif
}
void S9xDetectJoypads()
{
for (int C = 0; C != 16; C ++)
Joystick[C].Attached = joyGetDevCaps (JOYSTICKID1+C, &Joystick[C].Caps,
sizeof( JOYCAPS)) == JOYERR_NOERROR;
}
void InitSnes9X( void)
{
#ifdef DEBUGGER
@ -1023,9 +1030,7 @@ void InitSnes9X( void)
S9xMovieInit ();
for (int C = 0; C != 16; C ++)
Joystick[C].Attached = joyGetDevCaps (JOYSTICKID1+C, &Joystick[C].Caps,
sizeof( JOYCAPS)) == JOYERR_NOERROR;
S9xDetectJoypads();
}
void DeinitS9x()
{

View File

@ -282,6 +282,8 @@ HRESULT CALLBACK EnumModesCallback( LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpCo
VOID CALLBACK HotkeyTimer( UINT idEvent, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
void S9xDetectJoypads();
#define NOTKNOWN "Unknown Company "
#define HEADER_SIZE 512
#define INFO_LEN (0xFF - 0xC0)
@ -2685,6 +2687,9 @@ LRESULT CALLBACK WinProc(
#endif
break;
#endif
case WM_DEVICECHANGE:
S9xDetectJoypads();
break;
}
return DefWindowProc (hWnd, uMsg, wParam, lParam);
}