VIDEO: Issue reasonable failure message when SDL can't initialize
This commit is contained in:
parent
1571ba461b
commit
627c7e3e25
1 changed files with 23 additions and 9 deletions
28
sim_video.c
28
sim_video.c
|
@ -406,17 +406,22 @@ main_argv = argv;
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
_XInitThreads();
|
_XInitThreads();
|
||||||
SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
|
status = SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
|
||||||
|
|
||||||
vid_main_thread_handle = SDL_CreateThread (main_thread , NULL);
|
vid_main_thread_handle = SDL_CreateThread (main_thread , NULL);
|
||||||
#else
|
#else
|
||||||
SDL_SetHint (SDL_HINT_RENDER_DRIVER, "software");
|
SDL_SetHint (SDL_HINT_RENDER_DRIVER, "software");
|
||||||
|
|
||||||
SDL_Init (SDL_INIT_VIDEO);
|
status = SDL_Init (SDL_INIT_VIDEO);
|
||||||
|
|
||||||
vid_main_thread_handle = SDL_CreateThread (main_thread , "simh-main", NULL);
|
vid_main_thread_handle = SDL_CreateThread (main_thread , "simh-main", NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
fprintf (stderr, "SDL Video subsystem can't initialize\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
sim_os_set_thread_priority (PRIORITY_ABOVE_NORMAL);
|
sim_os_set_thread_priority (PRIORITY_ABOVE_NORMAL);
|
||||||
|
|
||||||
vid_beep_setup (400, 660);
|
vid_beep_setup (400, 660);
|
||||||
|
@ -558,12 +563,12 @@ if (vid_active) {
|
||||||
|
|
||||||
while (SDL_PushEvent (&user_event) < 0)
|
while (SDL_PushEvent (&user_event) < 0)
|
||||||
sim_os_ms_sleep (10);
|
sim_os_ms_sleep (10);
|
||||||
|
vid_dev = NULL;
|
||||||
|
}
|
||||||
if (vid_thread_handle) {
|
if (vid_thread_handle) {
|
||||||
SDL_WaitThread (vid_thread_handle, &status);
|
SDL_WaitThread (vid_thread_handle, &status);
|
||||||
vid_thread_handle = NULL;
|
vid_thread_handle = NULL;
|
||||||
}
|
}
|
||||||
vid_dev = NULL;
|
|
||||||
}
|
|
||||||
while (vid_ready)
|
while (vid_ready)
|
||||||
sim_os_ms_sleep (10);
|
sim_os_ms_sleep (10);
|
||||||
if (vid_mouse_events.sem) {
|
if (vid_mouse_events.sem) {
|
||||||
|
@ -1800,14 +1805,20 @@ return 0;
|
||||||
|
|
||||||
int vid_thread (void *arg)
|
int vid_thread (void *arg)
|
||||||
{
|
{
|
||||||
|
int stat;
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
_XInitThreads();
|
_XInitThreads();
|
||||||
SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
|
stat = SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
|
||||||
#else
|
#else
|
||||||
SDL_SetHint (SDL_HINT_RENDER_DRIVER, "software");
|
SDL_SetHint (SDL_HINT_RENDER_DRIVER, "software");
|
||||||
|
|
||||||
SDL_Init (SDL_INIT_VIDEO);
|
stat = SDL_Init (SDL_INIT_VIDEO);
|
||||||
#endif
|
#endif
|
||||||
|
if (stat) {
|
||||||
|
sim_printf ("SDL Video subsystem can't initialize\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
vid_beep_setup (400, 660);
|
vid_beep_setup (400, 660);
|
||||||
vid_video_events ();
|
vid_video_events ();
|
||||||
vid_beep_cleanup ();
|
vid_beep_cleanup ();
|
||||||
|
@ -1864,7 +1875,10 @@ fprintf (st, " SDL Events being processed on the main process thread\n");
|
||||||
#endif
|
#endif
|
||||||
if (!vid_active) {
|
if (!vid_active) {
|
||||||
#if !defined (SDL_MAIN_AVAILABLE)
|
#if !defined (SDL_MAIN_AVAILABLE)
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
int stat = SDL_Init(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
|
if (stat)
|
||||||
|
return sim_messagef (SCPE_OPENERR, "SDL_Init() failed. Video subsystem is unavailable.\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue