diff --git a/apps/plugin.c b/apps/plugin.c index 115db06..b8bbdd5 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -631,6 +631,7 @@ static const struct plugin_api rockbox_api = { appsversion, /* new stuff at the end, sort into place next time the API gets incompatible */ + get_dirfilter, }; int plugin_load(const char* plugin, const void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 84c3d25..2e64747 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -127,7 +127,7 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 143 +#define PLUGIN_API_VERSION 144 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -787,6 +787,7 @@ struct plugin_api { const char *appsversion; /* new stuff at the end, sort into place next time the API gets incompatible */ + int (*get_dirfilter)(void); }; /* plugin header */ diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 7c28230..4a89b0a 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c @@ -35,11 +35,24 @@ static bool play(void) int audio_status = rb->audio_status(); if (!audio_status && rb->global_status->resume_index != -1) { + int saved_dirfilter = rb->get_dirfilter(); + + /* The dirfilter is set to only show .rocks, which messes up + * resuming certain kinds of playlists. To fix that, set it + * to the global dirfilter setting. + */ + rb->set_dirfilter(rb->global_settings->dirfilter); if (rb->playlist_resume() != -1) { rb->playlist_start(rb->global_status->resume_index, rb->global_status->resume_offset); } + + /* Set it back or display in the plugins menu shows too much. + * Note: this can't be an unconditional set to SHOW_PLUGINS or + * it breaks after running plugins directly from .rockbox/rocks/ + * in the File Browser */ + rb->set_dirfilter(saved_dirfilter); } else if (audio_status & AUDIO_STATUS_PAUSE) rb->audio_resume(); diff --git a/apps/tree.c b/apps/tree.c index 1f0b78b..e152a6a 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -536,6 +536,13 @@ void set_dirfilter(int l_dirfilter) *tc.dirfilter = l_dirfilter; } +/* Apps also need to be able to read the current dirfilter in order to + set it back to the old value after forcing it. */ +int get_dirfilter(void) +{ + return *tc.dirfilter; +} + /* Selects a file and update tree context properly */ void set_current_file(char *path) { diff --git a/apps/tree.h b/apps/tree.h index a4f36d9..4ee16ae 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -74,6 +74,7 @@ void tree_mem_init(void); void tree_gui_init(void); void get_current_file(char* buffer, int buffer_len); void set_dirfilter(int l_dirfilter); +int get_dirfilter(void); void set_current_file(char *path); int rockbox_browse(const char *root, int dirfilter); bool create_playlist(void);