summaryrefslogtreecommitdiff
path: root/apps/plugin.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-09 16:17:21 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-09 16:17:21 +0000
commit0d4585b28ffcac1b62ed37cee2c34de0515df468 (patch)
tree70ace8b78a4d0a44da50d692e893fadd93f85878 /apps/plugin.c
parentcec7c99613b3c11deb8a05deecd7ee9d16b5ea8a (diff)
downloadrockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.zip
rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.gz
rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.bz2
rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.xz
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.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 9e08951..9b490d0 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -723,12 +723,18 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
dir_get_info,
+
+ lc_open,
+ lc_open_from_mem,
+ lc_get_header,
+ lc_close,
};
int plugin_load(const char* plugin, const void* parameter)
{
int rc, i;
- struct plugin_header *hdr;
+ struct plugin_header *p_hdr;
+ struct lc_header *hdr;
#if LCD_DEPTH > 1
fb_data* old_backdrop;
@@ -754,7 +760,10 @@ int plugin_load(const char* plugin, const void* parameter)
return -1;
}
- hdr = lc_get_header(current_plugin_handle);
+ p_hdr = lc_get_header(current_plugin_handle);
+
+ hdr = p_hdr ? &p_hdr->lc_hdr : NULL;
+
if (hdr == NULL
|| hdr->magic != PLUGIN_MAGIC
@@ -782,7 +791,7 @@ int plugin_load(const char* plugin, const void* parameter)
plugin_size = 0;
#endif
- *(hdr->api) = &rockbox_api;
+ *(p_hdr->api) = &rockbox_api;
#if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1
old_backdrop = lcd_get_backdrop();
@@ -806,7 +815,7 @@ int plugin_load(const char* plugin, const void* parameter)
open_files = 0;
#endif
- rc = hdr->entry_point(parameter);
+ rc = p_hdr->entry_point(parameter);
if (!pfn_tsr_exit)
{ /* close handle if plugin is no tsr one */