+
+static void vga_screen_dump_graphic(VGAState *s, const char *filename)
+{
+ int w, h;
+
+ s->get_resolution(s, &w, &h);
+ vga_screen_dump_common(s, filename, w, h);
+}
+
+static void vga_screen_dump_text(VGAState *s, const char *filename)
+{
+ int w, h, cwidth, cheight;
+
+ vga_get_text_resolution(s, &w, &h, &cwidth, &cheight);
+ vga_screen_dump_common(s, filename, w * cwidth, h * cheight);
+}
+
+/* save the vga display in a PPM image even if no display is
+ available */
+static void vga_screen_dump(void *opaque, const char *filename)
+{
+ VGAState *s = (VGAState *)opaque;
+
+ if (!(s->ar_index & 0x20))
+ vga_screen_dump_blank(s, filename);
+ else if (s->gr[6] & 1)
+ vga_screen_dump_graphic(s, filename);
+ else
+ vga_screen_dump_text(s, filename);
+}