summaryrefslogtreecommitdiff
path: root/uisimulator/common
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-01-16 23:20:58 +0000
committerJens Arnold <amiconn@rockbox.org>2006-01-16 23:20:58 +0000
commita79027743ab00911a839a76420e7e26a741ceee3 (patch)
tree7c60fd12ef0405dfff7ff7af46379ef40d6d0f74 /uisimulator/common
parent137501b9ac11032f57c63b4f90ec9379bf134b08 (diff)
downloadrockbox-a79027743ab00911a839a76420e7e26a741ceee3.tar.gz
rockbox-a79027743ab00911a839a76420e7e26a741ceee3.zip
Model & version check for simulator plugins.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8356 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common')
-rw-r--r--uisimulator/common/io.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index a5353af5e5..1871b29395 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -303,7 +303,7 @@ int sim_fsync(int fd)
303#include <dlfcn.h> 303#include <dlfcn.h>
304#endif 304#endif
305 305
306void *sim_codec_load_ram(char* codecptr, int size, 306void *sim_codec_load_ram(char* codecptr, int size,
307 void* ptr2, int bufwrap, int *pd_fd) 307 void* ptr2, int bufwrap, int *pd_fd)
308{ 308{
309 void *pd; 309 void *pd;
@@ -372,22 +372,21 @@ void *sim_codec_load_ram(char* codecptr, int size,
372 372
373void sim_codec_close(int pd) 373void sim_codec_close(int pd)
374{ 374{
375 dlclose((void *)pd); 375 dlclose((void *)pd);
376} 376}
377 377
378void *sim_plugin_load(char *plugin, int *fd) 378void *sim_plugin_load(char *plugin, int *fd)
379{ 379{
380 void* pd; 380 void *pd, *hdr;
381 char path[256]; 381 char path[256];
382 int (*plugin_start)(void * api, void* param);
383#ifdef WIN32 382#ifdef WIN32
384 char buf[256]; 383 char buf[256];
385#endif 384#endif
386 385
387 snprintf(path, sizeof path, "archos%s", plugin); 386 snprintf(path, sizeof path, "archos%s", plugin);
388
389 *fd = -1;
390 387
388 *fd = 0;
389
391 pd = dlopen(path, RTLD_NOW); 390 pd = dlopen(path, RTLD_NOW);
392 if (!pd) { 391 if (!pd) {
393 DEBUGF("failed to load %s\n", plugin); 392 DEBUGF("failed to load %s\n", plugin);
@@ -402,16 +401,12 @@ void *sim_plugin_load(char *plugin, int *fd)
402 return NULL; 401 return NULL;
403 } 402 }
404 403
405 plugin_start = dlsym(pd, "plugin_start"); 404 hdr = dlsym(pd, "__header");
406 if (!plugin_start) { 405 if (!hdr)
407 plugin_start = dlsym(pd, "_plugin_start"); 406 hdr = dlsym(pd, "___header");
408 if (!plugin_start) { 407
409 dlclose(pd);
410 return NULL;
411 }
412 }
413 *fd = (int)pd; /* success */ 408 *fd = (int)pd; /* success */
414 return plugin_start; 409 return hdr; /* maybe NULL if symbol not present */
415} 410}
416 411
417void sim_plugin_close(int pd) 412void sim_plugin_close(int pd)