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.

svn-id: r21542
This commit is contained in:
Max Horn 2006-04-02 00:08:22 +00:00
parent a2c4795f32
commit 587431f8e8
15 changed files with 57 additions and 46 deletions

View File

@ -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 @@ void dc_init_hardware()
init_arm();
}
extern "C" int scummvm_main(int argc, char *argv[]);
int main()
{
static char *argv[] = { "scummvm", NULL, };

View File

@ -37,6 +37,3 @@
#ifdef Timer
#undef Timer
#endif
#ifndef REAL_MAIN
#define main scummvm_main
#endif

View File

@ -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

View File

@ -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 @@ 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;

View File

@ -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 <stdio.h>
#include <fcntl.h>
#include <stdlib.h>

View File

@ -226,8 +226,6 @@ class AutoLock
#define AUTO_LOCK AutoLock cs(&CritSec);
int morphos_main(int argc, char *argv[]);
extern OSystem_MorphOS *TheSystem;
#endif

View File

@ -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);
}

View File

@ -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

View File

@ -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 */

View File

@ -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 @@ int SetupCallbacks(void)
}
extern "C" int scummvm_main(int argc, char *argv[]);
int main(void)
{
//PSPDebugTrace("Init debug screen\n");

View File

@ -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();
}

View File

@ -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");

View File

@ -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 <SDL.h>
#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 = "";

38
base/main.h Normal file
View File

@ -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

View File

@ -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