diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-01-15 18:20:18 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-01-15 18:20:18 +0000 |
commit | a36b1d4083e5cf34df1b217516be28471e7d0dc7 (patch) | |
tree | 629bb610d0ffcc451d3b0383f62daaed7d602603 /apps | |
parent | c7c9069ed4bda959e649520342017d826123931e (diff) | |
download | rockbox-a36b1d4083e5cf34df1b217516be28471e7d0dc7.tar.gz rockbox-a36b1d4083e5cf34df1b217516be28471e7d0dc7.zip |
New plugin loader. Solves the crashes introduced with the .bss changes while keeping the small binary size. The model & api version check is now part of the plugin loader. Codecs are not yet adapted, but the old method still works for them. Simulator plugins are not (yet) version-checked. API version numbering restarted, as this is an all-new system. Uses the target ID from configure, so don't change that too often.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8349 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
69 files changed, 264 insertions, 306 deletions
diff --git a/apps/Makefile b/apps/Makefile index 278e1c7118..c6e5d2dbcc 100644 --- a/apps/Makefile +++ b/apps/Makefile | |||
@@ -34,7 +34,7 @@ ifdef APPEXTRA | |||
34 | INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA))) | 34 | INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA))) |
35 | endif | 35 | endif |
36 | 36 | ||
37 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \ | 37 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) -DTARGET_ID=$(TARGET_ID) \ |
38 | -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} | 38 | -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} |
39 | 39 | ||
40 | OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o) | 40 | OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o) |
diff --git a/apps/plugin.c b/apps/plugin.c index 9a20827e26..0997b0a901 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -78,13 +78,8 @@ static bool plugin_loaded = false; | |||
78 | static int plugin_size = 0; | 78 | static int plugin_size = 0; |
79 | static void (*pfn_tsr_exit)(void) = NULL; /* TSR exit callback */ | 79 | static void (*pfn_tsr_exit)(void) = NULL; /* TSR exit callback */ |
80 | 80 | ||
81 | static int plugin_test(int api_version, int model, int memsize); | ||
82 | |||
83 | static const struct plugin_api rockbox_api = { | 81 | static const struct plugin_api rockbox_api = { |
84 | PLUGIN_API_VERSION, | ||
85 | 82 | ||
86 | plugin_test, | ||
87 | |||
88 | /* lcd */ | 83 | /* lcd */ |
89 | lcd_set_contrast, | 84 | lcd_set_contrast, |
90 | lcd_clear_display, | 85 | lcd_clear_display, |
@@ -135,6 +130,7 @@ static const struct plugin_api rockbox_api = { | |||
135 | checkbox, | 130 | checkbox, |
136 | font_get, | 131 | font_get, |
137 | font_getstringsize, | 132 | font_getstringsize, |
133 | font_get_width, | ||
138 | #endif | 134 | #endif |
139 | backlight_on, | 135 | backlight_on, |
140 | backlight_off, | 136 | backlight_off, |
@@ -243,9 +239,18 @@ static const struct plugin_api rockbox_api = { | |||
243 | strcat, | 239 | strcat, |
244 | memcmp, | 240 | memcmp, |
245 | strcasestr, | 241 | strcasestr, |
242 | /* unicode stuff */ | ||
243 | utf8decode, | ||
244 | iso_decode, | ||
245 | utf16LEdecode, | ||
246 | utf16BEdecode, | ||
247 | utf8encode, | ||
248 | utf8length, | ||
246 | 249 | ||
247 | /* sound */ | 250 | /* sound */ |
248 | sound_set, | 251 | sound_set, |
252 | sound_min, | ||
253 | sound_max, | ||
249 | #ifndef SIMULATOR | 254 | #ifndef SIMULATOR |
250 | mp3_play_data, | 255 | mp3_play_data, |
251 | mp3_play_pause, | 256 | mp3_play_pause, |
@@ -307,6 +312,21 @@ static const struct plugin_api rockbox_api = { | |||
307 | &rundb_fd, | 312 | &rundb_fd, |
308 | &rundb_initialized, | 313 | &rundb_initialized, |
309 | 314 | ||
315 | /* menu */ | ||
316 | menu_init, | ||
317 | menu_exit, | ||
318 | menu_show, | ||
319 | menu_run, | ||
320 | menu_cursor, | ||
321 | menu_description, | ||
322 | menu_delete, | ||
323 | menu_count, | ||
324 | menu_moveup, | ||
325 | menu_movedown, | ||
326 | menu_draw, | ||
327 | menu_insert, | ||
328 | menu_set_cursor, | ||
329 | |||
310 | /* misc */ | 330 | /* misc */ |
311 | srand, | 331 | srand, |
312 | rand, | 332 | rand, |
@@ -337,39 +357,13 @@ static const struct plugin_api rockbox_api = { | |||
337 | #endif | 357 | #endif |
338 | #ifdef HAVE_LCD_BITMAP | 358 | #ifdef HAVE_LCD_BITMAP |
339 | read_bmp_file, | 359 | read_bmp_file, |
360 | screen_dump_set_hook, | ||
340 | #endif | 361 | #endif |
341 | show_logo, | 362 | show_logo, |
342 | 363 | ||
343 | /* new stuff at the end, sort into place next time | 364 | /* new stuff at the end, sort into place next time |
344 | the API gets incompatible */ | 365 | the API gets incompatible */ |
345 | 366 | ||
346 | menu_init, | ||
347 | menu_exit, | ||
348 | menu_show, | ||
349 | menu_run, | ||
350 | menu_cursor, | ||
351 | menu_description, | ||
352 | menu_delete, | ||
353 | menu_count, | ||
354 | menu_moveup, | ||
355 | menu_movedown, | ||
356 | menu_draw, | ||
357 | menu_insert, | ||
358 | menu_set_cursor, | ||
359 | |||
360 | #ifdef HAVE_LCD_BITMAP | ||
361 | screen_dump_set_hook, | ||
362 | font_get_width, | ||
363 | #endif | ||
364 | utf8decode, | ||
365 | iso_decode, | ||
366 | utf16LEdecode, | ||
367 | utf16BEdecode, | ||
368 | utf8encode, | ||
369 | utf8length, | ||
370 | |||
371 | sound_min, | ||
372 | sound_max, | ||
373 | }; | 367 | }; |
374 | 368 | ||
375 | int plugin_load(const char* plugin, void* parameter) | 369 | int plugin_load(const char* plugin, void* parameter) |
@@ -377,7 +371,8 @@ int plugin_load(const char* plugin, void* parameter) | |||
377 | enum plugin_status (*plugin_start)(struct plugin_api* api, void* param); | 371 | enum plugin_status (*plugin_start)(struct plugin_api* api, void* param); |
378 | int rc; | 372 | int rc; |
379 | #ifndef SIMULATOR | 373 | #ifndef SIMULATOR |
380 | char buf[64]; | 374 | struct plugin_header header; |
375 | ssize_t readsize; | ||
381 | #endif | 376 | #endif |
382 | int fd; | 377 | int fd; |
383 | 378 | ||
@@ -408,28 +403,50 @@ int plugin_load(const char* plugin, void* parameter) | |||
408 | #else | 403 | #else |
409 | fd = open(plugin, O_RDONLY); | 404 | fd = open(plugin, O_RDONLY); |
410 | if (fd < 0) { | 405 | if (fd < 0) { |
411 | snprintf(buf, sizeof buf, str(LANG_PLUGIN_CANT_OPEN), plugin); | 406 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin); |
412 | gui_syncsplash(HZ*2, true, buf); | ||
413 | return fd; | 407 | return fd; |
414 | } | 408 | } |
415 | 409 | ||
410 | readsize = read(fd, &header, sizeof(header)); | ||
411 | close(fd); | ||
412 | /* Close for now. Less code than doing it in all error checks. | ||
413 | * Would need to seek back anyway. */ | ||
414 | |||
415 | if (readsize != sizeof(header)) { | ||
416 | gui_syncsplash(HZ*2, true, str(LANG_READ_FAILED), plugin); | ||
417 | return -1; | ||
418 | } | ||
419 | if (header.magic != PLUGIN_MAGIC | ||
420 | || header.target_id != TARGET_ID | ||
421 | || header.load_addr != pluginbuf | ||
422 | || header.end_addr > pluginbuf + PLUGIN_BUFFER_SIZE) { | ||
423 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); | ||
424 | return -1; | ||
425 | } | ||
426 | if (header.api_version > PLUGIN_API_VERSION | ||
427 | || header.api_version < PLUGIN_MIN_API_VERSION) { | ||
428 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION)); | ||
429 | return -1; | ||
430 | } | ||
431 | |||
416 | /* zero out plugin buffer to ensure a properly zeroed bss area */ | 432 | /* zero out plugin buffer to ensure a properly zeroed bss area */ |
417 | memset(pluginbuf, 0, PLUGIN_BUFFER_SIZE); | 433 | memset(pluginbuf, 0, header.end_addr - pluginbuf); |
418 | 434 | ||
419 | plugin_start = (void*)&pluginbuf; | 435 | fd = open(plugin, O_RDONLY); |
420 | plugin_size = read(fd, plugin_start, PLUGIN_BUFFER_SIZE); | 436 | if (fd < 0) { |
437 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin); | ||
438 | return fd; | ||
439 | } | ||
440 | readsize = read(fd, pluginbuf, PLUGIN_BUFFER_SIZE); | ||
421 | close(fd); | 441 | close(fd); |
422 | if (plugin_size < 0) { | 442 | |
443 | if (readsize < 0) { | ||
423 | /* read error */ | 444 | /* read error */ |
424 | snprintf(buf, sizeof buf, str(LANG_READ_FAILED), plugin); | 445 | gui_syncsplash(HZ*2, true, str(LANG_READ_FAILED), plugin); |
425 | gui_syncsplash(HZ*2, true, buf); | ||
426 | return -1; | ||
427 | } | ||
428 | if (plugin_size == 0) { | ||
429 | /* loaded a 0-byte plugin, implying it's not for this model */ | ||
430 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); | ||
431 | return -1; | 446 | return -1; |
432 | } | 447 | } |
448 | plugin_start = header.entry_point; | ||
449 | plugin_size = header.end_addr - header.load_addr; | ||
433 | #endif | 450 | #endif |
434 | 451 | ||
435 | plugin_loaded = true; | 452 | plugin_loaded = true; |
@@ -458,14 +475,6 @@ int plugin_load(const char* plugin, void* parameter) | |||
458 | case PLUGIN_USB_CONNECTED: | 475 | case PLUGIN_USB_CONNECTED: |
459 | return PLUGIN_USB_CONNECTED; | 476 | return PLUGIN_USB_CONNECTED; |
460 | 477 | ||
461 | case PLUGIN_WRONG_API_VERSION: | ||
462 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_VERSION)); | ||
463 | break; | ||
464 | |||
465 | case PLUGIN_WRONG_MODEL: | ||
466 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_WRONG_MODEL)); | ||
467 | break; | ||
468 | |||
469 | default: | 478 | default: |
470 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_ERROR)); | 479 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_ERROR)); |
471 | break; | 480 | break; |
@@ -521,19 +530,3 @@ void plugin_tsr(void (*exit_callback)(void)) | |||
521 | { | 530 | { |
522 | pfn_tsr_exit = exit_callback; /* remember the callback for later */ | 531 | pfn_tsr_exit = exit_callback; /* remember the callback for later */ |
523 | } | 532 | } |
524 | |||
525 | |||
526 | static int plugin_test(int api_version, int model, int memsize) | ||
527 | { | ||
528 | if (api_version < PLUGIN_MIN_API_VERSION || | ||
529 | api_version > PLUGIN_API_VERSION) | ||
530 | return PLUGIN_WRONG_API_VERSION; | ||
531 | |||
532 | if (model != MODEL) | ||
533 | return PLUGIN_WRONG_MODEL; | ||
534 | |||
535 | if (memsize != MEM) | ||
536 | return PLUGIN_WRONG_MODEL; | ||
537 | |||
538 | return PLUGIN_OK; | ||
539 | } | ||
diff --git a/apps/plugin.h b/apps/plugin.h index f935809949..bf8f34ab9e 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -90,44 +90,23 @@ | |||
90 | #define PREFIX(_x_) _x_ | 90 | #define PREFIX(_x_) _x_ |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | ||
94 | |||
93 | /* increase this every time the api struct changes */ | 95 | /* increase this every time the api struct changes */ |
94 | #define PLUGIN_API_VERSION 54 | 96 | #define PLUGIN_API_VERSION 1 |
95 | 97 | ||
96 | /* update this to latest version if a change to the api struct breaks | 98 | /* update this to latest version if a change to the api struct breaks |
97 | backwards compatibility (and please take the opportunity to sort in any | 99 | backwards compatibility (and please take the opportunity to sort in any |
98 | new function which are "waiting" at the end of the function table) */ | 100 | new function which are "waiting" at the end of the function table) */ |
99 | #define PLUGIN_MIN_API_VERSION 51 | 101 | #define PLUGIN_MIN_API_VERSION 1 |
100 | 102 | ||
101 | /* plugin return codes */ | 103 | /* plugin return codes */ |
102 | enum plugin_status { | 104 | enum plugin_status { |
103 | PLUGIN_OK = 0, | 105 | PLUGIN_OK = 0, |
104 | PLUGIN_USB_CONNECTED, | 106 | PLUGIN_USB_CONNECTED, |
105 | 107 | PLUGIN_ERROR = -1, | |
106 | PLUGIN_WRONG_API_VERSION = -1, | ||
107 | PLUGIN_WRONG_MODEL = -2, | ||
108 | PLUGIN_ERROR = -3, | ||
109 | }; | 108 | }; |
110 | 109 | ||
111 | /* different (incompatible) plugin models */ | ||
112 | enum model { | ||
113 | PLAYER, | ||
114 | RECORDER | ||
115 | }; | ||
116 | |||
117 | #ifdef HAVE_LCD_CHARCELLS | ||
118 | #define MODEL PLAYER | ||
119 | #else | ||
120 | #define MODEL RECORDER | ||
121 | #endif | ||
122 | |||
123 | /* compatibility test macro */ | ||
124 | #define TEST_PLUGIN_API(_api_) \ | ||
125 | do { \ | ||
126 | int _rc_ = _api_->plugin_test(PLUGIN_API_VERSION, MODEL, MEM); \ | ||
127 | if (_rc_<0) \ | ||
128 | return _rc_; \ | ||
129 | } while(0) | ||
130 | |||
131 | /* NOTE: To support backwards compatibility, only add new functions at | 110 | /* NOTE: To support backwards compatibility, only add new functions at |
132 | the end of the structure. Every time you add a new function, | 111 | the end of the structure. Every time you add a new function, |
133 | remember to increase PLUGIN_API_VERSION. If you make changes to the | 112 | remember to increase PLUGIN_API_VERSION. If you make changes to the |
@@ -135,10 +114,6 @@ do { \ | |||
135 | version | 114 | version |
136 | */ | 115 | */ |
137 | struct plugin_api { | 116 | struct plugin_api { |
138 | /* these two fields must always be first, to ensure | ||
139 | TEST_PLUGIN_API will always work */ | ||
140 | int version; | ||
141 | int (*plugin_test)(int api_version, int model, int memsize); | ||
142 | 117 | ||
143 | /* lcd */ | 118 | /* lcd */ |
144 | void (*lcd_set_contrast)(int x); | 119 | void (*lcd_set_contrast)(int x); |
@@ -198,6 +173,7 @@ struct plugin_api { | |||
198 | struct font* (*font_get)(int font); | 173 | struct font* (*font_get)(int font); |
199 | int (*font_getstringsize)(const unsigned char *str, int *w, int *h, | 174 | int (*font_getstringsize)(const unsigned char *str, int *w, int *h, |
200 | int fontnumber); | 175 | int fontnumber); |
176 | int (*font_get_width)(struct font* pf, unsigned short char_code); | ||
201 | #endif | 177 | #endif |
202 | void (*backlight_on)(void); | 178 | void (*backlight_on)(void); |
203 | void (*backlight_off)(void); | 179 | void (*backlight_off)(void); |
@@ -314,9 +290,18 @@ struct plugin_api { | |||
314 | char *(*strcat)(char *s1, const char *s2); | 290 | char *(*strcat)(char *s1, const char *s2); |
315 | int (*memcmp)(const void *s1, const void *s2, size_t n); | 291 | int (*memcmp)(const void *s1, const void *s2, size_t n); |
316 | char *(*strcasestr) (const char* phaystack, const char* pneedle); | 292 | char *(*strcasestr) (const char* phaystack, const char* pneedle); |
293 | /* unicode stuff */ | ||
294 | const unsigned char* (*utf8decode)(const unsigned char *utf8, unsigned short *ucs); | ||
295 | unsigned char* (*iso_decode)(const unsigned char *iso, unsigned char *utf8, int cp, int count); | ||
296 | unsigned char* (*utf16LEdecode)(const unsigned char *utf16, unsigned char *utf8, unsigned int count); | ||
297 | unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, unsigned int count); | ||
298 | unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8); | ||
299 | unsigned long (*utf8length)(const unsigned char *utf8); | ||
317 | 300 | ||
318 | /* sound */ | 301 | /* sound */ |
319 | void (*sound_set)(int setting, int value); | 302 | void (*sound_set)(int setting, int value); |
303 | int (*sound_min)(int setting); | ||
304 | int (*sound_max)(int setting); | ||
320 | #ifndef SIMULATOR | 305 | #ifndef SIMULATOR |
321 | void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)); | 306 | void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)); |
322 | void (*mp3_play_pause)(bool play); | 307 | void (*mp3_play_pause)(bool play); |
@@ -378,6 +363,23 @@ struct plugin_api { | |||
378 | int *rundb_fd; | 363 | int *rundb_fd; |
379 | int *rundb_initialized; | 364 | int *rundb_initialized; |
380 | 365 | ||
366 | /* menu */ | ||
367 | int (*menu_init)(const struct menu_item* mitems, int count, | ||
368 | int (*callback)(int, int), | ||
369 | const char *button1, const char *button2, const char *button3); | ||
370 | void (*menu_exit)(int menu); | ||
371 | int (*menu_show)(int m); | ||
372 | bool (*menu_run)(int menu); | ||
373 | int (*menu_cursor)(int menu); | ||
374 | char* (*menu_description)(int menu, int position); | ||
375 | void (*menu_delete)(int menu, int position); | ||
376 | int (*menu_count)(int menu); | ||
377 | bool (*menu_moveup)(int menu); | ||
378 | bool (*menu_movedown)(int menu); | ||
379 | void (*menu_draw)(int menu); | ||
380 | void (*menu_insert)(int menu, int position, char *desc, bool (*function) (void)); | ||
381 | void (*menu_set_cursor)(int menu, int position); | ||
382 | |||
381 | /* misc */ | 383 | /* misc */ |
382 | void (*srand)(unsigned int seed); | 384 | void (*srand)(unsigned int seed); |
383 | int (*rand)(void); | 385 | int (*rand)(void); |
@@ -416,42 +418,37 @@ struct plugin_api { | |||
416 | #ifdef HAVE_LCD_BITMAP | 418 | #ifdef HAVE_LCD_BITMAP |
417 | int (*read_bmp_file)(char* filename, int *get_width, int *get_height, | 419 | int (*read_bmp_file)(char* filename, int *get_width, int *get_height, |
418 | char *bitmap, int maxsize); | 420 | char *bitmap, int maxsize); |
421 | void (*screen_dump_set_hook)(void (*hook)(int fh)); | ||
419 | #endif | 422 | #endif |
420 | int (*show_logo)(void); | 423 | int (*show_logo)(void); |
421 | 424 | ||
422 | /* new stuff at the end, sort into place next time | 425 | /* new stuff at the end, sort into place next time |
423 | the API gets incompatible */ | 426 | the API gets incompatible */ |
424 | 427 | ||
425 | int (*menu_init)(const struct menu_item* mitems, int count, | 428 | }; |
426 | int (*callback)(int, int), | ||
427 | const char *button1, const char *button2, const char *button3); | ||
428 | void (*menu_exit)(int menu); | ||
429 | int (*menu_show)(int m); | ||
430 | bool (*menu_run)(int menu); | ||
431 | int (*menu_cursor)(int menu); | ||
432 | char* (*menu_description)(int menu, int position); | ||
433 | void (*menu_delete)(int menu, int position); | ||
434 | int (*menu_count)(int menu); | ||
435 | bool (*menu_moveup)(int menu); | ||
436 | bool (*menu_movedown)(int menu); | ||
437 | void (*menu_draw)(int menu); | ||
438 | void (*menu_insert)(int menu, int position, char *desc, bool (*function) (void)); | ||
439 | void (*menu_set_cursor)(int menu, int position); | ||
440 | 429 | ||
441 | #ifdef HAVE_LCD_BITMAP | 430 | #ifndef SIMULATOR |
442 | void (*screen_dump_set_hook)(void (*hook)(int fh)); | 431 | /* plugin header */ |
443 | int (*font_get_width)(struct font* pf, unsigned short char_code); | 432 | struct plugin_header { |
444 | #endif | 433 | unsigned long magic; |
445 | const unsigned char* (*utf8decode)(const unsigned char *utf8, unsigned short *ucs); | 434 | unsigned short target_id; |
446 | unsigned char* (*iso_decode)(const unsigned char *iso, unsigned char *utf8, int cp, int count); | 435 | unsigned short api_version; |
447 | unsigned char* (*utf16LEdecode)(const unsigned char *utf16, unsigned char *utf8, unsigned int count); | 436 | unsigned char *load_addr; |
448 | unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, unsigned int count); | 437 | unsigned char *end_addr; |
449 | unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8); | 438 | enum plugin_status(*entry_point)(struct plugin_api*, void*); |
450 | unsigned long (*utf8length)(const unsigned char *utf8); | ||
451 | |||
452 | int (*sound_min)(int setting); | ||
453 | int (*sound_max)(int setting); | ||
454 | }; | 439 | }; |
440 | #ifdef PLUGIN | ||
441 | extern unsigned char plugin_start_addr[]; | ||
442 | extern unsigned char plugin_end_addr[]; | ||
443 | #define PLUGIN_HEADER \ | ||
444 | const struct plugin_header __header \ | ||
445 | __attribute__ ((section (".header")))= { \ | ||
446 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | ||
447 | plugin_start_addr, plugin_end_addr, plugin_start }; | ||
448 | #endif | ||
449 | #else /* SIMULATOR */ | ||
450 | #define PLUGIN_HEADER | ||
451 | #endif | ||
455 | 452 | ||
456 | int plugin_load(const char* plugin, void* parameter); | 453 | int plugin_load(const char* plugin, void* parameter); |
457 | void* plugin_get_buffer(int *buffer_size); | 454 | void* plugin_get_buffer(int *buffer_size); |
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 45fa7a469d..2ed1a101bb 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile | |||
@@ -10,7 +10,7 @@ | |||
10 | INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \ | 10 | INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \ |
11 | -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR) | 11 | -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR) |
12 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ | 12 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ |
13 | -DMEM=${MEMORYSIZE} -DPLUGIN | 13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
14 | 14 | ||
15 | ifdef APPEXTRA | 15 | ifdef APPEXTRA |
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | 16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) |
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index 874f72265e..91cfb0ecdc 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c | |||
@@ -34,6 +34,8 @@ | |||
34 | /* Only build for (correct) target */ | 34 | /* Only build for (correct) target */ |
35 | #if !defined(SIMULATOR) && CONFIG_CPU==SH7034 && !defined(HAVE_MMC) | 35 | #if !defined(SIMULATOR) && CONFIG_CPU==SH7034 && !defined(HAVE_MMC) |
36 | 36 | ||
37 | PLUGIN_HEADER | ||
38 | |||
37 | #ifdef HAVE_LCD_CHARCELLS /* player model */ | 39 | #ifdef HAVE_LCD_CHARCELLS /* player model */ |
38 | #define LINES 2 | 40 | #define LINES 2 |
39 | #define COLUMNS 11 | 41 | #define COLUMNS 11 |
@@ -1192,10 +1194,6 @@ int main(void* parameter) | |||
1192 | 1194 | ||
1193 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1195 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
1194 | { | 1196 | { |
1195 | /* this macro should be called as the first thing you do in the plugin. | ||
1196 | it test that the api version and model the plugin was compiled for | ||
1197 | matches the machine it is running on */ | ||
1198 | TEST_PLUGIN_API(api); | ||
1199 | rb = api; /* copy to global api pointer */ | 1197 | rb = api; /* copy to global api pointer */ |
1200 | 1198 | ||
1201 | /* now go ahead and have fun! */ | 1199 | /* now go ahead and have fun! */ |
diff --git a/apps/plugins/battery_test.c b/apps/plugins/battery_test.c index ac47b001f2..c076ad74e8 100644 --- a/apps/plugins/battery_test.c +++ b/apps/plugins/battery_test.c | |||
@@ -29,6 +29,8 @@ | |||
29 | to watch. | 29 | to watch. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | PLUGIN_HEADER | ||
33 | |||
32 | /* variable button definitions */ | 34 | /* variable button definitions */ |
33 | #if CONFIG_KEYPAD == RECORDER_PAD | 35 | #if CONFIG_KEYPAD == RECORDER_PAD |
34 | #define BATTERY_TEST_QUIT BUTTON_OFF | 36 | #define BATTERY_TEST_QUIT BUTTON_OFF |
@@ -136,7 +138,6 @@ enum plugin_status loop(void) | |||
136 | 138 | ||
137 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 139 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
138 | { | 140 | { |
139 | TEST_PLUGIN_API(api); | ||
140 | (void)parameter; | 141 | (void)parameter; |
141 | rb = api; | 142 | rb = api; |
142 | 143 | ||
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c index 2a2d520371..7b59841055 100644 --- a/apps/plugins/bounce.c +++ b/apps/plugins/bounce.c | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #ifdef HAVE_LCD_BITMAP | 22 | #ifdef HAVE_LCD_BITMAP |
23 | 23 | ||
24 | PLUGIN_HEADER | ||
25 | |||
24 | #define SS_TITLE "Bouncer" | 26 | #define SS_TITLE "Bouncer" |
25 | #define SS_TITLE_FONT 2 | 27 | #define SS_TITLE_FONT 2 |
26 | 28 | ||
@@ -443,7 +445,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
443 | char *off = "[Off] to stop"; | 445 | char *off = "[Off] to stop"; |
444 | int len; | 446 | int len; |
445 | 447 | ||
446 | TEST_PLUGIN_API(api); | ||
447 | (void)(parameter); | 448 | (void)(parameter); |
448 | rb = api; | 449 | rb = api; |
449 | 450 | ||
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 51b9cfacc7..ba18cc1c55 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c | |||
@@ -76,6 +76,8 @@ F3: equal to "=" | |||
76 | #ifdef HAVE_LCD_BITMAP | 76 | #ifdef HAVE_LCD_BITMAP |
77 | #include "math.h" | 77 | #include "math.h" |
78 | 78 | ||
79 | PLUGIN_HEADER | ||
80 | |||
79 | #define REC_HEIGHT 10 /* blank height = 9 */ | 81 | #define REC_HEIGHT 10 /* blank height = 9 */ |
80 | #define REC_WIDTH 22 /* blank width = 21 */ | 82 | #define REC_WIDTH 22 /* blank width = 21 */ |
81 | 83 | ||
@@ -1324,7 +1326,6 @@ Main(); | |||
1324 | ----------------------------------------------------------------------- */ | 1326 | ----------------------------------------------------------------------- */ |
1325 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1327 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
1326 | { | 1328 | { |
1327 | TEST_PLUGIN_API(api); | ||
1328 | (void)parameter; | 1329 | (void)parameter; |
1329 | rb = api; | 1330 | rb = api; |
1330 | 1331 | ||
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 5cb04b565c..464d810342 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -23,6 +23,8 @@ | |||
23 | 23 | ||
24 | #include <timefuncs.h> | 24 | #include <timefuncs.h> |
25 | 25 | ||
26 | PLUGIN_HEADER | ||
27 | |||
26 | static struct plugin_api* rb; | 28 | static struct plugin_api* rb; |
27 | 29 | ||
28 | static bool leap_year; | 30 | static bool leap_year; |
@@ -664,9 +666,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
664 | bool exit = false; | 666 | bool exit = false; |
665 | int button; | 667 | int button; |
666 | 668 | ||
667 | TEST_PLUGIN_API(api); | ||
668 | (void)(parameter); | 669 | (void)(parameter); |
669 | 670 | ||
670 | rb = api; | 671 | rb = api; |
671 | 672 | ||
672 | calendar_init(&today, &shown); | 673 | calendar_init(&today, &shown); |
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index 18ba68014f..73f53c9205 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c | |||
@@ -18,6 +18,8 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | 20 | ||
21 | PLUGIN_HEADER | ||
22 | |||
21 | /* variable button definitions */ | 23 | /* variable button definitions */ |
22 | #if CONFIG_KEYPAD == RECORDER_PAD | 24 | #if CONFIG_KEYPAD == RECORDER_PAD |
23 | #define CHC_QUIT BUTTON_OFF | 25 | #define CHC_QUIT BUTTON_OFF |
@@ -136,8 +138,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
136 | bool done; | 138 | bool done; |
137 | int nr; | 139 | int nr; |
138 | 140 | ||
139 | TEST_PLUGIN_API(api); | ||
140 | |||
141 | (void)parameter; | 141 | (void)parameter; |
142 | rb=api; | 142 | rb=api; |
143 | 143 | ||
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index 56ce12a388..50e32ed90b 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -22,6 +22,8 @@ | |||
22 | /* Only build for (correct) target */ | 22 | /* Only build for (correct) target */ |
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 27 | static struct plugin_api* rb; /* here is a global api struct pointer */ |
26 | 28 | ||
27 | #define EXTERN static | 29 | #define EXTERN static |
@@ -1276,10 +1278,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1276 | { | 1278 | { |
1277 | char* filename; | 1279 | char* filename; |
1278 | 1280 | ||
1279 | /* this macro should be called as the first thing you do in the plugin. | ||
1280 | it test that the api version and model the plugin was compiled for | ||
1281 | matches the machine it is running on */ | ||
1282 | TEST_PLUGIN_API(api); | ||
1283 | rb = api; /* copy to global api pointer */ | 1281 | rb = api; /* copy to global api pointer */ |
1284 | 1282 | ||
1285 | if (parameter == NULL) | 1283 | if (parameter == NULL) |
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 9c940dc7c3..167a64e6a9 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c | |||
@@ -80,6 +80,8 @@ Original release, featuring analog / digital modes and a few options. | |||
80 | 80 | ||
81 | #if defined(HAVE_LCD_BITMAP) && defined(CONFIG_RTC) | 81 | #if defined(HAVE_LCD_BITMAP) && defined(CONFIG_RTC) |
82 | 82 | ||
83 | PLUGIN_HEADER | ||
84 | |||
83 | #define CLOCK_VERSION "2.60" | 85 | #define CLOCK_VERSION "2.60" |
84 | 86 | ||
85 | #define MODE_ANALOG 1 | 87 | #define MODE_ANALOG 1 |
@@ -2875,7 +2877,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2875 | 2877 | ||
2876 | struct tm* current_time; | 2878 | struct tm* current_time; |
2877 | 2879 | ||
2878 | TEST_PLUGIN_API(api); | ||
2879 | (void)parameter; | 2880 | (void)parameter; |
2880 | rb = api; | 2881 | rb = api; |
2881 | 2882 | ||
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c index 1b1aadbb46..5fdc215aa3 100644 --- a/apps/plugins/credits.c +++ b/apps/plugins/credits.c | |||
@@ -18,6 +18,8 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | 20 | ||
21 | PLUGIN_HEADER | ||
22 | |||
21 | void roll_credits(void); | 23 | void roll_credits(void); |
22 | const char* const credits[] = { | 24 | const char* const credits[] = { |
23 | #include "credits.raw" /* generated list of names from docs/CREDITS */ | 25 | #include "credits.raw" /* generated list of names from docs/CREDITS */ |
@@ -30,7 +32,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
30 | int j = 0; | 32 | int j = 0; |
31 | int btn; | 33 | int btn; |
32 | 34 | ||
33 | TEST_PLUGIN_API(api); | ||
34 | (void)parameter; | 35 | (void)parameter; |
35 | rb = api; | 36 | rb = api; |
36 | 37 | ||
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index e71d8b6e4e..a70e3322e0 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include "playergfx.h" | 22 | #include "playergfx.h" |
23 | #include "xlcd.h" | 23 | #include "xlcd.h" |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | /* Loops that the values are displayed */ | 27 | /* Loops that the values are displayed */ |
26 | #define DISP_TIME 30 | 28 | #define DISP_TIME 30 |
27 | 29 | ||
@@ -446,7 +448,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
446 | bool redraw = true; | 448 | bool redraw = true; |
447 | bool exit = false; | 449 | bool exit = false; |
448 | 450 | ||
449 | TEST_PLUGIN_API(api); | ||
450 | (void)(parameter); | 451 | (void)(parameter); |
451 | rb = api; | 452 | rb = api; |
452 | 453 | ||
diff --git a/apps/plugins/databox/Makefile b/apps/plugins/databox/Makefile index 78387fd6f1..6a44333b3f 100644 --- a/apps/plugins/databox/Makefile +++ b/apps/plugins/databox/Makefile | |||
@@ -10,7 +10,7 @@ | |||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | 10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ |
11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) | 11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) |
12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ | 12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ |
13 | -DMEM=${MEMORYSIZE} -DPLUGIN | 13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
14 | 14 | ||
15 | ifdef APPEXTRA | 15 | ifdef APPEXTRA |
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | 16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) |
diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c index ebed139020..2cc78a0b01 100644 --- a/apps/plugins/databox/databox.c +++ b/apps/plugins/databox/databox.c | |||
@@ -18,6 +18,8 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "databox.h" | 19 | #include "databox.h" |
20 | 20 | ||
21 | PLUGIN_HEADER | ||
22 | |||
21 | /* variable button definitions */ | 23 | /* variable button definitions */ |
22 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 24 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
23 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | 25 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
@@ -233,11 +235,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
233 | { | 235 | { |
234 | int button,done=0,abort=0; | 236 | int button,done=0,abort=0; |
235 | char filename[100],buf[100]; | 237 | char filename[100],buf[100]; |
236 | /* this macro should be called as the first thing you do in the plugin. | ||
237 | it test that the api version and model the plugin was compiled for | ||
238 | matches the machine it is running on */ | ||
239 | TEST_PLUGIN_API(api); | ||
240 | |||
241 | /* if you don't use the parameter, you can do like | 238 | /* if you don't use the parameter, you can do like |
242 | this to avoid the compiler warning about it */ | 239 | this to avoid the compiler warning about it */ |
243 | (void)parameter; | 240 | (void)parameter; |
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c index 8cb3315bdf..f4e54becb8 100644 --- a/apps/plugins/demystify.c +++ b/apps/plugins/demystify.c | |||
@@ -23,6 +23,8 @@ | |||
23 | 23 | ||
24 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
25 | 25 | ||
26 | PLUGIN_HEADER | ||
27 | |||
26 | /* Key assignement */ | 28 | /* Key assignement */ |
27 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) | 29 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) |
28 | #define DEMYSTIFY_QUIT BUTTON_MENU | 30 | #define DEMYSTIFY_QUIT BUTTON_MENU |
@@ -337,19 +339,12 @@ int plugin_main(void) | |||
337 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 339 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
338 | { | 340 | { |
339 | int ret; | 341 | int ret; |
340 | /* | ||
341 | * this macro should be called as the first thing you do in the plugin. | ||
342 | * it test that the api version and model the plugin was compiled for | ||
343 | * matches the machine it is running on | ||
344 | */ | ||
345 | |||
346 | TEST_PLUGIN_API(api); | ||
347 | 342 | ||
348 | rb = api; /* copy to global api pointer */ | 343 | rb = api; /* copy to global api pointer */ |
349 | (void)parameter; | 344 | (void)parameter; |
350 | if (rb->global_settings->backlight_timeout > 0) | 345 | if (rb->global_settings->backlight_timeout > 0) |
351 | rb->backlight_set_timeout(1);/* keep the light on */ | 346 | rb->backlight_set_timeout(1);/* keep the light on */ |
352 | 347 | ||
353 | ret = plugin_main(); | 348 | ret = plugin_main(); |
354 | 349 | ||
355 | return ret; | 350 | return ret; |
diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c index c432b564f4..7209240128 100644 --- a/apps/plugins/dict.c +++ b/apps/plugins/dict.c | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | /* as in hello world :) */ | 24 | /* as in hello world :) */ |
23 | static struct plugin_api* rb; | 25 | static struct plugin_api* rb; |
24 | /* screen info */ | 26 | /* screen info */ |
@@ -127,7 +129,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
127 | int lines, len, outputted, next; | 129 | int lines, len, outputted, next; |
128 | 130 | ||
129 | /* plugin stuff */ | 131 | /* plugin stuff */ |
130 | TEST_PLUGIN_API(api); | ||
131 | (void)parameter; | 132 | (void)parameter; |
132 | rb = api; | 133 | rb = api; |
133 | 134 | ||
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index 3fb1e0e819..3cf36affea 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c | |||
@@ -43,6 +43,8 @@ To do: | |||
43 | - The Irish currency needs 6 digits after the . to have sufficient precision on big number | 43 | - The Irish currency needs 6 digits after the . to have sufficient precision on big number |
44 | */ | 44 | */ |
45 | 45 | ||
46 | PLUGIN_HEADER | ||
47 | |||
46 | /* Name and path of the config file*/ | 48 | /* Name and path of the config file*/ |
47 | static const char cfg_filename[] = "euroconverter.cfg"; | 49 | static const char cfg_filename[] = "euroconverter.cfg"; |
48 | #define CFGFILE_VERSION 0 /* Current config file version */ | 50 | #define CFGFILE_VERSION 0 /* Current config file version */ |
@@ -405,11 +407,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
405 | longlong_t e,h,old_e,old_h; | 407 | longlong_t e,h,old_e,old_h; |
406 | int button; | 408 | int button; |
407 | 409 | ||
408 | /* this macro should be called as the first thing you do in the plugin. | ||
409 | it test that the api version and model the plugin was compiled for | ||
410 | matches the machine it is running on */ | ||
411 | TEST_PLUGIN_API(api); | ||
412 | |||
413 | /* if you don't use the parameter, you can do like | 410 | /* if you don't use the parameter, you can do like |
414 | this to avoid the compiler warning about it */ | 411 | this to avoid the compiler warning about it */ |
415 | (void)parameter; | 412 | (void)parameter; |
diff --git a/apps/plugins/favorites.c b/apps/plugins/favorites.c index 68eab43298..d45f785d64 100644 --- a/apps/plugins/favorites.c +++ b/apps/plugins/favorites.c | |||
@@ -1,6 +1,8 @@ | |||
1 | #include "plugin.h" | 1 | #include "plugin.h" |
2 | #define FAVORITES_FILE "/favorites.m3u" | 2 | #define FAVORITES_FILE "/favorites.m3u" |
3 | 3 | ||
4 | PLUGIN_HEADER | ||
5 | |||
4 | static struct plugin_api* rb; | 6 | static struct plugin_api* rb; |
5 | 7 | ||
6 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 8 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
@@ -9,11 +11,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
9 | char track_path[MAX_PATH+1]; | 11 | char track_path[MAX_PATH+1]; |
10 | int fd, result, len; | 12 | int fd, result, len; |
11 | 13 | ||
12 | /* this macro should be called as the first thing you do in the plugin. | ||
13 | it test that the api version and model the plugin was compiled for | ||
14 | matches the machine it is running on */ | ||
15 | TEST_PLUGIN_API(api); | ||
16 | |||
17 | rb = api; | 14 | rb = api; |
18 | 15 | ||
19 | /* If we were passed a parameter, use that as the file name, | 16 | /* If we were passed a parameter, use that as the file name, |
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c index bf01e9bf51..727644fcd4 100644 --- a/apps/plugins/fire.c +++ b/apps/plugins/fire.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | 25 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ |
26 | #include "gray.h" | 26 | #include "gray.h" |
27 | 27 | ||
28 | PLUGIN_HEADER | ||
29 | |||
28 | /******************************* Globals ***********************************/ | 30 | /******************************* Globals ***********************************/ |
29 | 31 | ||
30 | static struct plugin_api* rb; /* global api struct pointer */ | 32 | static struct plugin_api* rb; /* global api struct pointer */ |
@@ -278,13 +280,6 @@ int main(void) | |||
278 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 280 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
279 | { | 281 | { |
280 | int ret; | 282 | int ret; |
281 | /* | ||
282 | * this macro should be called as the first thing you do in the plugin. | ||
283 | * it test that the api version and model the plugin was compiled for | ||
284 | * matches the machine it is running on | ||
285 | */ | ||
286 | |||
287 | TEST_PLUGIN_API(api); | ||
288 | 283 | ||
289 | rb = api; // copy to global api pointer | 284 | rb = api; // copy to global api pointer |
290 | (void)parameter; | 285 | (void)parameter; |
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c index 697884fd5d..fa77a33697 100644 --- a/apps/plugins/firmware_flash.c +++ b/apps/plugins/firmware_flash.c | |||
@@ -79,6 +79,8 @@ | |||
79 | 79 | ||
80 | #ifdef PLATFORM_ID | 80 | #ifdef PLATFORM_ID |
81 | 81 | ||
82 | PLUGIN_HEADER | ||
83 | |||
82 | #if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */ | 84 | #if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */ |
83 | #define KEY1 BUTTON_LEFT | 85 | #define KEY1 BUTTON_LEFT |
84 | #define KEY2 BUTTON_UP | 86 | #define KEY2 BUTTON_UP |
@@ -1048,7 +1050,7 @@ void DoUserDialog(char* filename) | |||
1048 | rb->snprintf(buf, sizeof(buf), "Verify failed! %d errors", rc); | 1050 | rb->snprintf(buf, sizeof(buf), "Verify failed! %d errors", rc); |
1049 | rb->lcd_puts_scroll(0, 0, buf); | 1051 | rb->lcd_puts_scroll(0, 0, buf); |
1050 | } | 1052 | } |
1051 | 1053 | ||
1052 | rb->lcd_puts_scroll(0, 1, "Press any key to exit."); | 1054 | rb->lcd_puts_scroll(0, 1, "Press any key to exit."); |
1053 | WaitForButton(); | 1055 | WaitForButton(); |
1054 | } | 1056 | } |
@@ -1062,11 +1064,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1062 | { | 1064 | { |
1063 | int oldmode; | 1065 | int oldmode; |
1064 | 1066 | ||
1065 | /* this macro should be called as the first thing you do in the plugin. | ||
1066 | it test that the api version and model the plugin was compiled for | ||
1067 | matches the machine it is running on */ | ||
1068 | TEST_PLUGIN_API(api); | ||
1069 | |||
1070 | rb = api; /* copy to global api pointer */ | 1067 | rb = api; /* copy to global api pointer */ |
1071 | 1068 | ||
1072 | /* now go ahead and have fun! */ | 1069 | /* now go ahead and have fun! */ |
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index f921a2e95d..f1fba878e3 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #ifdef HAVE_LCD_BITMAP | 20 | #ifdef HAVE_LCD_BITMAP |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | /* variable button definitions */ | 24 | /* variable button definitions */ |
23 | #if CONFIG_KEYPAD == RECORDER_PAD | 25 | #if CONFIG_KEYPAD == RECORDER_PAD |
24 | #define FLIPIT_UP BUTTON_UP | 26 | #define FLIPIT_UP BUTTON_UP |
@@ -294,7 +296,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
294 | { | 296 | { |
295 | int w, h, i; | 297 | int w, h, i; |
296 | 298 | ||
297 | TEST_PLUGIN_API(api); | ||
298 | (void)parameter; | 299 | (void)parameter; |
299 | rb = api; | 300 | rb = api; |
300 | 301 | ||
diff --git a/apps/plugins/grayscale.c b/apps/plugins/grayscale.c index 192dcc1738..9e921ae534 100644 --- a/apps/plugins/grayscale.c +++ b/apps/plugins/grayscale.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) | 25 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) |
26 | #include "gray.h" | 26 | #include "gray.h" |
27 | 27 | ||
28 | PLUGIN_HEADER | ||
29 | |||
28 | /* variable button definitions */ | 30 | /* variable button definitions */ |
29 | #if CONFIG_KEYPAD == RECORDER_PAD | 31 | #if CONFIG_KEYPAD == RECORDER_PAD |
30 | #define GRAYSCALE_SHIFT BUTTON_ON | 32 | #define GRAYSCALE_SHIFT BUTTON_ON |
@@ -302,11 +304,6 @@ int main(void) | |||
302 | 304 | ||
303 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 305 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
304 | { | 306 | { |
305 | /* this macro should be called as the first thing you do in the plugin. | ||
306 | it test that the api version and model the plugin was compiled for | ||
307 | matches the machine it is running on */ | ||
308 | TEST_PLUGIN_API(api); | ||
309 | |||
310 | rb = api; // copy to global api pointer | 307 | rb = api; // copy to global api pointer |
311 | (void)parameter; | 308 | (void)parameter; |
312 | 309 | ||
diff --git a/apps/plugins/helloworld.c b/apps/plugins/helloworld.c index d0fecba169..e4220e4af3 100644 --- a/apps/plugins/helloworld.c +++ b/apps/plugins/helloworld.c | |||
@@ -20,6 +20,10 @@ | |||
20 | 20 | ||
21 | /* welcome to the example rockbox plugin */ | 21 | /* welcome to the example rockbox plugin */ |
22 | 22 | ||
23 | /* This macros must always be included. Should be placed at the top by | ||
24 | convention, although the actual position doesn't matter */ | ||
25 | PLUGIN_HEADER | ||
26 | |||
23 | /* here is a global api struct pointer. while not strictly necessary, | 27 | /* here is a global api struct pointer. while not strictly necessary, |
24 | it's nice not to have to pass the api pointer in all function calls | 28 | it's nice not to have to pass the api pointer in all function calls |
25 | in the plugin */ | 29 | in the plugin */ |
@@ -28,11 +32,6 @@ static struct plugin_api* rb; | |||
28 | /* this is the plugin entry point */ | 32 | /* this is the plugin entry point */ |
29 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 33 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
30 | { | 34 | { |
31 | /* this macro should be called as the first thing you do in the plugin. | ||
32 | it test that the api version and model the plugin was compiled for | ||
33 | matches the machine it is running on */ | ||
34 | TEST_PLUGIN_API(api); | ||
35 | |||
36 | /* if you don't use the parameter, you can do like | 35 | /* if you don't use the parameter, you can do like |
37 | this to avoid the compiler warning about it */ | 36 | this to avoid the compiler warning about it */ |
38 | (void)parameter; | 37 | (void)parameter; |
diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c index 7b5c21832f..a0f8d50a5f 100644 --- a/apps/plugins/iriverify.c +++ b/apps/plugins/iriverify.c | |||
@@ -23,6 +23,7 @@ | |||
23 | ****************************************************************************/ | 23 | ****************************************************************************/ |
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | 25 | ||
26 | PLUGIN_HEADER | ||
26 | 27 | ||
27 | static struct plugin_api* rb; | 28 | static struct plugin_api* rb; |
28 | 29 | ||
@@ -133,7 +134,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
133 | { | 134 | { |
134 | char *buf; | 135 | char *buf; |
135 | int rc; | 136 | int rc; |
136 | TEST_PLUGIN_API(api); | ||
137 | 137 | ||
138 | filename = (char *)parameter; | 138 | filename = (char *)parameter; |
139 | 139 | ||
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c index d35e35a8c0..a2ebb81f5c 100644 --- a/apps/plugins/jackpot.c +++ b/apps/plugins/jackpot.c | |||
@@ -29,6 +29,8 @@ History: | |||
29 | 29 | ||
30 | #ifdef HAVE_LCD_CHARCELLS | 30 | #ifdef HAVE_LCD_CHARCELLS |
31 | 31 | ||
32 | PLUGIN_HEADER | ||
33 | |||
32 | /* Jackpot game for the player */ | 34 | /* Jackpot game for the player */ |
33 | 35 | ||
34 | static unsigned char pattern[]={ | 36 | static unsigned char pattern[]={ |
@@ -89,11 +91,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
89 | bool exit=false; | 91 | bool exit=false; |
90 | bool go; | 92 | bool go; |
91 | 93 | ||
92 | /* this macro should be called as the first thing you do in the plugin. | ||
93 | it test that the api version and model the plugin was compiled for | ||
94 | matches the machine it is running on */ | ||
95 | TEST_PLUGIN_API(api); | ||
96 | |||
97 | /* if you don't use the parameter, you can do like | 94 | /* if you don't use the parameter, you can do like |
98 | this to avoid the compiler warning about it */ | 95 | this to avoid the compiler warning about it */ |
99 | (void)parameter; | 96 | (void)parameter; |
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index af5a3743c7..a4ce1ae92a 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c | |||
@@ -20,11 +20,11 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "button.h" | ||
24 | #include "lcd.h" | ||
25 | 23 | ||
26 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
27 | 25 | ||
26 | PLUGIN_HEADER | ||
27 | |||
28 | /* save files */ | 28 | /* save files */ |
29 | #define SCORE_FILE PLUGIN_DIR "/bejeweled.score" | 29 | #define SCORE_FILE PLUGIN_DIR "/bejeweled.score" |
30 | #define SAVE_FILE PLUGIN_DIR "/bejeweled.save" | 30 | #define SAVE_FILE PLUGIN_DIR "/bejeweled.save" |
@@ -2466,7 +2466,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | |||
2466 | char str[19]; | 2466 | char str[19]; |
2467 | 2467 | ||
2468 | /* plugin init */ | 2468 | /* plugin init */ |
2469 | TEST_PLUGIN_API(api); | ||
2470 | (void)parameter; | 2469 | (void)parameter; |
2471 | rb = api; | 2470 | rb = api; |
2472 | /* end of plugin init */ | 2471 | /* end of plugin init */ |
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index fee24d1082..468f745fba 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) | 29 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) |
30 | #include "gray.h" | 30 | #include "gray.h" |
31 | 31 | ||
32 | PLUGIN_HEADER | ||
33 | |||
32 | /* variable button definitions */ | 34 | /* variable button definitions */ |
33 | #if CONFIG_KEYPAD == RECORDER_PAD | 35 | #if CONFIG_KEYPAD == RECORDER_PAD |
34 | #define JPEG_ZOOM_IN BUTTON_PLAY | 36 | #define JPEG_ZOOM_IN BUTTON_PLAY |
@@ -1959,11 +1961,6 @@ int main(char* filename) | |||
1959 | 1961 | ||
1960 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1962 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
1961 | { | 1963 | { |
1962 | /* this macro should be called as the first thing you do in the plugin. | ||
1963 | it test that the api version and model the plugin was compiled for | ||
1964 | matches the machine it is running on */ | ||
1965 | TEST_PLUGIN_API(api); | ||
1966 | |||
1967 | rb = api; /* copy to global api pointer */ | 1964 | rb = api; /* copy to global api pointer */ |
1968 | 1965 | ||
1969 | return main((char*)parameter); | 1966 | return main((char*)parameter); |
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c index 9472de9110..01678596f0 100644 --- a/apps/plugins/logo.c +++ b/apps/plugins/logo.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "playergfx.h" | 20 | #include "playergfx.h" |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
23 | #define DISPLAY_WIDTH LCD_WIDTH | 25 | #define DISPLAY_WIDTH LCD_WIDTH |
24 | #define DISPLAY_HEIGHT LCD_HEIGHT | 26 | #define DISPLAY_HEIGHT LCD_HEIGHT |
@@ -226,7 +228,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | |||
226 | int old_cpos = -1; | 228 | int old_cpos = -1; |
227 | #endif | 229 | #endif |
228 | 230 | ||
229 | TEST_PLUGIN_API(api); | ||
230 | (void)parameter; | 231 | (void)parameter; |
231 | 232 | ||
232 | #ifdef HAVE_LCD_CHARCELLS | 233 | #ifdef HAVE_LCD_CHARCELLS |
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c index 1f80ff395f..1d2b48cb8b 100644 --- a/apps/plugins/mandelbrot.c +++ b/apps/plugins/mandelbrot.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) | 24 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) |
25 | #include "gray.h" | 25 | #include "gray.h" |
26 | 26 | ||
27 | PLUGIN_HEADER | ||
28 | |||
27 | /* variable button definitions */ | 29 | /* variable button definitions */ |
28 | #if CONFIG_KEYPAD == RECORDER_PAD | 30 | #if CONFIG_KEYPAD == RECORDER_PAD |
29 | #define MANDELBROT_QUIT BUTTON_OFF | 31 | #define MANDELBROT_QUIT BUTTON_OFF |
@@ -371,7 +373,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
371 | int grayscales; | 373 | int grayscales; |
372 | int redraw = REDRAW_FULL; | 374 | int redraw = REDRAW_FULL; |
373 | 375 | ||
374 | TEST_PLUGIN_API(api); | ||
375 | rb = api; | 376 | rb = api; |
376 | (void)parameter; | 377 | (void)parameter; |
377 | 378 | ||
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index 1b2d28a4b7..2f897d72a2 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #if !defined(SIMULATOR) | 21 | #if !defined(SIMULATOR) |
22 | 22 | ||
23 | PLUGIN_HEADER | ||
24 | |||
23 | /* variable button definitions */ | 25 | /* variable button definitions */ |
24 | #if CONFIG_KEYPAD == RECORDER_PAD | 26 | #if CONFIG_KEYPAD == RECORDER_PAD |
25 | #define METRONOME_QUIT BUTTON_OFF | 27 | #define METRONOME_QUIT BUTTON_OFF |
@@ -907,7 +909,6 @@ void tap(void) | |||
907 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ | 909 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ |
908 | int button; | 910 | int button; |
909 | 911 | ||
910 | TEST_PLUGIN_API(api); | ||
911 | (void)parameter; | 912 | (void)parameter; |
912 | rb = api; | 913 | rb = api; |
913 | 914 | ||
diff --git a/apps/plugins/midi2wav.c b/apps/plugins/midi2wav.c index e0f9e83fd2..d0d46612b6 100644 --- a/apps/plugins/midi2wav.c +++ b/apps/plugins/midi2wav.c | |||
@@ -41,6 +41,8 @@ | |||
41 | 41 | ||
42 | //#include "../codecs/lib/xxx2wav.h" | 42 | //#include "../codecs/lib/xxx2wav.h" |
43 | 43 | ||
44 | PLUGIN_HEADER | ||
45 | |||
44 | int numberOfSamples IDATA_ATTR; | 46 | int numberOfSamples IDATA_ATTR; |
45 | long bpm; | 47 | long bpm; |
46 | 48 | ||
@@ -67,9 +69,6 @@ struct plugin_api * rb; | |||
67 | 69 | ||
68 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 70 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
69 | { | 71 | { |
70 | TEST_PLUGIN_API(api); | ||
71 | rb = api; | ||
72 | TEST_PLUGIN_API(api); | ||
73 | (void)parameter; | 72 | (void)parameter; |
74 | rb = api; | 73 | rb = api; |
75 | 74 | ||
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index 624c807b92..5baaea6812 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c | |||
@@ -28,11 +28,11 @@ use F3 to see how many mines are left (supposing all your flags are correct) | |||
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #include "plugin.h" | 30 | #include "plugin.h" |
31 | #include "button.h" | ||
32 | #include "lcd.h" | ||
33 | 31 | ||
34 | #ifdef HAVE_LCD_BITMAP | 32 | #ifdef HAVE_LCD_BITMAP |
35 | 33 | ||
34 | PLUGIN_HEADER | ||
35 | |||
36 | //what the minesweeper() function can return | 36 | //what the minesweeper() function can return |
37 | #define MINESWEEPER_USB 3 | 37 | #define MINESWEEPER_USB 3 |
38 | #define MINESWEEPER_QUIT 2 | 38 | #define MINESWEEPER_QUIT 2 |
@@ -521,7 +521,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
521 | { | 521 | { |
522 | bool exit = false; | 522 | bool exit = false; |
523 | /* plugin init */ | 523 | /* plugin init */ |
524 | TEST_PLUGIN_API(api); | ||
525 | (void)parameter; | 524 | (void)parameter; |
526 | rb = api; | 525 | rb = api; |
527 | /* end of plugin init */ | 526 | /* end of plugin init */ |
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 7a18bc2d42..bccc436cad 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "playergfx.h" | 20 | #include "playergfx.h" |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
23 | #define LARGE ((LCD_WIDTH - 2) / 2) | 25 | #define LARGE ((LCD_WIDTH - 2) / 2) |
24 | #define HAUT ((LCD_HEIGHT - 2) / 2) | 26 | #define HAUT ((LCD_HEIGHT - 2) / 2) |
@@ -72,7 +74,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
72 | int sx = 3; | 74 | int sx = 3; |
73 | int sy = 3; | 75 | int sy = 3; |
74 | struct plugin_api* rb = api; | 76 | struct plugin_api* rb = api; |
75 | TEST_PLUGIN_API(api); | ||
76 | (void)parameter; | 77 | (void)parameter; |
77 | 78 | ||
78 | #ifdef HAVE_LCD_CHARCELLS | 79 | #ifdef HAVE_LCD_CHARCELLS |
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 0171bc4d79..bd1a3040c2 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c | |||
@@ -38,6 +38,8 @@ enum e_byte_order { order_unknown, order_bigEndian, order_littleEndian }; | |||
38 | #define memcpy rb->memcpy | 38 | #define memcpy rb->memcpy |
39 | #define memset rb->memset | 39 | #define memset rb->memset |
40 | 40 | ||
41 | PLUGIN_HEADER | ||
42 | |||
41 | static struct plugin_api* rb; | 43 | static struct plugin_api* rb; |
42 | extern char iramcopy[]; | 44 | extern char iramcopy[]; |
43 | extern char iramstart[]; | 45 | extern char iramstart[]; |
@@ -1892,8 +1894,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1892 | char *bitratename[] = { "64","80","96","112","128","160","192","224","256","320" }; | 1894 | char *bitratename[] = { "64","80","96","112","128","160","192","224","256","320" }; |
1893 | int brate[] = { 64,80,96,112,128,160,192,224,256,320 }; | 1895 | int brate[] = { 64,80,96,112,128,160,192,224,256,320 }; |
1894 | 1896 | ||
1895 | TEST_PLUGIN_API(api); | ||
1896 | |||
1897 | (void)parameter; | 1897 | (void)parameter; |
1898 | rb = api; | 1898 | rb = api; |
1899 | 1899 | ||
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c index 27f1210ea4..d937af168b 100644 --- a/apps/plugins/nim.c +++ b/apps/plugins/nim.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #ifdef HAVE_LCD_CHARCELLS | 21 | #ifdef HAVE_LCD_CHARCELLS |
22 | 22 | ||
23 | /* NIM game for the player | 23 | /* NIM game for the player |
24 | 24 | ||
25 | Rules of nim game | 25 | Rules of nim game |
26 | ----------------- | 26 | ----------------- |
@@ -46,6 +46,7 @@ V1.2 : 2003-07-30 | |||
46 | take a match. Later you are obliged to take at least one.) | 46 | take a match. Later you are obliged to take at least one.) |
47 | */ | 47 | */ |
48 | 48 | ||
49 | PLUGIN_HEADER | ||
49 | 50 | ||
50 | /*Pattern for the game*/ | 51 | /*Pattern for the game*/ |
51 | static unsigned char smile[]={0x00, 0x11, 0x04, 0x04, 0x00, 0x11, 0x0E}; /* :-) */ | 52 | static unsigned char smile[]={0x00, 0x11, 0x04, 0x04, 0x00, 0x11, 0x0E}; /* :-) */ |
@@ -140,11 +141,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
140 | bool ok; | 141 | bool ok; |
141 | bool go; | 142 | bool go; |
142 | 143 | ||
143 | /* this macro should be called as the first thing you do in the plugin. | ||
144 | it test that the api version and model the plugin was compiled for | ||
145 | matches the machine it is running on */ | ||
146 | TEST_PLUGIN_API(api); | ||
147 | |||
148 | /* if you don't use the parameter, you can do like | 144 | /* if you don't use the parameter, you can do like |
149 | this to avoid the compiler warning about it */ | 145 | this to avoid the compiler warning about it */ |
150 | (void)parameter; | 146 | (void)parameter; |
diff --git a/apps/plugins/oscillograph.c b/apps/plugins/oscillograph.c index 069ef44247..13858a1c3c 100644 --- a/apps/plugins/oscillograph.c +++ b/apps/plugins/oscillograph.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #ifndef SIMULATOR /* don't want this code in the simulator */ | 22 | #ifndef SIMULATOR /* don't want this code in the simulator */ |
23 | #if CONFIG_CODEC != SWCODEC /* only for MAS-targets */ | 23 | #if CONFIG_CODEC != SWCODEC /* only for MAS-targets */ |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | /* The different drawing modes */ | 27 | /* The different drawing modes */ |
26 | #define DRAW_MODE_FILLED 0 | 28 | #define DRAW_MODE_FILLED 0 |
27 | #define DRAW_MODE_OUTLINE 1 | 29 | #define DRAW_MODE_OUTLINE 1 |
@@ -93,7 +95,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
93 | 95 | ||
94 | bool exit = false; | 96 | bool exit = false; |
95 | 97 | ||
96 | TEST_PLUGIN_API(api); | ||
97 | (void)parameter; | 98 | (void)parameter; |
98 | rb = api; | 99 | rb = api; |
99 | 100 | ||
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index 916e55018c..b69d15daae 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | 25 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ |
26 | #if CONFIG_CODEC != SWCODEC /* only for MAS-targets */ | 26 | #if CONFIG_CODEC != SWCODEC /* only for MAS-targets */ |
27 | 27 | ||
28 | PLUGIN_HEADER | ||
29 | |||
28 | /* The different drawing modes */ | 30 | /* The different drawing modes */ |
29 | #define DRAW_MODE_FILLED 0 | 31 | #define DRAW_MODE_FILLED 0 |
30 | #define DRAW_MODE_OUTLINE 1 | 32 | #define DRAW_MODE_OUTLINE 1 |
@@ -201,7 +203,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
201 | bool exit = false; | 203 | bool exit = false; |
202 | bool paused = false; | 204 | bool paused = false; |
203 | 205 | ||
204 | TEST_PLUGIN_API(api); | ||
205 | (void)parameter; | 206 | (void)parameter; |
206 | rb = api; | 207 | rb = api; |
207 | 208 | ||
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c index 2623bdcffb..46cf4c7b50 100644 --- a/apps/plugins/plasma.c +++ b/apps/plugins/plasma.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | 28 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ |
29 | #include "gray.h" | 29 | #include "gray.h" |
30 | 30 | ||
31 | PLUGIN_HEADER | ||
32 | |||
31 | /******************************* Globals ***********************************/ | 33 | /******************************* Globals ***********************************/ |
32 | 34 | ||
33 | static struct plugin_api* rb; /* global api struct pointer */ | 35 | static struct plugin_api* rb; /* global api struct pointer */ |
@@ -241,13 +243,6 @@ int main(void) | |||
241 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 243 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
242 | { | 244 | { |
243 | int ret; | 245 | int ret; |
244 | /* | ||
245 | * this macro should be called as the first thing you do in the plugin. | ||
246 | * it test that the api version and model the plugin was compiled for | ||
247 | * matches the machine it is running on | ||
248 | */ | ||
249 | |||
250 | TEST_PLUGIN_API(api); | ||
251 | 246 | ||
252 | rb = api; // copy to global api pointer | 247 | rb = api; // copy to global api pointer |
253 | (void)parameter; | 248 | (void)parameter; |
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index c8ac88fb62..0626623fbf 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds | |||
@@ -64,7 +64,13 @@ MEMORY | |||
64 | 64 | ||
65 | SECTIONS | 65 | SECTIONS |
66 | { | 66 | { |
67 | .text : | 67 | .header : { |
68 | _plugin_start_addr = .; | ||
69 | plugin_start_addr = .; | ||
70 | KEEP(*(.header)) | ||
71 | } > PLUGIN_RAM | ||
72 | |||
73 | .text : | ||
68 | { | 74 | { |
69 | KEEP(*(.entry)) | 75 | KEEP(*(.entry)) |
70 | *(.text*) | 76 | *(.text*) |
@@ -80,7 +86,7 @@ SECTIONS | |||
80 | . = ALIGN(0x4); | 86 | . = ALIGN(0x4); |
81 | } > PLUGIN_RAM | 87 | } > PLUGIN_RAM |
82 | 88 | ||
83 | .data : | 89 | .data : |
84 | { | 90 | { |
85 | *(.data*) | 91 | *(.data*) |
86 | #if defined(ARCH_IRIVER) || defined(ARCH_IPOD) || (CONFIG_CPU==PNX0101) | 92 | #if defined(ARCH_IRIVER) || defined(ARCH_IPOD) || (CONFIG_CPU==PNX0101) |
@@ -118,6 +124,9 @@ SECTIONS | |||
118 | { | 124 | { |
119 | *(.bss*) | 125 | *(.bss*) |
120 | *(COMMON) | 126 | *(COMMON) |
127 | . = ALIGN(0x4); | ||
128 | _plugin_end_addr = .; | ||
129 | plugin_end_addr = .; | ||
121 | } > PLUGIN_RAM | 130 | } > PLUGIN_RAM |
122 | 131 | ||
123 | /* Special trick to avoid a linker error when no other sections are | 132 | /* Special trick to avoid a linker error when no other sections are |
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c index 41507c5ff4..4e9d99b8f0 100644 --- a/apps/plugins/pong.c +++ b/apps/plugins/pong.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #ifdef HAVE_LCD_BITMAP | 21 | #ifdef HAVE_LCD_BITMAP |
22 | 22 | ||
23 | PLUGIN_HEADER | ||
24 | |||
23 | #define PAD_HEIGHT LCD_HEIGHT / 6 /* Recorder: 10 iRiver: 21 */ | 25 | #define PAD_HEIGHT LCD_HEIGHT / 6 /* Recorder: 10 iRiver: 21 */ |
24 | #define PAD_WIDTH LCD_WIDTH / 50 /* Recorder: 2 iRiver: 2 */ | 26 | #define PAD_WIDTH LCD_WIDTH / 50 /* Recorder: 2 iRiver: 2 */ |
25 | 27 | ||
@@ -336,9 +338,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
336 | /* if you don't use the parameter, you can do like | 338 | /* if you don't use the parameter, you can do like |
337 | this to avoid the compiler warning about it */ | 339 | this to avoid the compiler warning about it */ |
338 | (void)parameter; | 340 | (void)parameter; |
339 | 341 | ||
340 | TEST_PLUGIN_API(api); | ||
341 | |||
342 | rb = api; /* use the "standard" rb pointer */ | 342 | rb = api; /* use the "standard" rb pointer */ |
343 | 343 | ||
344 | /* Clear screen */ | 344 | /* Clear screen */ |
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 786e590571..f30a21aff8 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) | 27 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) |
26 | #define ROCKBLOX_OFF BUTTON_MENU | 28 | #define ROCKBLOX_OFF BUTTON_MENU |
27 | #define ROCKBLOX_UP BUTTON_SCROLL_BACK | 29 | #define ROCKBLOX_UP BUTTON_SCROLL_BACK |
@@ -420,11 +422,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
420 | { | 422 | { |
421 | int ret; | 423 | int ret; |
422 | 424 | ||
423 | TEST_PLUGIN_API(api); | ||
424 | |||
425 | (void)parameter; | 425 | (void)parameter; |
426 | rb = api; | 426 | rb = api; |
427 | 427 | ||
428 | /* Lets use the default font */ | 428 | /* Lets use the default font */ |
429 | rb->lcd_setfont(FONT_SYSFIXED); | 429 | rb->lcd_setfont(FONT_SYSFIXED); |
430 | 430 | ||
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c index 4c552622e5..0b713405ed 100644 --- a/apps/plugins/rockbox_flash.c +++ b/apps/plugins/rockbox_flash.c | |||
@@ -23,6 +23,8 @@ | |||
23 | 23 | ||
24 | #if !defined(SIMULATOR) && (CONFIG_CPU == SH7034) /* Only for SH targets */ | 24 | #if !defined(SIMULATOR) && (CONFIG_CPU == SH7034) /* Only for SH targets */ |
25 | 25 | ||
26 | PLUGIN_HEADER | ||
27 | |||
26 | /* define DUMMY if you only want to "play" with the UI, does no harm */ | 28 | /* define DUMMY if you only want to "play" with the UI, does no harm */ |
27 | /* #define DUMMY */ | 29 | /* #define DUMMY */ |
28 | 30 | ||
@@ -1010,10 +1012,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1010 | { | 1012 | { |
1011 | int oldmode; | 1013 | int oldmode; |
1012 | 1014 | ||
1013 | /* this macro should be called as the first thing you do in the plugin. | ||
1014 | it test that the api version and model the plugin was compiled for | ||
1015 | matches the machine it is running on */ | ||
1016 | TEST_PLUGIN_API(api); | ||
1017 | rb = api; /* copy to global api pointer */ | 1015 | rb = api; /* copy to global api pointer */ |
1018 | 1016 | ||
1019 | if (parameter == NULL) | 1017 | if (parameter == NULL) |
diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c index 783e096214..d3504572cf 100644 --- a/apps/plugins/rockboy.c +++ b/apps/plugins/rockboy.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #if MEM <= 8 && !defined(SIMULATOR) | 23 | #if MEM <= 8 && !defined(SIMULATOR) |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | #define OVL_NAME "/.rockbox/viewers/rockboy.ovl" | 27 | #define OVL_NAME "/.rockbox/viewers/rockboy.ovl" |
26 | #define OVL_DISPLAYNAME "RockBoy" | 28 | #define OVL_DISPLAYNAME "RockBoy" |
27 | 29 | ||
@@ -40,10 +42,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
40 | enum plugin_status(*entry_point)(struct plugin_api*, void*); | 42 | enum plugin_status(*entry_point)(struct plugin_api*, void*); |
41 | } header; | 43 | } header; |
42 | 44 | ||
43 | /* this macro should be called as the first thing you do in the plugin. | ||
44 | it test that the api version and model the plugin was compiled for | ||
45 | matches the machine it is running on */ | ||
46 | TEST_PLUGIN_API(api); | ||
47 | rb = api; | 45 | rb = api; |
48 | 46 | ||
49 | fh = rb->open(OVL_NAME, O_RDONLY); | 47 | fh = rb->open(OVL_NAME, O_RDONLY); |
diff --git a/apps/plugins/rockboy/Makefile b/apps/plugins/rockboy/Makefile index 3657e8d786..f0dbc55857 100644 --- a/apps/plugins/rockboy/Makefile +++ b/apps/plugins/rockboy/Makefile | |||
@@ -10,7 +10,7 @@ | |||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | 10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ |
11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) | 11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) |
12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ | 12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ |
13 | -DMEM=${MEMORYSIZE} -DPLUGIN | 13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
14 | 14 | ||
15 | ifdef APPEXTRA | 15 | ifdef APPEXTRA |
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | 16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) |
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index fc004e752d..a21e9e4368 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c | |||
@@ -36,6 +36,8 @@ const struct { | |||
36 | 0x524f564c, /* ROVL */ | 36 | 0x524f564c, /* ROVL */ |
37 | ovl_start_addr, ovl_end_addr, plugin_start | 37 | ovl_start_addr, ovl_end_addr, plugin_start |
38 | }; | 38 | }; |
39 | #else | ||
40 | PLUGIN_HEADER | ||
39 | #endif | 41 | #endif |
40 | 42 | ||
41 | #ifdef USE_IRAM | 43 | #ifdef USE_IRAM |
@@ -93,17 +95,12 @@ void setmallocpos(void *pointer) | |||
93 | /* this is the plugin entry point */ | 95 | /* this is the plugin entry point */ |
94 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 96 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
95 | { | 97 | { |
96 | /* this macro should be called as the first thing you do in the plugin. | ||
97 | it test that the api version and model the plugin was compiled for | ||
98 | matches the machine it is running on */ | ||
99 | TEST_PLUGIN_API(api); | ||
100 | |||
101 | /* if you are using a global api pointer, don't forget to copy it! | 98 | /* if you are using a global api pointer, don't forget to copy it! |
102 | otherwise you will get lovely "I04: IllInstr" errors... :-) */ | 99 | otherwise you will get lovely "I04: IllInstr" errors... :-) */ |
103 | rb = api; | 100 | rb = api; |
104 | 101 | ||
105 | rb->lcd_setfont(0); | 102 | rb->lcd_setfont(0); |
106 | 103 | ||
107 | if (!parameter) { | 104 | if (!parameter) { |
108 | rb->splash(HZ*3, true, "Play gameboy ROM file! (.gb/.gbc)"); | 105 | rb->splash(HZ*3, true, "Play gameboy ROM file! (.gb/.gbc)"); |
109 | return PLUGIN_OK; | 106 | return PLUGIN_OK; |
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index 450b05c778..fb9d239dc7 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | #include "ctype.h" | 21 | #include "ctype.h" |
22 | 22 | ||
23 | PLUGIN_HEADER | ||
24 | |||
23 | static struct plugin_api* rb; | 25 | static struct plugin_api* rb; |
24 | 26 | ||
25 | #define BUFFER_SIZE 16384 | 27 | #define BUFFER_SIZE 16384 |
@@ -150,8 +152,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
150 | char *filename = parameter; | 152 | char *filename = parameter; |
151 | char *p; | 153 | char *p; |
152 | 154 | ||
153 | TEST_PLUGIN_API(api); | ||
154 | |||
155 | rb = api; | 155 | rb = api; |
156 | 156 | ||
157 | DEBUGF("%s - %s\n", parameter, &filename[rb->strlen(filename)-4]); | 157 | DEBUGF("%s - %s\n", parameter, &filename[rb->strlen(filename)-4]); |
diff --git a/apps/plugins/searchengine/Makefile b/apps/plugins/searchengine/Makefile index efa7d95d2d..baa0020cc2 100644 --- a/apps/plugins/searchengine/Makefile +++ b/apps/plugins/searchengine/Makefile | |||
@@ -10,7 +10,7 @@ | |||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | 10 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ |
11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) | 11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) |
12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ | 12 | CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ |
13 | -DMEM=${MEMORYSIZE} -DPLUGIN | 13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
14 | 14 | ||
15 | ifdef APPEXTRA | 15 | ifdef APPEXTRA |
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | 16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) |
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c index 8953ba7552..b585c25f13 100644 --- a/apps/plugins/searchengine/searchengine.c +++ b/apps/plugins/searchengine/searchengine.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include "token.h" | 21 | #include "token.h" |
22 | #include "dbinterface.h" | 22 | #include "dbinterface.h" |
23 | 23 | ||
24 | PLUGIN_HEADER | ||
25 | |||
24 | void *audio_bufferbase; | 26 | void *audio_bufferbase; |
25 | void *audio_bufferpointer; | 27 | void *audio_bufferpointer; |
26 | unsigned int audio_buffer_free; | 28 | unsigned int audio_buffer_free; |
@@ -58,15 +60,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
58 | { | 60 | { |
59 | unsigned char *result,buf[500]; | 61 | unsigned char *result,buf[500]; |
60 | int parsefd,hits; | 62 | int parsefd,hits; |
61 | /* this macro should be called as the first thing you do in the plugin. | ||
62 | it test that the api version and model the plugin was compiled for | ||
63 | matches the machine it is running on */ | ||
64 | TEST_PLUGIN_API(api); | ||
65 | |||
66 | /* if you are using a global api pointer, don't forget to copy it! | 63 | /* if you are using a global api pointer, don't forget to copy it! |
67 | otherwise you will get lovely "I04: IllInstr" errors... :-) */ | 64 | otherwise you will get lovely "I04: IllInstr" errors... :-) */ |
68 | rb = api; | 65 | rb = api; |
69 | 66 | ||
70 | audio_bufferbase=audio_bufferpointer=0; | 67 | audio_bufferbase=audio_bufferpointer=0; |
71 | audio_buffer_free=0; | 68 | audio_buffer_free=0; |
72 | 69 | ||
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index a153467a75..060ab1866a 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #ifdef HAVE_LCD_BITMAP | 20 | #ifdef HAVE_LCD_BITMAP |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | /* variable button definitions */ | 24 | /* variable button definitions */ |
23 | #if CONFIG_KEYPAD == RECORDER_PAD | 25 | #if CONFIG_KEYPAD == RECORDER_PAD |
24 | #define PUZZLE_QUIT BUTTON_OFF | 26 | #define PUZZLE_QUIT BUTTON_OFF |
@@ -333,7 +335,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
333 | { | 335 | { |
334 | int i, w, h; | 336 | int i, w, h; |
335 | 337 | ||
336 | TEST_PLUGIN_API(api); | ||
337 | (void)parameter; | 338 | (void)parameter; |
338 | rb = api; | 339 | rb = api; |
339 | 340 | ||
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c index bf5d8f9795..dc78f17820 100644 --- a/apps/plugins/snake.c +++ b/apps/plugins/snake.c | |||
@@ -33,6 +33,8 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left; | |||
33 | #include "plugin.h" | 33 | #include "plugin.h" |
34 | #ifdef HAVE_LCD_BITMAP | 34 | #ifdef HAVE_LCD_BITMAP |
35 | 35 | ||
36 | PLUGIN_HEADER | ||
37 | |||
36 | /* variable button definitions */ | 38 | /* variable button definitions */ |
37 | #if CONFIG_KEYPAD == RECORDER_PAD | 39 | #if CONFIG_KEYPAD == RECORDER_PAD |
38 | #define SNAKE_QUIT BUTTON_OFF | 40 | #define SNAKE_QUIT BUTTON_OFF |
@@ -344,7 +346,6 @@ void game_init(void) { | |||
344 | 346 | ||
345 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 347 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
346 | { | 348 | { |
347 | TEST_PLUGIN_API(api); | ||
348 | (void)(parameter); | 349 | (void)(parameter); |
349 | rb = api; | 350 | rb = api; |
350 | 351 | ||
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index ea526b3871..4008209578 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c | |||
@@ -30,6 +30,8 @@ Head and Tail are stored | |||
30 | #include "plugin.h" | 30 | #include "plugin.h" |
31 | #ifdef HAVE_LCD_BITMAP | 31 | #ifdef HAVE_LCD_BITMAP |
32 | 32 | ||
33 | PLUGIN_HEADER | ||
34 | |||
33 | #define WIDTH 28 | 35 | #define WIDTH 28 |
34 | #define HEIGHT 16 | 36 | #define HEIGHT 16 |
35 | 37 | ||
@@ -1425,7 +1427,6 @@ void game_init(void) | |||
1425 | 1427 | ||
1426 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1428 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
1427 | { | 1429 | { |
1428 | TEST_PLUGIN_API(api); | ||
1429 | (void)(parameter); | 1430 | (void)(parameter); |
1430 | rb = api; | 1431 | rb = api; |
1431 | 1432 | ||
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c index 7fd0c8a3d6..a1405a1863 100644 --- a/apps/plugins/snow.c +++ b/apps/plugins/snow.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "playergfx.h" | 20 | #include "playergfx.h" |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
23 | #define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72) | 25 | #define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72) |
24 | #define SNOW_HEIGHT LCD_HEIGHT | 26 | #define SNOW_HEIGHT LCD_HEIGHT |
@@ -161,7 +163,6 @@ static void snow_init(void) | |||
161 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 163 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
162 | { | 164 | { |
163 | int button; | 165 | int button; |
164 | TEST_PLUGIN_API(api); | ||
165 | (void)(parameter); | 166 | (void)(parameter); |
166 | rb = api; | 167 | rb = api; |
167 | 168 | ||
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 515997379d..994a1172c8 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | #define SOKOBAN_TITLE "Sokoban" | 27 | #define SOKOBAN_TITLE "Sokoban" |
26 | #define SOKOBAN_TITLE_FONT 2 | 28 | #define SOKOBAN_TITLE_FONT 2 |
27 | 29 | ||
@@ -896,7 +898,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
896 | int w, h; | 898 | int w, h; |
897 | int len; | 899 | int len; |
898 | 900 | ||
899 | TEST_PLUGIN_API(api); | ||
900 | (void)(parameter); | 901 | (void)(parameter); |
901 | rb = api; | 902 | rb = api; |
902 | 903 | ||
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 81bd820fb2..9a60635f45 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -39,6 +39,8 @@ use F3 to put card on top of the remains' stack on one of the 4 final stacks | |||
39 | 39 | ||
40 | #ifdef HAVE_LCD_BITMAP | 40 | #ifdef HAVE_LCD_BITMAP |
41 | 41 | ||
42 | PLUGIN_HEADER | ||
43 | |||
42 | /* here is a global api struct pointer. while not strictly necessary, | 44 | /* here is a global api struct pointer. while not strictly necessary, |
43 | it's nice not to have to pass the api pointer in all function calls | 45 | it's nice not to have to pass the api pointer in all function calls |
44 | in the plugin */ | 46 | in the plugin */ |
@@ -1541,7 +1543,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1541 | int result; | 1543 | int result; |
1542 | 1544 | ||
1543 | /* plugin init */ | 1545 | /* plugin init */ |
1544 | TEST_PLUGIN_API(api); | ||
1545 | (void)parameter; | 1546 | (void)parameter; |
1546 | rb = api; | 1547 | rb = api; |
1547 | /* end of plugin init */ | 1548 | /* end of plugin init */ |
diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c index cf91dbb4dd..7ba510ec32 100644 --- a/apps/plugins/sort.c +++ b/apps/plugins/sort.c | |||
@@ -55,6 +55,8 @@ | |||
55 | * TODO: Implement a merge sort for files larger than the buffer | 55 | * TODO: Implement a merge sort for files larger than the buffer |
56 | ****************************************************************************/ | 56 | ****************************************************************************/ |
57 | 57 | ||
58 | PLUGIN_HEADER | ||
59 | |||
58 | static struct plugin_api* rb; | 60 | static struct plugin_api* rb; |
59 | 61 | ||
60 | int buf_size; | 62 | int buf_size; |
@@ -178,7 +180,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
178 | { | 180 | { |
179 | char *buf; | 181 | char *buf; |
180 | int rc; | 182 | int rc; |
181 | TEST_PLUGIN_API(api); | ||
182 | 183 | ||
183 | filename = (char *)parameter; | 184 | filename = (char *)parameter; |
184 | 185 | ||
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index 35562f99fc..d0fd4e161b 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #ifndef SIMULATOR | 22 | #ifndef SIMULATOR |
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | 24 | ||
25 | PLUGIN_HEADER | ||
26 | |||
25 | /* variable button definitions */ | 27 | /* variable button definitions */ |
26 | #if CONFIG_KEYPAD == RECORDER_PAD | 28 | #if CONFIG_KEYPAD == RECORDER_PAD |
27 | #define SPLITEDIT_QUIT BUTTON_OFF | 29 | #define SPLITEDIT_QUIT BUTTON_OFF |
diff --git a/apps/plugins/star.c b/apps/plugins/star.c index c6a2853231..03dac3482c 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #ifdef HAVE_LCD_BITMAP | 20 | #ifdef HAVE_LCD_BITMAP |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | /* file which contains the levels */ | 24 | /* file which contains the levels */ |
23 | #define STAR_LEVELS_FILE "/.rockbox/star/levels.txt" | 25 | #define STAR_LEVELS_FILE "/.rockbox/star/levels.txt" |
24 | 26 | ||
@@ -877,7 +879,6 @@ static int star_menu(void) | |||
877 | */ | 879 | */ |
878 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 880 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
879 | { | 881 | { |
880 | TEST_PLUGIN_API(api); | ||
881 | (void)parameter; | 882 | (void)parameter; |
882 | rb = api; | 883 | rb = api; |
883 | 884 | ||
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c index 407e79f3c1..750c59fe41 100644 --- a/apps/plugins/starfield.c +++ b/apps/plugins/starfield.c | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | 20 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | /******************************* Globals ***********************************/ | 24 | /******************************* Globals ***********************************/ |
23 | 25 | ||
24 | static struct plugin_api* rb; /* global api struct pointer */ | 26 | static struct plugin_api* rb; /* global api struct pointer */ |
@@ -251,13 +253,6 @@ int plugin_main(void) | |||
251 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 253 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
252 | { | 254 | { |
253 | int ret; | 255 | int ret; |
254 | /* | ||
255 | * this macro should be called as the first thing you do in the plugin. | ||
256 | * it test that the api version and model the plugin was compiled for | ||
257 | * matches the machine it is running on | ||
258 | */ | ||
259 | |||
260 | TEST_PLUGIN_API(api); | ||
261 | 256 | ||
262 | rb = api; // copy to global api pointer | 257 | rb = api; // copy to global api pointer |
263 | (void)parameter; | 258 | (void)parameter; |
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index e1b8b6fc21..b54adb584b 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c | |||
@@ -18,6 +18,8 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | 20 | ||
21 | PLUGIN_HEADER | ||
22 | |||
21 | static struct plugin_api* rb; | 23 | static struct plugin_api* rb; |
22 | static int files, dirs; | 24 | static int files, dirs; |
23 | static int lasttick; | 25 | static int lasttick; |
@@ -100,7 +102,6 @@ void traversedir(char* location, char* name) | |||
100 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 102 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
101 | { | 103 | { |
102 | int button; | 104 | int button; |
103 | TEST_PLUGIN_API(api); | ||
104 | 105 | ||
105 | (void)parameter; | 106 | (void)parameter; |
106 | 107 | ||
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index 4a1382ef65..3742a9a552 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
23 | #define LAP_LINES 6 | 25 | #define LAP_LINES 6 |
24 | #define TIMER_Y 1 | 26 | #define TIMER_Y 1 |
@@ -121,7 +123,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
121 | int done = false; | 123 | int done = false; |
122 | bool update_lap = true; | 124 | bool update_lap = true; |
123 | 125 | ||
124 | TEST_PLUGIN_API(api); | ||
125 | (void)parameter; | 126 | (void)parameter; |
126 | rb = api; | 127 | rb = api; |
127 | 128 | ||
diff --git a/apps/plugins/sudoku.c b/apps/plugins/sudoku.c index 453a4447b1..94ff96d171 100644 --- a/apps/plugins/sudoku.c +++ b/apps/plugins/sudoku.c | |||
@@ -57,11 +57,11 @@ Example ".ss" file, and one with a saved state: | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include "plugin.h" | 59 | #include "plugin.h" |
60 | #include "button.h" | ||
61 | #include "lcd.h" | ||
62 | 60 | ||
63 | #ifdef HAVE_LCD_BITMAP | 61 | #ifdef HAVE_LCD_BITMAP |
64 | 62 | ||
63 | PLUGIN_HEADER | ||
64 | |||
65 | #define STATE_FILE PLUGIN_DIR "/sudoku.state" | 65 | #define STATE_FILE PLUGIN_DIR "/sudoku.state" |
66 | #define GAMES_FILE PLUGIN_DIR "/sudoku.levels" | 66 | #define GAMES_FILE PLUGIN_DIR "/sudoku.levels" |
67 | 67 | ||
@@ -2429,7 +2429,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2429 | struct sudoku_state_t state; | 2429 | struct sudoku_state_t state; |
2430 | 2430 | ||
2431 | /* plugin init */ | 2431 | /* plugin init */ |
2432 | TEST_PLUGIN_API(api); | ||
2433 | rb = api; | 2432 | rb = api; |
2434 | /* end of plugin init */ | 2433 | /* end of plugin init */ |
2435 | 2434 | ||
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index ca6b9ca096..d05419f19c 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c | |||
@@ -18,6 +18,8 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | 20 | ||
21 | PLUGIN_HEADER | ||
22 | |||
21 | static struct plugin_api* rb; | 23 | static struct plugin_api* rb; |
22 | 24 | ||
23 | static char *audiobuf; | 25 | static char *audiobuf; |
@@ -265,8 +267,6 @@ static bool vbr_fix(char *selected_file) | |||
265 | 267 | ||
266 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) | 268 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) |
267 | { | 269 | { |
268 | TEST_PLUGIN_API(api); | ||
269 | |||
270 | rb = api; | 270 | rb = api; |
271 | 271 | ||
272 | if (!parameter) | 272 | if (!parameter) |
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index 91d47a52d1..6ed7036015 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #ifndef SIMULATOR // not for simulator by now | 32 | #ifndef SIMULATOR // not for simulator by now |
33 | #ifdef HAVE_LCD_BITMAP // and definitely not for the Player, haha | 33 | #ifdef HAVE_LCD_BITMAP // and definitely not for the Player, haha |
34 | 34 | ||
35 | PLUGIN_HEADER | ||
36 | |||
35 | /* variable button definitions */ | 37 | /* variable button definitions */ |
36 | #if CONFIG_KEYPAD == RECORDER_PAD | 38 | #if CONFIG_KEYPAD == RECORDER_PAD |
37 | #define VIDEO_STOP_SEEK BUTTON_PLAY | 39 | #define VIDEO_STOP_SEEK BUTTON_PLAY |
@@ -984,11 +986,6 @@ int main(char* filename) | |||
984 | 986 | ||
985 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 987 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
986 | { | 988 | { |
987 | /* this macro should be called as the first thing you do in the plugin. | ||
988 | it test that the api version and model the plugin was compiled for | ||
989 | matches the machine it is running on */ | ||
990 | TEST_PLUGIN_API(api); | ||
991 | |||
992 | rb = api; // copy to global api pointer | 989 | rb = api; // copy to global api pointer |
993 | 990 | ||
994 | if (parameter == NULL) | 991 | if (parameter == NULL) |
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 823072e145..b98605af84 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -20,9 +20,7 @@ | |||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | #include <ctype.h> | 21 | #include <ctype.h> |
22 | 22 | ||
23 | #if PLUGIN_API_VERSION < 3 | 23 | PLUGIN_HEADER |
24 | #error Scrollbar function requires PLUGIN_API_VERSION 3 at least | ||
25 | #endif | ||
26 | 24 | ||
27 | #define SETTINGS_FILE "/.rockbox/viewers/viewer.dat" | 25 | #define SETTINGS_FILE "/.rockbox/viewers/viewer.dat" |
28 | 26 | ||
@@ -1022,7 +1020,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) | |||
1022 | int i; | 1020 | int i; |
1023 | int ok; | 1021 | int ok; |
1024 | 1022 | ||
1025 | TEST_PLUGIN_API(api); | ||
1026 | rb = api; | 1023 | rb = api; |
1027 | 1024 | ||
1028 | if (!file) | 1025 | if (!file) |
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index 6a55a1af1a..b486c3c94e 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #if defined(HAVE_LCD_BITMAP) && (CONFIG_CODEC != SWCODEC) | 20 | #if defined(HAVE_LCD_BITMAP) && (CONFIG_CODEC != SWCODEC) |
21 | 21 | ||
22 | PLUGIN_HEADER | ||
23 | |||
22 | /* variable button definitions */ | 24 | /* variable button definitions */ |
23 | #if CONFIG_KEYPAD == RECORDER_PAD | 25 | #if CONFIG_KEYPAD == RECORDER_PAD |
24 | #define VUMETER_QUIT BUTTON_OFF | 26 | #define VUMETER_QUIT BUTTON_OFF |
@@ -427,7 +429,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | |||
427 | int button; | 429 | int button; |
428 | int lastbutton = BUTTON_NONE; | 430 | int lastbutton = BUTTON_NONE; |
429 | 431 | ||
430 | TEST_PLUGIN_API(api); | ||
431 | (void) parameter; | 432 | (void) parameter; |
432 | rb = api; | 433 | rb = api; |
433 | 434 | ||
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index 1f47eff3ed..20a458960f 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #include <codecs/libwavpack/wavpack.h> | 21 | #include <codecs/libwavpack/wavpack.h> |
22 | 22 | ||
23 | PLUGIN_HEADER | ||
24 | |||
23 | #define SAMPLES_PER_BLOCK 22050 | 25 | #define SAMPLES_PER_BLOCK 22050 |
24 | 26 | ||
25 | static struct plugin_api* rb; | 27 | static struct plugin_api* rb; |
@@ -287,8 +289,6 @@ static int wav2wv (char *filename) | |||
287 | 289 | ||
288 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) | 290 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) |
289 | { | 291 | { |
290 | TEST_PLUGIN_API(api); | ||
291 | |||
292 | rb = api; | 292 | rb = api; |
293 | 293 | ||
294 | if (!parameter) | 294 | if (!parameter) |
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index e0e33b6801..6016cda873 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #if defined(HAVE_LCD_BITMAP) && (CONFIG_KEYPAD == RECORDER_PAD) | 21 | #if defined(HAVE_LCD_BITMAP) && (CONFIG_KEYPAD == RECORDER_PAD) |
22 | 22 | ||
23 | PLUGIN_HEADER | ||
24 | |||
23 | /* size of the field the worm lives in */ | 25 | /* size of the field the worm lives in */ |
24 | #define FIELD_RECT_X 1 | 26 | #define FIELD_RECT_X 1 |
25 | #define FIELD_RECT_Y 1 | 27 | #define FIELD_RECT_Y 1 |
@@ -1891,7 +1893,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1891 | bool worm_dead = false; | 1893 | bool worm_dead = false; |
1892 | int button; | 1894 | int button; |
1893 | 1895 | ||
1894 | TEST_PLUGIN_API(api); | ||
1895 | (void)(parameter); | 1896 | (void)(parameter); |
1896 | 1897 | ||
1897 | rb = api; | 1898 | rb = api; |