diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 790e249b1..2b81b7dde 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -52,6 +52,12 @@ SystemView::~SystemView() } } +void SystemView::onShow() +{ + if (mFadeTransitions) + finishAnimation(0); +} + void SystemView::onTransition() { for (auto& anim : mSystemElements[mPrimary->getCursor()].lottieAnimComponents) @@ -112,6 +118,7 @@ bool SystemView::input(InputConfig* config, Input input) config->isMappedTo("rightthumbstickclick", input))) { // Get a random system and jump to it. NavigationSounds::getInstance().playThemeNavigationSound(SYSTEMBROWSESOUND); + mPrimary->stopScrolling(); mPrimary->setCursor(SystemData::getRandomSystem(mPrimary->getSelected())); return true; } @@ -217,16 +224,15 @@ void SystemView::onCursorChanged(const CursorState& state) int cursor {mPrimary->getCursor()}; // Avoid double updates. - if (cursor == mLastCursor) - return; + if (cursor != mLastCursor) { + for (auto& selector : mSystemElements[cursor].gameSelectors) { + if (selector->getGameSelection() == GameSelectorComponent::GameSelection::RANDOM) + selector->setNeedsRefresh(); + } + } mLastCursor = cursor; - for (auto& selector : mSystemElements[cursor].gameSelectors) { - if (selector->getGameSelection() == GameSelectorComponent::GameSelection::RANDOM) - selector->setNeedsRefresh(); - } - for (auto& video : mSystemElements[cursor].videoComponents) video->setStaticVideo(); @@ -397,7 +403,8 @@ void SystemView::populate() if (mCarousel == nullptr) { mCarousel = std::make_unique>(); mPrimary = mCarousel.get(); - mPrimary->setDefaultZIndex(50.0f); + // For legacy themes the carousel has a zIndex value of 40 instead of 50. + mPrimary->setDefaultZIndex(40.0f); mPrimary->setCursorChangedCallback( [&](const CursorState& state) { onCursorChanged(state); }); mPrimary->setCancelTransitionsCallback([&] { @@ -1180,8 +1187,8 @@ void SystemView::legacyApplyTheme(const std::shared_ptr& theme) Font::get(static_cast(0.035f * mSize.y), Font::getDefaultPath())); mLegacySystemInfo->setColor(0x000000FF); mLegacySystemInfo->setUppercase(true); - mLegacySystemInfo->setZIndex(49.0f); - mLegacySystemInfo->setDefaultZIndex(49.0f); + mLegacySystemInfo->setZIndex(50.0f); + mLegacySystemInfo->setDefaultZIndex(50.0f); const ThemeData::ThemeElement* sysInfoElem { theme->getElement("system", "text_systemInfo", "text")}; @@ -1244,6 +1251,12 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary) if ((mFadeTransitions || element->getDimming() != 1.0f) && element->getZIndex() < primaryZIndex) element->setDimming(1.0f - mFadeOpacity); + if (mFadeTransitions && isAnimationPlaying(0)) + element->setOpacity(mMaxFade ? 1.0f - mFadeOpacity : 0.0f); + else + element->setOpacity(1.0f); + if (mNavigated && mMaxFade) + continue; element->render(elementTrans); } } @@ -1262,10 +1275,16 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary) } } - if (mLegacyMode && !abovePrimary) { - if (mFadeTransitions) - mLegacySystemInfo->setDimming(1.0f - mFadeOpacity); - mLegacySystemInfo->render(elementTrans); + if (mLegacyMode) { + if (mFadeTransitions && !abovePrimary) { + if (mFadeTransitions && isAnimationPlaying(0)) + mLegacySystemInfo->setOpacity(mMaxFade ? 1.0f - mFadeOpacity : 0.0f); + else + mLegacySystemInfo->setOpacity(1.0f); + } + if ((abovePrimary && mLegacySystemInfo->getZIndex() > 40.0f) || + (!abovePrimary && mLegacySystemInfo->getZIndex() <= 40.0f)) + mLegacySystemInfo->render(elementTrans); } mRenderer->popClipRect(); diff --git a/es-app/src/views/SystemView.h b/es-app/src/views/SystemView.h index 2da756f7b..e9a8ed400 100644 --- a/es-app/src/views/SystemView.h +++ b/es-app/src/views/SystemView.h @@ -36,6 +36,7 @@ public: SystemView(); ~SystemView(); + void onShow() override; void onTransition() override; void goToSystem(SystemData* system, bool animate); @@ -48,8 +49,13 @@ public: bool isSystemAnimationPlaying(unsigned char slot) { return mPrimary->isAnimationPlaying(slot); } void finishSystemAnimation(unsigned char slot) { - finishAnimation(slot); - mPrimary->finishAnimation(slot); + if (mFadeTransitions) { + mPrimary->finishAnimation(slot); + } + else { + finishAnimation(slot); + mPrimary->finishAnimation(slot); + } } PrimaryComponent::PrimaryType getPrimaryType() { return mPrimaryType; }