Get rid of Engine::_gameDataDir.

This greatly reduces indirect dependencies on several header files
from common.

svn-id: r48933
This commit is contained in:
Max Horn 2010-05-04 11:56:52 +00:00
parent c5f94872a7
commit 5568a8473b
23 changed files with 100 additions and 70 deletions

View File

@ -27,7 +27,7 @@
#include "agi/lzw.h"
#include "common/config-manager.h"
//#include "common/fs.h"
#include "common/fs.h"
namespace Agi {

View File

@ -25,6 +25,7 @@
#include "common/md5.h"
#include "common/config-manager.h"
#include "common/fs.h"
#include "common/random.h"
#include "common/str-array.h"

View File

@ -24,10 +24,11 @@
*/
#include "common/config-manager.h"
#include "common/file.h"
#include "common/system.h"
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/events.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/system.h"
#include "agos/debugger.h"
#include "agos/intern.h"
@ -514,20 +515,22 @@ AGOSEngine::AGOSEngine(OSystem *syst)
"\x5\x5\x4\x6\x5\x3\x4\x5\x6\x3\x5\x5\x4\x6\x5\x3\x4\x6\x5\x6\x6\x6\x5\x5\x5\x6\x5\x6\x6\x6\x6\x6", 32);
const Common::FSNode gameDataDir(ConfMan.get("path"));
// Add default file directories for Acorn version of
// Simon the Sorcerer 1
SearchMan.addSubDirectoryMatching(_gameDataDir, "execute");
SearchMan.addSubDirectoryMatching(gameDataDir, "execute");
// Add default file directories for Amiga/Macintosh
// verisons of Simon the Sorcerer 2
SearchMan.addSubDirectoryMatching(_gameDataDir, "voices");
SearchMan.addSubDirectoryMatching(gameDataDir, "voices");
// Add default file directories for Amiga & Macintosh
// versions of The Feeble Files
SearchMan.addSubDirectoryMatching(_gameDataDir, "gfx");
SearchMan.addSubDirectoryMatching(_gameDataDir, "movies");
SearchMan.addSubDirectoryMatching(_gameDataDir, "sfx");
SearchMan.addSubDirectoryMatching(_gameDataDir, "speech");
SearchMan.addSubDirectoryMatching(gameDataDir, "gfx");
SearchMan.addSubDirectoryMatching(gameDataDir, "movies");
SearchMan.addSubDirectoryMatching(gameDataDir, "sfx");
SearchMan.addSubDirectoryMatching(gameDataDir, "speech");
g_eventRec.registerRandomSource(_rnd, "agos");
}

View File

@ -79,7 +79,8 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc)
// Do not initialize graphics here
// However this is the place to specify all default directories
//SearchMan.addSubDirectoryMatching(_gameDataDir, "sound");
//const Common::FSNode gameDataDir(ConfMan.get("path"));
//SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
// Here is the right place to set up the engine specific debug levels
DebugMan.addDebugChannel(kDraciGeneralDebugLevel, "general", "Draci general debug info");

View File

