1
0
Fork 0
forked from len0rd/rockbox

loader-initialized global plugin API:

struct plugin_api *rb is declared in PLUGIN_HEADER, and pointed to by
__header.api

the loader uses this pointer to initialize rb before calling entry_point

entry_point is no longer passed a pointer to the plugin API

all plugins, and pluginlib functions, are modified to refer to the
global rb

pluginlib functions which only served to copy the API pointer are
removed

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19776 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-01-16 10:34:40 +00:00
parent 35677cbc54
commit 23d9812273
179 changed files with 586 additions and 1183 deletions

View file

@ -51,11 +51,6 @@ further options:
PLUGIN_HEADER
/* The 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 */
static const struct plugin_api* rb;
/* Thickness of the grid lines */
#define LINE_THCK 1
@ -391,7 +386,7 @@ static bool reversi_gui_menu(void) {
{ "Quit", NULL },
};
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
result = menu_show(m);
@ -553,7 +548,7 @@ static void reversi_gui_move_cursor(int new_row, int new_col) {
/* plugin entry point */
enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) {
enum plugin_status plugin_start(const void *parameter) {
bool exit, draw_screen;
int button;
int lastbutton = BUTTON_NONE;
@ -561,10 +556,6 @@ enum plugin_status plugin_start(const struct plugin_api *api, const void *parame
int w_cnt, b_cnt;
char msg_buf[30];
/* plugin init */
rb = api;
/* end of plugin init */
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
rb->lcd_set_foreground(LCD_BLACK);
@ -574,7 +565,6 @@ enum plugin_status plugin_start(const struct plugin_api *api, const void *parame
/* Avoid compiler warnings */
(void)parameter;
game.rb = rb;
rb->srand(*rb->current_tick); /* Some AIs use rand() */
white_strategy = &strategy_human;
black_strategy = &strategy_human;