ENGINES: Introduce method Engine::initializePath which sets up SearchMan.
This replaces the hardcoded addition of the game path in runGame in base/main.cpp by an engine configurable one.
This commit is contained in:
parent
1fa74e355c
commit
651e280801
3 changed files with 16 additions and 1 deletions
|
@ -197,7 +197,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
|
||||||
//
|
//
|
||||||
|
|
||||||
// Add the game path to the directory search list
|
// Add the game path to the directory search list
|
||||||
SearchMan.addDirectory(dir.getPath(), dir, 0, 4);
|
engine->initializePath(dir);
|
||||||
|
|
||||||
// Add extrapath (if any) to the directory search list
|
// Add extrapath (if any) to the directory search list
|
||||||
if (ConfMan.hasKey("extrapath")) {
|
if (ConfMan.hasKey("extrapath")) {
|
||||||
|
|
|
@ -154,6 +154,10 @@ Engine::~Engine() {
|
||||||
CursorMan.popCursorPalette();
|
CursorMan.popCursorPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::initializePath(const Common::FSNode &gamePath) {
|
||||||
|
SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
void initCommonGFX(bool defaultTo1XScaler) {
|
void initCommonGFX(bool defaultTo1XScaler) {
|
||||||
const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
|
const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
|
||||||
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
|
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Error;
|
||||||
class EventManager;
|
class EventManager;
|
||||||
class SaveFileManager;
|
class SaveFileManager;
|
||||||
class TimerManager;
|
class TimerManager;
|
||||||
|
class FSNode;
|
||||||
}
|
}
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
class Debugger;
|
class Debugger;
|
||||||
|
@ -141,6 +142,16 @@ public:
|
||||||
Engine(OSystem *syst);
|
Engine(OSystem *syst);
|
||||||
virtual ~Engine();
|
virtual ~Engine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init SearchMan according to the game path.
|
||||||
|
*
|
||||||
|
* By default it adds the directory in non-flat mode with a depth of 4 as
|
||||||
|
* priority 0 to SearchMan.
|
||||||
|
*
|
||||||
|
* @param gamePath The base directory of the game data.
|
||||||
|
*/
|
||||||
|
virtual void initializePath(const Common::FSNode &gamePath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init the engine and start its main loop.
|
* Init the engine and start its main loop.
|
||||||
* @return returns kNoError on success, else an error code.
|
* @return returns kNoError on success, else an error code.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue