diff --git a/apps/filetree.c b/apps/filetree.c index d4681ae2c7..87ac37c2e0 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -552,22 +552,35 @@ int ft_enter(struct tree_context* c) /* plugin file */ case FILE_ATTR_ROCK: + { + int ret; if (global_settings.party_mode && audio_status()) { splash(HZ, ID2P(LANG_PARTY_MODE)); break; } - - if (plugin_load(buf,NULL) == PLUGIN_USB_CONNECTED) + ret = plugin_load(buf,NULL); + switch (ret) { - if(*c->dirfilter > NUM_FILTER_MODES) - /* leave sub-browsers after usb, doing - otherwise might be confusing to the user */ - exit_func = true; - else - reload_dir = true; + case PLUGIN_GOTO_WPS: + play = true; + break; + case PLUGIN_USB_CONNECTED: + if(*c->dirfilter > NUM_FILTER_MODES) + /* leave sub-browsers after usb, doing + otherwise might be confusing to the user */ + exit_func = true; + else + reload_dir = true; + break; + /* + case PLUGIN_ERROR: + case PLUGIN_OK: + */ + default: + break; } break; - + } case FILE_ATTR_CUE: display_cuesheet_content(buf); break; @@ -584,8 +597,21 @@ int ft_enter(struct tree_context* c) plugin = filetype_get_plugin(file); if (plugin) { - if (plugin_load(plugin,buf) == PLUGIN_USB_CONNECTED) - reload_dir = true; + switch (plugin_load(plugin,buf)) + { + case PLUGIN_USB_CONNECTED: + reload_dir = true; + break; + case PLUGIN_GOTO_WPS: + play = true; + break; + /* + case PLUGIN_OK: + case PLUGIN_ERROR: + */ + default: + break; + } } break; } diff --git a/apps/plugin.c b/apps/plugin.c index d6a5d067ce..f08a98753a 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -664,6 +664,7 @@ static const struct plugin_api rockbox_api = { int plugin_load(const char* plugin, const void* parameter) { int rc; + int i; int oldbars; struct plugin_header *hdr; #ifdef SIMULATOR @@ -804,8 +805,6 @@ int plugin_load(const char* plugin, const void* parameter) #endif /* LCD_DEPTH */ #endif /* HAVE_LCD_BITMAP */ - lcd_clear_display(); - lcd_update(); #ifdef HAVE_REMOTE_LCD #if LCD_REMOTE_DEPTH > 1 @@ -814,32 +813,27 @@ int plugin_load(const char* plugin, const void* parameter) #else lcd_remote_set_drawmode(DRMODE_SOLID); #endif - lcd_remote_clear_display(); - - - lcd_remote_update(); - - #endif + + if (rc != PLUGIN_GOTO_WPS) + { + FOR_NB_SCREENS(i) + { + screens[i].clear_display(); + screens[i].update(); + } + } + viewportmanager_set_statusbar(oldbars); if (pfn_tsr_exit == NULL) plugin_loaded = false; sim_plugin_close(pd); - switch (rc) { - case PLUGIN_OK: - break; + if (rc == PLUGIN_ERROR) + splash(HZ*2, str(LANG_PLUGIN_ERROR)); - case PLUGIN_USB_CONNECTED: - return PLUGIN_USB_CONNECTED; - - default: - splash(HZ*2, str(LANG_PLUGIN_ERROR)); - break; - } - - return PLUGIN_OK; + return rc; } /* Returns a pointer to the portion of the plugin buffer that is not already diff --git a/apps/plugin.h b/apps/plugin.h index f3d4c23e8a..253cfd0aab 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -139,6 +139,7 @@ void* plugin_get_buffer(size_t *buffer_size); enum plugin_status { PLUGIN_OK = 0, PLUGIN_USB_CONNECTED, + PLUGIN_GOTO_WPS, PLUGIN_ERROR = -1, };