1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2006-01-15 18:20:18 +00:00
parent c7c9069ed4
commit a36b1d4083
70 changed files with 270 additions and 310 deletions

View file

@ -10,7 +10,7 @@
INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \
-I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR)
CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
-DMEM=${MEMORYSIZE} -DPLUGIN
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
ifdef APPEXTRA
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))

View file

@ -34,6 +34,8 @@
/* Only build for (correct) target */
#if !defined(SIMULATOR) && CONFIG_CPU==SH7034 && !defined(HAVE_MMC)
PLUGIN_HEADER
#ifdef HAVE_LCD_CHARCELLS /* player model */
#define LINES 2
#define COLUMNS 11
@ -1192,10 +1194,6 @@ int main(void* parameter)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; /* copy to global api pointer */
/* now go ahead and have fun! */

View file

@ -29,6 +29,8 @@
to watch.
*/
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define BATTERY_TEST_QUIT BUTTON_OFF
@ -136,7 +138,6 @@ enum plugin_status loop(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -21,6 +21,8 @@
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
#define SS_TITLE "Bouncer"
#define SS_TITLE_FONT 2
@ -443,7 +445,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
char *off = "[Off] to stop";
int len;
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;

View file

@ -76,6 +76,8 @@ F3: equal to "="
#ifdef HAVE_LCD_BITMAP
#include "math.h"
PLUGIN_HEADER
#define REC_HEIGHT 10 /* blank height = 9 */
#define REC_WIDTH 22 /* blank width = 21 */
@ -1324,7 +1326,6 @@ Main();
----------------------------------------------------------------------- */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -23,6 +23,8 @@
#include <timefuncs.h>
PLUGIN_HEADER
static struct plugin_api* rb;
static bool leap_year;
@ -664,9 +666,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool exit = false;
int button;
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;
calendar_init(&today, &shown);

View file

@ -18,6 +18,8 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define CHC_QUIT BUTTON_OFF
@ -136,8 +138,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool done;
int nr;
TEST_PLUGIN_API(api);
(void)parameter;
rb=api;

View file

@ -22,6 +22,8 @@
/* Only build for (correct) target */
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
static struct plugin_api* rb; /* here is a global api struct pointer */
#define EXTERN static
@ -1276,10 +1278,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
char* filename;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; /* copy to global api pointer */
if (parameter == NULL)

View file

@ -80,6 +80,8 @@ Original release, featuring analog / digital modes and a few options.
#if defined(HAVE_LCD_BITMAP) && defined(CONFIG_RTC)
PLUGIN_HEADER
#define CLOCK_VERSION "2.60"
#define MODE_ANALOG 1
@ -2875,7 +2877,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
struct tm* current_time;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -18,6 +18,8 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
void roll_credits(void);
const char* const credits[] = {
#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)
int j = 0;
int btn;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -22,6 +22,8 @@
#include "playergfx.h"
#include "xlcd.h"
PLUGIN_HEADER
/* Loops that the values are displayed */
#define DISP_TIME 30
@ -446,7 +448,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool redraw = true;
bool exit = false;
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;

View file

@ -10,7 +10,7 @@
INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
-DMEM=${MEMORYSIZE} -DPLUGIN
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
ifdef APPEXTRA
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))

View file

@ -18,6 +18,8 @@
****************************************************************************/
#include "databox.h"
PLUGIN_HEADER
/* variable button definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_PAD)
@ -233,11 +235,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int button,done=0,abort=0;
char filename[100],buf[100];
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;

View file

@ -23,6 +23,8 @@
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* Key assignement */
#if (CONFIG_KEYPAD == IPOD_4G_PAD)
#define DEMYSTIFY_QUIT BUTTON_MENU
@ -337,19 +339,12 @@ int plugin_main(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int ret;
/*
* this macro should be called as the first thing you do in the plugin.
* it test that the api version and model the plugin was compiled for
* matches the machine it is running on
*/
TEST_PLUGIN_API(api);
rb = api; /* copy to global api pointer */
(void)parameter;
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);/* keep the light on */
ret = plugin_main();
return ret;

View file

@ -19,6 +19,8 @@
#include "plugin.h"
PLUGIN_HEADER
/* as in hello world :) */
static struct plugin_api* rb;
/* screen info */
@ -127,7 +129,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int lines, len, outputted, next;
/* plugin stuff */
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -43,6 +43,8 @@ To do:
- The Irish currency needs 6 digits after the . to have sufficient precision on big number
*/
PLUGIN_HEADER
/* Name and path of the config file*/
static const char cfg_filename[] = "euroconverter.cfg";
#define CFGFILE_VERSION 0 /* Current config file version */
@ -405,11 +407,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
longlong_t e,h,old_e,old_h;
int button;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;

