mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
cellMusic: always select the whole playlist instead of a single track
This commit is contained in:
parent
9bccdf4f71
commit
a5d07af89a
4 changed files with 52 additions and 8 deletions
|
@ -213,19 +213,29 @@ error_code cell_music_select_contents()
|
||||||
error_code error = rsx::overlays::show_media_list_dialog(rsx::overlays::media_list_dialog::media_type::audio, vfs_dir_path, title,
|
error_code error = rsx::overlays::show_media_list_dialog(rsx::overlays::media_list_dialog::media_type::audio, vfs_dir_path, title,
|
||||||
[&music](s32 status, utils::media_info info)
|
[&music](s32 status, utils::media_info info)
|
||||||
{
|
{
|
||||||
sysutil_register_cb([&music, info, status](ppu_thread& ppu) -> s32
|
sysutil_register_cb([&music, info = std::move(info), status](ppu_thread& ppu) -> s32
|
||||||
{
|
{
|
||||||
std::lock_guard lock(music.mtx);
|
std::lock_guard lock(music.mtx);
|
||||||
const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_CANCELED};
|
const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_CANCELED};
|
||||||
if (result == CELL_OK)
|
if (result == CELL_OK)
|
||||||
{
|
{
|
||||||
|
// Let's always choose the whole directory for now
|
||||||
|
std::string track;
|
||||||
|
std::string dir = info.path;
|
||||||
|
if (fs::is_file(info.path))
|
||||||
|
{
|
||||||
|
track = std::move(dir);
|
||||||
|
dir = fs::get_parent_dir(track);
|
||||||
|
}
|
||||||
|
|
||||||
music_selection_context context{};
|
music_selection_context context{};
|
||||||
context.set_playlist(info.path);
|
context.set_playlist(dir);
|
||||||
|
context.set_track(track);
|
||||||
// TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE;
|
// TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE;
|
||||||
// TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE;
|
// TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE;
|
||||||
music.current_selection_context = context;
|
music.current_selection_context = std::move(context);
|
||||||
music.current_selection_context.create_playlist(music_selection_context::get_next_hash());
|
music.current_selection_context.create_playlist(music_selection_context::get_next_hash());
|
||||||
cellMusic.success("Media list dialog: selected entry '%s'", context.playlist.front());
|
cellMusic.success("Media list dialog: selected entry '%s'", music.current_selection_context.playlist.front());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -166,6 +166,7 @@ struct music_selection_context
|
||||||
void set_playlist(const std::string& path);
|
void set_playlist(const std::string& path);
|
||||||
void create_playlist(const std::string& new_hash);
|
void create_playlist(const std::string& new_hash);
|
||||||
bool load_playlist();
|
bool load_playlist();
|
||||||
|
void set_track(std::string_view track);
|
||||||
u32 step_track(bool next);
|
u32 step_track(bool next);
|
||||||
|
|
||||||
operator bool() const
|
operator bool() const
|
||||||
|
|
|
@ -140,19 +140,29 @@ error_code cell_music_decode_select_contents()
|
||||||
error_code error = rsx::overlays::show_media_list_dialog(rsx::overlays::media_list_dialog::media_type::audio, vfs_dir_path, title,
|
error_code error = rsx::overlays::show_media_list_dialog(rsx::overlays::media_list_dialog::media_type::audio, vfs_dir_path, title,
|
||||||
[&dec](s32 status, utils::media_info info)
|
[&dec](s32 status, utils::media_info info)
|
||||||
{
|
{
|
||||||
sysutil_register_cb([&dec, info, status](ppu_thread& ppu) -> s32
|
sysutil_register_cb([&dec, info = std::move(info), status](ppu_thread& ppu) -> s32
|
||||||
{
|
{
|
||||||
std::lock_guard lock(dec.mutex);
|
std::lock_guard lock(dec.mutex);
|
||||||
const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_CANCELED};
|
const u32 result = status >= 0 ? u32{CELL_OK} : u32{CELL_MUSIC_DECODE_CANCELED};
|
||||||
if (result == CELL_OK)
|
if (result == CELL_OK)
|
||||||
{
|
{
|
||||||
|
// Let's always choose the whole directory for now
|
||||||
|
std::string track;
|
||||||
|
std::string dir = info.path;
|
||||||
|
if (fs::is_file(info.path))
|
||||||
|
{
|
||||||
|
track = std::move(dir);
|
||||||
|
dir = fs::get_parent_dir(track);
|
||||||
|
}
|
||||||
|
|
||||||
music_selection_context context{};
|
music_selection_context context{};
|
||||||
context.set_playlist(info.path);
|
context.set_playlist(dir);
|
||||||
|
context.set_track(track);
|
||||||
// TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE;
|
// TODO: context.repeat_mode = CELL_SEARCH_REPEATMODE_NONE;
|
||||||
// TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE;
|
// TODO: context.context_option = CELL_SEARCH_CONTEXTOPTION_NONE;
|
||||||
dec.current_selection_context = context;
|
dec.current_selection_context = std::move(context);
|
||||||
dec.current_selection_context.create_playlist(music_selection_context::get_next_hash());
|
dec.current_selection_context.create_playlist(music_selection_context::get_next_hash());
|
||||||
cellMusicDecode.success("Media list dialog: selected entry '%s'", context.playlist.front());
|
cellMusicDecode.success("Media list dialog: selected entry '%s'", dec.current_selection_context.playlist.front());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -248,6 +248,29 @@ bool music_selection_context::load_playlist()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void music_selection_context::set_track(std::string_view track)
|
||||||
|
{
|
||||||
|
if (track.empty()) return;
|
||||||
|
|
||||||
|
if (playlist.empty())
|
||||||
|
{
|
||||||
|
cellMusicSelectionContext.error("No tracks to play... (requested path='%s')", track);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (usz i = 0; i < playlist.size(); i++)
|
||||||
|
{
|
||||||
|
cellMusicSelectionContext.error("Comparing track '%s' vs '%s'", track, playlist[i]);
|
||||||
|
if (track.ends_with(playlist[i]))
|
||||||
|
{
|
||||||
|
first_track = current_track = static_cast<u32>(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cellMusicSelectionContext.error("Track '%s' not found...", track);
|
||||||
|
}
|
||||||
|
|
||||||
u32 music_selection_context::step_track(bool next)
|
u32 music_selection_context::step_track(bool next)
|
||||||
{
|
{
|
||||||
if (playlist.empty())
|
if (playlist.empty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue