diff options
Diffstat (limited to 'engine.cpp')
-rw-r--r-- | engine.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/engine.cpp b/engine.cpp index 8e90280b0b..bd416f5f70 100644 --- a/engine.cpp +++ b/engine.cpp @@ -20,10 +20,11 @@ #include "stdafx.h" #include "engine.h" -#include "sound/mixer.h" #include "gameDetector.h" +#include "config-file.h" #include "scumm.h" #include "simon/simon.h" +#include "sound/mixer.h" /* FIXME - BIG HACK for MidiEmu */ OSystem *g_system = 0; @@ -34,6 +35,8 @@ Engine::Engine(GameDetector *detector, OSystem *syst) { _mixer = new SoundMixer(); + _gameDataPath = detector->_gameDataPath; + /* FIXME - BIG HACK for MidiEmu */ g_system = _system; g_mixer = _mixer; @@ -44,6 +47,34 @@ Engine::~Engine() delete _mixer; } +const char *Engine::getSavePath() const +{ + const char *dir = NULL; + +#ifdef _WIN32_WCE + dir = _gameDataPath; +#else + +#if !defined(MACOS_CARBON) + dir = getenv("SCUMMVM_SAVEPATH"); +#endif + + // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config + if (!dir || dir[0] == 0) + dir = scummcfg->get("savepath"); + + // If SCUMMVM_SAVEPATH was not specified, try to use general path from config + if (!dir || dir[0] == 0) + dir = scummcfg->get("savepath", "scummvm"); + + // If no save path was specified, use no directory prefix + if (dir == NULL) + dir = ""; +#endif + + return dir; +} + Engine *Engine::createFromDetector(GameDetector *detector, OSystem *syst) { Engine *engine; |