Fixed SDL error when filtering events after shutdown.
This can happen when restoring video modes during video system shutdown
Use D3D9Ex when available
This hopefully works around crashes in Intel D3D9 support in Windows 8.1.
Fixed cast
Fixed Direct3DCreate9Ex prototype