Skip to contentSkip to conversation

Make the SDL_main workaround more generic

PATCH New Filip Navara 1 participant 1 message Jun 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make the SDL_main workaround more generic

SDL 1.3 mostly removes the need for SDL_main on the mainstream platforms (including MacOS X and Win32). Current stable release requires it though, so support it properly for all the SDL platforms instead of just Win32 and MacOS X.

---
 vl.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
vl.c +13 -13
index 3a99ee0..7c98c14 100644
@@ -103,24 +103,15 @@
 #include <libvdeplug.h>
 #endif
 
+#ifdef CONFIG_SDL
+#include <SDL.h>
+#endif
+
 #ifdef _WIN32
 #include <windows.h>
 #include <mmsystem.h>
 #endif
 
-#ifdef CONFIG_SDL
-#if defined(__APPLE__) || defined(main)
-#include <SDL.h>
-int qemu_main(int argc, char **argv, char **envp);
-int main(int argc, char **argv)
-{
-    return qemu_main(argc, argv, NULL);
-}
-#undef main
-#define main qemu_main
-#endif
-#endif /* CONFIG_SDL */
-
 #ifdef CONFIG_COCOA
 #undef main
 #define main qemu_main
@@ -4949,7 +4940,12 @@ char *qemu_find_file(int type, const char *name)
     return buf;
 }
 
+/* SDL redefines the "main" function and requires a strict prototype */
+#ifdef main
+int main(int argc, char **argv)
+#else
 int main(int argc, char **argv, char **envp)
+#endif
 {
     const char *gdbstub_dev = NULL;
     uint32_t boot_devices_bitmap = 0;
@@ -4996,7 +4992,11 @@ int main(int argc, char **argv, char **envp)
     CPUState *env;
     int show_vnc_port = 0;
 
+#ifdef main
+    qemu_cache_utils_init(NULL);
+#else
     qemu_cache_utils_init(envp);
+#endif
 
     LIST_INIT (&vm_change_state_head);
 #ifndef _WIN32
Signature · 1 line
1.6.3.msysgit.0