View file

@ -1,6 +1,8 @@
#include "plugin.h"
#define FAVORITES_FILE "/favorites.m3u"
PLUGIN_HEADER
static struct plugin_api* rb;
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)
char track_path[MAX_PATH+1];
int fd, result, len;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api;
/* If we were passed a parameter, use that as the file name,

View file

@ -25,6 +25,8 @@
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
#include "gray.h"
PLUGIN_HEADER
/******************************* Globals ***********************************/
static struct plugin_api* rb; /* global api struct pointer */
@ -278,13 +280,6 @@ int main(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int ret;
/*
* this macro should be called as the first thing you do in the plugin.
* it test that the api version and model the plugin was compiled for
* matches the machine it is running on
*/
TEST_PLUGIN_API(api);
rb = api; // copy to global api pointer
(void)parameter;

View file

@ -79,6 +79,8 @@
#ifdef PLATFORM_ID
PLUGIN_HEADER
#if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */
#define KEY1 BUTTON_LEFT
#define KEY2 BUTTON_UP
@ -1048,7 +1050,7 @@ void DoUserDialog(char* filename)
rb->snprintf(buf, sizeof(buf), "Verify failed! %d errors", rc);
rb->lcd_puts_scroll(0, 0, buf);
}
rb->lcd_puts_scroll(0, 1, "Press any key to exit.");
WaitForButton();
}
@ -1062,11 +1064,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int oldmode;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; /* copy to global api pointer */
/* now go ahead and have fun! */

View file

