[Scummvm-cvs-logs] CVS: scummvm/base engine.cpp,1.40,1.41 engine.h,1.21,1.22
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Tue Jun 14 01:55:09 CEST 2005
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15173/base
Modified Files:
engine.cpp engine.h
Log Message:
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.
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- engine.cpp 10 May 2005 23:17:13 -0000 1.40
+++ engine.cpp 14 Jun 2005 08:54:11 -0000 1.41
@@ -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 @@
_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();
}
Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- engine.h 10 May 2005 23:48:35 -0000 1.21
+++ engine.h 14 Jun 2005 08:54:11 -0000 1.22
@@ -69,6 +69,9 @@
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;
More information about the Scummvm-git-logs
mailing list