From be9d4066e147e1f7eebd5b554f11b876f93f3ae9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Sep 2003 02:07:18 +0000 Subject: moved engine.* to base; this fixes some linking issues when building a barebone ScummVM (or maybe I just want to increase our CVS stats? ) svn-id: r10287 --- backends/PalmOS/Src/palmsave.cpp | 2 +- backends/dc/audio.cpp | 2 +- backends/dc/dc-fs.cpp | 2 +- backends/dc/dcmain.cpp | 2 +- backends/dc/display.cpp | 2 +- backends/dc/selector.cpp | 2 +- backends/dc/vmsave.cpp | 2 +- backends/fs/morphos/abox-fs.cpp | 2 +- backends/gp32/gp32.h | 2 +- backends/midi/adlib.cpp | 2 +- backends/midi/morphos.cpp | 2 +- backends/midi/ypa1.cpp | 2 +- backends/x11/x11.cpp | 2 +- base/engine.cpp | 199 +++++++++++++++++++++++++++++++++++++++ base/engine.h | 88 +++++++++++++++++ base/gameDetector.cpp | 2 +- base/main.cpp | 2 +- base/module.mk | 1 + base/plugins.cpp | 2 +- common/config-file.cpp | 2 +- common/engine.cpp | 199 --------------------------------------- common/engine.h | 88 ----------------- common/module.mk | 1 - common/scummsys.h | 35 +------ common/util.cpp | 2 +- gui/PopUpWidget.cpp | 2 +- gui/about.cpp | 2 +- gui/console.cpp | 2 +- gui/launcher.cpp | 2 +- scumm/imuse_player.cpp | 2 +- scumm/player_v1.cpp | 2 +- scumm/player_v2.cpp | 2 +- scumm/player_v3a.cpp | 2 +- scumm/script.h | 2 +- scumm/scumm.h | 2 +- scumm/smush/smush_player.cpp | 2 +- simon/simon.h | 2 +- sky/control.h | 2 +- sky/disk.cpp | 2 +- sky/music/adlibchannel.h | 2 +- sky/music/adlibmusic.h | 2 +- sky/music/gmmusic.h | 2 +- sky/screen.h | 2 +- sky/sky.h | 2 +- sky/sound.h | 2 +- sound/audiostream.cpp | 2 +- sound/mpu401.cpp | 2 +- sound/rate.h | 2 +- sword2/driver/driver96.h | 2 +- sword2/driver/palette.cpp | 2 +- sword2/driver/rdwin.cpp | 2 +- sword2/resman.cpp | 2 +- 52 files changed, 334 insertions(+), 367 deletions(-) create mode 100644 base/engine.cpp create mode 100644 base/engine.h delete mode 100644 common/engine.cpp delete mode 100644 common/engine.h diff --git a/backends/PalmOS/Src/palmsave.cpp b/backends/PalmOS/Src/palmsave.cpp index caf2d1c885..44e4260300 100644 --- a/backends/PalmOS/Src/palmsave.cpp +++ b/backends/PalmOS/Src/palmsave.cpp @@ -22,7 +22,7 @@ #include #include "common/scummsys.h" -#include "common/engine.h" +#include "base/engine.h" #include "scumm/saveload.h" #include "palm.h" diff --git a/backends/dc/audio.cpp b/backends/dc/audio.cpp index cfb59cc60d..22c1015189 100644 --- a/backends/dc/audio.cpp +++ b/backends/dc/audio.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include "base/engine.h" #include "dc.h" EXTERN_C void *memcpy4(void *s1, const void *s2, unsigned int n); diff --git a/backends/dc/dc-fs.cpp b/backends/dc/dc-fs.cpp index 85e6de899b..f86ffb0522 100644 --- a/backends/dc/dc-fs.cpp +++ b/backends/dc/dc-fs.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include "base/engine.h" FilesystemNode *FilesystemNode::getRoot() { error ("No filesystem implemented for DC!"); diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp index 46cdc7b9ab..a9c758a578 100644 --- a/backends/dc/dcmain.cpp +++ b/backends/dc/dcmain.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include "base/engine.h" #include "dc.h" #include "icon.h" diff --git a/backends/dc/display.cpp b/backends/dc/display.cpp index 6ac642a37b..884ef8c32a 100644 --- a/backends/dc/display.cpp +++ b/backends/dc/display.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include "base/engine.h" #include "dc.h" #define SCREEN_W 640 diff --git a/backends/dc/selector.cpp b/backends/dc/selector.cpp index 13561531b1..c59b09b129 100644 --- a/backends/dc/selector.cpp +++ b/backends/dc/selector.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include "base/engine.h" #include #include "dc.h" #include "icon.h" diff --git a/backends/dc/vmsave.cpp b/backends/dc/vmsave.cpp index 8eaf06f83c..f9d00f8108 100644 --- a/backends/dc/vmsave.cpp +++ b/backends/dc/vmsave.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include "base/engine.h" #include "dc.h" #include "icon.h" #include diff --git a/backends/fs/morphos/abox-fs.cpp b/backends/fs/morphos/abox-fs.cpp index 203bd88330..05fcb23c1c 100644 --- a/backends/fs/morphos/abox-fs.cpp +++ b/backends/fs/morphos/abox-fs.cpp @@ -24,7 +24,7 @@ #include -#include "common/engine.h" +#include "base/engine.h" #include "../fs.h" /* diff --git a/backends/gp32/gp32.h b/backends/gp32/gp32.h index b38912ccf2..0b3f3dd338 100644 --- a/backends/gp32/gp32.h +++ b/backends/gp32/gp32.h @@ -25,7 +25,7 @@ #include "common/system.h" #include "common/scummsys.h" #include "common/stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "scumm/saveload.h" #include "common/scaler.h" diff --git a/backends/midi/adlib.cpp b/backends/midi/adlib.cpp index 5198609796..2205c56589 100644 --- a/backends/midi/adlib.cpp +++ b/backends/midi/adlib.cpp @@ -22,7 +22,7 @@ #include "sound/mididrv.h" #include "sound/fmopl.h" #include "sound/mixer.h" -#include "common/engine.h" // for g_system +#include "base/engine.h" // for g_system #include "common/util.h" #define BASE_FREQ 250 diff --git a/backends/midi/morphos.cpp b/backends/midi/morphos.cpp index 9e32b6293d..f75839cdd2 100644 --- a/backends/midi/morphos.cpp +++ b/backends/midi/morphos.cpp @@ -31,7 +31,7 @@ #include "stdafx.h" #include "sound/mpu401.h" -#include "common/engine.h" // for g_system +#include "base/engine.h" // for g_system #include "common/util.h" #include "morphos.h" #include "morphos_sound.h" diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp index c779d73ade..e2c12de70b 100644 --- a/backends/midi/ypa1.cpp +++ b/backends/midi/ypa1.cpp @@ -20,7 +20,7 @@ #include "stdafx.h" #include "sound/mpu401.h" -#include "common/engine.h" // for g_system +#include "base/engine.h" // for g_system #include "common/util.h" #include "Pa1Lib.h" diff --git a/backends/x11/x11.cpp b/backends/x11/x11.cpp index 29d394c86d..37b3ec69a4 100644 --- a/backends/x11/x11.cpp +++ b/backends/x11/x11.cpp @@ -24,7 +24,7 @@ #include "backends/intern.h" #include "common/util.h" -#include "common/engine.h" // Only #included for error() and warning() +#include "base/engine.h" // Only #included for error() and warning() #include #include diff --git a/base/engine.cpp b/base/engine.cpp new file mode 100644 index 0000000000..f7536dc769 --- /dev/null +++ b/base/engine.cpp @@ -0,0 +1,199 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#include "stdafx.h" +#if defined(_MSC_VER) +#include +#endif +#include "base/engine.h" +#include "base/gameDetector.h" +#include "common/config-file.h" +#include "common/timer.h" +#include "sound/mixer.h" + +/* FIXME - BIG HACK for MidiEmu */ +OSystem *g_system = 0; +Engine *g_engine = 0; + +Engine::Engine(GameDetector *detector, OSystem *syst) + : _system(syst) { + g_engine = this; + _mixer = detector->createMixer(); + + _gameDataPath = detector->_gameDataPath; + + g_system = _system; // FIXME - BIG HACK for MidiEmu + + _timer = new Timer(_system); +} + +Engine::~Engine() { + delete _mixer; + delete _timer; +} + +const char *Engine::getSavePath() const { + const char *dir = NULL; + +#ifdef _WIN32_WCE + dir = _gameDataPath; +#elif defined(__PALM_OS__) + dir = SCUMMVM_SAVEPATH; +#else + +#if !defined(MACOS_CARBON) + dir = getenv("SCUMMVM_SAVEPATH"); +#endif + + // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config + if (!dir || dir[0] == 0) + dir = g_config->get("savepath"); + + // If SCUMMVM_SAVEPATH was not specified, try to use general path from config + if (!dir || dir[0] == 0) + dir = g_config->get("savepath", "scummvm"); + + // If no save path was specified, use no directory prefix + if (dir == NULL) + dir = ""; +#endif + + return dir; +} + +void NORETURN CDECL error(const char *s, ...) { +#ifdef __PALM_OS__ + char buf_input[256]; // 1024 is too big overflow the stack + char buf_output[256]; +#else + char buf_input[1024]; + char buf_output[1024]; +#endif + va_list va; + + va_start(va, s); + vsprintf(buf_input, s, va); + va_end(va); + + if (g_engine) { + g_engine->errorString(buf_input, buf_output); + } else { + strcpy(buf_output, buf_input); + } + +#ifdef __GP32__ //ph0x FIXME? + printf("ERROR: %s\n", buf_output); +#else + fprintf(stderr, "%s!\n", buf_output); +#endif + +#if defined( USE_WINDBG ) +#if defined( _WIN32_WCE ) + TCHAR buf_output_unicode[1024]; + MultiByteToWideChar(CP_ACP, 0, buf_output, strlen(buf_output) + 1, buf_output_unicode, sizeof(buf_output_unicode)); + OutputDebugString(buf_output_unicode); +#else + OutputDebugString(buf_output); +#endif +#endif + +#if defined ( _WIN32_WCE ) + drawError(buf_output); +#endif + +#ifdef __PALM_OS__ + PalmFatalError(buf_output); +#endif + + // Finally exit. quit() will terminate the program if g_system iss present + if (g_system) + g_system->quit(); + + exit(1); +} + +void CDECL warning(const char *s, ...) { +#ifdef __PALM_OS__ + char buf[256]; // 1024 is too big overflow the stack +#else + char buf[1024]; +#endif + va_list va; + + va_start(va, s); + vsprintf(buf, s, va); + va_end(va); + +#ifdef __GP32__ //ph0x FIXME: implement fprint? + printf("WARNING: %s\n", buf); +#else + fprintf(stderr, "WARNING: %s!\n", buf); +#endif +#if defined( USE_WINDBG ) + strcat(buf, "\n"); +#if defined( _WIN32_WCE ) + TCHAR buf_unicode[1024]; + MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode)); + OutputDebugString(buf_unicode); +#else + OutputDebugString(buf); +#endif +#endif +} + +uint16 _debugLevel = 0; + +void CDECL debug(int level, const char *s, ...) { +#ifdef __PALM_OS__ + char buf[256]; // 1024 is too big overflow the stack +#else + char buf[1024]; +#endif + va_list va; + + if (level > _debugLevel) + return; + + va_start(va, s); + vsprintf(buf, s, va); + va_end(va); + printf("%s\n", buf); + +#if defined( USE_WINDBG ) + strcat(buf, "\n"); +#if defined( _WIN32_WCE ) + TCHAR buf_unicode[1024]; + MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode)); + OutputDebugString(buf_unicode); +#else + OutputDebugString(buf); +#endif +#endif + + fflush(stdout); +} + +void checkHeap() { +#if defined(_MSC_VER) + if (_heapchk() != _HEAPOK) { + error("Heap is invalid!"); + } +#endif +} diff --git a/base/engine.h b/base/engine.h new file mode 100644 index 0000000000..d62a4de3cd --- /dev/null +++ b/base/engine.h @@ -0,0 +1,88 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef ENGINE_H +#define ENGINE_H + +#include "common/scummsys.h" +#include "common/system.h" + +extern const char *gScummVMVersion; // e.g. "0.4.1" +extern const char *gScummVMBuildDate; // e.g. "2003-06-24" +extern const char *gScummVMFullVersion; // e.g. "ScummVM 0.4.1 (2003-06-24)" + +// TODO: Get rid of these enums. Ideally, GIDs should be +// 100% local to the module they are defined in. Right now +// we can't make this change since some of the backends +// and also gui/launcher.cpp contain tests on the GID. +// Ideally, all those should be converted to something else. +enum GameId { + GID_SCUMM_FIRST = 1, + GID_SCUMM_LAST = GID_SCUMM_FIRST + 99, + + // Simon the Sorcerer + GID_SIMON_FIRST, + GID_SIMON_LAST = GID_SIMON_FIRST + 49, + + // Beneath a Steel Sky + GID_SKY_FIRST, + GID_SKY_LAST = GID_SKY_FIRST + 49, + + // Broken Sword 2 + GID_SWORD2_FIRST, + GID_SWORD2_LAST = GID_SWORD2_FIRST + 49 +}; + + +class SoundMixer; +class GameDetector; +class Timer; +struct TargetSettings; + +/* FIXME - BIG HACK for MidiEmu */ +extern OSystem *g_system; + +class Engine { +public: + OSystem *_system; + SoundMixer *_mixer; + Timer * _timer; + +protected: + char *_gameDataPath; + +public: + Engine(GameDetector *detector, OSystem *syst); + virtual ~Engine(); + + // Invoke the main engine loop using this method + virtual void go() = 0; + + // Get the save game dir path + const char *getSavePath() const; + + // Specific for each engine preparare of erroe string + virtual void errorString(const char *buf_input, char *buf_output) = 0; +}; + +extern Engine *g_engine; + +#endif + diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index 02183415af..e05b747624 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -25,7 +25,7 @@ #include "base/gameDetector.h" #include "base/plugins.h" #include "common/config-file.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/scaler.h" // Only for gfx_modes #include "sound/mididrv.h" #include "sound/mixer.h" diff --git a/base/main.cpp b/base/main.cpp index f549c2b831..8bcbafc97c 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -29,10 +29,10 @@ */ #include "stdafx.h" +#include "base/engine.h" #include "base/gameDetector.h" #include "base/plugins.h" #include "common/config-file.h" -#include "common/engine.h" #include "common/scaler.h" // For GFX_NORMAL #include "gui/newgui.h" #include "gui/launcher.h" diff --git a/base/module.mk b/base/module.mk index e3af9b367c..0cf2943e25 100644 --- a/base/module.mk +++ b/base/module.mk @@ -1,6 +1,7 @@ MODULE := base MODULE_OBJS := \ + base/engine.o \ base/gameDetector.o \ base/main.o \ base/plugins.o diff --git a/base/plugins.cpp b/base/plugins.cpp index 0b5b909558..f3c16ac845 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -22,7 +22,7 @@ #include "base/gameDetector.h" #include "base/plugins.h" -#include "common/engine.h" +#include "base/engine.h" // Factory functions => no need to include the specific classes diff --git a/common/config-file.cpp b/common/config-file.cpp index 9294a6a52a..c24419258b 100644 --- a/common/config-file.cpp +++ b/common/config-file.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "common/config-file.h" -#include "common/engine.h" // for debug() +#include "base/engine.h" // for debug() #define MAXLINELEN 256 diff --git a/common/engine.cpp b/common/engine.cpp deleted file mode 100644 index 9f127fc53e..0000000000 --- a/common/engine.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* ScummVM - Scumm Interpreter - * Copyright (C) 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - */ - -#include "stdafx.h" -#if defined(_MSC_VER) -#include -#endif -#include "common/config-file.h" -#include "common/engine.h" -#include "base/gameDetector.h" -#include "common/timer.h" -#include "sound/mixer.h" - -/* FIXME - BIG HACK for MidiEmu */ -OSystem *g_system = 0; -Engine *g_engine = 0; - -Engine::Engine(GameDetector *detector, OSystem *syst) - : _system(syst) { - g_engine = this; - _mixer = detector->createMixer(); - - _gameDataPath = detector->_gameDataPath; - - g_system = _system; // FIXME - BIG HACK for MidiEmu - - _timer = new Timer(_system); -} - -Engine::~Engine() { - delete _mixer; - delete _timer; -} - -const char *Engine::getSavePath() const { - const char *dir = NULL; - -#ifdef _WIN32_WCE - dir = _gameDataPath; -#elif defined(__PALM_OS__) - dir = SCUMMVM_SAVEPATH; -#else - -#if !defined(MACOS_CARBON) - dir = getenv("SCUMMVM_SAVEPATH"); -#endif - - // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config - if (!dir || dir[0] == 0) - dir = g_config->get("savepath"); - - // If SCUMMVM_SAVEPATH was not specified, try to use general path from config - if (!dir || dir[0] == 0) - dir = g_config->get("savepath", "scummvm"); - - // If no save path was specified, use no directory prefix - if (dir == NULL) - dir = ""; -#endif - - return dir; -} - -void NORETURN CDECL error(const char *s, ...) { -#ifdef __PALM_OS__ - char buf_input[256]; // 1024 is too big overflow the stack - char buf_output[256]; -#else - char buf_input[1024]; - char buf_output[1024]; -#endif - va_list va; - - va_start(va, s); - vsprintf(buf_input, s, va); - va_end(va); - - if (g_engine) { - g_engine->errorString(buf_input, buf_output); - } else { - strcpy(buf_output, buf_input); - } - -#ifdef __GP32__ //ph0x FIXME? - printf("ERROR: %s\n", buf_output); -#else - fprintf(stderr, "%s!\n", buf_output); -#endif - -#if defined( USE_WINDBG ) -#if defined( _WIN32_WCE ) - TCHAR buf_output_unicode[1024]; - MultiByteToWideChar(CP_ACP, 0, buf_output, strlen(buf_output) + 1, buf_output_unicode, sizeof(buf_output_unicode)); - OutputDebugString(buf_output_unicode); -#else - OutputDebugString(buf_output); -#endif -#endif - -#if defined ( _WIN32_WCE ) - drawError(buf_output); -#endif - -#ifdef __PALM_OS__ - PalmFatalError(buf_output); -#endif - - // Finally exit. quit() will terminate the program if g_system iss present - if (g_system) - g_system->quit(); - - exit(1); -} - -void CDECL warning(const char *s, ...) { -#ifdef __PALM_OS__ - char buf[256]; // 1024 is too big overflow the stack -#else - char buf[1024]; -#endif - va_list va; - - va_start(va, s); - vsprintf(buf, s, va); - va_end(va); - -#ifdef __GP32__ //ph0x FIXME: implement fprint? - printf("WARNING: %s\n", buf); -#else - fprintf(stderr, "WARNING: %s!\n", buf); -#endif -#if defined( USE_WINDBG ) - strcat(buf, "\n"); -#if defined( _WIN32_WCE ) - TCHAR buf_unicode[1024]; - MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode)); - OutputDebugString(buf_unicode); -#else - OutputDebugString(buf); -#endif -#endif -} - -uint16 _debugLevel = 0; - -void CDECL debug(int level, const char *s, ...) { -#ifdef __PALM_OS__ - char buf[256]; // 1024 is too big overflow the stack -#else - char buf[1024]; -#endif - va_list va; - - if (level > _debugLevel) - return; - - va_start(va, s); - vsprintf(buf, s, va); - va_end(va); - printf("%s\n", buf); - -#if defined( USE_WINDBG ) - strcat(buf, "\n"); -#if defined( _WIN32_WCE ) - TCHAR buf_unicode[1024]; - MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode)); - OutputDebugString(buf_unicode); -#else - OutputDebugString(buf); -#endif -#endif - - fflush(stdout); -} - -void checkHeap() { -#if defined(_MSC_VER) - if (_heapchk() != _HEAPOK) { - error("Heap is invalid!"); - } -#endif -} diff --git a/common/engine.h b/common/engine.h deleted file mode 100644 index d62a4de3cd..0000000000 --- a/common/engine.h +++ /dev/null @@ -1,88 +0,0 @@ -/* ScummVM - Scumm Interpreter - * Copyright (C) 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - */ - -#ifndef ENGINE_H -#define ENGINE_H - -#include "common/scummsys.h" -#include "common/system.h" - -extern const char *gScummVMVersion; // e.g. "0.4.1" -extern const char *gScummVMBuildDate; // e.g. "2003-06-24" -extern const char *gScummVMFullVersion; // e.g. "ScummVM 0.4.1 (2003-06-24)" - -// TODO: Get rid of these enums. Ideally, GIDs should be -// 100% local to the module they are defined in. Right now -// we can't make this change since some of the backends -// and also gui/launcher.cpp contain tests on the GID. -// Ideally, all those should be converted to something else. -enum GameId { - GID_SCUMM_FIRST = 1, - GID_SCUMM_LAST = GID_SCUMM_FIRST + 99, - - // Simon the Sorcerer - GID_SIMON_FIRST, - GID_SIMON_LAST = GID_SIMON_FIRST + 49, - - // Beneath a Steel Sky - GID_SKY_FIRST, - GID_SKY_LAST = GID_SKY_FIRST + 49, - - // Broken Sword 2 - GID_SWORD2_FIRST, - GID_SWORD2_LAST = GID_SWORD2_FIRST + 49 -}; - - -class SoundMixer; -class GameDetector; -class Timer; -struct TargetSettings; - -/* FIXME - BIG HACK for MidiEmu */ -extern OSystem *g_system; - -class Engine { -public: - OSystem *_system; - SoundMixer *_mixer; - Timer * _timer; - -protected: - char *_gameDataPath; - -public: - Engine(GameDetector *detector, OSystem *syst); - virtual ~Engine(); - - // Invoke the main engine loop using this method - virtual void go() = 0; - - // Get the save game dir path - const char *getSavePath() const; - - // Specific for each engine preparare of erroe string - virtual void errorString(const char *buf_input, char *buf_output) = 0; -}; - -extern Engine *g_engine; - -#endif - diff --git a/common/module.mk b/common/module.mk index b38c3e2ba7..059abd5dbe 100644 --- a/common/module.mk +++ b/common/module.mk @@ -2,7 +2,6 @@ MODULE := common MODULE_OBJS := \ common/config-file.o \ - common/engine.o \ common/file.o \ common/scaler.o \ common/str.o \ diff --git a/common/scummsys.h b/common/scummsys.h index 5831275502..b08f520aa6 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -25,15 +25,11 @@ #include #include -// TODO - use config.h, generated by configure +// Use config.h, generated by configure #if defined(HAVE_CONFIG_H) #include "config.h" #endif -#if defined(USE_MAD) || defined(USE_VORBIS) -#define COMPRESSED_SOUND_FILE -#endif - #if defined(_MSC_VER) #define scumm_stricmp stricmp @@ -189,35 +185,6 @@ #define NEWGUI_256 -#elif defined(macintosh) - #include - - #include "macos.h" - - #define scumm_stricmp strcmp// FIXME - this is definitly wrong. Try strcasecmp? - - #define CHECK_HEAP - #define SCUMM_BIG_ENDIAN - - #define FORCEINLINE inline - #define CDECL - - typedef unsigned char byte; - typedef unsigned char uint8; - typedef unsigned short uint16; - typedef unsigned long uint32; - typedef unsigned int uint; - typedef signed char int8; - typedef signed short int16; - typedef signed long int32; - - #define START_PACK_STRUCTS pack (1) - #define END_PACK_STRUCTS pack () - #define GCC_PACK - #define NORETURN - #define USE_QTMUSIC - #define NEED_STRDUP - #elif defined(__MORPHOS__) #define scumm_stricmp stricmp #define scumm_strnicmp strnicmp diff --git a/common/util.cpp b/common/util.cpp index 60bbd14df7..7732372dbb 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -19,7 +19,7 @@ */ #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/util.h" // diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index 96dc9f1581..06c0b7fdb0 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -22,7 +22,7 @@ #include "PopUpWidget.h" #include "dialog.h" #include "newgui.h" -#include "common/engine.h" +#include "base/engine.h" #define UP_DOWN_BOX_HEIGHT 10 diff --git a/gui/about.cpp b/gui/about.cpp index 23f0bb6d27..99f054b18e 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -21,7 +21,7 @@ #include "stdafx.h" #include "about.h" #include "newgui.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/str.h" AboutDialog::AboutDialog(NewGui *gui) diff --git a/gui/console.cpp b/gui/console.cpp index 775fce0422..53fdeba312 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -22,7 +22,7 @@ #include "console.h" #include "ScrollBarWidget.h" -#include "common/engine.h" +#include "base/engine.h" #define PROMPT ") " diff --git a/gui/launcher.cpp b/gui/launcher.cpp index dc62755e3f..d231519f67 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -36,7 +36,7 @@ #include "base/plugins.h" #include "common/config-file.h" -#include "common/engine.h" +#include "base/engine.h" enum { kStartCmd = 'STRT', diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp index 986dfb6340..784b92bb0e 100644 --- a/scumm/imuse_player.cpp +++ b/scumm/imuse_player.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "common/util.h" -#include "common/engine.h" +#include "base/engine.h" #include "scumm/imuse_internal.h" #include "scumm/saveload.h" diff --git a/scumm/player_v1.cpp b/scumm/player_v1.cpp index a5032d099e..92b2366705 100644 --- a/scumm/player_v1.cpp +++ b/scumm/player_v1.cpp @@ -19,7 +19,7 @@ */ #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "player_v1.h" #include "scumm.h" diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index b2d36d472f..d8910ebf63 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -19,7 +19,7 @@ */ #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "player_v2.h" #include "scumm.h" #include "sound/mididrv.h" diff --git a/scumm/player_v3a.cpp b/scumm/player_v3a.cpp index 00522e9f48..739a91ad82 100644 --- a/scumm/player_v3a.cpp +++ b/scumm/player_v3a.cpp @@ -19,7 +19,7 @@ */ #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "player_v3a.h" #include "scumm.h" #include "sound/mixer.h" diff --git a/scumm/script.h b/scumm/script.h index 9957566dfd..e1c5fcdb8c 100644 --- a/scumm/script.h +++ b/scumm/script.h @@ -23,7 +23,7 @@ #ifndef SCRIPT_H #define SCRIPT_H -#include "common/engine.h" +#include "base/engine.h" /* System Wide Constants */ diff --git a/scumm/scumm.h b/scumm/scumm.h index c5869f4835..2474d81cd4 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -23,7 +23,7 @@ #ifndef SCUMM_H #define SCUMM_H -#include "common/engine.h" +#include "base/engine.h" #include "common/file.h" #include "common/map.h" #include "common/rect.h" diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index e4342e045b..e317e7a903 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -33,7 +33,7 @@ #include "chunk.h" #include "chunk_type.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/file.h" #include "common/util.h" #include "common/timer.h" diff --git a/simon/simon.h b/simon/simon.h index 2ece8e813b..173b327d49 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -23,7 +23,7 @@ #define SIMON_H #include -#include "common/engine.h" +#include "base/engine.h" #include "common/util.h" #include "simon/midi.h" #include "sound/mixer.h" diff --git a/sky/control.h b/sky/control.h index 3a6508a9c8..c3a1c3e762 100644 --- a/sky/control.h +++ b/sky/control.h @@ -25,7 +25,7 @@ #include "common/stdafx.h" #include "common/scummsys.h" #include "sky/struc.h" -#include "common/engine.h" +#include "base/engine.h" #include "sky/screen.h" #include "sky/disk.h" #include "sky/mouse.h" diff --git a/sky/disk.cpp b/sky/disk.cpp index 678c26784e..2b3fde11eb 100644 --- a/sky/disk.cpp +++ b/sky/disk.cpp @@ -21,7 +21,7 @@ #include "stdafx.h" #include "common/scummsys.h" -#include "common/engine.h" +#include "base/engine.h" #include "sky/disk.h" #include "sky/skydefs.h" #include "sky/sky.h" diff --git a/sky/music/adlibchannel.h b/sky/music/adlibchannel.h index 3b27c2305b..8118213b52 100644 --- a/sky/music/adlibchannel.h +++ b/sky/music/adlibchannel.h @@ -23,7 +23,7 @@ #define ADLIBCHANNEL_H #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "sky/sky.h" #include "sky/music/musicbase.h" #include "sound/fmopl.h" diff --git a/sky/music/adlibmusic.h b/sky/music/adlibmusic.h index 481977b385..b1b366c402 100644 --- a/sky/music/adlibmusic.h +++ b/sky/music/adlibmusic.h @@ -25,7 +25,7 @@ #include "stdafx.h" #include "sky/sky.h" #include "sound/mixer.h" -#include "common/engine.h" +#include "base/engine.h" #include "adlibchannel.h" #include "musicbase.h" #include "sound/fmopl.h" diff --git a/sky/music/gmmusic.h b/sky/music/gmmusic.h index 925e60d1a3..78aaea4d7f 100644 --- a/sky/music/gmmusic.h +++ b/sky/music/gmmusic.h @@ -23,7 +23,7 @@ #define GMMUSIC_H #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "musicbase.h" #include "sound/mididrv.h" #include "gmchannel.h" diff --git a/sky/screen.h b/sky/screen.h index 80572671a0..b3aee36264 100644 --- a/sky/screen.h +++ b/sky/screen.h @@ -24,7 +24,7 @@ #include "stdafx.h" #include -#include "common/engine.h" +#include "base/engine.h" #include "common/scummsys.h" #include "sky/disk.h" #include "sky/skydefs.h" diff --git a/sky/sky.h b/sky/sky.h index 13f44fb2b1..573fc6a807 100644 --- a/sky/sky.h +++ b/sky/sky.h @@ -23,7 +23,7 @@ #define SKYMAIN_H #include -#include "common/engine.h" +#include "base/engine.h" #include "common/util.h" #include "common/timer.h" #include "sound/mixer.h" diff --git a/sky/sound.h b/sky/sound.h index 4a388e6e2b..084726dd97 100644 --- a/sky/sound.h +++ b/sky/sound.h @@ -24,7 +24,7 @@ #include "sound/mixer.h" #include "sky/disk.h" -#include "common/engine.h" +#include "base/engine.h" enum { SOUND_CH0 = 0, diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 2eda39e6f4..83dc9ec460 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "audiostream.h" #include "mixer.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/file.h" #include "common/util.h" diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp index b3b09cde86..5277844426 100644 --- a/sound/mpu401.cpp +++ b/sound/mpu401.cpp @@ -20,7 +20,7 @@ #include "stdafx.h" #include "mpu401.h" -#include "common/engine.h" // for g_system +#include "base/engine.h" // for g_system #include "common/util.h" // for ARRAYSIZE diff --git a/sound/rate.h b/sound/rate.h index 364c14f763..f6d0304dcd 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -23,7 +23,7 @@ #define SOUND_RATE_H #include "common/scummsys.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/util.h" //#include "sound/audiostream.h" diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h index bf3ae4d1ad..0ec40348bc 100644 --- a/sword2/driver/driver96.h +++ b/sword2/driver/driver96.h @@ -1022,7 +1022,7 @@ #include #include "common/scummsys.h" -#include "common/engine.h" // for warning() +#include "base/engine.h" // for warning() #include "common/system.h" #include "common/rect.h" //#include "ddraw.h" diff --git a/sword2/driver/palette.cpp b/sword2/driver/palette.cpp index 96a73da58d..7b3b7820c5 100644 --- a/sword2/driver/palette.cpp +++ b/sword2/driver/palette.cpp @@ -147,7 +147,7 @@ #include #include "common/util.h" -#include "common/engine.h" +#include "base/engine.h" #include "d_draw.h" #include "driver96.h" #include "../sword2.h" diff --git a/sword2/driver/rdwin.cpp b/sword2/driver/rdwin.cpp index 32c729975b..dfa96190bf 100644 --- a/sword2/driver/rdwin.cpp +++ b/sword2/driver/rdwin.cpp @@ -18,7 +18,7 @@ */ #include "common/stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/timer.h" #include "driver96.h" diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 6e031da08f..ce8f723660 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -23,7 +23,7 @@ #include "stdafx.h" -#include "common/engine.h" +#include "base/engine.h" #include "common/file.h" #include "driver/driver96.h" -- cgit v1.2.3