diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp index 0955836bdd5..d622c350196 100644 --- a/backends/dc/dcmain.cpp +++ b/backends/dc/dcmain.cpp @@ -21,13 +21,11 @@ * */ - -#define REAL_MAIN - #include #include #include #include +#include #include #include "dc.h" #include "icon.h" @@ -205,7 +203,6 @@ void dc_init_hardware() init_arm(); } -extern "C" int scummvm_main(int argc, char *argv[]); int main() { static char *argv[] = { "scummvm", NULL, }; diff --git a/backends/dc/portdefs.h b/backends/dc/portdefs.h index 1217810ef5a..cedfd5c0fed 100644 --- a/backends/dc/portdefs.h +++ b/backends/dc/portdefs.h @@ -37,6 +37,3 @@ #ifdef Timer #undef Timer #endif -#ifndef REAL_MAIN -#define main scummvm_main -#endif diff --git a/backends/gp32/gp32_main.cpp b/backends/gp32/gp32_main.cpp index cf636fdba41..8abdb4a7ce0 100644 --- a/backends/gp32/gp32_main.cpp +++ b/backends/gp32/gp32_main.cpp @@ -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 diff --git a/backends/maemo/main.cpp b/backends/maemo/main.cpp index 7ef2bfd2f11..231f3191587 100644 --- a/backends/maemo/main.cpp +++ b/backends/maemo/main.cpp @@ -20,7 +20,6 @@ * */ -#define REAL_MAIN #include #include #include @@ -29,6 +28,7 @@ #include #include +#include "base/main.h" #include #include #include @@ -48,8 +48,6 @@ void set_doubling(unsigned char enable) { 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; diff --git a/backends/maemo/portdefs.h b/backends/maemo/portdefs.h index 82894331b33..f825e5c4e21 100644 --- a/backends/maemo/portdefs.h +++ b/backends/maemo/portdefs.h @@ -52,12 +52,6 @@ typedef signed int int32; /* Whether we should use i386 assembly routines */ #undef USE_NASM -#undef main - -#ifndef REAL_MAIN -#define main scummvm_main -#endif - #include #include #include diff --git a/backends/morphos/morphos.h b/backends/morphos/morphos.h index 46d35689c0c..7f919f70801 100644 --- a/backends/morphos/morphos.h +++ b/backends/morphos/morphos.h @@ -226,8 +226,6 @@ class AutoLock #define AUTO_LOCK AutoLock cs(&CritSec); -int morphos_main(int argc, char *argv[]); - extern OSystem_MorphOS *TheSystem; #endif diff --git a/backends/morphos/morphos_start.cpp b/backends/morphos/morphos_start.cpp index f19a96983e7..f7ec56f2249 100644 --- a/backends/morphos/morphos_start.cpp +++ b/backends/morphos/morphos_start.cpp @@ -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 @@ int main() if (ScummStory) argv[argc++] = ScummStory; - return morphos_main(argc, argv); + return scummvm_main(argc, argv); } diff --git a/backends/ps2/systemps2.cpp b/backends/ps2/systemps2.cpp index 7262000986e..d0154ab590b 100644 --- a/backends/ps2/systemps2.cpp +++ b/backends/ps2/systemps2.cpp @@ -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 @@ OSystem *OSystem_PS2_create(void) { 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 diff --git a/backends/psp/portdefs.h b/backends/psp/portdefs.h index 558b218f906..a63c8ff39e0 100644 --- a/backends/psp/portdefs.h +++ b/backends/psp/portdefs.h @@ -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 */ diff --git a/backends/psp/psp_main.cpp b/backends/psp/psp_main.cpp index b4af6dbbe7e..d981c314dc2 100644 --- a/backends/psp/psp_main.cpp +++ b/backends/psp/psp_main.cpp @@ -28,10 +28,10 @@ #include #include -#define REAL_MAIN #include #include #include +#include #include #include @@ -123,8 +123,6 @@ int SetupCallbacks(void) } -extern "C" int scummvm_main(int argc, char *argv[]); - int main(void) { //PSPDebugTrace("Init debug screen\n"); diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 74dbb969e99..b1da08c60e6 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -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(); } diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp index f8150d6f2c4..46c95f9ed5a 100644 --- a/backends/wince/wince-sdl.cpp +++ b/backends/wince/wince-sdl.cpp @@ -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 @@ bool isSmartphone() { // 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"); diff --git a/base/main.cpp b/base/main.cpp index a7eb30aff58..b3aff496412 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -155,12 +155,6 @@ const char* stackCookie = "$STACK: 655360\0"; extern "C" int main(int argc, char *argv[]); #endif -#if defined(MACOSX) || defined(QTOPIA) || defined(__SYMBIAN32__) -#include -#elif !defined(__MORPHOS__) && !defined(__DC__) && !defined(__GP32__) -#undef main -#endif - #if defined (ALLEGRO_BACKEND) #include "allegro.h" #endif @@ -344,10 +338,8 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String #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 = ""; diff --git a/base/main.h b/base/main.h new file mode 100644 index 00000000000..06b7e2cb5fb --- /dev/null +++ b/base/main.h @@ -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 diff --git a/common/scummsys.h b/common/scummsys.h index 05a9950c41a..2f38eec9923 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -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