From 3142a9c5cd2f7e36a24350d9fc5aff73ca80598c Mon Sep 17 00:00:00 2001 From: James Brown Date: Sun, 7 Apr 2002 07:33:39 +0000 Subject: [PATCH] Add support for selecting CDROM drive for Loom/MI cd audio, fix midi support svn-id: r3888 --- gameDetector.cpp | 15 +++++++++++---- gameDetector.h | 1 + scumm.h | 1 + sdl.cpp | 12 +++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/gameDetector.cpp b/gameDetector.cpp index 2e2d0622355..0c885d5be67 100644 --- a/gameDetector.cpp +++ b/gameDetector.cpp @@ -31,6 +31,7 @@ "\tscummvm [-v] [-d] [-n] [-b] [-t] [-s] [-p] [-m] [-f] game\n" \ "Flags:\n" \ "\tv - show version info and exit\n" \ + "\tc - use cdrom for cd audio\n" \ "\td - enable debug output\n" \ "\tn - no subtitles for speech\n" \ "\tb - start in room \n" \ @@ -130,10 +131,16 @@ void GameDetector::parseCommandLine(int argc, char **argv) { _midi_driver = atoi(s+1); goto NextArg; case 'g': - if (*(s+1) == '\0') - goto ShowHelpAndExit; - _videoMode = atoi(s+1); - goto NextArg; + if (*(s+1) == '\0') + goto ShowHelpAndExit; + _videoMode = atoi(s+1); + goto NextArg; + + case 'c': + if (*(s+1) == '\0') + goto ShowHelpAndExit; + _cdrom = atoi(s+1); + goto NextArg; default: ShowHelpAndExit:; diff --git a/gameDetector.h b/gameDetector.h index 6288054bc08..3e53bcc316b 100644 --- a/gameDetector.h +++ b/gameDetector.h @@ -44,6 +44,7 @@ public: uint16 _soundCardType; int _scummVersion; + int _cdrom; bool _restore; }; diff --git a/scumm.h b/scumm.h index b18cefc8b5c..43e0e66501a 100644 --- a/scumm.h +++ b/scumm.h @@ -1291,6 +1291,7 @@ public: bool fileEof(void *handle); uint32 filePos(void *handle); bool checkFixedDisk(); + int _cdrom; int fileReadByte(); uint32 fileReadDwordLE(); diff --git a/sdl.cpp b/sdl.cpp index 1465e32d411..a173544e803 100644 --- a/sdl.cpp +++ b/sdl.cpp @@ -792,9 +792,13 @@ void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) { if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1) cdrom = NULL; - else - cdrom = SDL_CDOpen(0); - + else { + cdrom = SDL_CDOpen(s->_cdrom); + /* Did if open? Check if cdrom is NULL */ + if(!cdrom){ + warning("Couldn't open drive: %s\n", SDL_GetError()); + } + } /* Clean up on exit */ atexit(SDL_Quit); atexit(cd_shutdown); @@ -963,6 +967,8 @@ int main(int argc, char* argv[]) { scumm->_features = detector._features; scumm->_soundCardType = detector._soundCardType; scumm->_noSubtitles = detector._noSubtitles; + scumm->_midi_driver = detector._midi_driver; + scumm->_cdrom = detector._cdrom; scumm->delta=6; if (detector._restore) {