@ -19,6 +19,8 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define FLIPIT_UP BUTTON_UP
@ -294,7 +296,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int w, h, i;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -25,6 +25,8 @@
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
#include "gray.h"
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define GRAYSCALE_SHIFT BUTTON_ON
@ -302,11 +304,6 @@ int main(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; // copy to global api pointer
(void)parameter;

View file

@ -20,6 +20,10 @@
/* welcome to the example rockbox plugin */
/* This macros must always be included. Should be placed at the top by
convention, although the actual position doesn't matter */
PLUGIN_HEADER
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
@ -28,11 +32,6 @@ static struct plugin_api* rb;
/* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;

View file

@ -23,6 +23,7 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
static struct plugin_api* rb;
@ -133,7 +134,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
char *buf;
int rc;
TEST_PLUGIN_API(api);
filename = (char *)parameter;

View file

@ -29,6 +29,8 @@ History:
#ifdef HAVE_LCD_CHARCELLS
PLUGIN_HEADER
/* Jackpot game for the player */
static unsigned char pattern[]={
@ -89,11 +91,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool exit=false;
bool go;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;

View file

@ -20,11 +20,11 @@
****************************************************************************/
#include "plugin.h"
#include "button.h"
#include "lcd.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* save files */
#define SCORE_FILE PLUGIN_DIR "/bejeweled.score"
#define SAVE_FILE PLUGIN_DIR "/bejeweled.save"
@ -2466,7 +2466,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
char str[19];
/* plugin init */
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;
/* end of plugin init */

View file

@ -29,6 +29,8 @@
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
#include "gray.h"
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define JPEG_ZOOM_IN BUTTON_PLAY
@ -1959,11 +1961,6 @@ int main(char* filename)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; /* copy to global api pointer */
return main((char*)parameter);

View file

@ -19,6 +19,8 @@
#include "plugin.h"
#include "playergfx.h"
PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#define DISPLAY_WIDTH LCD_WIDTH
#define DISPLAY_HEIGHT LCD_HEIGHT
@ -226,7 +228,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
int old_cpos = -1;
#endif
TEST_PLUGIN_API(api);
(void)parameter;
#ifdef HAVE_LCD_CHARCELLS

View file

@ -24,6 +24,8 @@
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
#include "gray.h"
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define MANDELBROT_QUIT BUTTON_OFF
@ -371,7 +373,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int grayscales;
int redraw = REDRAW_FULL;
TEST_PLUGIN_API(api);
rb = api;
(void)parameter;

View file

@ -20,6 +20,8 @@
#if !defined(SIMULATOR)
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define METRONOME_QUIT BUTTON_OFF
@ -907,7 +909,6 @@ void tap(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
int button;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -41,6 +41,8 @@
//#include "../codecs/lib/xxx2wav.h"
PLUGIN_HEADER
int numberOfSamples IDATA_ATTR;
long bpm;
@ -67,9 +69,6 @@ struct plugin_api * rb;
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
TEST_PLUGIN_API(api);
rb = api;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -28,11 +28,11 @@ use F3 to see how many mines are left (supposing all your flags are correct)
*****************************************************************************/
#include "plugin.h"
#include "button.h"
#include "lcd.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
//what the minesweeper() function can return
#define MINESWEEPER_USB 3
#define MINESWEEPER_QUIT 2
@ -521,7 +521,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
bool exit = false;
/* plugin init */
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;
/* end of plugin init */

View file

@ -19,6 +19,8 @@
#include "plugin.h"
#include "playergfx.h"
PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#define LARGE ((LCD_WIDTH - 2) / 2)
#define HAUT ((LCD_HEIGHT - 2) / 2)
@ -72,7 +74,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int sx = 3;
int sy = 3;
struct plugin_api* rb = api;
TEST_PLUGIN_API(api);
(void)parameter;
#ifdef HAVE_LCD_CHARCELLS

View file

@ -38,6 +38,8 @@ enum e_byte_order { order_unknown, order_bigEndian, order_littleEndian };
#define memcpy rb->memcpy
#define memset rb->memset
PLUGIN_HEADER
static struct plugin_api* rb;
extern char iramcopy[];
extern char iramstart[];
@ -1892,8 +1894,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
char *bitratename[] = { "64","80","96","112","128","160","192","224","256","320" };
int brate[] = { 64,80,96,112,128,160,192,224,256,320 };
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -20,7 +20,7 @@
#ifdef HAVE_LCD_CHARCELLS
/* NIM game for the player
/* NIM game for the player
Rules of nim game
-----------------
@ -46,6 +46,7 @@ V1.2 : 2003-07-30
take a match. Later you are obliged to take at least one.)
*/
PLUGIN_HEADER
/*Pattern for the game*/
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)
bool ok;
bool go;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;

View file

@ -22,6 +22,8 @@
#ifndef SIMULATOR /* don't want this code in the simulator */
#if CONFIG_CODEC != SWCODEC /* only for MAS-targets */
PLUGIN_HEADER
/* The different drawing modes */
#define DRAW_MODE_FILLED 0
#define DRAW_MODE_OUTLINE 1
@ -93,7 +95,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool exit = false;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -25,6 +25,8 @@
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
#if CONFIG_CODEC != SWCODEC /* only for MAS-targets */
PLUGIN_HEADER
/* The different drawing modes */
#define DRAW_MODE_FILLED 0
#define DRAW_MODE_OUTLINE 1
@ -201,7 +203,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool exit = false;
bool paused = false;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -28,6 +28,8 @@
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
#include "gray.h"
PLUGIN_HEADER
/******************************* Globals ***********************************/
static struct plugin_api* rb; /* global api struct pointer */
@ -241,13 +243,6 @@ int main(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int ret;
/*
* this macro should be called as the first thing you do in the plugin.
* it test that the api version and model the plugin was compiled for
* matches the machine it is running on
*/
TEST_PLUGIN_API(api);
rb = api; // copy to global api pointer
(void)parameter;

View file

@ -64,7 +64,13 @@ MEMORY
SECTIONS
{
.text :
.header : {
_plugin_start_addr = .;
plugin_start_addr = .;
KEEP(*(.header))
} > PLUGIN_RAM
.text :
{
KEEP(*(.entry))
*(.text*)
@ -80,7 +86,7 @@ SECTIONS
. = ALIGN(0x4);
} > PLUGIN_RAM
.data :
.data :
{
*(.data*)
#if defined(ARCH_IRIVER) || defined(ARCH_IPOD) || (CONFIG_CPU==PNX0101)
@ -118,6 +124,9 @@ SECTIONS
{
*(.bss*)
*(COMMON)
. = ALIGN(0x4);
_plugin_end_addr = .;
plugin_end_addr = .;
} > PLUGIN_RAM
/* Special trick to avoid a linker error when no other sections are

View file

@ -20,6 +20,8 @@
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
#define PAD_HEIGHT LCD_HEIGHT / 6 /* Recorder: 10 iRiver: 21 */
#define PAD_WIDTH LCD_WIDTH / 50 /* Recorder: 2 iRiver: 2 */
@ -336,9 +338,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;
TEST_PLUGIN_API(api);
rb = api; /* use the "standard" rb pointer */
/* Clear screen */

View file

@ -22,6 +22,8 @@
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
#if (CONFIG_KEYPAD == IPOD_4G_PAD)
#define ROCKBLOX_OFF BUTTON_MENU
#define ROCKBLOX_UP BUTTON_SCROLL_BACK
@ -420,11 +422,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int ret;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;
/* Lets use the default font */
rb->lcd_setfont(FONT_SYSFIXED);

View file

@ -23,6 +23,8 @@
#if !defined(SIMULATOR) && (CONFIG_CPU == SH7034) /* Only for SH targets */
PLUGIN_HEADER
/* define DUMMY if you only want to "play" with the UI, does no harm */
/* #define DUMMY */
@ -1010,10 +1012,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int oldmode;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; /* copy to global api pointer */
if (parameter == NULL)

View file

@ -22,6 +22,8 @@
#if MEM <= 8 && !defined(SIMULATOR)
PLUGIN_HEADER
#define OVL_NAME "/.rockbox/viewers/rockboy.ovl"
#define OVL_DISPLAYNAME "RockBoy"
@ -40,10 +42,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
enum plugin_status(*entry_point)(struct plugin_api*, void*);
} header;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api;
fh = rb->open(OVL_NAME, O_RDONLY);

View file

@ -10,7 +10,7 @@
INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
-DMEM=${MEMORYSIZE} -DPLUGIN
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
ifdef APPEXTRA
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))

View file

@ -36,6 +36,8 @@ const struct {
0x524f564c, /* ROVL */
ovl_start_addr, ovl_end_addr, plugin_start
};
#else
PLUGIN_HEADER
#endif
#ifdef USE_IRAM
@ -93,17 +95,12 @@ void setmallocpos(void *pointer)
/* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you are using a global api pointer, don't forget to copy it!
otherwise you will get lovely "I04: IllInstr" errors... :-) */
rb = api;
rb->lcd_setfont(0);
if (!parameter) {
rb->splash(HZ*3, true, "Play gameboy ROM file! (.gb/.gbc)");
return PLUGIN_OK;

View file

@ -20,6 +20,8 @@
#include "plugin.h"
#include "ctype.h"
PLUGIN_HEADER
static struct plugin_api* rb;
#define BUFFER_SIZE 16384
@ -150,8 +152,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
char *filename = parameter;
char *p;
TEST_PLUGIN_API(api);
rb = api;
DEBUGF("%s - %s\n", parameter, &filename[rb->strlen(filename)-4]);

View file

@ -10,7 +10,7 @@
INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
-DMEM=${MEMORYSIZE} -DPLUGIN
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
ifdef APPEXTRA
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))

View file

@ -21,6 +21,8 @@
#include "token.h"
#include "dbinterface.h"
PLUGIN_HEADER
void *audio_bufferbase;
void *audio_bufferpointer;
unsigned int audio_buffer_free;
@ -58,15 +60,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
unsigned char *result,buf[500];
int parsefd,hits;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
/* if you are using a global api pointer, don't forget to copy it!
otherwise you will get lovely "I04: IllInstr" errors... :-) */
rb = api;
audio_bufferbase=audio_bufferpointer=0;
audio_buffer_free=0;

View file

@ -19,6 +19,8 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define PUZZLE_QUIT BUTTON_OFF
@ -333,7 +335,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int i, w, h;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -33,6 +33,8 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define SNAKE_QUIT BUTTON_OFF
@ -344,7 +346,6 @@ void game_init(void) {
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;

View file

@ -30,6 +30,8 @@ Head and Tail are stored
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
#define WIDTH 28
#define HEIGHT 16
@ -1425,7 +1427,6 @@ void game_init(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;

View file

@ -19,6 +19,8 @@
#include "plugin.h"
#include "playergfx.h"
PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72)
#define SNOW_HEIGHT LCD_HEIGHT
@ -161,7 +163,6 @@ static void snow_init(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int button;
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;

View file

@ -22,6 +22,8 @@
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
#define SOKOBAN_TITLE "Sokoban"
#define SOKOBAN_TITLE_FONT 2
@ -896,7 +898,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int w, h;
int len;
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;

View file

@ -39,6 +39,8 @@ use F3 to put card on top of the remains' stack on one of the 4 final stacks
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
@ -1541,7 +1543,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int result;
/* plugin init */
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;
/* end of plugin init */

View file

@ -55,6 +55,8 @@
* TODO: Implement a merge sort for files larger than the buffer
****************************************************************************/
PLUGIN_HEADER
static struct plugin_api* rb;
int buf_size;
@ -178,7 +180,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
char *buf;
int rc;
TEST_PLUGIN_API(api);
filename = (char *)parameter;

View file

@ -22,6 +22,8 @@
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define SPLITEDIT_QUIT BUTTON_OFF

View file

@ -19,6 +19,8 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* file which contains the levels */
#define STAR_LEVELS_FILE "/.rockbox/star/levels.txt"
@ -877,7 +879,6 @@ static int star_menu(void)
*/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -19,6 +19,8 @@
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
PLUGIN_HEADER
/******************************* Globals ***********************************/
static struct plugin_api* rb; /* global api struct pointer */
@ -251,13 +253,6 @@ int plugin_main(void)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int ret;
/*
* this macro should be called as the first thing you do in the plugin.
* it test that the api version and model the plugin was compiled for
* matches the machine it is running on
*/
TEST_PLUGIN_API(api);
rb = api; // copy to global api pointer
(void)parameter;

View file

@ -18,6 +18,8 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
static struct plugin_api* rb;
static int files, dirs;
static int lasttick;
@ -100,7 +102,6 @@ void traversedir(char* location, char* name)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int button;
TEST_PLUGIN_API(api);
(void)parameter;

View file

@ -19,6 +19,8 @@
#include "plugin.h"
PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#define LAP_LINES 6
#define TIMER_Y 1
@ -121,7 +123,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int done = false;
bool update_lap = true;
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;

View file

@ -57,11 +57,11 @@ Example ".ss" file, and one with a saved state:
*/
#include "plugin.h"
#include "button.h"
#include "lcd.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
#define STATE_FILE PLUGIN_DIR "/sudoku.state"
#define GAMES_FILE PLUGIN_DIR "/sudoku.levels"
@ -2429,7 +2429,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
struct sudoku_state_t state;
/* plugin init */
TEST_PLUGIN_API(api);
rb = api;
/* end of plugin init */

View file

@ -18,6 +18,8 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
static struct plugin_api* rb;
static char *audiobuf;
@ -265,8 +267,6 @@ static bool vbr_fix(char *selected_file)
enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
{
TEST_PLUGIN_API(api);
rb = api;
if (!parameter)

View file

@ -32,6 +32,8 @@
#ifndef SIMULATOR // not for simulator by now
#ifdef HAVE_LCD_BITMAP // and definitely not for the Player, haha
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define VIDEO_STOP_SEEK BUTTON_PLAY
@ -984,11 +986,6 @@ int main(char* filename)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
TEST_PLUGIN_API(api);
rb = api; // copy to global api pointer
if (parameter == NULL)

View file

@ -20,9 +20,7 @@
#include "plugin.h"
#include <ctype.h>
#if PLUGIN_API_VERSION < 3
#error Scrollbar function requires PLUGIN_API_VERSION 3 at least
#endif
PLUGIN_HEADER
#define SETTINGS_FILE "/.rockbox/viewers/viewer.dat"
@ -1022,7 +1020,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
int i;
int ok;
TEST_PLUGIN_API(api);
rb = api;
if (!file)

View file

@ -19,6 +19,8 @@
#if defined(HAVE_LCD_BITMAP) && (CONFIG_CODEC != SWCODEC)
PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define VUMETER_QUIT BUTTON_OFF
@ -427,7 +429,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
int button;
int lastbutton = BUTTON_NONE;
TEST_PLUGIN_API(api);
(void) parameter;
rb = api;

View file

@ -20,6 +20,8 @@
#include <codecs/libwavpack/wavpack.h>
PLUGIN_HEADER
#define SAMPLES_PER_BLOCK 22050
static struct plugin_api* rb;
@ -287,8 +289,6 @@ static int wav2wv (char *filename)
enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
{
TEST_PLUGIN_API(api);
rb = api;
if (!parameter)

View file

@ -20,6 +20,8 @@
#if defined(HAVE_LCD_BITMAP) && (CONFIG_KEYPAD == RECORDER_PAD)
PLUGIN_HEADER
/* size of the field the worm lives in */
#define FIELD_RECT_X 1
#define FIELD_RECT_Y 1
@ -1891,7 +1893,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
bool worm_dead = false;
int button;
TEST_PLUGIN_API(api);
(void)(parameter);
rb = api;