82 lines
1.3 KiB
C
82 lines
1.3 KiB
C
#include "config.h"
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <SDL.h>
|
|
#include "libutils/utils.h"
|
|
#include "video.h"
|
|
|
|
static int
|
|
vm_maim(void)
|
|
{
|
|
SDL_Event event;
|
|
int run;
|
|
|
|
if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO) != 0)
|
|
{
|
|
fatal("SDL: %s", SDL_GetError());
|
|
}
|
|
|
|
monitor_setup();
|
|
run = 1;
|
|
while (run)
|
|
{
|
|
while(SDL_PollEvent(&event))
|
|
{
|
|
if(event.type == SDL_QUIT)
|
|
{
|
|
run = 0;
|
|
}
|
|
}
|
|
monitor_draw();
|
|
}
|
|
monitor_cleanup();
|
|
SDL_Quit();
|
|
return (EXIT_SUCCESS);
|
|
}
|
|
|
|
static void
|
|
usage(int retcode)
|
|
{
|
|
if (retcode == EXIT_FAILURE)
|
|
{
|
|
fprintf(stderr,
|
|
"Try '%s -h' for more information.\n", get_exec_name());
|
|
}
|
|
else
|
|
{
|
|
printf("Usage: %s [-hV] [-b bios]\n", get_exec_name());
|
|
printf("\t-h\tdisplay this help and exit\n");
|
|
printf("\t-V\toutput version information\n");
|
|
printf("\nReport bugs to <%s>\n", PACKAGE_BUGREPORT);
|
|
}
|
|
|
|
exit(retcode);
|
|
}
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
set_exec_name(argv[0]);
|
|
|
|
while ((argc > 1) && (argv[1][0] == '-'))
|
|
{
|
|
switch (argv[1][1])
|
|
{
|
|
case 'h':
|
|
usage(EXIT_SUCCESS);
|
|
break;
|
|
case 'V':
|
|
version();
|
|
break;
|
|
default:
|
|
usage(EXIT_FAILURE);
|
|
break;
|
|
}
|
|
|
|
argv++;
|
|
argc--;
|
|
}
|
|
|
|
return (vm_maim());
|
|
}
|