[Scummvm-cvs-logs] SF.net SVN: scummvm: [21542] scummvm/trunk/base

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Apr 1 16:09:08 CEST 2006


Revision: 21542
Author:   fingolfin
Date:     2006-04-01 16:08:22 -0800 (Sat, 01 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21542&view=rev

Log Message:
-----------
Fully and officially renamed our main function to scummvm_main, thus making
various backend specific hacks unnecessary. As a consequence, it is now the
responsibility of the backend to define main. Hence I adapted the SDL backend
accordingly.

Modified Paths:
--------------
    scummvm/trunk/backends/dc/dcmain.cpp
    scummvm/trunk/backends/dc/portdefs.h
    scummvm/trunk/backends/gp32/gp32_main.cpp
    scummvm/trunk/backends/maemo/main.cpp
    scummvm/trunk/backends/maemo/portdefs.h
    scummvm/trunk/backends/morphos/morphos.h
    scummvm/trunk/backends/morphos/morphos_start.cpp
    scummvm/trunk/backends/ps2/systemps2.cpp
    scummvm/trunk/backends/psp/portdefs.h
    scummvm/trunk/backends/psp/psp_main.cpp
    scummvm/trunk/backends/sdl/sdl.cpp
    scummvm/trunk/backends/wince/wince-sdl.cpp
    scummvm/trunk/base/main.cpp
    scummvm/trunk/common/scummsys.h

Added Paths:
-----------
    scummvm/trunk/base/main.h
Modified: scummvm/trunk/backends/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/dc/dcmain.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/dc/dcmain.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -21,13 +21,11 @@
  *
  */
 
-
-#define REAL_MAIN
-
 #include <common/stdafx.h>
 #include <common/scummsys.h>
 #include <base/engine.h>
 #include <base/gameDetector.h>
+#include <base/main.h>
 #include <base/plugins.h>
 #include "dc.h"
 #include "icon.h"
@@ -205,7 +203,6 @@
   init_arm();
 }
 
