From 0d4585b28ffcac1b62ed37cee2c34de0515df468 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 9 Sep 2010 16:17:21 +0000 Subject: 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 --- apps/plugin.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'apps/plugin.c') 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 */ -- cgit v1.1