@ -90,7 +90,6 @@ Engine::Engine(OSystem *syst)
_eventMan(_system->getEventManager()),
_saveFileMan(_system->getSavefileManager()),
_targetName(ConfMan.getActiveDomainName()),
_gameDataDir(ConfMan.get("path")),
_pauseLevel(0),
_mainMenuDialog(NULL) {
@ -320,12 +319,14 @@ void Engine::checkCD() {
char buffer[MAXPATHLEN];
int i;
if (_gameDataDir.getPath().empty()) {
const Common::FSNode gameDataDir(ConfMan.get("path"));
if (gameDataDir.getPath().empty()) {
// That's it! I give up!
if (getcwd(buffer, MAXPATHLEN) == NULL)
return;
} else
strncpy(buffer, _gameDataDir.getPath().c_str(), MAXPATHLEN);
strncpy(buffer, gameDataDir.getPath().c_str(), MAXPATHLEN);
for (i = 0; i < MAXPATHLEN - 1; i++) {
if (buffer[i] == '\\')

View File

@ -27,8 +27,8 @@
#include "common/scummsys.h"
#include "common/error.h"
#include "common/fs.h"
#include "common/str.h"
#include "common/list.h"
#include "graphics/pixelformat.h"
class OSystem;
@ -89,8 +89,6 @@ protected:
const Common::String _targetName; // target name for saves
const Common::FSNode _gameDataDir; // FIXME: Get rid of this
private:
/**
* The pause level, 0 means 'running', a positive value indicates

View File

@ -41,9 +41,10 @@ GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) :
_graphicsMan(NULL), _waitingForInput(false) {
// Adding the default directories
SearchMan.addSubDirectoryMatching(_gameDataDir, "groovie");
SearchMan.addSubDirectoryMatching(_gameDataDir, "media");
SearchMan.addSubDirectoryMatching(_gameDataDir, "system");
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "groovie");
SearchMan.addSubDirectoryMatching(gameDataDir, "media");
SearchMan.addSubDirectoryMatching(gameDataDir, "system");
// Initialize the custom debug levels
DebugMan.addDebugChannel(kGroovieDebugAll, "All", "Debug everything");

View File

@ -52,6 +52,7 @@
#include "m4/mads_menus.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/endian.h"
@ -111,8 +112,10 @@ MadsM4Engine::MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
_vm = this;
_madsVm = NULL;
SearchMan.addSubDirectoryMatching(_gameDataDir, "goodstuf");
SearchMan.addSubDirectoryMatching(_gameDataDir, "resource");
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "goodstuf");
SearchMan.addSubDirectoryMatching(gameDataDir, "resource");
DebugMan.addDebugChannel(kDebugScript, "script", "Script debug level");
DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics debug level");

View File

@ -33,6 +33,10 @@
class OSystem;
namespace Common {
class SeekableReadStream;
}
namespace Mohawk {
enum MohawkGameType {

View File

@ -74,8 +74,10 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_scriptParser->disableInitOpcodes();
if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh)
SearchMan.addSubDirectoryMatching(_gameDataDir, "CD Data");
if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh) {
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "CD Data");
}
}
MohawkEngine_Myst::~MohawkEngine_Myst() {

View File

@ -49,12 +49,14 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_activatedSLST = false;
_extrasFile = NULL;
// Attempt to let game run from the CD's
// Attempt to let game run from the CDs
// NOTE: assets2 contains higher quality audio than assets1
SearchMan.addSubDirectoryMatching(_gameDataDir, "all");
SearchMan.addSubDirectoryMatching(_gameDataDir, "data");
SearchMan.addSubDirectoryMatching(_gameDataDir, "exe");
SearchMan.addSubDirectoryMatching(_gameDataDir, "assets2");
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "all");
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "exe");
SearchMan.addSubDirectoryMatching(gameDataDir, "assets2");
g_atrusJournalRectSolo = new Common::Rect(295, 402, 313, 426);
g_atrusJournalRect = new Common::Rect(222, 402, 240, 426);

View File

@ -27,6 +27,7 @@
#define RIVEN_SCRIPTS_H
#include "common/str-array.h"
#include "common/ptr.h"
class MohawkEngine_Riven;

View File

@ -23,9 +23,8 @@
*
*/
#include "common/file.h"
#include "common/fs.h"
#include "common/config-manager.h"
#include "common/system.h"
#include "common/events.h"
@ -112,28 +111,30 @@ SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc)
_frameCount = 0;
const Common::FSNode gameDataDir(ConfMan.get("path"));
// The Linux version of Inherit the Earth puts all data files in an
// 'itedata' sub-directory, except for voices.rsc
SearchMan.addSubDirectoryMatching(_gameDataDir, "itedata");
SearchMan.addSubDirectoryMatching(gameDataDir, "itedata");
// The Windows version of Inherit the Earth puts various data files in
// other subdirectories.
SearchMan.addSubDirectoryMatching(_gameDataDir, "graphics");
SearchMan.addSubDirectoryMatching(_gameDataDir, "music");
SearchMan.addSubDirectoryMatching(_gameDataDir, "sound");
SearchMan.addSubDirectoryMatching(gameDataDir, "graphics");
SearchMan.addSubDirectoryMatching(gameDataDir, "music");
SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
// 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
SearchMan.addSubDirectoryMatching(_gameDataDir, "game/itedata");
SearchMan.addSubDirectoryMatching(gameDataDir, "game/itedata");
// Mac CD Wyrmkeep
SearchMan.addSubDirectoryMatching(_gameDataDir, "patch");
SearchMan.addSubDirectoryMatching(gameDataDir, "patch");
// Dinotopia
SearchMan.addSubDirectoryMatching(_gameDataDir, "smack");
SearchMan.addSubDirectoryMatching(gameDataDir, "smack");
// FTA2
SearchMan.addSubDirectoryMatching(_gameDataDir, "video");
SearchMan.addSubDirectoryMatching(gameDataDir, "video");
_displayClip.left = _displayClip.top = 0;
g_eventRec.registerRandomSource(_rnd, "saga");

View File

@ -27,6 +27,7 @@
#define SCI_SCICORE_RESOURCE_H
#include "common/str.h"
#include "common/fs.h"
#include "sci/graphics/helpers.h" // for ViewType
#include "sci/decompressor.h"

View File

@ -96,18 +96,20 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc)
_gamestate = 0;
SearchMan.addSubDirectoryMatching(_gameDataDir, "actors"); // KQ6 hi-res portraits
SearchMan.addSubDirectoryMatching(_gameDataDir, "aud"); // resource.aud and audio files
SearchMan.addSubDirectoryMatching(_gameDataDir, "avi"); // AVI movie files for Windows versions
SearchMan.addSubDirectoryMatching(_gameDataDir, "seq"); // SEQ movie files for DOS versions
SearchMan.addSubDirectoryMatching(_gameDataDir, "wav"); // speech files in WAV format
SearchMan.addSubDirectoryMatching(_gameDataDir, "sfx"); // music/sound files in WAV format
SearchMan.addSubDirectoryMatching(_gameDataDir, "robot"); // robot files
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "actors"); // KQ6 hi-res portraits
SearchMan.addSubDirectoryMatching(gameDataDir, "aud"); // resource.aud and audio files
SearchMan.addSubDirectoryMatching(gameDataDir, "avi"); // AVI movie files for Windows versions
SearchMan.addSubDirectoryMatching(gameDataDir, "seq"); // SEQ movie files for DOS versions
SearchMan.addSubDirectoryMatching(gameDataDir, "wav"); // speech files in WAV format
SearchMan.addSubDirectoryMatching(gameDataDir, "sfx"); // music/sound files in WAV format
SearchMan.addSubDirectoryMatching(gameDataDir, "robot"); // robot files
// Add the patches directory, except for KQ6CD; The patches folder in some versions of KQ6CD
// is for the demo of Phantasmagoria, included in the disk
if (strcmp(getGameID(), "kq6"))
SearchMan.addSubDirectoryMatching(_gameDataDir, "patches"); // resource patches
SearchMan.addSubDirectoryMatching(gameDataDir, "patches"); // resource patches
}
SciEngine::~SciEngine() {

View File

@ -27,7 +27,7 @@
#define SCI_H
#include "engines/engine.h"
//#include "engines/advancedDetector.h"
#include "common/util.h"
struct ADGameDescription;

View File

@ -226,7 +226,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) {
#ifdef MACOSX
sprintf(buf, "Cannot find file: '%s'\nPlease insert disc %d.\nPress OK to retry, Quit to exit", filename, disknum);
#else
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());
sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nPress OK to retry, Quit to exit", filename, disknum, ConfMan.get("path").c_str());
#endif
result = displayMessage("Quit", "%s", buf);

