429 |
|
} |
430 |
|
fclose(proc_file); |
431 |
|
} else { |
432 |
+ |
char str[256]; |
433 |
|
sprintf(str, GetString(STR_PROC_CPUINFO_WARN), strerror(errno)); |
434 |
|
WarningAlert(str); |
435 |
|
} |
668 |
|
return true; |
669 |
|
} |
670 |
|
|
671 |
< |
int main(int argc, char **argv) |
671 |
> |
static bool init_sdl() |
672 |
|
{ |
673 |
< |
char str[256]; |
674 |
< |
bool memory_mapped_from_zero, ram_rom_areas_contiguous; |
675 |
< |
const char *vmdir = NULL; |
673 |
> |
int sdl_flags = 0; |
674 |
> |
#ifdef USE_SDL_VIDEO |
675 |
> |
sdl_flags |= SDL_INIT_VIDEO; |
676 |
> |
#endif |
677 |
> |
#ifdef USE_SDL_AUDIO |
678 |
> |
sdl_flags |= SDL_INIT_AUDIO; |
679 |
> |
#endif |
680 |
> |
assert(sdl_flags != 0); |
681 |
|
|
682 |
|
#ifdef USE_SDL_VIDEO |
683 |
|
// Don't let SDL block the screensaver |
687 |
|
setenv("SDL_HAS3BUTTONMOUSE", "1", TRUE); |
688 |
|
#endif |
689 |
|
|
690 |
+ |
if (SDL_Init(sdl_flags) == -1) { |
691 |
+ |
char str[256]; |
692 |
+ |
sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError()); |
693 |
+ |
ErrorAlert(str); |
694 |
+ |
return false; |
695 |
+ |
} |
696 |
+ |
atexit(SDL_Quit); |
697 |
+ |
|
698 |
+ |
// Don't let SDL catch SIGINT and SIGTERM signals |
699 |
+ |
signal(SIGINT, SIG_DFL); |
700 |
+ |
signal(SIGTERM, SIG_DFL); |
701 |
+ |
return true; |
702 |
+ |
} |
703 |
+ |
|
704 |
+ |
int main(int argc, char **argv) |
705 |
+ |
{ |
706 |
+ |
char str[256]; |
707 |
+ |
bool memory_mapped_from_zero, ram_rom_areas_contiguous; |
708 |
+ |
const char *vmdir = NULL; |
709 |
+ |
|
710 |
|
// Initialize variables |
711 |
|
RAMBase = 0; |
712 |
|
tzset(); |
797 |
|
|
798 |
|
#ifdef USE_SDL |
799 |
|
// Initialize SDL system |
800 |
< |
int sdl_flags = 0; |
775 |
< |
#ifdef USE_SDL_VIDEO |
776 |
< |
sdl_flags |= SDL_INIT_VIDEO; |
777 |
< |
#endif |
778 |
< |
#ifdef USE_SDL_AUDIO |
779 |
< |
sdl_flags |= SDL_INIT_AUDIO; |
780 |
< |
#endif |
781 |
< |
assert(sdl_flags != 0); |
782 |
< |
if (SDL_Init(sdl_flags) == -1) { |
783 |
< |
char str[256]; |
784 |
< |
sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError()); |
785 |
< |
ErrorAlert(str); |
800 |
> |
if (!init_sdl()) |
801 |
|
goto quit; |
787 |
– |
} |
788 |
– |
atexit(SDL_Quit); |
789 |
– |
|
790 |
– |
// Don't let SDL catch SIGINT and SIGTERM signals |
791 |
– |
signal(SIGINT, SIG_DFL); |
792 |
– |
signal(SIGTERM, SIG_DFL); |
802 |
|
#endif |
803 |
|
|
804 |
|
#ifndef USE_SDL_VIDEO |