diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
commit | 0d4585b28ffcac1b62ed37cee2c34de0515df468 (patch) | |
tree | 70ace8b78a4d0a44da50d692e893fadd93f85878 /apps/plugin.c | |
parent | cec7c99613b3c11deb8a05deecd7ee9d16b5ea8a (diff) | |
download | rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.gz rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.zip |
Extend lc_open() to also being able to load overlay plugins.
For this it needs to look at the plugin header. Since lc_open() doesn't know
it's a plugin, the header needs to be changed slightly to include the new lc_header (which needs to be the first element in plugin_header so it can be casted savely).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28054 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugin.c')
-rw-r--r-- | apps/plugin.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 9e08951828..9b490d0fa9 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -723,12 +723,18 @@ static const struct plugin_api rockbox_api = { | |||
723 | /* new stuff at the end, sort into place next time | 723 | /* new stuff at the end, sort into place next time |
724 | the API gets incompatible */ | 724 | the API gets incompatible */ |
725 | dir_get_info, | 725 | dir_get_info, |
726 | |||
727 | lc_open, | ||
728 | lc_open_from_mem, | ||
729 | lc_get_header, | ||
730 | lc_close, | ||
726 | }; | 731 | }; |
727 | 732 | ||
728 | int plugin_load(const char* plugin, const void* parameter) | 733 | int plugin_load(const char* plugin, const void* parameter) |
729 | { | 734 | { |
730 | int rc, i; | 735 | int rc, i; |
731 | struct plugin_header *hdr; | 736 | struct plugin_header *p_hdr; |
737 | struct lc_header *hdr; | ||
732 | 738 | ||
733 | #if LCD_DEPTH > 1 | 739 | #if LCD_DEPTH > 1 |
734 | fb_data* old_backdrop; | 740 | fb_data* old_backdrop; |
@@ -754,7 +760,10 @@ int plugin_load(const char* plugin, const void* parameter) | |||
754 | return -1; | 760 | return -1; |
755 | } | 761 | } |
756 | 762 | ||
757 | hdr = lc_get_header(current_plugin_handle); | 763 | p_hdr = lc_get_header(current_plugin_handle); |
764 | |||
765 | hdr = p_hdr ? &p_hdr->lc_hdr : NULL; | ||
766 | |||
758 | 767 | ||
759 | if (hdr == NULL | 768 | if (hdr == NULL |
760 | || hdr->magic != PLUGIN_MAGIC | 769 | || hdr->magic != PLUGIN_MAGIC |
@@ -782,7 +791,7 @@ int plugin_load(const char* plugin, const void* parameter) | |||
782 | plugin_size = 0; | 791 | plugin_size = 0; |
783 | #endif | 792 | #endif |
784 | 793 | ||
785 | *(hdr->api) = &rockbox_api; | 794 | *(p_hdr->api) = &rockbox_api; |
786 | 795 | ||
787 | #if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1 | 796 | #if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1 |
788 | old_backdrop = lcd_get_backdrop(); | 797 | old_backdrop = lcd_get_backdrop(); |
@@ -806,7 +815,7 @@ int plugin_load(const char* plugin, const void* parameter) | |||
806 | open_files = 0; | 815 | open_files = 0; |
807 | #endif | 816 | #endif |
808 | 817 | ||
809 | rc = hdr->entry_point(parameter); | 818 | rc = p_hdr->entry_point(parameter); |
810 | 819 | ||
811 | if (!pfn_tsr_exit) | 820 | if (!pfn_tsr_exit) |
812 | { /* close handle if plugin is no tsr one */ | 821 | { /* close handle if plugin is no tsr one */ |