View File

@ -933,22 +933,24 @@ ScummEngine_v8::~ScummEngine_v8() {
Common::Error ScummEngine::init() {
const Common::FSNode gameDataDir(ConfMan.get("path"));
// Add default file directories.
if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) {
// This is for the Amiga version of Indy3/Loom/Maniac/Zak
SearchMan.addSubDirectoryMatching(_gameDataDir, "rooms");
SearchMan.addSubDirectoryMatching(gameDataDir, "rooms");
}
if ((_game.platform == Common::kPlatformMacintosh) && (_game.version == 3)) {
// This is for the Mac version of Indy3/Loom
SearchMan.addSubDirectoryMatching(_gameDataDir, "rooms 1");
SearchMan.addSubDirectoryMatching(_gameDataDir, "rooms 2");
SearchMan.addSubDirectoryMatching(_gameDataDir, "rooms 3");
SearchMan.addSubDirectoryMatching(gameDataDir, "rooms 1");
SearchMan.addSubDirectoryMatching(gameDataDir, "rooms 2");
SearchMan.addSubDirectoryMatching(gameDataDir, "rooms 3");
}
#ifdef ENABLE_SCUMM_7_8
#ifdef MACOSX
if (_game.version == 8 && !memcmp(_gameDataDir.getPath().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
// 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)
@ -963,12 +965,12 @@ Common::Error ScummEngine::init() {
#endif
if (_game.version == 8)
// This is for COMI
SearchMan.addSubDirectoryMatching(_gameDataDir, "resource");
SearchMan.addSubDirectoryMatching(gameDataDir, "resource");
if (_game.version == 7) {
// This is for Full Throttle & The Dig
SearchMan.addSubDirectoryMatching(_gameDataDir, "video");
SearchMan.addSubDirectoryMatching(_gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "video");
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
}
#endif

View File

@ -56,13 +56,14 @@ SwordEngine::SwordEngine(OSystem *syst)
_features = 0;
// Add default file directories
SearchMan.addSubDirectoryMatching(_gameDataDir, "clusters");
SearchMan.addSubDirectoryMatching(_gameDataDir, "music");
SearchMan.addSubDirectoryMatching(_gameDataDir, "speech");
SearchMan.addSubDirectoryMatching(_gameDataDir, "video");
SearchMan.addSubDirectoryMatching(_gameDataDir, "smackshi");
SearchMan.addSubDirectoryMatching(_gameDataDir, "english");//PSX Demo
SearchMan.addSubDirectoryMatching(_gameDataDir, "italian");//PSX Demo
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "clusters");
SearchMan.addSubDirectoryMatching(gameDataDir, "music");
SearchMan.addSubDirectoryMatching(gameDataDir, "speech");
SearchMan.addSubDirectoryMatching(gameDataDir, "video");
SearchMan.addSubDirectoryMatching(gameDataDir, "smackshi");
SearchMan.addSubDirectoryMatching(gameDataDir, "english");//PSX Demo
SearchMan.addSubDirectoryMatching(gameDataDir, "italian");//PSX Demo
}
SwordEngine::~SwordEngine() {

View File

@ -257,10 +257,11 @@ namespace Sword2 {
Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) {
// Add default file directories
SearchMan.addSubDirectoryMatching(_gameDataDir, "clusters");
SearchMan.addSubDirectoryMatching(_gameDataDir, "sword2");
SearchMan.addSubDirectoryMatching(_gameDataDir, "video");
SearchMan.addSubDirectoryMatching(_gameDataDir, "smacks");
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "clusters");
SearchMan.addSubDirectoryMatching(gameDataDir, "sword2");
SearchMan.addSubDirectoryMatching(gameDataDir, "video");
SearchMan.addSubDirectoryMatching(gameDataDir, "smacks");
if (!scumm_stricmp(ConfMan.get("gameid").c_str(), "sword2demo") || !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword2psxdemo"))
_features = GF_DEMO;

View File

@ -23,6 +23,7 @@
*/
#include "common/stream.h"
#include "common/ptr.h"
#include "teenagent/inventory.h"
#include "teenagent/resources.h"

View File

@ -25,6 +25,8 @@
#include "common/config-manager.h"
#include "common/debug.h"
#include "common/algorithm.h"
#include "common/ptr.h"
#include "teenagent/scene.h"
#include "teenagent/resources.h"
#include "teenagent/surface.h"

View File

@ -29,6 +29,7 @@
#include "common/EventRecorder.h"
#include "common/keyboard.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/savefile.h"
#include "common/config-manager.h"
#include "common/serializer.h"
@ -834,11 +835,12 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc)
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
// Add DW2 subfolder to search path in case user is running directly from the CDs
SearchMan.addSubDirectoryMatching(_gameDataDir, "dw2");
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "dw2");
// Add subfolders needed for psx versions of Discworld 1
if (TinselV1PSX)
SearchMan.addDirectory(_gameDataDir.getPath(), _gameDataDir, 0, 3, true);
SearchMan.addDirectory(gameDataDir.getPath(), gameDataDir, 0, 3, true);
const GameSettings *g;