-extern "C" int scummvm_main(int argc, char *argv[]);
 int main()
 {
   static char *argv[] = { "scummvm", NULL, };

Modified: scummvm/trunk/backends/dc/portdefs.h
===================================================================
--- scummvm/trunk/backends/dc/portdefs.h	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/dc/portdefs.h	2006-04-02 00:08:22 UTC (rev 21542)
@@ -37,6 +37,3 @@
 #ifdef Timer
 #undef Timer
 #endif
-#ifndef REAL_MAIN
-#define main scummvm_main
-#endif

Modified: scummvm/trunk/backends/gp32/gp32_main.cpp
===================================================================
--- scummvm/trunk/backends/gp32/gp32_main.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/gp32/gp32_main.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -26,6 +26,8 @@
 
 #include "common/config-manager.h"
 
+#include "base/main.h"
+
 #include "backends/gp32/gp32std.h"
 #include "backends/gp32/gp32std_grap.h"
 
@@ -34,8 +36,6 @@
 
 GlobalVars g_vars;
 
-extern "C" int scummvm_main(int argc, char *argv[]);
-
 void init() {
 	gp_setCpuSpeed(40); // Default CPU Speed
 

Modified: scummvm/trunk/backends/maemo/main.cpp
===================================================================
--- scummvm/trunk/backends/maemo/main.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/maemo/main.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -20,7 +20,6 @@
  *
  */
  
-#define	REAL_MAIN
 #include <common/stdafx.h>
 #include <common/scummsys.h>
 #include <X11/Xlib.h> 
@@ -29,6 +28,7 @@
 #include <SDL/SDL.h>
 #include <SDL/SDL_syswm.h>
 
+#include "base/main.h"
 #include <hildon-widgets/hildon-app.h>
 #include <gtk/gtk.h>
 #include <libosso.h>
@@ -48,8 +48,6 @@
   XSPSetPixelDoubling(wminfo.info.x11.display, 0, enable);
 }
 
-extern "C" int scummvm_main(int argc, char *argv[]);
-
 int main(int argc, char *argv[]) {
     osso_context_t *osso_context;
 

Modified: scummvm/trunk/backends/maemo/portdefs.h
===================================================================
--- scummvm/trunk/backends/maemo/portdefs.h	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/maemo/portdefs.h	2006-04-02 00:08:22 UTC (rev 21542)
@@ -52,12 +52,6 @@
 /* Whether we should use i386 assembly routines */
 #undef USE_NASM
 
-#undef main
-
-#ifndef REAL_MAIN
-#define main scummvm_main
-#endif
-
 #include <stdio.h>
 #include <fcntl.h>
 #include <stdlib.h>

Modified: scummvm/trunk/backends/morphos/morphos.h
===================================================================
--- scummvm/trunk/backends/morphos/morphos.h	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/morphos/morphos.h	2006-04-02 00:08:22 UTC (rev 21542)
@@ -226,8 +226,6 @@
 #define AUTO_LOCK	 AutoLock cs(&CritSec);
 
 
-int morphos_main(int argc, char *argv[]);
-
 extern OSystem_MorphOS *TheSystem;
 
 #endif

Modified: scummvm/trunk/backends/morphos/morphos_start.cpp
===================================================================
--- scummvm/trunk/backends/morphos/morphos_start.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/morphos/morphos_start.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -37,6 +37,7 @@
 #include "common/stdafx.h"
 #include "scumm/scumm.h"
 #include "base/gameDetector.h"
+#include "base/main.h"
 #include "common/scaler.h"
 #include "sound/mididrv.h"
 #include "morphos.h"
@@ -433,6 +434,6 @@
 	if (ScummStory)
 		argv[argc++] = ScummStory;
 
-	return morphos_main(argc, argv);
+	return scummvm_main(argc, argv);
 }
 

Modified: scummvm/trunk/backends/ps2/systemps2.cpp
===================================================================
--- scummvm/trunk/backends/ps2/systemps2.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/ps2/systemps2.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -35,6 +35,7 @@
 #include "common/scummsys.h"
 #include "../intern.h"
 #include "base/engine.h"
+#include "base/main.h"
 #include "backends/ps2/systemps2.h"
 #include "backends/ps2/Gs2dScreen.h"
 #include "backends/ps2/ps2input.h"
@@ -98,8 +99,6 @@
 	return g_systemPs2;
 }
 
-extern "C" int scummvm_main(int argc, char *argv[]);
-
 extern "C" int main(int argc, char *argv[]) {
 	SifInitRpc(0);
 #ifndef USE_PS2LINK // reset the IOP if this is a CD build

Modified: scummvm/trunk/backends/psp/portdefs.h
===================================================================
--- scummvm/trunk/backends/psp/portdefs.h	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/psp/portdefs.h	2006-04-02 00:08:22 UTC (rev 21542)
@@ -51,12 +51,6 @@
 //#define printf  pspDebugScreenPrintf
 #define exit(x) printf("exit() called\n"); sceKernelSleepThread();
 
-#undef main
-
-#ifndef REAL_MAIN
-#define main scummvm_main
-#endif
-
 #endif /* PORTDEFS_H */
 
 

Modified: scummvm/trunk/backends/psp/psp_main.cpp
===================================================================
--- scummvm/trunk/backends/psp/psp_main.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/psp/psp_main.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -28,10 +28,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define	REAL_MAIN
 #include <common/stdafx.h>
 #include <common/scummsys.h>
 #include <base/engine.h>
+#include <base/main.h>
 #include <base/gameDetector.h>
 #include <base/plugins.h>
 
@@ -123,8 +123,6 @@
 }
 
 
