From c3886adb075b8aa79f93cb95bb5dedfec1887362 Mon Sep 17 00:00:00 2001 From: Crash Cringle <30600688+CrashCringle12@users.noreply.github.com> Date: Wed, 26 Feb 2025 02:54:58 -0500 Subject: [PATCH] Update Banner handling for new sorts --- .../Graphics/Banner Popularity.redir | 1 + Themes/_fallback/Graphics/Banner Recent.redir | 1 + Themes/_fallback/Languages/en.ini | 8 +++++- Themes/_fallback/metrics.ini | 6 ++++- src/Banner.cpp | 25 ++++++++++++++----- src/MusicWheel.cpp | 4 +-- src/SongUtil.cpp | 6 +---- 7 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 Themes/_fallback/Graphics/Banner Popularity.redir create mode 100644 Themes/_fallback/Graphics/Banner Recent.redir diff --git a/Themes/_fallback/Graphics/Banner Popularity.redir b/Themes/_fallback/Graphics/Banner Popularity.redir new file mode 100644 index 0000000000..507050cda9 --- /dev/null +++ b/Themes/_fallback/Graphics/Banner Popularity.redir @@ -0,0 +1 @@ +Common fallback banner \ No newline at end of file diff --git a/Themes/_fallback/Graphics/Banner Recent.redir b/Themes/_fallback/Graphics/Banner Recent.redir new file mode 100644 index 0000000000..507050cda9 --- /dev/null +++ b/Themes/_fallback/Graphics/Banner Recent.redir @@ -0,0 +1 @@ +Common fallback banner \ No newline at end of file diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 8301880461..93502aa7dc 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -306,9 +306,13 @@ HardMeterText=Hard Meter LengthText=Length MediumMeterText=Medium Meter PopularityText=Player's Best! +PopularityP1Text=P1's Most Played +PopularityP2Text=P2's Most Played PreferredText=Preferred TitleText=Title -RecentText=Recent +RecentText=Recently Played +RecentP1Text=P1's Recent Songs +RecentP2Text=P2's Recent Songs TopGradesText=Top Grades TopP1GradesText=P1 Top Grades TopP2GradesText=P2 Top Grades @@ -2039,6 +2043,8 @@ LowestGrades=Lowest Grades MostPlays=Most Plays Randomize=Randomize TopGrades=Top Grades +RecentlyPlayed=Recently Played +MostPlayed=Most Played [Sort] NotAvailable=N/A diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 75f244f53c..7cede7ec19 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -965,13 +965,15 @@ RecentSongsToShow=30 UseEasyMarkerFlag=false -ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,TopP1Grades,TopP2Grades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent" +ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,PopularityP1,PopularityP2,TopGrades,TopP1Grades,TopP2Grades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent,RecentP1,RecentP2" # ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,EasyMeter,MediumMeter,HardMeter,ChallengeMeter,DoubleEasyMeter,DoubleMediumMeter,DoubleHardMeter,DoubleChallengeMeter,Genre,Length,Recent,NormalMode,BattleMode" ChoicePreferred="sort,Preferred" ChoiceGroup="sort,Group" ChoiceTitle="sort,Title" ChoiceBpm="sort,BPM" ChoicePopularity="sort,Popularity" +ChoicePopularityP1="sort,PopularityP1" +ChoicePopularityP2="sort,PopularityP2" ChoiceTopGrades="sort,TopGrades" ChoiceTopP1Grades="sort,TopP1Grades" ChoiceTopP2Grades="sort,TopP2Grades" @@ -987,6 +989,8 @@ ChoiceDoubleHardMeter="sort,DoubleHardMeter" ChoiceDoubleChallengeMeter="sort,DoubleChallengeMeter" ChoiceLength="sort,Length" ChoiceRecent="sort,Recent" +ChoiceRecentP1="sort,RecentP1" +ChoiceRecentP2="sort,RecentP2" ChoiceNormalMode="playmode,regular" ChoiceBattleMode="playmode,battle" diff --git a/src/Banner.cpp b/src/Banner.cpp index ea02866191..d981bcf2e0 100644 --- a/src/Banner.cpp +++ b/src/Banner.cpp @@ -228,14 +228,27 @@ void Banner::LoadRandom() void Banner::LoadFromSortOrder( SortOrder so ) { // TODO: See if the check for nullptr/PREFERRED(?) is needed. - if( so == SortOrder_Invalid ) + switch( so ) { - LoadFallback(); - } - else - { - if( so != SORT_GROUP && so != SORT_RECENT && so != SORT_RECENT_P1 && so != SORT_RECENT_P2 ) + case SortOrder_Invalid: + LoadFallback(); + break; + case SORT_GROUP: + break; + // This is necessary to prevent multiple banners from matching for SORT_RECENT and SORT_POPULARITY + case SORT_RECENT: + case SORT_RECENT_P1: + case SORT_RECENT_P2: + Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(SORT_RECENT).c_str())) ); + break; + case SORT_POPULARITY: + case SORT_POPULARITY_P1: + case SORT_POPULARITY_P2: + Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(SORT_POPULARITY).c_str())) ); + break; + default: Load( THEME->GetPathG("Banner",ssprintf("%s",SortOrderToString(so).c_str())) ); + break; } m_bScrolling = (bool)SCROLL_SORT_ORDER; } diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index a8744e5ced..af7482aa2b 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -625,7 +625,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector &arrayWh case SORT_POPULARITY: if( (int) arraySongs.size() > MOST_PLAYED_SONGS_TO_SHOW ) arraySongs.erase( arraySongs.begin()+MOST_PLAYED_SONGS_TO_SHOW, arraySongs.end() ); - bUseSections = false; + bUseSections = true; break; case SORT_POPULARITY_P1: if( PROFILEMAN->IsPersistentProfile(PLAYER_1) ) @@ -666,7 +666,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector &arrayWh SongUtil::SortByMostRecentlyPlayedForMachine( arraySongs ); if( (int) arraySongs.size() > RECENT_SONGS_TO_SHOW ) arraySongs.erase( arraySongs.begin()+RECENT_SONGS_TO_SHOW, arraySongs.end() ); - bUseSections = false; + bUseSections = true; break; case SORT_RECENT_P1: if( PROFILEMAN->IsPersistentProfile(PLAYER_1) ) diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index a57d8957e8..bf8b5221bc 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -642,9 +642,6 @@ void SongUtil::SortSongPointerArrayByNumPlays( std::vector &vpSongsInOut, g_mapSongSortVal.clear(); } -static LocalizedString SECTION_RECENTLY_PLAYED("SongSort", "Recently Played"); -static LocalizedString SECTION_POPULAR_SONGS("SongSort", "Most Played"); - RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so ) { if( pSong == nullptr ) @@ -713,11 +710,10 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so case SORT_POPULARITY: case SORT_POPULARITY_P1: case SORT_POPULARITY_P2: - return SECTION_POPULAR_SONGS.GetValue(); case SORT_RECENT: case SORT_RECENT_P1: case SORT_RECENT_P2: - return SECTION_RECENTLY_PLAYED.GetValue(); + return THEME->GetString("MusicWheel", ssprintf("%s%s", SortOrderToString(so).c_str(), "Text")); case SORT_TOP_GRADES_P1: { int iCounts[NUM_Grade];