diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-10-29 23:11:15 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2021-10-31 21:49:31 -0400 |
commit | 2731144094c8ba324a2936a1f8969d52d3a18713 (patch) | |
tree | 7b36f75616f52e84f03229c5bb517c1a2c529dff /apps/root_menu.c | |
parent | 684565b8f34d0f2bb9012b5a20499ed64db38812 (diff) | |
download | rockbox-2731144094c8ba324a2936a1f8969d52d3a18713.tar.gz rockbox-2731144094c8ba324a2936a1f8969d52d3a18713.zip |
exit file browser before running plugins
now that the plugin browser is resumable
exit it before running plugins
this causes a problem with the open plugin
shortcuts that call other plugins
but its now handled in count limited loop
so plugins can run plugins in a chain
and overall with less overhead too..
the problem remaining --
the plugin exits on USB, returns to ROOT
the browser resumes the
directory next time you select plugins
making for an unwanted auto return
Change-Id: If401f698207cbae824e95d69a378f13456a5dee4
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r-- | apps/root_menu.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c index ed6bdfdcca..f731531e16 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -709,47 +709,41 @@ static int load_context_screen(int selection) | |||
709 | 709 | ||
710 | static int load_plugin_screen(char *key) | 710 | static int load_plugin_screen(char *key) |
711 | { | 711 | { |
712 | int ret_val; | 712 | int ret_val = PLUGIN_ERROR; |
713 | int loops = 100; | ||
713 | int old_previous = last_screen; | 714 | int old_previous = last_screen; |
714 | int old_global = global_status.last_screen; | 715 | int old_global = global_status.last_screen; |
715 | last_screen = next_screen; | 716 | last_screen = next_screen; |
716 | global_status.last_screen = (char)next_screen; | 717 | global_status.last_screen = (char)next_screen; |
717 | status_save(); | 718 | status_save(); |
718 | 719 | ||
719 | int opret = open_plugin_get_entry(key, &open_plugin_entry); | 720 | while(loops-- > 0) /* just to keep things from getting out of hand */ |
720 | char *path = open_plugin_entry.path; | ||
721 | char *param = open_plugin_entry.param; | ||
722 | if (param[0] == '\0') | ||
723 | param = NULL; | ||
724 | |||
725 | switch (plugin_load(path, param)) | ||
726 | { | 721 | { |
727 | case PLUGIN_USB_CONNECTED: | 722 | int opret = open_plugin_get_entry(key, &open_plugin_entry); |
728 | ret_val = GO_TO_ROOT; | 723 | char *path = open_plugin_entry.path; |
729 | break; | 724 | char *param = open_plugin_entry.param; |
730 | case PLUGIN_GOTO_WPS: | 725 | if (param[0] == '\0') |
731 | ret_val = GO_TO_WPS; | 726 | param = NULL; |
732 | break; | 727 | |
733 | case PLUGIN_GOTO_PLUGIN: | 728 | int ret = plugin_load(path, param); |
734 | ret_val = GO_TO_PLUGIN; | 729 | |
735 | break; | 730 | if (ret == PLUGIN_USB_CONNECTED) |
736 | case PLUGIN_OK: | ||
737 | /* Prevents infinite loop with WPS & Plugins*/ | ||
738 | if (old_global == GO_TO_WPS && !audio_status()) | ||
739 | { | ||
740 | ret_val = GO_TO_ROOT; | 731 | ret_val = GO_TO_ROOT; |
741 | break; | 732 | else if (ret == PLUGIN_GOTO_WPS) |
733 | ret_val = GO_TO_WPS; | ||
734 | else if (ret == PLUGIN_GOTO_PLUGIN) | ||
735 | continue; | ||
736 | else | ||
737 | { | ||
738 | /* Prevents infinite loop with WPS & Plugins*/ | ||
739 | if (ret == PLUGIN_OK && old_global == GO_TO_WPS && !audio_status()) | ||
740 | ret_val = GO_TO_ROOT; | ||
741 | ret_val = GO_TO_PREVIOUS; | ||
742 | last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous; | ||
742 | } | 743 | } |
743 | /*fallthrough*/ | ||
744 | default: | ||
745 | ret_val = GO_TO_PREVIOUS; | ||
746 | last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous; | ||
747 | break; | ||
748 | 744 | ||
749 | } | 745 | /* ret_val != GO_TO_PLUGIN */ |
750 | 746 | ||
751 | if (ret_val != GO_TO_PLUGIN) | ||
752 | { | ||
753 | if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS) | 747 | if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS) |
754 | { | 748 | { |
755 | /* Keep the entry in case of GO_TO_PREVIOUS */ | 749 | /* Keep the entry in case of GO_TO_PREVIOUS */ |
@@ -757,7 +751,8 @@ static int load_plugin_screen(char *key) | |||
757 | open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN; | 751 | open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN; |
758 | /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */ | 752 | /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */ |
759 | } | 753 | } |
760 | } | 754 | break; |
755 | } /*while */ | ||
761 | return ret_val; | 756 | return ret_val; |
762 | } | 757 | } |
763 | 758 | ||