[Scummvm-cvs-logs] SF.net SVN: scummvm:[34916] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Thu Nov 6 18:05:55 CET 2008
Revision: 34916
http://scummvm.svn.sourceforge.net/scummvm/?rev=34916&view=rev
Author: fingolfin
Date: 2008-11-06 17:05:54 +0000 (Thu, 06 Nov 2008)
Log Message:
-----------
Switched various Engine APIs to use Common::Error
Modified Paths:
--------------
scummvm/trunk/base/main.cpp
scummvm/trunk/engines/agi/agi.cpp
scummvm/trunk/engines/agi/agi.h
scummvm/trunk/engines/agi/preagi.cpp
scummvm/trunk/engines/agi/preagi.h
scummvm/trunk/engines/agos/agos.cpp
scummvm/trunk/engines/agos/agos.h
scummvm/trunk/engines/cine/cine.cpp
scummvm/trunk/engines/cine/cine.h
scummvm/trunk/engines/cruise/cruise.cpp
scummvm/trunk/engines/cruise/cruise.h
scummvm/trunk/engines/drascula/drascula.cpp
scummvm/trunk/engines/drascula/drascula.h
scummvm/trunk/engines/engine.cpp
scummvm/trunk/engines/engine.h
scummvm/trunk/engines/gob/gob.cpp
scummvm/trunk/engines/gob/gob.h
scummvm/trunk/engines/igor/igor.cpp
scummvm/trunk/engines/igor/igor.h
scummvm/trunk/engines/igor/saveload.cpp
scummvm/trunk/engines/kyra/kyra_hof.cpp
scummvm/trunk/engines/kyra/kyra_hof.h
scummvm/trunk/engines/kyra/kyra_lok.cpp
scummvm/trunk/engines/kyra/kyra_lok.h
scummvm/trunk/engines/kyra/kyra_mr.cpp
scummvm/trunk/engines/kyra/kyra_mr.h
scummvm/trunk/engines/kyra/kyra_v1.cpp
scummvm/trunk/engines/kyra/kyra_v1.h
scummvm/trunk/engines/kyra/lol.cpp
scummvm/trunk/engines/kyra/lol.h
scummvm/trunk/engines/kyra/saveload.cpp
scummvm/trunk/engines/lure/lure.cpp
scummvm/trunk/engines/lure/lure.h
scummvm/trunk/engines/m4/m4.cpp
scummvm/trunk/engines/m4/m4.h
scummvm/trunk/engines/made/made.cpp
scummvm/trunk/engines/made/made.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/parallaction_br.cpp
scummvm/trunk/engines/parallaction/parallaction_ns.cpp
scummvm/trunk/engines/queen/queen.cpp
scummvm/trunk/engines/queen/queen.h
scummvm/trunk/engines/saga/detection.cpp
scummvm/trunk/engines/saga/saga.cpp
scummvm/trunk/engines/saga/saga.h
scummvm/trunk/engines/scumm/detection.cpp
scummvm/trunk/engines/scumm/he/intern_he.h
scummvm/trunk/engines/scumm/saveload.cpp
scummvm/trunk/engines/scumm/scumm.cpp
scummvm/trunk/engines/scumm/scumm.h
scummvm/trunk/engines/sky/sky.cpp
scummvm/trunk/engines/sky/sky.h
scummvm/trunk/engines/sword1/sword1.cpp
scummvm/trunk/engines/sword1/sword1.h
scummvm/trunk/engines/sword2/sword2.cpp
scummvm/trunk/engines/sword2/sword2.h
scummvm/trunk/engines/tinsel/tinsel.cpp
scummvm/trunk/engines/tinsel/tinsel.h
scummvm/trunk/engines/touche/menu.cpp
scummvm/trunk/engines/touche/saveload.cpp
scummvm/trunk/engines/touche/touche.cpp
scummvm/trunk/engines/touche/touche.h
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/base/main.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -126,13 +126,21 @@
}
// TODO: specify the possible return values here
-static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
- // Query the game data path, for messages
- Common::String path = ConfMan.hasKey("path") ? ConfMan.get("path") : ".";
+static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
+ // Determine the game data path, for validation and error messages
+ Common::FSNode dir(ConfMan.get("path"));
+ Common::Error err = Common::kNoError;
+ Engine *engine = 0;
+ // Verify that the game path refers to an actual directory
+ if (!(dir.exists() && dir.isDirectory()))
+ err = Common::kInvalidPathError;
+
// Create the game engine
- Engine *engine = 0;
- Common::Error err = (*plugin)->createInstance(&system, &engine);
+ if (err == Common::kNoError)
+ err = (*plugin)->createInstance(&system, &engine);
+
+ // Check for errors
if (!engine || err != Common::kNoError) {
// TODO: Show an error dialog or so?
// TODO: Also take 'err' into consideration...
@@ -154,9 +162,9 @@
plugin->getName(),
errMsg,
ConfMan.getActiveDomainName().c_str(),
- path.c_str()
+ dir.getPath().c_str()
);
- return 0;
+ return err;
}
// Set the window caption to the game name
@@ -172,20 +180,10 @@
}
//
- // Setup varios paths in the SearchManager
+ // Setup various paths in the SearchManager
//
- Common::FSNode dir;
// Add the game path to the directory search list
- //
- // FIXME: at this moment, game path handling is being discussed in the mailing list,
- // while Common::File is being reworked under the hood. After commit 34444, which
- // changed the implementation of Common::File (specifically removing usage of fopen
- // and fOpenNoCase, which implicitly supported backslashes in file names), some games
- // stopped working. Example of this are the HE games which use subdirectories: Kirben
- // found this issue on lost-win-demo at first. Thus, in commit 34450, searching the
- // game path was made recursive as a temporary fix/workaround.
- dir = Common::FSNode(path);
SearchMan.addDirectory(dir.getPath(), dir, 0, 4);
// Add extrapath (if any) to the directory search list
@@ -209,10 +207,10 @@
// Init the engine (this might change the screen parameters)
// TODO: We should specify what return values
- int result = engine->init();
+ Common::Error result = engine->init();
// Run the game engine if the initialization was successful.
- if (result == 0) {
+ if (result == Common::kNoError) {
result = engine->go();
} else {
// TODO: Set an error flag, notify user about the problem
@@ -306,10 +304,10 @@
PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, plugin);
// Try to run the game
- int result = runGame(plugin, system, specialDebug);
+ Common::Error result = runGame(plugin, system, specialDebug);
// Did an error occur ?
- if (result != 0) {
+ if (result != Common::kNoError) {
// TODO: Show an informative error dialog if starting the selected game failed.
}
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/agi/agi.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -779,7 +779,7 @@
free(_predictiveDictText);
}
-int AgiBase::init() {
+Common::Error AgiBase::init() {
// Initialize backend
_system->beginGFXTransaction();
@@ -791,10 +791,10 @@
_gfx->gfxSetPalette();
- return 0;
+ return Common::kNoError;
}
-int AgiEngine::go() {
+Common::Error AgiEngine::go() {
CursorMan.showMouse(true);
report(" \nAGI engine %s is ready.\n", gScummVMVersion);
@@ -808,7 +808,7 @@
runGame();
- return 0;
+ return Common::kNoError;
}
void AgiEngine::syncSoundSettings() {
Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/agi/agi.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -696,7 +696,7 @@
class AgiBase : public ::Engine {
protected:
// Engine API
- virtual int init();
+ virtual Common::Error init();
virtual bool hasFeature(EngineFeature f) const;
virtual void initialize() = 0;
@@ -745,7 +745,7 @@
protected:
// Engine APIs
- virtual int go();
+ virtual Common::Error go();
virtual void syncSoundSettings();
void initialize();
Modified: scummvm/trunk/engines/agi/preagi.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/agi/preagi.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -189,7 +189,7 @@
}
-int PreAgiEngine::go() {
+Common::Error PreAgiEngine::go() {
setflag(fSoundOn, true); // enable sound
/*
@@ -227,7 +227,7 @@
error("Unknown preagi engine");
break;
}
- return 0;
+ return Common::kNoError;
}
} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/preagi.h
===================================================================
--- scummvm/trunk/engines/agi/preagi.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/agi/preagi.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -37,7 +37,7 @@
int _gameId;
protected:
- int go();
+ Common::Error go();
void initialize();
public:
Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/agos/agos.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -528,7 +528,7 @@
syst->getEventManager()->registerRandomSource(_rnd, "agos");
}
-int AGOSEngine::init() {
+Common::Error AGOSEngine::init() {
if (getGameId() == GID_DIMP) {
_screenWidth = 496;
_screenHeight = 400;
@@ -663,7 +663,7 @@
if (gDebugLevel == 5)
_startVgaScript = true;
- return 0;
+ return Common::kNoError;
}
static const uint16 initialVideoWindows_Simon[20] = {
@@ -958,7 +958,7 @@
}
}
-int AGOSEngine::go() {
+Common::Error AGOSEngine::go() {
loadGamePcFile();
addTimeEvent(0, 1);
@@ -1023,7 +1023,7 @@
delay(100);
}
- return 0;
+ return Common::kNoError;
}
Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/agos/agos.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -164,8 +164,8 @@
friend class MoviePlayer;
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/cine/cine.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -74,7 +74,7 @@
Common::clearAllSpecialDebugLevels();
}
-int CineEngine::init() {
+Common::Error CineEngine::init() {
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(false);
@@ -91,10 +91,10 @@
initialize();
- return 0;
+ return Common::kNoError;
}
-int CineEngine::go() {
+Common::Error CineEngine::go() {
CursorMan.showMouse(true);
mainLoop(1);
@@ -102,7 +102,7 @@
delete[] collisionPage;
delete g_sound;
- return 0;
+ return Common::kNoError;
}
int CineEngine::getTimerDelay() const {
Modified: scummvm/trunk/engines/cine/cine.h
===================================================================
--- scummvm/trunk/engines/cine/cine.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/cine/cine.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -71,8 +71,8 @@
protected:
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual bool hasFeature(EngineFeature f) const;
void shutdown();
Modified: scummvm/trunk/engines/cruise/cruise.cpp
===================================================================
--- scummvm/trunk/engines/cruise/cruise.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/cruise/cruise.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -70,7 +70,7 @@
#endif
}
-int CruiseEngine::init() {
+Common::Error CruiseEngine::init() {
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(false);
@@ -79,16 +79,16 @@
initialize();
- return 0;
+ return Common::kNoError;
}
-int CruiseEngine::go() {
+Common::Error CruiseEngine::go() {
Cruise::changeCursor(Cruise::CURSOR_NORMAL);
CursorMan.showMouse(true);
Cruise::mainLoop();
- return 0;
+ return Common::kNoError;
}
void CruiseEngine::initialize() {
Modified: scummvm/trunk/engines/cruise/cruise.h
===================================================================
--- scummvm/trunk/engines/cruise/cruise.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/cruise/cruise.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -44,8 +44,10 @@
class CruiseEngine:public Engine {
protected:
- int init();
- int go();
+ // Engine APIs
+ virtual Common::Error init();
+ virtual Common::Error go();
+
void shutdown();
bool initGame();
Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/drascula/drascula.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -104,7 +104,7 @@
freeTexts(_textd1);
}
-int DrasculaEngine::init() {
+Common::Error DrasculaEngine::init() {
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(false);
@@ -170,15 +170,15 @@
*textName = 0;
if (!loadDrasculaDat())
- return 1;
+ return Common::kUnknownError;
setupRoomsTable();
loadArchives();
- return 0;
+ return Common::kNoError;
}
-int DrasculaEngine::go() {
+Common::Error DrasculaEngine::go() {
currentChapter = 1; // values from 1 to 6 will start each part of game
loadedDifferentChapter = 0;
@@ -274,7 +274,7 @@
currentChapter++;
}
- return 0;
+ return Common::kNoError;
}
void DrasculaEngine::endChapter() {
Modified: scummvm/trunk/engines/drascula/drascula.h
===================================================================
--- scummvm/trunk/engines/drascula/drascula.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/drascula/drascula.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -275,9 +275,9 @@
Common::KeyState _keyPressed;
protected:
- int init();
- int go();
-// void shutdown();
+ // Engine APIs
+ virtual Common::Error init();
+ virtual Common::Error go();
public:
DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc);
Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/engine.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -255,9 +255,9 @@
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
}
-int Engine::loadGameState(int slot) {
+Common::Error Engine::loadGameState(int slot) {
// Do nothing by default
- return 0;
+ return Common::kNoError;
}
bool Engine::canLoadGameStateCurrently() {
@@ -265,9 +265,9 @@
return false;
}
-int Engine::saveGameState(int slot, const char *desc) {
+Common::Error Engine::saveGameState(int slot, const char *desc) {
// Do nothing by default
- return 0;
+ return Common::kNoError;
}
bool Engine::canSaveGameStateCurrently() {
Modified: scummvm/trunk/engines/engine.h
===================================================================
--- scummvm/trunk/engines/engine.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/engine.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -26,6 +26,7 @@
#define ENGINES_ENGINE_H
#include "common/scummsys.h"
+#include "common/error.h"
#include "common/fs.h"
#include "common/str.h"
@@ -127,17 +128,17 @@
/**
* Init the engine.
- * @return 0 for success, else an error code.
+ * @return returns kNoError on success, else an error code.
*/
- virtual int init() = 0;
+ virtual Common::Error init() = 0;
/**
* Start the main engine loop.
* The return value is not yet used, but could indicate whether the user
* wants to return to the launch or to fully quit ScummVM.
- * @return 0 for success, else an error code.
+ * @return returns kNoError on success, else an error code.
*/
- virtual int go() = 0;
+ virtual Common::Error go() = 0;
/**
* Prepare an error string, which is printed by the error() function.
@@ -168,11 +169,9 @@
/**
* Load a game state.
* @param slot the slot from which a savestate should be loaded
- * @return returns 0 on success, anything else indicates failure
- *
- * @todo define proper error values
+ * @return returns kNoError on success, else an error code.
*/
- virtual int loadGameState(int slot);
+ virtual Common::Error loadGameState(int slot);
/**
* Indicates whether a game state can be loaded.
@@ -183,11 +182,9 @@
* Save a game state.
* @param slot the slot into which the savestate should be stored
* @param desc a description for the savestate, entered by the user
- * @return returns 0 on success, anything else indicates failure
- *
- * @todo define proper error values
+ * @return returns kNoError on success, else an error code.
*/
- virtual int saveGameState(int slot, const char *desc);
+ virtual Common::Error saveGameState(int slot, const char *desc);
/**
* Indicates whether a game state can be saved.
Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/gob/gob.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -110,10 +110,10 @@
delete[] _startTot0;
}
-int GobEngine::go() {
+Common::Error GobEngine::go() {
_init->initGame(0);
- return 0;
+ return Common::kNoError;
}
const char *GobEngine::getLangDesc(int16 language) const {
@@ -177,10 +177,10 @@
return (_features & kFeaturesAdlib) != 0;
}
-int GobEngine::init() {
+Common::Error GobEngine::init() {
if (!initGameParts()) {
GUIErrorMessage("GobEngine::init(): Unknown version of game engine");
- return -1;
+ return Common::kUnknownError;
}
_video->setSize(is640());
@@ -259,7 +259,7 @@
// 640x480.
g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
- return 0;
+ return Common::kNoError;
}
void GobEngine::pauseEngineIntern(bool pause) {
Modified: scummvm/trunk/engines/gob/gob.h
===================================================================
--- scummvm/trunk/engines/gob/gob.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/gob/gob.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -191,8 +191,8 @@
uint32 _pauseStart;
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual bool hasFeature(EngineFeature f) const;
virtual void pauseEngineIntern(bool pause);
Modified: scummvm/trunk/engines/igor/igor.cpp
===================================================================
--- scummvm/trunk/engines/igor/igor.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/igor/igor.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -88,14 +88,14 @@
delete _midiPlayer;
}
-int IgorEngine::init() {
+Common::Error IgorEngine::init() {
_system->beginGFXTransaction();
initCommonGFX(false);
_system->initSize(320, 200);
_system->endGFXTransaction();
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
- return 0;
+ return Common::kNoError;
}
void IgorEngine::restart() {
@@ -169,7 +169,7 @@
_gameTicks = 0;
}
-int IgorEngine::go() {
+Common::Error IgorEngine::go() {
restart();
setupDefaultPalette();
_currentPart = ConfMan.getInt("boot_param");
@@ -192,7 +192,7 @@
PART_MAIN();
_ovlFile.close();
_sndFile.close();
- return 0;
+ return Common::kNoError;
}
void IgorEngine::readTableFile() {
Modified: scummvm/trunk/engines/igor/igor.h
===================================================================
--- scummvm/trunk/engines/igor/igor.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/igor/igor.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -312,8 +312,8 @@
IgorEngine(OSystem *system, const DetectedGameVersion *dgv);
virtual ~IgorEngine();
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
void handleOptionsMenu_paintSave();
bool handleOptionsMenu_handleKeyDownSave(int key);
@@ -427,8 +427,8 @@
void dialogueReplyToQuestion(int x, int y, int r, int g, int b, int reply = 0);
void saveOrLoadGameState(TypeSerializer &typeSerializer);
- int loadGameState(int slot);
- int saveGameState(int slot);
+ Common::Error loadGameState(int slot);
+ Common::Error saveGameState(int slot);
void generateGameStateFileName(int num, char *dst, int len) const;
MidiPlayer *_midiPlayer;
Modified: scummvm/trunk/engines/igor/saveload.cpp
===================================================================
--- scummvm/trunk/engines/igor/saveload.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/igor/saveload.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -156,7 +156,7 @@
}
}
-int IgorEngine::loadGameState(int slot) {
+Common::Error IgorEngine::loadGameState(int slot) {
char name[64];
generateGameStateFileName(slot, name, 63);
Common::InSaveFile *isf = _saveFileMan->openForLoading(name);
@@ -176,10 +176,10 @@
debug(0, "Loaded state, current part %d", _currentPart);
}
- return 0; // TODO: return success/failure
+ return Common::kNoError; // TODO: return success/failure
}
-int IgorEngine::saveGameState(int slot) {
+Common::Error IgorEngine::saveGameState(int slot) {
char name[64];
generateGameStateFileName(slot, name, 63);
Common::OutSaveFile *osf = _saveFileMan->openForSaving(name);
@@ -190,7 +190,7 @@
delete osf;
}
- return 0; // TODO: return success/failure
+ return Common::kNoError; // TODO: return success/failure
}
void IgorEngine::generateGameStateFileName(int num, char *dst, int len) const {
Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -219,7 +219,7 @@
}
}
-int KyraEngine_HoF::init() {
+Common::Error KyraEngine_HoF::init() {
_screen = new Screen_HoF(this, _system);
assert(_screen);
_screen->setResolution();
@@ -261,7 +261,7 @@
// No mouse display in demo
if (_flags.isDemo && !_flags.isTalkie)
- return 0;
+ return Common::kNoError;
_res->exists("PWGMOUSE.SHP", true);
uint8 *shapes = _res->fileData("PWGMOUSE.SHP", 0);
@@ -273,10 +273,10 @@
delete[] shapes;
_screen->setMouseCursor(0, 0, getShapePtr(0));
- return 0;
+ return Common::kNoError;
}
-int KyraEngine_HoF::go() {
+Common::Error KyraEngine_HoF::go() {
if (_gameToLoad == -1) {
if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)
seq_showStarcraftLogo();
@@ -326,7 +326,7 @@
seq_playSequences(kSequenceFunters, kSequenceFrash);
}
- return 0;
+ return Common::kNoError;
}
void KyraEngine_HoF::startup() {
Modified: scummvm/trunk/engines/kyra/kyra_hof.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_hof.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -292,8 +292,8 @@
void seq_init();
void seq_uninit();
- int init();
- int go();
+ Common::Error init();
+ Common::Error go();
Screen_HoF *_screen;
TextDisplayer_HoF *_text;
Modified: scummvm/trunk/engines/kyra/kyra_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_lok.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -155,7 +155,7 @@
delete[] _sceneAnimTable[i];
}
-int KyraEngine_LoK::init() {
+Common::Error KyraEngine_LoK::init() {
_screen = new Screen_LoK(this, _system);
assert(_screen);
_screen->setResolution();
@@ -284,10 +284,10 @@
_lastMusicCommand = 0;
- return 0;
+ return Common::kNoError;
}
-int KyraEngine_LoK::go() {
+Common::Error KyraEngine_LoK::go() {
if (_res->getFileSize("6.FNT"))
_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
@@ -304,7 +304,7 @@
setGameFlag(0xEF);
seq_intro();
if (shouldQuit())
- return 0;
+ return Common::kNoError;
if (_skipIntroFlag && _abortIntroFlag)
resetGameFlag(0xEF);
}
@@ -312,7 +312,7 @@
resetGameFlag(0xEF);
mainLoop();
}
- return 0;
+ return Common::kNoError;
}
Modified: scummvm/trunk/engines/kyra/kyra_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_lok.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -144,8 +144,8 @@
const uint8 * const*palTable2() { return &_specialPalettes[29]; }
protected:
- virtual int go();
- virtual int init();
+ virtual Common::Error go();
+ virtual Common::Error init();
public:
// sequences
Modified: scummvm/trunk/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_mr.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -202,7 +202,7 @@
delete _album.rightPage.wsa;
}
-int KyraEngine_MR::init() {
+Common::Error KyraEngine_MR::init() {
_screen = new Screen_MR(this, _system);
assert(_screen);
_screen->setResolution();
@@ -233,10 +233,10 @@
_res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 768);
_screen->setScreenPalette(_screen->getPalette(0));
- return 0;
+ return Common::kNoError;
}
-int KyraEngine_MR::go() {
+Common::Error KyraEngine_MR::go() {
bool running = true;
preinit();
_screen->hideMouse();
@@ -324,7 +324,7 @@
if (_showOutro)
playVQA("CREDITS");
- return 0;
+ return Common::kNoError;
}
void KyraEngine_MR::initMainMenu() {
Modified: scummvm/trunk/engines/kyra/kyra_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_mr.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -62,7 +62,7 @@
int language() const { return _lang; }
bool heliumMode() const { return _configHelium; }
- int go();
+ Common::Error go();
void playVQA(const char *name);
@@ -84,7 +84,7 @@
Screen_MR *_screen;
SoundDigital *_soundDigital;
- int init();
+ Common::Error init();
void preinit();
void startup();
Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -92,7 +92,7 @@
_timer->pause(pause);
}
-int KyraEngine_v1::init() {
+Common::Error KyraEngine_v1::init() {
registerDefaultSettings();
// Setup mixer
@@ -186,7 +186,7 @@
// Prevent autosave on game startup
_lastAutosave = _system->getMillis();
- return 0;
+ return Common::kNoError;
}
KyraEngine_v1::~KyraEngine_v1() {
Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/kyra_v1.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -168,7 +168,7 @@
protected:
// Engine APIs
- virtual int init();
+ virtual Common::Error init();
virtual ::GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void pauseEngineIntern(bool pause);
@@ -304,7 +304,7 @@
static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, bool loadThumbnail, SaveHeader &header);
- int loadGameState(int slot);
+ Common::Error loadGameState(int slot);
virtual void loadGame(const char *fileName) = 0;
virtual void saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumbnail) = 0;
Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/lol.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -74,7 +74,7 @@
return _screen;
}
-int LoLEngine::init() {
+Common::Error LoLEngine::init() {
_screen = new Screen_LoL(this, _system);
assert(_screen);
_screen->setResolution();
@@ -90,10 +90,10 @@
if (!_sound->init())
error("Couldn't init sound");
- return 0;
+ return Common::kNoError;
}
-int LoLEngine::go() {
+Common::Error LoLEngine::go() {
setupPrologueData(true);
showIntro();
_sound->playTrack(6);
@@ -102,7 +102,7 @@
_screen->fadeToBlack();
setupPrologueData(false);
- return 0;
+ return Common::kNoError;
}
#pragma mark - Input
Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/lol.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -47,8 +47,8 @@
Screen_LoL *_screen;
TIMInterpreter *_tim;
- int init();
- int go();
+ Common::Error init();
+ Common::Error go();
// input
void updateInput();
Modified: scummvm/trunk/engines/kyra/saveload.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/kyra/saveload.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -244,14 +244,14 @@
return false;
}
-int KyraEngine_v1::loadGameState(int slot) {
+Common::Error KyraEngine_v1::loadGameState(int slot) {
if (!_isSaveAllowed)
- return -1;
+ return Common::kUnknownError; // FIXME
const char *filename = getSavegameFilename(slot);
loadGame(filename);
- return 0;
+ return Common::kNoError;
}
void KyraEngine_v1::checkAutosave() {
Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/lure/lure.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -48,7 +48,7 @@
Common::addSpecialDebugLevel(kLureDebugStrings, "strings", "Strings debugging");
}
-int LureEngine::init() {
+Common::Error LureEngine::init() {
int_engine = this;
_initialised = false;
@@ -62,7 +62,7 @@
VersionStructure version;
if (!f.open(SUPPORT_FILENAME)) {
GUIError("Could not locate Lure support file");
- return 1;
+ return Common::kUnknownError;
}
f.seek(0xbf * 8);
@@ -71,12 +71,12 @@
if (READ_LE_UINT16(&version.id) != 0xffff) {
GUIError("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME);
- return 1;
+ return Common::kUnknownError;
} else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) {
GUIError("Incorrect version of %s file - expected %d.%d but got %d.%d",
SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR,
version.vMajor, version.vMinor);
- return 1;
+ return Common::kUnknownError;
}
_disk = new Disk();
@@ -92,7 +92,7 @@
_gameToLoad = -1;
_initialised = true;
- return 0;
+ return Common::kNoError;
}
LureEngine::~LureEngine() {
@@ -119,7 +119,7 @@
return *int_engine;
}
-int LureEngine::go() {
+Common::Error LureEngine::go() {
Game *gameInstance = new Game();
// If requested, load a savegame instead of showing the intro
@@ -135,7 +135,7 @@
bool result = dialog->show();
delete dialog;
if (shouldQuit())
- return 0;
+ return Common::kNoError;
if (!result)
error("Sorry - copy protection failed");
@@ -158,7 +158,7 @@
}
delete gameInstance;
- return 0;
+ return Common::kNoError;
}
void LureEngine::pauseEngineIntern(bool pause) {
Modified: scummvm/trunk/engines/lure/lure.h
===================================================================
--- scummvm/trunk/engines/lure/lure.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/lure/lure.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -70,8 +70,8 @@
static LureEngine &getReference();
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
virtual void pauseEngineIntern(bool pause);
Modified: scummvm/trunk/engines/m4/m4.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/m4/m4.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -141,7 +141,7 @@
delete _resourceManager;
}
-int M4Engine::init() {
+Common::Error M4Engine::init() {
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(isM4());
@@ -197,7 +197,7 @@
_random = new Common::RandomSource();
g_system->getEventManager()->registerRandomSource(*_random, "m4");
- return 0;
+ return Common::kNoError;
}
void M4Engine::eventHandler() {
@@ -272,14 +272,14 @@
_viewManager->moveToFront(view);
}
-int M4Engine::go() {
+Common::Error M4Engine::go() {
if (isM4())
return goM4();
else
return goMADS();
}
-int M4Engine::goMADS() {
+Common::Error M4Engine::goMADS() {
_palette->setMadsSystemPalette();
_mouse->init("cursor.ss", NULL);
@@ -351,10 +351,10 @@
g_system->delayMillis(10);
}
- return 0;
+ return Common::kNoError;
}
-int M4Engine::goM4() {
+Common::Error M4Engine::goM4() {
_script->open("m4.dat");
@@ -375,7 +375,7 @@
}
#endif
- return 0;
+ return Common::kNoError;
#endif
// Set up the inventory
@@ -520,7 +520,7 @@
g_system->delayMillis(10);
}
- return 0;
+ return Common::kNoError;
}
void M4Engine::dumpFile(const char* filename, bool uncompress) {
Modified: scummvm/trunk/engines/m4/m4.h
===================================================================
--- scummvm/trunk/engines/m4/m4.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/m4/m4.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -107,12 +107,14 @@
class M4Engine : public Engine {
private:
- int goMADS();
- int goM4();
+ Common::Error goMADS();
+ Common::Error goM4();
protected:
- int init();
- int go();
+ // Engine APIs
+ virtual Common::Error init();
+ virtual Common::Error go();
+
void shutdown();
MidiPlayer *_midi;
Modified: scummvm/trunk/engines/made/made.cpp
===================================================================
--- scummvm/trunk/engines/made/made.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/made/made.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -138,14 +138,14 @@
delete _music;
}
-int MadeEngine::init() {
+Common::Error MadeEngine::init() {
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(false);
_system->initSize(320, 200);
_system->endGFXTransaction();
- return 0;
+ return Common::kNoError;
}
int16 MadeEngine::getTicks() {
@@ -244,7 +244,7 @@
}
-int MadeEngine::go() {
+Common::Error MadeEngine::go() {
for (int i = 0; i < ARRAYSIZE(_timers); i++)
_timers[i] = -1;
@@ -297,7 +297,7 @@
_script->runScript(_dat->getMainCodeObjectIndex());
#endif
- return 0;
+ return Common::kNoError;
}
} // End of namespace Made
Modified: scummvm/trunk/engines/made/made.h
===================================================================
--- scummvm/trunk/engines/made/made.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/made/made.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -78,8 +78,9 @@
protected:
- int init();
- int go();
+ // Engine APIs
+ virtual Common::Error init();
+ virtual Common::Error go();
public:
MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc);
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -109,7 +109,7 @@
}
-int Parallaction::init() {
+Common::Error Parallaction::init() {
_engineFlags = 0;
_objectsNames = NULL;
@@ -145,7 +145,7 @@
setupBalloonManager();
- return 0;
+ return Common::kNoError;
}
void Parallaction::updateView() {
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -228,7 +228,7 @@
~Parallaction();
// Engine APIs
- virtual int init();
+ virtual Common::Error init();
virtual bool hasFeature(EngineFeature f) const;
// info
@@ -363,8 +363,8 @@
~Parallaction_ns();
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
public:
virtual void parseLocation(const char *filename);
@@ -451,8 +451,8 @@
Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction_ns(syst, gameDesc) { }
~Parallaction_br();
- int init();
- int go();
+ Common::Error init();
+ Common::Error go();
public:
virtual void parseLocation(const char* name);
Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -42,7 +42,7 @@
"PART4"
};
-int Parallaction_br::init() {
+Common::Error Parallaction_br::init() {
_screenWidth = 640;
_screenHeight = 400;
@@ -89,7 +89,7 @@
Parallaction::init();
- return 0;
+ return Common::kNoError;
}
Parallaction_br::~Parallaction_br() {
@@ -102,7 +102,7 @@
(this->*_callables[index])(parm);
}
-int Parallaction_br::go() {
+Common::Error Parallaction_br::go() {
bool splash = true;
@@ -127,7 +127,7 @@
cleanupGame();
}
- return 0;
+ return Common::kNoError;
}
Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -143,7 +143,7 @@
-int Parallaction_ns::init() {
+Common::Error Parallaction_ns::init() {
_screenWidth = 320;
_screenHeight = 200;
@@ -193,7 +193,7 @@
Parallaction::init();
- return 0;
+ return Common::kNoError;
}
Parallaction_ns::~Parallaction_ns() {
@@ -228,7 +228,7 @@
}
-int Parallaction_ns::go() {
+Common::Error Parallaction_ns::go() {
_saveLoad->renameOldSavefiles();
_globalFlagsNames = _disk->loadTable("global");
@@ -239,7 +239,7 @@
runGame();
}
- return 0;
+ return Common::kNoError;
}
void Parallaction_ns::switchBackground(const char* background, const char* mask) {
Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/queen/queen.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -312,9 +312,10 @@
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
}
-int QueenEngine::saveGameState(int slot, const char *desc) {
+Common::Error QueenEngine::saveGameState(int slot, const char *desc) {
debug(3, "Saving game to slot %d", slot);
char name[20];
+ Common::Error err = Common::kNoError;
makeGameStateName(slot, name);
Common::OutSaveFile *file = _saveFileMan->openForSaving(name);
if (file) {
@@ -345,18 +346,21 @@
// check for errors
if (file->ioFailed()) {
warning("Can't write file '%s'. (Disk full?)", name);
+ err = Common::kWritingFailed;
}
delete[] saveData;
delete file;
} else {
warning("Can't create file '%s', game not saved", name);
+ err = Common::kCreatingFileFailed;
}
- return 0;
+ return err;
}
-int QueenEngine::loadGameState(int slot) {
+Common::Error QueenEngine::loadGameState(int slot) {
debug(3, "Loading game from slot %d", slot);
+ Common::Error err = Common::kNoError;
GameStateHeader header;
Common::InSaveFile *file = readGameStateHeader(slot, &header);
if (file && header.dataSize != 0) {
@@ -364,6 +368,7 @@
byte *p = saveData;
if (file->read(saveData, header.dataSize) != header.dataSize) {
warning("Error reading savegame file");
+ err = Common::kReadingFailed;
} else {
_bam->loadState(header.version, p);
_grid->loadState(header.version, p);
@@ -371,15 +376,18 @@
_sound->loadState(header.version, p);
if (header.dataSize != (uint32)(p - saveData)) {
warning("Corrupted savegame file");
+ err = Common::kReadingFailed; // FIXME
} else {
_logic->setupRestoredGame();
}
}
delete[] saveData;
delete file;
+ } else {
+ err = Common::kReadingFailed;
}
- return 0; // TODO: return success/failure
+ return err;
}
Common::InSaveFile *QueenEngine::readGameStateHeader(int slot, GameStateHeader *gsh) {
@@ -436,7 +444,7 @@
return _debugger;
}
-int QueenEngine::go() {
+Common::Error QueenEngine::go() {
_logic->start();
if (ConfMan.hasKey("save_slot") && canLoadOrSave()) {
loadGameState(ConfMan.getInt("save_slot"));
@@ -461,10 +469,10 @@
update(true);
}
}
- return 0;
+ return Common::kNoError;
}
-int QueenEngine::init() {
+Common::Error QueenEngine::init() {
_system->beginGFXTransaction();
initCommonGFX(false);
_system->initSize(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
@@ -496,7 +504,7 @@
registerDefaultSettings();
readOptionSettings();
- return 0;
+ return Common::kNoError;
}
} // End of namespace Queen
Modified: scummvm/trunk/engines/queen/queen.h
===================================================================
--- scummvm/trunk/engines/queen/queen.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/queen/queen.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -106,8 +106,8 @@
void update(bool checkPlayerInput = false);
bool canLoadOrSave() const;
- int saveGameState(int slot, const char *desc);
- int loadGameState(int slot);
+ Common::Error saveGameState(int slot, const char *desc);
+ Common::Error loadGameState(int slot);
void makeGameStateName(int slot, char *buf) const;
int getGameStateSlot(const char *filename) const;
void findGameStateDescriptions(char descriptions[100][32]);
@@ -129,8 +129,8 @@
protected:
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
Modified: scummvm/trunk/engines/saga/detection.cpp
===================================================================
--- scummvm/trunk/engines/saga/detection.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/saga/detection.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -245,7 +245,7 @@
return di.logicalHeight;
}
-int SagaEngine::loadGameState(int slot) {
+Common::Error SagaEngine::loadGameState(int slot) {
// Init the current chapter to 8 (character selection) for IHNM
if (getGameType() == GType_IHNM)
_scene->changeScene(-2, 0, kTransitionFade, 8);
@@ -262,7 +262,7 @@
load(calcSaveFileName((uint)slot));
syncSoundSettings();
- return 0; // TODO: return success/failure
+ return Common::kNoError; // TODO: return success/failure
}
} // End of namespace Saga
Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/saga/saga.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -140,7 +140,7 @@
delete _resource;
}
-int SagaEngine::init() {
+Common::Error SagaEngine::init() {
_musicVolume = ConfMan.getInt("music_volume");
_subtitlesEnabled = ConfMan.getBool("subtitles");
_readingSpeed = getTalkspeed();
@@ -156,7 +156,7 @@
// Detect game and open resource files
if (!initGame()) {
GUIErrorMessage("Error loading game resources.");
- return FAILURE;
+ return Common::kUnknownError;
}
// Initialize engine modules
@@ -197,7 +197,7 @@
_music->setAdlib(adlib);
_render = new Render(this, _system);
if (!_render->initialized()) {
- return FAILURE;
+ return Common::kUnknownError;
}
// Initialize system specific sound
@@ -232,10 +232,10 @@
if (getGameType() == GType_ITE)
_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
- return SUCCESS;
+ return Common::kNoError;
}
-int SagaEngine::go() {
+Common::Error SagaEngine::go() {
int msec = 0;
_previousTicks = _system->getMillis();
@@ -310,7 +310,7 @@
_system->delayMillis(10);
}
- return 0;
+ return Common::kNoError;
}
void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPointer, size_t stringsLength) {
Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/saga/saga.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -488,8 +488,8 @@
public:
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
@@ -652,7 +652,7 @@
const Common::Rect &getDisplayClip() const { return _displayClip;}
int getDisplayWidth() const;
int getDisplayHeight() const;
- int loadGameState(int slot);
+ Common::Error loadGameState(int slot);
bool canLoadGameStateCurrently();
bool canSaveGameStateCurrently();
const GameDisplayInfo &getDisplayInfo();
Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/scumm/detection.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -794,18 +794,18 @@
// Fetch the list of files in the current directory
Common::FSList fslist;
Common::FSNode dir(ConfMan.get("path"));
- if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly)) {
+ if (!dir.isDirectory())
return Common::kInvalidPathError;
- }
+ if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly))
+ return Common::kNoGameDataFoundError;
// Invoke the detector, but fixed to the specified gameid.
Common::List<DetectorResult> results;
::detectGames(fslist, results, gameid);
// Unable to locate game data
- if (results.empty()) {
+ if (results.empty())
return Common::kNoGameDataFoundError;
- }
// No unique match found. If a platform override is present, try to
// narrow down the list a bit more.
@@ -831,9 +831,8 @@
}
// Still no unique match found -> print a warning
- if (results.size() > 1) {
+ if (results.size() > 1)
warning("Engine_SCUMM_create: No unique game candidate found, using first one");
- }
// Simply use the first match
DetectorResult res(*(results.begin()));
Modified: scummvm/trunk/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/intern_he.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/scumm/he/intern_he.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -669,8 +669,8 @@
ScummEngine_vCUPhe(OSystem *syst, const DetectorResult &dr);
~ScummEngine_vCUPhe();
- int init();
- int go();
+ Common::Error init();
+ Common::Error go();
void parseEvents();
Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/scumm/saveload.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -75,9 +75,9 @@
#pragma mark -
-int ScummEngine::loadGameState(int slot) {
+Common::Error ScummEngine::loadGameState(int slot) {
requestLoad(slot);
- return 0;
+ return Common::kNoError;
}
bool ScummEngine::canLoadGameStateCurrently() {
@@ -85,9 +85,9 @@
return true;
}
-int ScummEngine::saveGameState(int slot, const char *desc) {
+Common::Error ScummEngine::saveGameState(int slot, const char *desc) {
requestSave(slot, desc);
- return 0;
+ return Common::kNoError;
}
bool ScummEngine::canSaveGameStateCurrently() {
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -821,21 +821,21 @@
delete _cupPlayer;
}
-int ScummEngine_vCUPhe::init() {
+Common::Error ScummEngine_vCUPhe::init() {
_system->beginGFXTransaction();
_system->initSize(CUP_Player::kDefaultVideoWidth, CUP_Player::kDefaultVideoHeight);
initCommonGFX(true);
_system->endGFXTransaction();
- return 0;
+ return Common::kNoError;
}
-int ScummEngine_vCUPhe::go() {
+Common::Error ScummEngine_vCUPhe::go() {
if (_cupPlayer->open(_filenamePattern.pattern)) {
_cupPlayer->play();
_cupPlayer->close();
}
- return 0;
+ return Common::kNoError;
}
void ScummEngine_vCUPhe::parseEvents() {
@@ -907,7 +907,7 @@
#pragma mark --- Initialization ---
#pragma mark -
-int ScummEngine::init() {
+Common::Error ScummEngine::init() {
// Add default file directories.
if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) {
@@ -1106,7 +1106,7 @@
syncSoundSettings();
- return 0;
+ return Common::kNoError;
}
void ScummEngine::setupScumm() {
@@ -1712,7 +1712,7 @@
#pragma mark --- Main loop ---
#pragma mark -
-int ScummEngine::go() {
+Common::Error ScummEngine::go() {
_engineStartTime = _system->getMillis() / 1000;
// If requested, load a save game instead of running the boot script
@@ -1763,7 +1763,7 @@
}
}
- return 0;
+ return Common::kNoError;
}
void ScummEngine::waitForTimer(int msec_delay) {
Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/scumm/scumm.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -443,16 +443,16 @@
virtual ~ScummEngine();
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual void errorString(const char *buf_input, char *buf_output);
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
- virtual int loadGameState(int slot);
+ virtual Common::Error loadGameState(int slot);
virtual bool canLoadGameStateCurrently();
- virtual int saveGameState(int slot, const char *desc);
+ virtual Common::Error saveGameState(int slot, const char *desc);
virtual bool canSaveGameStateCurrently();
virtual void pauseEngineIntern(bool pause);
Modified: scummvm/trunk/engines/sky/sky.cpp
===================================================================
--- scummvm/trunk/engines/sky/sky.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/sky/sky.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -349,7 +349,7 @@
_keyPressed.reset();
}
-int SkyEngine::go() {
+Common::Error SkyEngine::go() {
_keyPressed.reset();
@@ -428,10 +428,10 @@
_skyMusic->stopMusic();
ConfMan.flushToDisk();
delay(1500);
- return 0;
+ return Common::kNoError;
}
-int SkyEngine::init() {
+Common::Error SkyEngine::init() {
_system->beginGFXTransaction();
initCommonGFX(false);
_system->initSize(320, 200);
@@ -549,7 +549,7 @@
_skyMusic->setVolume(ConfMan.getInt("music_volume") >> 1);
_debugger = new Debugger(_skyLogic, _skyMouse, _skyScreen, _skyCompact);
- return 0;
+ return Common::kNoError;
}
void SkyEngine::initItemList() {
Modified: scummvm/trunk/engines/sky/sky.h
===================================================================
--- scummvm/trunk/engines/sky/sky.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/sky/sky.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -89,8 +89,8 @@
protected:
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/sword1/sword1.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -309,7 +309,7 @@
delete _resMan;
}
-int SwordEngine::init() {
+Common::Error SwordEngine::init() {
_system->beginGFXTransaction();
initCommonGFX(true);
@@ -377,7 +377,7 @@
_mouse->initialize();
_control = new Control(_saveFileMan, _resMan, _objectMan, _system, _mouse, _sound, _music);
- return 0;
+ return Common::kNoError;
}
void SwordEngine::reinitialize(void) {
@@ -719,7 +719,7 @@
#endif
}
-int SwordEngine::go() {
+Common::Error SwordEngine::go() {
uint16 startPos = ConfMan.getInt("boot_param");
if (startPos) {
_logic->startPositions(startPos);
@@ -757,7 +757,7 @@
}
}
- return 0;
+ return Common::kNoError;
}
void SwordEngine::checkCd(void) {
Modified: scummvm/trunk/engines/sword1/sword1.h
===================================================================
--- scummvm/trunk/engines/sword1/sword1.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/sword1/sword1.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -81,8 +81,8 @@
uint32 _features;
protected:
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -218,7 +218,7 @@
Common::FSList fslist;
Common::FSNode dir(ConfMan.get("path"));
if (!dir.getChildren(fslist, Common::FSNode::kListAll)) {
- return Common::kInvalidPathError;
+ return Common::kNoGameDataFoundError;
}
// Invoke the detector
@@ -349,7 +349,7 @@
_resman->openResource(CUR_PLAYER_ID);
}
-int Sword2Engine::init() {
+Common::Error Sword2Engine::init() {
// Get some falling RAM and put it in your pocket, never let it slip
// away
@@ -378,7 +378,7 @@
_resman = new ResourceManager(this);
if (!_resman->init())
- return 1;
+ return Common::kUnknownError;
_logic = new Logic(this);
_fontRenderer = new FontRenderer(this);
@@ -426,7 +426,7 @@
// will either have killed the music, or done a crossfade.
if (shouldQuit())
- return 0;
+ return Common::kNoError;
if (result)
startGame();
@@ -435,10 +435,10 @@
_screen->initialiseRenderCycle();
- return 0;
+ return Common::kNoError;
}
-int Sword2Engine::go() {
+Common::Error Sword2Engine::go() {
while (1) {
if (_debugger->isAttached())
_debugger->onFrame();
@@ -514,7 +514,7 @@
#endif
}
- return 0;
+ return Common::kNoError;
}
void Sword2Engine::restartGame() {
Modified: scummvm/trunk/engines/sword2/sword2.h
===================================================================
--- scummvm/trunk/engines/sword2/sword2.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/sword2/sword2.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -127,8 +127,8 @@
~Sword2Engine();
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void pauseEngineIntern(bool pause);
Modified: scummvm/trunk/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/tinsel/tinsel.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -658,7 +658,7 @@
delete _scheduler;
}
-int TinselEngine::init() {
+Common::Error TinselEngine::init() {
// Initialize backend
_system->beginGFXTransaction();
initCommonGFX(false);
@@ -707,7 +707,7 @@
// Actors, globals and inventory icons
LoadBasicChunks();
- return 0;
+ return Common::kNoError;
}
Common::String TinselEngine::getSavegameFilename(int16 saveNum) const {
@@ -718,7 +718,7 @@
#define GAME_FRAME_DELAY (1000 / ONE_SECOND)
-int TinselEngine::go() {
+Common::Error TinselEngine::go() {
uint32 timerVal = 0;
// Continuous game processes
@@ -774,7 +774,7 @@
// Write configuration
WriteConfig();
- return 0;
+ return Common::kNoError;
}
Modified: scummvm/trunk/engines/tinsel/tinsel.h
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/tinsel/tinsel.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -91,8 +91,9 @@
protected:
- int init();
- int go();
+ // Engine APIs
+ virtual Common::Error init();
+ virtual Common::Error go();
public:
TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc);
Modified: scummvm/trunk/engines/touche/menu.cpp
===================================================================
--- scummvm/trunk/engines/touche/menu.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/touche/menu.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -331,14 +331,14 @@
break;
case kActionPerformSaveLoad:
if (menuData->mode == kMenuLoadStateMode) {
- if (loadGameState(_saveLoadCurrentSlot) == 0) {
+ if (loadGameState(_saveLoadCurrentSlot) == Common::kNoError) {
menuData->quit = true;
}
} else if (menuData->mode == kMenuSaveStateMode) {
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
const char *description = menuData->saveLoadDescriptionsTable[_saveLoadCurrentSlot];
if (strlen(description) > 0) {
- if (saveGameState(_saveLoadCurrentSlot, description)) {
+ if (saveGameState(_saveLoadCurrentSlot, description) == Common::kNoError) {
menuData->quit = true;
}
}
Modified: scummvm/trunk/engines/touche/saveload.cpp
===================================================================
--- scummvm/trunk/engines/touche/saveload.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/touche/saveload.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -316,7 +316,7 @@
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
}
-int ToucheEngine::saveGameState(int num, const char *description) {
+Common::Error ToucheEngine::saveGameState(int num, const char *description) {
bool saveOk = false;
char gameStateFileName[64];
generateGameStateFileName(num, gameStateFileName, 63);
@@ -337,10 +337,10 @@
}
delete f;
}
- return saveOk;
+ return saveOk ? Common::kNoError : Common::kUnknownError;
}
-int ToucheEngine::loadGameState(int num) {
+Common::Error ToucheEngine::loadGameState(int num) {
bool loadOk = false;
char gameStateFileName[64];
generateGameStateFileName(num, gameStateFileName, 63);
@@ -360,7 +360,7 @@
}
delete f;
}
- return loadOk ? 0 : 1;
+ return loadOk ? Common::kNoError : Common::kUnknownError;
}
void ToucheEngine::readGameStateDescription(int num, char *description, int len) {
Modified: scummvm/trunk/engines/touche/touche.cpp
===================================================================
--- scummvm/trunk/engines/touche/touche.cpp 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/touche/touche.cpp 2008-11-06 17:05:54 UTC (rev 34916)
@@ -81,7 +81,7 @@
delete _midiPlayer;
}
-int ToucheEngine::init() {
+Common::Error ToucheEngine::init() {
_system->beginGFXTransaction();
initCommonGFX(true);
_system->initSize(kScreenWidth, kScreenHeight);
@@ -96,10 +96,10 @@
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
- return 0;
+ return Common::kNoError;
}
-int ToucheEngine::go() {
+Common::Error ToucheEngine::go() {
res_openDataFile();
res_allocateTables();
res_loadSpriteImage(18, _menuKitData);
@@ -111,7 +111,7 @@
res_deallocateTables();
res_closeDataFile();
- return 0;
+ return Common::kNoError;
}
void ToucheEngine::restart() {
Modified: scummvm/trunk/engines/touche/touche.h
===================================================================
--- scummvm/trunk/engines/touche/touche.h 2008-11-06 16:40:00 UTC (rev 34915)
+++ scummvm/trunk/engines/touche/touche.h 2008-11-06 17:05:54 UTC (rev 34916)
@@ -362,8 +362,8 @@
virtual ~ToucheEngine();
// Engine APIs
- virtual int init();
- virtual int go();
+ virtual Common::Error init();
+ virtual Common::Error go();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
@@ -497,8 +497,8 @@
void saveGameStateData(Common::WriteStream *stream);
void loadGameStateData(Common::ReadStream *stream);
- int saveGameState(int num, const char *description);
- int loadGameState(int num);
+ Common::Error saveGameState(int num, const char *description);
+ Common::Error loadGameState(int num);
void readGameStateDescription(int num, char *description, int len);
void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
int getGameStateFileSlot(const char *filename) const;
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