summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index a366f28d..4a9a6f39 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -141,7 +141,23 @@ static Mix_Music *loadMusic(const std::string &filename)
ResourceManager *resman = ResourceManager::getInstance();
std::string path = resman->getPath("music/" + filename);
- logger->log("Loading music \"%s\"", path.c_str());
+ if (path.find(".zip/") != std::string::npos ||
+ path.find(".zip\\") != std::string::npos)
+ {
+ // Music file is a virtual file inside a zip archive - we have to copy
+ // it to a temporary physical file so that SDL_mixer can stream it.
+ logger->log("Loading music \"%s\" from temporary file tempMusic.ogg",
+ path.c_str());
+ bool success = resman->copyFile("music/" + filename, "tempMusic.ogg");
+ if (success)
+ {
+ path = resman->getPath("tempMusic.ogg");
+ } else {
+ return NULL;
+ }
+ } else {
+ logger->log("Loading music \"%s\"", path.c_str());
+ }
Mix_Music *music = Mix_LoadMUS(path.c_str());