Skip to contentSkip to conversation

Fix for ppc-softmmu and cocoa video driver

PATCH In review Pierre d'Herbemont 2 participants 3 messages Mar 2, 2005 – Mar 3, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for ppc-softmmu and cocoa video driver

Fabrice,

Here are two (tiny) fixes for the cocoa video driver. The first one enables compilation of the ppc-softmmu target with the cocoa driver. The second removes the following warning:
vl.c:3565: warning: implicit declaration of function `cocoa_display_init'

Thanks,

Pierre.

Index: cocoa.m
===================================================================
RCS file: /cvsroot/qemu/qemu/cocoa.m,v
retrieving revision 1.1

cocoa.m +3 -1
diff -u -r1.1 cocoa.m
@@ -34,9 +34,11 @@
               x  simple graphical prompt to demo
               -  better graphical prompt
 */
-#include "vl.h"
+
 #import <Cocoa/Cocoa.h>
 
+#include "vl.h"
+
 NSWindow *window = NULL;
 NSQuickDrawView *qd_view = NULL;
 

Index: vl.h
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.h,v
retrieving revision 1.67

vl.h +3 -0
diff -u -r1.67 vl.h
@@ -572,6 +572,9 @@
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen);
 
+/* sdl.c */
+void cocoa_display_init(DisplayState *ds, int full_screen);
+
 /* ide.c */
 #define MAX_DISKS 4
 
#1 lore raw

That works *much* better. :)

One issue that I found, which is really easy to fix, is that the Cocoa driver'd won't allow you to load disk images other than .img and .iso, which is a far cry from all the image types that QEMU actually supports. Attached is a patch which corrects this by adding cow, qcow, dmg, cloop, and vmdk to the allowable image types (strictly a suffix check).

As it is currently written, qemu in cocoa mode will always ask you to select the disk image via the cocoa open file dialog, even if you specified an image from the command-line. Would it be possible to have qemu only open the dialog box if an image was not selected from command-line?

- Dave

cocoa.m renamed from cocoa.m.orig +1 -1
@@ -427,7 +427,7 @@
         
         [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"];
         
-        [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",nil]
+        [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil]
               modalForWindow:window modalDelegate:self
               didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
     }

.

Quoted 13 lines · Pierre d'Herbemont

Fabrice,

Here are two (tiny) fixes for the cocoa video driver. The first one enables compilation of the ppc-softmmu target with the cocoa driver. The second removes the following warning:
vl.c:3565: warning: implicit declaration of function `cocoa_display_init'

Thanks,

Pierre.

<tinycocoadrvfixes.diff.txt>_______________________________________________ Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#2 lore raw
Quoted 2 lines · David Still

As it is currently written, qemu in cocoa mode will always ask you to select the disk image via the cocoa open file dialog, even if you specified an image from the command-line. Would it be possible to have qemu only open the dialog box if an image was not selected from command-line?

Here is a fix.

Pierre.

Index: cocoa.m
===================================================================
RCS file: /cvsroot/qemu/qemu/cocoa.m,v
retrieving revision 1.2

cocoa.m +10 -5
diff -u -r1.2 cocoa.m
@@ -416,8 +416,11 @@
 /* Called when the internal event loop has just started running */
 - (void)applicationDidFinishLaunching: (NSNotification *) note
 {
-    
-    /* Do whatever we want here : set up a pc list... */
+
+    /* Display an open dialog box if no argument were passed or
+       if qemu was launched from the finder ( the Finder passes "-psn" ) */
+
+    if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0)
     {
         NSOpenPanel *op = [[NSOpenPanel alloc] init];
         
@@ -431,9 +434,11 @@
               modalForWindow:window modalDelegate:self
               didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
     }
-    
-    /* or Launch Qemu, with the global args */
-    //[self startEmulationWithArgc:gArgc argv:gArgv];
+    else
+    {
+        /* or Launch Qemu, with the global args */
+        [self startEmulationWithArgc:gArgc argv:gArgv];
+    }
 }
 
 - (void)applicationWillTerminate:(NSNotification *)aNotification