Skip to content

Commit

Permalink
SCI: Fix for bug #3522046 "Detection of SQ4CD as Windows breaks Music"
Browse files Browse the repository at this point in the history
Fall back to the DOS soundtracks in Windows CD versions if the user picks
a non-General MIDI music device, as the Windows tracks only contain MIDI
music
  • Loading branch information
bluegr committed Apr 29, 2012
1 parent 24e5780 commit e41e412
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion engines/sci/engine/features.cpp
Expand Up @@ -45,6 +45,7 @@ GameFeatures::GameFeatures(SegManager *segMan, Kernel *kernel) : _segMan(segMan)
_usesCdTrack = Common::File::exists("cdaudio.map");
if (!ConfMan.getBool("use_cdaudio"))
_usesCdTrack = false;
_forceDOSTracks = false;
}

reg_t GameFeatures::getDetectionAddr(const Common::String &objName, Selector slc, int methodNum) {
Expand Down Expand Up @@ -642,7 +643,7 @@ MoveCountType GameFeatures::detectMoveCountType() {
}

bool GameFeatures::useAltWinGMSound() {
if (g_sci && g_sci->getPlatform() == Common::kPlatformWindows && g_sci->isCD()) {
if (g_sci && g_sci->getPlatform() == Common::kPlatformWindows && g_sci->isCD() && !_forceDOSTracks) {
SciGameId id = g_sci->getGameId();
return (id == GID_ECOQUEST ||
id == GID_JONES ||
Expand Down
7 changes: 7 additions & 0 deletions engines/sci/engine/features.h
Expand Up @@ -117,6 +117,12 @@ class GameFeatures {
*/
bool useAltWinGMSound();

/**
* Forces DOS soundtracks in Windows CD versions when the user hasn't
* selected a MIDI output device
*/
void forceDOSTracks() { _forceDOSTracks = true; }

private:
reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);

Expand All @@ -137,6 +143,7 @@ class GameFeatures {

MoveCountType _moveCountType;
bool _usesCdTrack;
bool _forceDOSTracks;

SegManager *_segMan;
Kernel *_kernel;
Expand Down
6 changes: 6 additions & 0 deletions engines/sci/sound/music.cpp
Expand Up @@ -88,6 +88,12 @@ void SciMusic::init() {
uint32 dev = MidiDriver::detectDevice(deviceFlags);
_musicType = MidiDriver::getMusicType(dev);

if (g_sci->_features->useAltWinGMSound() && _musicType != MT_GM) {
warning("A Windows CD version with an alternate MIDI soundtrack has been chosen, "
"but no MIDI music device has been selected. Reverting to the DOS soundtrack");
g_sci->_features->forceDOSTracks();
}

switch (_musicType) {
case MT_ADLIB:
// FIXME: There's no Amiga sound option, so we hook it up to AdLib
Expand Down

0 comments on commit e41e412

Please sign in to comment.