-extern "C" int scummvm_main(int argc, char *argv[]);
-
 int main(void)
 {
 	//PSPDebugTrace("Init debug screen\n");

Modified: scummvm/trunk/backends/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/sdl/sdl.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/sdl/sdl.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -24,6 +24,7 @@
 #include "backends/sdl/sdl-common.h"
 #include "common/config-manager.h"
 #include "common/util.h"
+#include "base/main.h"
 
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
@@ -32,6 +33,12 @@
 #include "scummvm.xpm"
 
 
+#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(__MAEMO__)
+int main(int argc, char *argv[]) {
+	return scummvm_main(argc, argv);
+}
+#endif
+
 OSystem *OSystem_SDL_create() {
 	return new OSystem_SDL();
 }

Modified: scummvm/trunk/backends/wince/wince-sdl.cpp
===================================================================
--- scummvm/trunk/backends/wince/wince-sdl.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/backends/wince/wince-sdl.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -26,6 +26,7 @@
 #include "common/util.h"
 #include "base/gameDetector.h"
 #include "base/engine.h"
+#include "base/main.h"
 #include "base/plugins.h"
 #include "common/timer.h"
 
@@ -119,8 +120,6 @@
 
 // MAIN
 
-extern "C" int scummvm_main(GameDetector &gameDetector, int argc, char **argv);
-
 int handleException(EXCEPTION_POINTERS *exceptionPointers) {
 	CEException::writeException(TEXT("\\scummvmCrash"), exceptionPointers);
 	drawError("Unrecoverable exception occurred - see crash dump in latest \\scummvmCrash file");

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/base/main.cpp	2006-04-02 00:08:22 UTC (rev 21542)
@@ -155,12 +155,6 @@
 extern "C" int main(int argc, char *argv[]);
 #endif
 
-#if defined(MACOSX) || defined(QTOPIA) || defined(__SYMBIAN32__)
-#include <SDL.h>
-#elif !defined(__MORPHOS__) && !defined(__DC__) && !defined(__GP32__)
-#undef main
-#endif
-
 #if defined (ALLEGRO_BACKEND)
 #include "allegro.h"
 #endif
@@ -344,10 +338,8 @@
 
 #ifdef _WIN32_WCE
 extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]) {
-#elif defined(__PLAYSTATION2__) || defined(__PSP__) || defined(__GP32__) || defined(__MAEMO__)
-extern "C" int scummvm_main(int argc, char *argv[]) {
 #else
-extern "C" int main(int argc, char *argv[]) {
+extern "C" int scummvm_main(int argc, char *argv[]) {
 #endif
 	char *cfgFilename = NULL;
 	Common::String specialDebug = "";

Added: scummvm/trunk/base/main.h
===================================================================
--- scummvm/trunk/base/main.h	                        (rev 0)
+++ scummvm/trunk/base/main.h	2006-04-02 00:08:22 UTC (rev 21542)
@@ -0,0 +1,38 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001  Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id: scummsys.h 21500 2006-03-29 15:59:37Z fingolfin $
+ *
+ */
+
+#ifndef BASE_MAIN_H
+#define BASE_MAIN_H
+
+#include "common/scummsys.h"
+
+//
+// The scummvm main entry point, to be invoked by ports
+//
+#ifdef _WIN32_WCE
+extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]);
+#else
+extern "C" int scummvm_main(int argc, char *argv[]);
+#endif
+
+#endif


Property changes on: scummvm/trunk/base/main.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Date Rev Author URL Id"
Name: svn:eol-style
   + native

Modified: scummvm/trunk/common/scummsys.h
===================================================================
--- scummvm/trunk/common/scummsys.h	2006-04-01 23:31:51 UTC (rev 21541)
+++ scummvm/trunk/common/scummsys.h	2006-04-02 00:08:22 UTC (rev 21542)
@@ -20,6 +20,7 @@
  * $Id$
  *
  */
+
 #ifndef COMMON_SCUMMSYS_H
 #define COMMON_SCUMMSYS_H
 
@@ -200,8 +201,6 @@
 		#define END_PACK_STRUCTS   pack ()
 	#endif
 
-	#define main morphos_main
-
 #elif defined(__DC__)
 
 	#define scumm_stricmp strcasecmp
@@ -386,7 +385,6 @@
 #endif
 
 
-
 //
 // Overlay color type (FIXME: shouldn't be declared here)
 //
@@ -398,4 +396,5 @@
 	typedef int16 OverlayColor;
 #endif
 
+
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list