mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
refactor init_sdl() into a function
This commit is contained in:
parent
d58da945c6
commit
c78c3046db
@ -667,11 +667,16 @@ static bool install_signal_handlers(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
static bool init_sdl()
|
||||||
{
|
{
|
||||||
char str[256];
|
int sdl_flags = 0;
|
||||||
bool memory_mapped_from_zero, ram_rom_areas_contiguous;
|
#ifdef USE_SDL_VIDEO
|
||||||
const char *vmdir = NULL;
|
sdl_flags |= SDL_INIT_VIDEO;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_SDL_AUDIO
|
||||||
|
sdl_flags |= SDL_INIT_AUDIO;
|
||||||
|
#endif
|
||||||
|
assert(sdl_flags != 0);
|
||||||
|
|
||||||
#ifdef USE_SDL_VIDEO
|
#ifdef USE_SDL_VIDEO
|
||||||
// Don't let SDL block the screensaver
|
// Don't let SDL block the screensaver
|
||||||
@ -681,6 +686,26 @@ int main(int argc, char **argv)
|
|||||||
setenv("SDL_HAS3BUTTONMOUSE", "1", TRUE);
|
setenv("SDL_HAS3BUTTONMOUSE", "1", TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (SDL_Init(sdl_flags) == -1) {
|
||||||
|
char str[256];
|
||||||
|
sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError());
|
||||||
|
ErrorAlert(str);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
atexit(SDL_Quit);
|
||||||
|
|
||||||
|
// Don't let SDL catch SIGINT and SIGTERM signals
|
||||||
|
signal(SIGINT, SIG_DFL);
|
||||||
|
signal(SIGTERM, SIG_DFL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
bool memory_mapped_from_zero, ram_rom_areas_contiguous;
|
||||||
|
const char *vmdir = NULL;
|
||||||
|
|
||||||
// Initialize variables
|
// Initialize variables
|
||||||
RAMBase = 0;
|
RAMBase = 0;
|
||||||
tzset();
|
tzset();
|
||||||
@ -771,25 +796,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef USE_SDL
|
#ifdef USE_SDL
|
||||||
// Initialize SDL system
|
// Initialize SDL system
|
||||||
int sdl_flags = 0;
|
if (!init_sdl())
|
||||||
#ifdef USE_SDL_VIDEO
|
|
||||||
sdl_flags |= SDL_INIT_VIDEO;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_SDL_AUDIO
|
|
||||||
sdl_flags |= SDL_INIT_AUDIO;
|
|
||||||
#endif
|
|
||||||
assert(sdl_flags != 0);
|
|
||||||
if (SDL_Init(sdl_flags) == -1) {
|
|
||||||
char str[256];
|
|
||||||
sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError());
|
|
||||||
ErrorAlert(str);
|
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
|
||||||
atexit(SDL_Quit);
|
|
||||||
|
|
||||||
// Don't let SDL catch SIGINT and SIGTERM signals
|
|
||||||
signal(SIGINT, SIG_DFL);
|
|
||||||
signal(SIGTERM, SIG_DFL);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_SDL_VIDEO
|
#ifndef USE_SDL_VIDEO
|
||||||
|
Loading…
Reference in New Issue
Block a user