-loadvm and -full-screen options
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 3 Oct 2004 13:29:03 +0000 (13:29 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 3 Oct 2004 13:29:03 +0000 (13:29 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1090 c046a42c-6fe2-441c-8c8c-71466251a162

Changelog
qemu-doc.texi
sdl.c
vl.c
vl.h

index 150a52d..d3ed889 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version 0.6.1:
   - DHCP fix for Windows (accept DHCPREQUEST alone)
   - SPARC system emulation (Blue Swirl)
   - Automatic Samba configuration for host file access from Windows.
+  - '-loadvm' and '-full-screen' options
 
 version 0.6.0:
 
index 9e8eaf2..d7159a6 100644 (file)
@@ -199,6 +199,9 @@ Set the real time clock to local time (the default is to UTC
 time). This option is needed to have correct date in MS-DOS or
 Windows.
 
+@item -full-screen
+Start in full screen.
+
 @end table
 
 Network options:
@@ -345,7 +348,8 @@ Simulate an ISA-only system (default is PCI system).
 @item -std-vga
 Simulate a standard VGA card with Bochs VBE extensions (default is
 Cirrus Logic GD5446 PCI VGA)
-
+@item -loadvm file
+Start right away with a saved state (@code{loadvm} in monitor)
 @end table
 
 @c man end
diff --git a/sdl.c b/sdl.c
index fc23ea9..c089f56 100644 (file)
--- a/sdl.c
+++ b/sdl.c
@@ -40,6 +40,7 @@ static int gui_saved_grab;
 static int gui_fullscreen;
 static int gui_key_modifier_pressed;
 static int gui_keysym;
+static int gui_fullscreen_initial_grab;
 
 static void sdl_update(DisplayState *ds, int x, int y, int w, int h)
 {
@@ -525,7 +526,8 @@ static void sdl_refresh(DisplayState *ds)
             }
             break;
         case SDL_ACTIVEEVENT:
-            if (gui_grab && (ev->active.gain & SDL_ACTIVEEVENTMASK) == 0) {
+            if (gui_grab && (ev->active.gain & SDL_ACTIVEEVENTMASK) == 0 &&
+                !gui_fullscreen_initial_grab) {
                 sdl_grab_end();
             }
             break;
@@ -540,7 +542,7 @@ static void sdl_cleanup(void)
     SDL_Quit();
 }
 
-void sdl_display_init(DisplayState *ds)
+void sdl_display_init(DisplayState *ds, int full_screen)
 {
     int flags;
 
@@ -566,4 +568,9 @@ void sdl_display_init(DisplayState *ds)
     gui_grab = 0;
 
     atexit(sdl_cleanup);
+    if (full_screen) {
+        gui_fullscreen = 1;
+        gui_fullscreen_initial_grab = 1;
+        sdl_grab_start();
+    }
 }
diff --git a/vl.c b/vl.c
index 22b1412..9fc76c7 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -129,6 +129,7 @@ int cirrus_vga_enabled = 1;
 int graphic_width = 800;
 int graphic_height = 600;
 int graphic_depth = 15;
+int full_screen = 0;
 TextConsole *vga_console;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 
@@ -2505,6 +2506,7 @@ void help(void)
            "-nographic      disable graphical output and redirect serial I/Os to console\n"
            "-enable-audio   enable audio support\n"
            "-localtime      set the real time clock to local time [default=utc]\n"
+           "-full-screen    start in full screen\n"
 #ifdef TARGET_PPC
            "-prep           Simulate a PREP system (default is PowerMAC)\n"
            "-g WxH[xDEPTH]  Set the initial VGA graphic mode\n"
@@ -2548,6 +2550,7 @@ void help(void)
            "-std-vga        simulate a standard VGA card with VESA Bochs Extensions\n"
            "                (default is CL-GD5446 PCI VGA)\n"
 #endif
+           "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
            "\n"
            "During emulation, the following keys are useful:\n"
            "ctrl-shift-f    toggle full screen\n"
@@ -2622,6 +2625,8 @@ enum {
     QEMU_OPTION_std_vga,
     QEMU_OPTION_monitor,
     QEMU_OPTION_serial,
+    QEMU_OPTION_loadvm,
+    QEMU_OPTION_full_screen,
 };
 
 typedef struct QEMUOption {
@@ -2680,6 +2685,8 @@ const QEMUOption qemu_options[] = {
     { "std-vga", 0, QEMU_OPTION_std_vga },
     { "monitor", 1, QEMU_OPTION_monitor },
     { "serial", 1, QEMU_OPTION_serial },
+    { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
+    { "full-screen", 0, QEMU_OPTION_full_screen },
     
     /* temporary options */
     { "pci", 0, QEMU_OPTION_pci },
@@ -2759,6 +2766,7 @@ int main(int argc, char **argv)
     char monitor_device[128];
     char serial_devices[MAX_SERIAL_PORTS][128];
     int serial_device_index;
+    const char *loadvm = NULL;
     
 #if !defined(CONFIG_SOFTMMU)
     /* we never want that malloc() uses mmap() */
@@ -3080,6 +3088,12 @@ int main(int argc, char **argv)
                         sizeof(serial_devices[0]), optarg);
                 serial_device_index++;
                 break;
+           case QEMU_OPTION_loadvm:
+               loadvm = optarg;
+               break;
+            case QEMU_OPTION_full_screen:
+                full_screen = 1;
+                break;
             }
         }
     }
@@ -3264,7 +3278,7 @@ int main(int argc, char **argv)
         dumb_display_init(ds);
     } else {
 #ifdef CONFIG_SDL
-        sdl_display_init(ds);
+        sdl_display_init(ds, full_screen);
 #else
         dumb_display_init(ds);
 #endif
@@ -3365,6 +3379,9 @@ int main(int argc, char **argv)
         }
     } else 
 #endif
+    if (loadvm)
+        qemu_loadvm(loadvm);
+
     {
         /* XXX: simplify init */
         read_passwords();
diff --git a/vl.h b/vl.h
index 8151613..3eb1367 100644 (file)
--- a/vl.h
+++ b/vl.h
@@ -537,7 +537,7 @@ void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
                          unsigned long vga_ram_offset, int vga_ram_size);
 
 /* sdl.c */
-void sdl_display_init(DisplayState *ds);
+void sdl_display_init(DisplayState *ds, int full_screen);
 
 /* ide.c */
 #define MAX_DISKS 4