aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-06-14 08:54:11 +0000
committerTorbjörn Andersson2005-06-14 08:54:11 +0000
commitdc3372b5804b61f5e213ccbfd98c8847fd5f10cf (patch)
treea63b6c5dfafe4c4d042304d98ed996ee5fa56e8c /base
parent962e716a5272bd627ec4f823310f57a26699ba32 (diff)
downloadscummvm-rg350-dc3372b5804b61f5e213ccbfd98c8847fd5f10cf.tar.gz
scummvm-rg350-dc3372b5804b61f5e213ccbfd98c8847fd5f10cf.tar.bz2
scummvm-rg350-dc3372b5804b61f5e213ccbfd98c8847fd5f10cf.zip
Applied patch #1208299. A warning message about the "playing from CD under
Windows" bug is better than nothing, even if a proper bugfix - if one is possible - would be preferable. svn-id: r18389
Diffstat (limited to 'base')
-rw-r--r--base/engine.cpp52
-rw-r--r--base/engine.h3
2 files changed, 55 insertions, 0 deletions
diff --git a/base/engine.cpp b/base/engine.cpp
index 5905e7e598..f48ca83c96 100644
--- a/base/engine.cpp
+++ b/base/engine.cpp
@@ -30,6 +30,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "sound/mixer.h"
+#include "gui/message.h"
/* FIXME - BIG HACK for MidiEmu */
Engine *g_engine = 0;
@@ -84,6 +85,57 @@ void Engine::initCommonGFX(GameDetector &detector) {
_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
}
+void Engine::checkCD() {
+#ifdef WIN32
+ // It is a known bug under Windows that games that play CD audio cause
+ // ScummVM to crash if the data files are read from the same CD. Check
+ // if this appears to be the case and issue a warning.
+
+ // If we can find a compressed audio track, then it should be ok even
+ // if it's running from CD.
+
+#ifdef USE_VORBIS
+ if (Common::File::exists("track1.ogg"))
+ return;
+#endif
+#ifdef USE_FLAC
+ if (Common::File::exists("track1.fla") || Common::File::exists("track1.flac"))
+ return;
+#endif
+#ifdef USE_MAD
+ if (Common::File::exists("track1.mp3"))
+ return;
+#endif
+
+ char buffer[MAXPATHLEN];
+ int i;
+
+ if (strlen(getGameDataPath()) == 0) {
+ // That's it! I give up!
+ if (getcwd(buffer, MAXPATHLEN) == NULL)
+ return;
+ } else
+ strncpy(buffer, getGameDataPath(), MAXPATHLEN);
+
+ for (i = 0; i < MAXPATHLEN - 1; i++) {
+ if (buffer[i] == '\\')
+ break;
+ }
+
+ buffer[i + 1] = 0;
+
+ if (GetDriveType(buffer) == DRIVE_CDROM) {
+ GUI::MessageDialog dialog(
+ "You appear to be playing this game directly\n"
+ "from the CD. This is known to cause problems,\n"
+ "and it's therefore recommended that you copy\n"
+ "the data files to your hard disk instead.\n"
+ "See the README file for details.", "OK");
+ dialog.runModal();
+ }
+#endif
+}
+
const char *Engine::getGameDataPath() const {
return _gameDataPath.c_str();
}
diff --git a/base/engine.h b/base/engine.h
index 6c34b988de..42212be230 100644
--- a/base/engine.h
+++ b/base/engine.h
@@ -69,6 +69,9 @@ public:
virtual void errorString(const char *buf_input, char *buf_output) = 0;
void initCommonGFX(GameDetector &detector);
+
+ /** On some systems, check if the game appears to be run from CD. */
+ void checkCD();
};
extern Engine *g_engine;