Replaced Engine::_gameDataPath (a String) by Engine::_gameDataDir (an FSNode); adapted code to that (by using getChild() to get subdirs, not string concatenation
svn-id: r34434
This commit is contained in:
parent
3c48fb7eae
commit
2bc093828f
10 changed files with 53 additions and 59 deletions
|
@ -506,24 +506,24 @@ AGOSEngine::AGOSEngine(OSystem *syst)
|
||||||
|
|
||||||
// Add default file directories for Acorn version of
|
// Add default file directories for Acorn version of
|
||||||
// Simon the Sorcerer 1
|
// Simon the Sorcerer 1
|
||||||
File::addDefaultDirectory(_gameDataPath + "execute");
|
File::addDefaultDirectory(_gameDataDir.getChild("execute"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "EXECUTE");
|
File::addDefaultDirectory(_gameDataDir.getChild("EXECUTE"));
|
||||||
|
|
||||||
// Add default file directories for Amiga/Macintosh
|
// Add default file directories for Amiga/Macintosh
|
||||||
// verisons of Simon the Sorcerer 2
|
// verisons of Simon the Sorcerer 2
|
||||||
File::addDefaultDirectory(_gameDataPath + "voices");
|
File::addDefaultDirectory(_gameDataDir.getChild("voices"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "VOICES");
|
File::addDefaultDirectory(_gameDataDir.getChild("VOICES"));
|
||||||
|
|
||||||
// Add default file directories for Amiga & Macintosh
|
// Add default file directories for Amiga & Macintosh
|
||||||
// versions of The Feeble Files
|
// versions of The Feeble Files
|
||||||
File::addDefaultDirectory(_gameDataPath + "gfx");
|
File::addDefaultDirectory(_gameDataDir.getChild("gfx"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "GFX");
|
File::addDefaultDirectory(_gameDataDir.getChild("GFX"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "movies");
|
File::addDefaultDirectory(_gameDataDir.getChild("movies"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "MOVIES");
|
File::addDefaultDirectory(_gameDataDir.getChild("MOVIES"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "sfx");
|
File::addDefaultDirectory(_gameDataDir.getChild("sfx"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "SFX");
|
File::addDefaultDirectory(_gameDataDir.getChild("SFX"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "speech");
|
File::addDefaultDirectory(_gameDataDir.getChild("speech"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "SPEECH");
|
File::addDefaultDirectory(_gameDataDir.getChild("SPEECH"));
|
||||||
|
|
||||||
syst->getEventManager()->registerRandomSource(_rnd, "agos");
|
syst->getEventManager()->registerRandomSource(_rnd, "agos");
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,7 @@ Engine::Engine(OSystem *syst)
|
||||||
_eventMan(_system->getEventManager()),
|
_eventMan(_system->getEventManager()),
|
||||||
_saveFileMan(_system->getSavefileManager()),
|
_saveFileMan(_system->getSavefileManager()),
|
||||||
_targetName(ConfMan.getActiveDomainName()),
|
_targetName(ConfMan.getActiveDomainName()),
|
||||||
|
_gameDataDir(ConfMan.get("path")),
|
||||||
// FIXME: Temporary workaround for "missing" slashes at the end
|
|
||||||
// of _gameDataPath. This can go once we completed the transition
|
|
||||||
// to the new Archive/SearchPath system. See also bug #2098279.
|
|
||||||
#ifdef __SYMBIAN32__
|
|
||||||
_gameDataPath(ConfMan.get("path")),
|
|
||||||
#else
|
|
||||||
_gameDataPath(ConfMan.get("path") + '/'),
|
|
||||||
#endif
|
|
||||||
_pauseLevel(0),
|
_pauseLevel(0),
|
||||||
_mainMenuDialog(NULL) {
|
_mainMenuDialog(NULL) {
|
||||||
|
|
||||||
|
@ -158,12 +150,12 @@ void Engine::checkCD() {
|
||||||
char buffer[MAXPATHLEN];
|
char buffer[MAXPATHLEN];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (strlen(_gameDataPath.c_str()) == 0) {
|
if (_gameDataDir.getPath().empty()) {
|
||||||
// That's it! I give up!
|
// That's it! I give up!
|
||||||
if (getcwd(buffer, MAXPATHLEN) == NULL)
|
if (getcwd(buffer, MAXPATHLEN) == NULL)
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
strncpy(buffer, _gameDataPath.c_str(), MAXPATHLEN);
|
strncpy(buffer, _gameDataDir.getPath().c_str(), MAXPATHLEN);
|
||||||
|
|
||||||
for (i = 0; i < MAXPATHLEN - 1; i++) {
|
for (i = 0; i < MAXPATHLEN - 1; i++) {
|
||||||
if (buffer[i] == '\\')
|
if (buffer[i] == '\\')
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define ENGINES_ENGINE_H
|
#define ENGINES_ENGINE_H
|
||||||
|
|
||||||
#include "common/events.h"
|
#include "common/events.h"
|
||||||
|
#include "common/fs.h"
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
|
|
||||||
|
@ -60,7 +61,8 @@ protected:
|
||||||
virtual int runDialog(Dialog &dialog);
|
virtual int runDialog(Dialog &dialog);
|
||||||
|
|
||||||
const Common::String _targetName; // target name for saves
|
const Common::String _targetName; // target name for saves
|
||||||
const Common::String _gameDataPath;
|
|
||||||
|
const Common::FilesystemNode _gameDataDir;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -107,7 +107,7 @@ M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
|
||||||
// FIXME
|
// FIXME
|
||||||
_vm = this;
|
_vm = this;
|
||||||
|
|
||||||
Common::File::addDefaultDirectory(_gameDataPath);
|
Common::File::addDefaultDirectory(_gameDataDir);
|
||||||
Common::File::addDefaultDirectory("goodstuf"); // FIXME: This is nonsense
|
Common::File::addDefaultDirectory("goodstuf"); // FIXME: This is nonsense
|
||||||
Common::File::addDefaultDirectory("resource"); // FIXME: This is nonsense
|
Common::File::addDefaultDirectory("resource"); // FIXME: This is nonsense
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam
|
||||||
// FIXME
|
// FIXME
|
||||||
_vm = this;
|
_vm = this;
|
||||||
|
|
||||||
Common::File::addDefaultDirectory( _gameDataPath );
|
Common::File::addDefaultDirectory(_gameDataDir);
|
||||||
|
|
||||||
Common::addSpecialDebugLevel(kDebugDialogue, "dialogue", "Dialogues debug level");
|
Common::addSpecialDebugLevel(kDebugDialogue, "dialogue", "Dialogues debug level");
|
||||||
Common::addSpecialDebugLevel(kDebugParser, "parser", "Parser debug level");
|
Common::addSpecialDebugLevel(kDebugParser, "parser", "Parser debug level");
|
||||||
|
|
|
@ -92,20 +92,20 @@ SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc)
|
||||||
|
|
||||||
// The Linux version of Inherit the Earth puts all data files in an
|
// The Linux version of Inherit the Earth puts all data files in an
|
||||||
// 'itedata' sub-directory, except for voices.rsc
|
// 'itedata' sub-directory, except for voices.rsc
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "itedata/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("itedata"));
|
||||||
|
|
||||||
// The Windows version of Inherit the Earth puts various data files in
|
// The Windows version of Inherit the Earth puts various data files in
|
||||||
// other subdirectories.
|
// other subdirectories.
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "graphics/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("graphics"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "music/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("music"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "sound/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("sound"));
|
||||||
|
|
||||||
// The Multi-OS version puts the voices file in the root directory of
|
// The Multi-OS version puts the voices file in the root directory of
|
||||||
// the CD. The rest of the data files are in game/itedata
|
// the CD. The rest of the data files are in game/itedata
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "game/itedata/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("game").getChild("itedata"));
|
||||||
|
|
||||||
// Mac CD Wyrmkeep
|
// Mac CD Wyrmkeep
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "patch/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("patch"));
|
||||||
|
|
||||||
_displayClip.left = _displayClip.top = 0;
|
_displayClip.left = _displayClip.top = 0;
|
||||||
syst->getEventManager()->registerRandomSource(_rnd, "saga");
|
syst->getEventManager()->registerRandomSource(_rnd, "saga");
|
||||||
|
|
|
@ -226,7 +226,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) {
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
sprintf(buf, "Cannot find file: '%s'\nPlease insert disc %d.\nPress OK to retry, Quit to exit", filename, disknum);
|
sprintf(buf, "Cannot find file: '%s'\nPlease insert disc %d.\nPress OK to retry, Quit to exit", filename, disknum);
|
||||||
#else
|
#else
|
||||||
sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nPress OK to retry, Quit to exit", filename, disknum, _gameDataPath.c_str());
|
sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nPress OK to retry, Quit to exit", filename, disknum, _gameDataDir.getPath().c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result = displayMessage("Quit", buf);
|
result = displayMessage("Quit", buf);
|
||||||
|
|
|
@ -913,20 +913,20 @@ int ScummEngine::init() {
|
||||||
// Add default file directories.
|
// Add default file directories.
|
||||||
if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) {
|
if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) {
|
||||||
// This is for the Amiga version of Indy3/Loom/Maniac/Zak
|
// This is for the Amiga version of Indy3/Loom/Maniac/Zak
|
||||||
File::addDefaultDirectory(_gameDataPath + "ROOMS/");
|
File::addDefaultDirectory(_gameDataDir.getChild("ROOMS"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "rooms/");
|
File::addDefaultDirectory(_gameDataDir.getChild("rooms"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_game.platform == Common::kPlatformMacintosh) && (_game.version == 3)) {
|
if ((_game.platform == Common::kPlatformMacintosh) && (_game.version == 3)) {
|
||||||
// This is for the Mac version of Indy3/Loom
|
// This is for the Mac version of Indy3/Loom
|
||||||
File::addDefaultDirectory(_gameDataPath + "Rooms 1/");
|
File::addDefaultDirectory(_gameDataDir.getChild("Rooms 1"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "Rooms 2/");
|
File::addDefaultDirectory(_gameDataDir.getChild("Rooms 2"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "Rooms 3/");
|
File::addDefaultDirectory(_gameDataDir.getChild("Rooms 3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_SCUMM_7_8
|
#ifdef ENABLE_SCUMM_7_8
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
if (_game.version == 8 && !memcmp(_gameDataPath.c_str(), "/Volumes/MONKEY3_", 17)) {
|
if (_game.version == 8 && !memcmp(_gameDataDir.getPath().c_str(), "/Volumes/MONKEY3_", 17)) {
|
||||||
// Special case for COMI on Mac OS X. The mount points on OS X depend
|
// Special case for COMI on Mac OS X. The mount points on OS X depend
|
||||||
// on the volume name. Hence if playing from CD, we'd get a problem.
|
// on the volume name. Hence if playing from CD, we'd get a problem.
|
||||||
// So if loading of a resource file fails, we fall back to the (fixed)
|
// So if loading of a resource file fails, we fall back to the (fixed)
|
||||||
|
@ -943,16 +943,16 @@ int ScummEngine::init() {
|
||||||
#endif
|
#endif
|
||||||
if (_game.version == 8) {
|
if (_game.version == 8) {
|
||||||
// This is for COMI
|
// This is for COMI
|
||||||
File::addDefaultDirectory(_gameDataPath + "RESOURCE/");
|
File::addDefaultDirectory(_gameDataDir.getChild("RESOURCE"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "resource/");
|
File::addDefaultDirectory(_gameDataDir.getChild("resource"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_game.version == 7) {
|
if (_game.version == 7) {
|
||||||
// This is for Full Throttle & The Dig
|
// This is for Full Throttle & The Dig
|
||||||
File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
File::addDefaultDirectory(_gameDataDir.getChild("VIDEO"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "video/");
|
File::addDefaultDirectory(_gameDataDir.getChild("video"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "DATA/");
|
File::addDefaultDirectory(_gameDataDir.getChild("DATA"));
|
||||||
File::addDefaultDirectory(_gameDataPath + "data/");
|
File::addDefaultDirectory(_gameDataDir.getChild("data"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -257,14 +257,14 @@ SwordEngine::SwordEngine(OSystem *syst)
|
||||||
_features = 0;
|
_features = 0;
|
||||||
|
|
||||||
// Add default file directories
|
// Add default file directories
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("CLUSTERS"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "MUSIC/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("MUSIC"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "SPEECH/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("SPEECH"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("VIDEO"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("clusters"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "music/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("music"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "speech/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("speech"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "video/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("video"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SwordEngine::~SwordEngine() {
|
SwordEngine::~SwordEngine() {
|
||||||
|
|
|
@ -230,12 +230,12 @@ namespace Sword2 {
|
||||||
|
|
||||||
Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) {
|
Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) {
|
||||||
// Add default file directories
|
// Add default file directories
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("CLUSTERS"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("SWORD2"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("VIDEO"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "clusters/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("clusters"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "sword2/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("sword2"));
|
||||||
Common::File::addDefaultDirectory(_gameDataPath + "video/");
|
Common::File::addDefaultDirectory(_gameDataDir.getChild("video"));
|
||||||
|
|
||||||
if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword2demo"))
|
if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword2demo"))
|
||||||
_features = GF_DEMO;
|
_features = GF_DEMO;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue