diff options
-rw-r--r-- | common/error.cpp | 2 | ||||
-rw-r--r-- | common/error.h | 1 | ||||
-rw-r--r-- | engines/mohawk/cstime.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/livingbooks.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/mohawk.cpp | 3 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/riven.cpp | 4 |
7 files changed, 19 insertions, 3 deletions
diff --git a/common/error.cpp b/common/error.cpp index bbbcb7c95e..1c3b515a38 100644 --- a/common/error.cpp +++ b/common/error.cpp @@ -42,6 +42,8 @@ static String errorToString(ErrorCode errorCode) { return _s("Game id not supported"); case kUnsupportedColorMode: return _s("Unsupported color mode"); + case kAudioDeviceInitFailed: + return _s("Audio device initialization failed"); case kReadPermissionDenied: return _s("Read permission denied"); diff --git a/common/error.h b/common/error.h index 3e0a7b556f..00495e06b2 100644 --- a/common/error.h +++ b/common/error.h @@ -46,6 +46,7 @@ enum ErrorCode { kNoGameDataFoundError, ///< Engine initialization: No game data was found in the specified location kUnsupportedGameidError, ///< Engine initialization: Gameid not supported by this (Meta)Engine kUnsupportedColorMode, ///< Engine initialization: Engine does not support backend's color mode + kAudioDeviceInitFailed, ///< Engine initialization: Audio device initialization failed kReadPermissionDenied, ///< Unable to read data due to missing read permission kWritePermissionDenied, ///< Unable to write data due to missing write permission diff --git a/engines/mohawk/cstime.cpp b/engines/mohawk/cstime.cpp index f3760a58ed..27d646fde1 100644 --- a/engines/mohawk/cstime.cpp +++ b/engines/mohawk/cstime.cpp @@ -77,6 +77,10 @@ MohawkEngine_CSTime::~MohawkEngine_CSTime() { Common::Error MohawkEngine_CSTime::run() { MohawkEngine::run(); + if (!_mixer->isReady()) { + return Common::kAudioDeviceInitFailed; + } + _console = new CSTimeConsole(this); _gfx = new CSTimeGraphics(this); _video = new VideoManager(this); diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index b9e54e4e20..eeadde1b46 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -170,6 +170,10 @@ MohawkEngine_LivingBooks::~MohawkEngine_LivingBooks() { Common::Error MohawkEngine_LivingBooks::run() { MohawkEngine::run(); + if (!_mixer->isReady()) { + return Common::kAudioDeviceInitFailed; + } + _console = new LivingBooksConsole(this); // Load the book info from the detected file loadBookInfo(getBookInfoFileName()); diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp index 52f73dbbb1..2b7e90e0c8 100644 --- a/engines/mohawk/mohawk.cpp +++ b/engines/mohawk/mohawk.cpp @@ -35,9 +35,6 @@ namespace Mohawk { MohawkEngine::MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc) { - if (!_mixer->isReady()) - error ("Sound initialization failed"); - // Setup mixer syncSoundSettings(); diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index a01cfdd343..4ff1df2eb7 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -347,6 +347,10 @@ void MohawkEngine_Myst::playSoundBlocking(uint16 id) { Common::Error MohawkEngine_Myst::run() { MohawkEngine::run(); + if (!_mixer->isReady()) { + return Common::kAudioDeviceInitFailed; + } + _gfx = new MystGraphics(this); _video = new VideoManager(this); _sound = new MystSound(this); diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 8139c1a92f..648496b35e 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -114,6 +114,10 @@ GUI::Debugger *MohawkEngine_Riven::getDebugger() { Common::Error MohawkEngine_Riven::run() { MohawkEngine::run(); + if (!_mixer->isReady()) { + return Common::kAudioDeviceInitFailed; + } + // Let's try to open the installer file (it holds extras.mhk) // Though, we set a low priority to prefer the extracted version if (_installerArchive.open("arcriven.z")) |