From 5c4d7baa06530cb17d7fdf91eb1c93d62274827a Mon Sep 17 00:00:00 2001 From: Scott Thomas Date: Fri, 8 Apr 2011 21:04:51 +0930 Subject: GROOVIE: Determine correct MPEG4 resource to load for based on fileref --- engines/groovie/music.cpp | 17 ++++++++++++++--- engines/groovie/resource.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'engines/groovie') diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index e02125c192..bc8131379b 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -761,13 +761,24 @@ bool MusicPlayerMPEG4::load(uint32 fileref, bool loop) { // Stop any old sound _vm->_system->getMixer()->stopHandle(_handle); + // Find the filename + ResInfo info; + _vm->_resMan->getResInfo(fileref, info); + uint len = info.filename.size(); + if (len < 4) + return false; // This shouldn't actually occur + + // RL still says xmi, but we're after external m4a + info.filename.setChar('m', len-3); + info.filename.setChar('4', len-2); + info.filename.setChar('a', len-1); + // Create the audio stream - Common::String filename = Common::String::format("gu%d.m4a", fileref & 0x3FF); - Audio::AudioStream *audStream = Audio::makeQuickTimeStream(filename); + Audio::AudioStream *audStream = Audio::makeQuickTimeStream(info.filename); if (!audStream) { // MPEG-4 sounds aren't handled yet, so nothing should play here yet - warning("Could not play MPEG-4 sound '%s'", filename.c_str()); + warning("Could not play MPEG-4 sound '%s'", info.filename.c_str()); return false; } diff --git a/engines/groovie/resource.h b/engines/groovie/resource.h index 798bbf4b5b..c87658999a 100644 --- a/engines/groovie/resource.h +++ b/engines/groovie/resource.h @@ -45,10 +45,10 @@ public: Common::SeekableReadStream *open(uint32 fileRef); virtual uint16 getRef(Common::String name, Common::String scriptname = "") = 0; + virtual bool getResInfo(uint32 fileRef, ResInfo &resInfo) = 0; protected: Common::Array _gjds; - virtual bool getResInfo(uint32 fileRef, ResInfo &resInfo) = 0; uint16 _lastGjd; }; -- cgit v1.2.3