Add headless mode
This commit is contained in:
parent
c1652c34b0
commit
17f452bacf
|
@ -58,6 +58,7 @@ typedef struct {
|
|||
bool halted;
|
||||
|
||||
bool debug;
|
||||
bool headless;
|
||||
|
||||
bool mmu_enabled;
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ int main(int argc, char *argv[]) {
|
|||
" --disk DISK Specify a disk image to use\n"
|
||||
" --rom ROM Specify a ROM image to use\n"
|
||||
" --debug Enable debug output\n"
|
||||
" --headless Headless mode: don't open a window\n"
|
||||
, argv[0]);
|
||||
return 0;
|
||||
} else if (strcmp(argv[i], "--disk") == 0) {
|
||||
|
@ -78,11 +79,15 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
} else if (strcmp(argv[i], "--debug") == 0) {
|
||||
vm.debug = true;
|
||||
} else if (strcmp(argv[i], "--headless") == 0) {
|
||||
vm.headless = true;
|
||||
} else {
|
||||
fprintf(stderr, "unrecognized option %s\n", argv[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vm.headless) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||
fprintf(stderr, "unable to initialize SDL: %s", SDL_GetError());
|
||||
return 1;
|
||||
|
@ -103,6 +108,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
ScreenInit();
|
||||
ScreenDraw();
|
||||
}
|
||||
|
||||
tick_start = SDL_GetTicks();
|
||||
tick_end = SDL_GetTicks();
|
||||
|
@ -158,6 +164,7 @@ void main_loop(void) {
|
|||
}
|
||||
|
||||
if ((ticks % TPF) == 0) {
|
||||
if (!vm.headless)
|
||||
ScreenDraw();
|
||||
fox32_raise(&vm, VSYNC_INTERRUPT_VECTOR);
|
||||
vm.halted = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user