From 1492af0c5403c656fd76ce5fc1422f670a5153c0 Mon Sep 17 00:00:00 2001 From: GrapheneCt <57592952+GrapheneCt@users.noreply.github.com> Date: Thu, 15 Jul 2021 21:08:12 +0200 Subject: [PATCH] Fix cover loader logic --- ElevenMPV-A/include/menus/menu_audioplayer.h | 2 ++ ElevenMPV-A/param.sfx | 2 +- ElevenMPV-A/source/menus/menu_audioplayer.cpp | 18 ++++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ElevenMPV-A/include/menus/menu_audioplayer.h b/ElevenMPV-A/include/menus/menu_audioplayer.h index 3d2ff06..f78afe4 100644 --- a/ElevenMPV-A/include/menus/menu_audioplayer.h +++ b/ElevenMPV-A/include/menus/menu_audioplayer.h @@ -98,6 +98,8 @@ namespace menu { static SceVoid HandleNext(SceBool fromHandlePrev, SceBool fromFfButton); + static SceVoid ReloadCoverForNext(); + static SceVoid HandlePrev(); static SceVoid ConvertSecondsToString(String *string, SceUInt64 seconds, SceBool needSeparator); diff --git a/ElevenMPV-A/param.sfx b/ElevenMPV-A/param.sfx index c602b35..08a975b 100644 --- a/ElevenMPV-A/param.sfx +++ b/ElevenMPV-A/param.sfx @@ -1,6 +1,6 @@ - 05.02 + 05.03 17338504 17 0 diff --git a/ElevenMPV-A/source/menus/menu_audioplayer.cpp b/ElevenMPV-A/source/menus/menu_audioplayer.cpp index 9d2dc85..44808ce 100644 --- a/ElevenMPV-A/source/menus/menu_audioplayer.cpp +++ b/ElevenMPV-A/source/menus/menu_audioplayer.cpp @@ -57,6 +57,16 @@ static SceUInt64 s_oldCurrentPosSec = 0; static String *s_totalLength; +SceVoid menu::audioplayer::Audioplayer::ReloadCoverForNext() +{ + // Handle cover + if (g_currentPlayerInstance->core->GetDecoder()->coverLoader == SCE_NULL && !g_currentPlayerInstance->core->GetDecoder()->GetMetadataLocation()->hasCover) { + g_currentPlayerInstance->core->GetDecoder()->coverLoader = new audio::PlayerCoverLoaderThread(SCE_KERNEL_COMMON_QUEUE_HIGHEST_PRIORITY, SCE_KERNEL_4KiB, "EMPVA::PlayerCoverLoader"); + g_currentPlayerInstance->core->GetDecoder()->coverLoader->workptr = SCE_NULL; + g_currentPlayerInstance->core->GetDecoder()->coverLoader->Start(); + } +} + SceVoid menu::audioplayer::Audioplayer::HandleNext(SceBool fromHandlePrev, SceBool fromFfButton) { Resource::Element searchParam; @@ -77,6 +87,7 @@ SceVoid menu::audioplayer::Audioplayer::HandleNext(SceBool fromHandlePrev, SceBo if (s_repeatState == REPEAT_STATE_ONE && !fromHandlePrev && !fromFfButton) { g_currentPlayerInstance->core = new AudioplayerCore(g_currentPlayerInstance->playlist.path[g_currentPlayerInstance->playlistIdx]->data); + ReloadCoverForNext(); return; } @@ -132,12 +143,7 @@ SceVoid menu::audioplayer::Audioplayer::HandleNext(SceBool fromHandlePrev, SceBo text8.Clear(); text16.Clear(); - // Handle cover - if (g_currentPlayerInstance->core->GetDecoder()->coverLoader == SCE_NULL && !g_currentPlayerInstance->core->GetDecoder()->GetMetadataLocation()->hasCover) { - g_currentPlayerInstance->core->GetDecoder()->coverLoader = new audio::PlayerCoverLoaderThread(SCE_KERNEL_COMMON_QUEUE_HIGHEST_PRIORITY, SCE_KERNEL_4KiB, "EMPVA::PlayerCoverLoader"); - g_currentPlayerInstance->core->GetDecoder()->coverLoader->workptr = SCE_NULL; - g_currentPlayerInstance->core->GetDecoder()->coverLoader->Start(); - } + ReloadCoverForNext(); } SceVoid menu::audioplayer::Audioplayer::HandlePrev()