mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
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
This commit is contained in:
parent
cec7c99613
commit
0d4585b28f
10 changed files with 167 additions and 105 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue