From e1ebc12d7fbb6db0f35f6815dac43ae9c4f57c48 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 13 Feb 2016 10:48:11 +0100 Subject: [PATCH] Improve reliability of "menu background music". Fix issue with mixed navigation mentioned in #8565 --- UI/BackgroundAudio.cpp | 5 ++--- UI/GameInfoCache.cpp | 1 + UI/MainScreen.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 986da3ea37..64421d8312 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -16,8 +16,7 @@ class AT3PlusReader { public: AT3PlusReader(const std::string &data) - : file_((const uint8_t *)&data[0], - (int32_t)data.size()), + : file_((const uint8_t *)&data[0], (int32_t)data.size()), raw_data_(0), raw_data_size_(0), raw_offset_(0), @@ -96,7 +95,7 @@ public: } file_.ascend(); } else { - ELOG("Could not descend into RIFF file"); + ELOG("Could not descend into RIFF file. Data size=%d", (int32_t)data.size()); return; } sample_rate = samplesPerSec; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 39fec7b098..29ca59734c 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -734,6 +734,7 @@ again: GameInfoWorkItem *item = new GameInfoWorkItem(gamePath, info); gameInfoWQ_->Add(item); + info->pending = true; info_[gamePath] = info; return info; } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 7803ab1f44..85d827cc11 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1046,8 +1046,10 @@ UI::EventReturn MainScreen::OnGameHighlight(UI::EventParams &e) { } } - if ((!highlightedGamePath_.empty() || e.a == FF_LOSTFOCUS) && !lockBackgroundAudio_) + if ((!highlightedGamePath_.empty() || e.a == FF_LOSTFOCUS) && !lockBackgroundAudio_) { SetBackgroundAudioGame(highlightedGamePath_); + } + lockBackgroundAudio_ = false; return UI::EVENT_DONE; } @@ -1135,7 +1137,7 @@ void MainScreen::dialogFinished(const Screen *dialog, DialogResult result) { RecreateViews(); } if (dialog->tag() == "game") { - if (!restoreFocusGamePath_.empty()) { + if (!restoreFocusGamePath_.empty() && UI::IsFocusMovementEnabled()) { // Prevent the background from fading, since we just were displaying it. highlightedGamePath_ = restoreFocusGamePath_; highlightProgress_ = 1.0f;