summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-01-16 10:34:40 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-01-16 10:34:40 +0000
commit23d9812273d9c74af72ccdc3aa4cfea971f220a4 (patch)
tree8e60c3a2a41879f8b2a52516fa416b3ab906e239 /apps
parent35677cbc54bbe400ebbff59b489dda7ca7f04916 (diff)
downloadrockbox-23d9812273d9c74af72ccdc3aa4cfea971f220a4.tar.gz
rockbox-23d9812273d9c74af72ccdc3aa4cfea971f220a4.tar.bz2
rockbox-23d9812273d9c74af72ccdc3aa4cfea971f220a4.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c3
-rw-r--r--apps/plugin.h39
-rw-r--r--apps/plugins/alpine_cdc.c8
-rw-r--r--apps/plugins/battery_bench.c6
-rw-r--r--apps/plugins/beatbox/beatbox.c8
-rw-r--r--apps/plugins/blackjack.c8
-rw-r--r--apps/plugins/bounce.c6
-rw-r--r--apps/plugins/brickmania.c10
-rw-r--r--apps/plugins/bubbles.c13
-rw-r--r--apps/plugins/calculator.c6
-rw-r--r--apps/plugins/calendar.c8
-rw-r--r--apps/plugins/chessbox.c4
-rw-r--r--apps/plugins/chessbox/chessbox.c29
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.c29
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.h16
-rw-r--r--apps/plugins/chessbox/gnuchess.c3
-rw-r--r--apps/plugins/chessbox/gnuchess.h3
-rw-r--r--apps/plugins/chessclock.c9
-rw-r--r--apps/plugins/chip8.c6
-rw-r--r--apps/plugins/chopper.c11
-rw-r--r--apps/plugins/clock/clock.c8
-rw-r--r--apps/plugins/clock/clock.h1
-rw-r--r--apps/plugins/credits.c9
-rw-r--r--apps/plugins/cube.c13
-rw-r--r--apps/plugins/demystify.c15
-rw-r--r--apps/plugins/dice.c7
-rw-r--r--apps/plugins/dict.c5
-rw-r--r--apps/plugins/disktidy.c6
-rw-r--r--apps/plugins/doom/i_video.c2
-rw-r--r--apps/plugins/doom/rockdoom.c18
-rw-r--r--apps/plugins/doom/rockmacros.h1
-rw-r--r--apps/plugins/euroconverter.c10
-rw-r--r--apps/plugins/fire.c13
-rw-r--r--apps/plugins/fireworks.c12
-rw-r--r--apps/plugins/firmware_flash.c6
-rw-r--r--apps/plugins/flipit.c4
-rw-r--r--apps/plugins/greyscale.c10
-rw-r--r--apps/plugins/helloworld.c11
-rw-r--r--apps/plugins/invadrox.c11
-rw-r--r--apps/plugins/iriver_flash.c6
-rw-r--r--apps/plugins/iriverify.c6
-rw-r--r--apps/plugins/jackpot.c7
-rw-r--r--apps/plugins/jewels.c8
-rw-r--r--apps/plugins/jpeg/jpeg.c23
-rw-r--r--apps/plugins/jpeg/jpeg_decoder.c2
-rw-r--r--apps/plugins/jpeg/yuv2rgb.c3
-rw-r--r--apps/plugins/keybox.c9
-rw-r--r--apps/plugins/lamp.c13
-rw-r--r--apps/plugins/lib/checkbox.c14
-rw-r--r--apps/plugins/lib/checkbox.h2
-rw-r--r--apps/plugins/lib/configfile.c79
-rw-r--r--apps/plugins/lib/configfile.h2
-rw-r--r--apps/plugins/lib/grey.h3
-rw-r--r--apps/plugins/lib/grey_core.c68
-rw-r--r--apps/plugins/lib/grey_draw.c22
-rw-r--r--apps/plugins/lib/grey_parm.c4
-rw-r--r--apps/plugins/lib/grey_scroll.c40
-rw-r--r--apps/plugins/lib/helper.c17
-rw-r--r--apps/plugins/lib/helper.h17
-rw-r--r--apps/plugins/lib/highscore.c7
-rw-r--r--apps/plugins/lib/highscore.h1
-rw-r--r--apps/plugins/lib/md5.c7
-rw-r--r--apps/plugins/lib/md5.h2
-rw-r--r--apps/plugins/lib/oldmenuapi.c5
-rw-r--r--apps/plugins/lib/oldmenuapi.h2
-rw-r--r--apps/plugins/lib/overlay.c5
-rw-r--r--apps/plugins/lib/overlay.h2
-rw-r--r--apps/plugins/lib/playback_control.c51
-rw-r--r--apps/plugins/lib/playback_control.h6
-rw-r--r--apps/plugins/lib/playergfx.c18
-rw-r--r--apps/plugins/lib/playergfx.h2
-rw-r--r--apps/plugins/lib/pluginlib_actions.c4
-rw-r--r--apps/plugins/lib/pluginlib_actions.h2
-rw-r--r--apps/plugins/lib/pluginlib_bmp.c9
-rw-r--r--apps/plugins/lib/pluginlib_bmp.h12
-rw-r--r--apps/plugins/lib/pluginlib_resize.h29
-rw-r--r--apps/plugins/lib/profile_plugin.c13
-rw-r--r--apps/plugins/lib/profile_plugin.h2
-rw-r--r--apps/plugins/lib/xlcd.h4
-rw-r--r--apps/plugins/lib/xlcd_core.c12
-rw-r--r--apps/plugins/lib/xlcd_draw.c6
-rw-r--r--apps/plugins/lib/xlcd_scroll.c132
-rw-r--r--apps/plugins/logo.c5
-rw-r--r--apps/plugins/mandelbrot.c9
-rw-r--r--apps/plugins/matrix.c6
-rw-r--r--apps/plugins/maze.c12
-rw-r--r--apps/plugins/mazezam.c19
-rw-r--r--apps/plugins/md5sum.c10
-rw-r--r--apps/plugins/metronome.c11
-rw-r--r--apps/plugins/midi/guspat.c2
-rw-r--r--apps/plugins/midi/midifile.c2
-rw-r--r--apps/plugins/midi/midiplay.c6
-rw-r--r--apps/plugins/midi/midiutil.c2
-rw-r--r--apps/plugins/midi/sequencer.c1
-rw-r--r--apps/plugins/midi/synth.c2
-rw-r--r--apps/plugins/minesweeper.c9
-rw-r--r--apps/plugins/mosaique.c5
-rw-r--r--apps/plugins/mp3_encoder.c9
-rw-r--r--apps/plugins/mpegplayer/decode.c2
-rw-r--r--apps/plugins/mpegplayer/header.c2
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c14
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c18
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.h3
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c2
-rw-r--r--apps/plugins/nim.c8
-rw-r--r--apps/plugins/oscilloscope.c12
-rw-r--r--apps/plugins/pacbox/arcade.c2
-rw-r--r--apps/plugins/pacbox/hardware.c2
-rw-r--r--apps/plugins/pacbox/pacbox.c11
-rw-r--r--apps/plugins/pegbox.c5
-rw-r--r--apps/plugins/pictureflow.c14
-rw-r--r--apps/plugins/plasma.c10
-rw-r--r--apps/plugins/pong.c6
-rw-r--r--apps/plugins/ppmviewer.c6
-rw-r--r--apps/plugins/properties.c7
-rw-r--r--apps/plugins/random_folder_advance_config.c10
-rw-r--r--apps/plugins/reversi/reversi-game.h2
-rw-r--r--apps/plugins/reversi/reversi-gui.c14
-rw-r--r--apps/plugins/reversi/reversi-strategy-naive.c2
-rw-r--r--apps/plugins/reversi/reversi-strategy-simple.c7
-rw-r--r--apps/plugins/robotfindskitten.c12
-rw-r--r--apps/plugins/rockblox.c17
-rw-r--r--apps/plugins/rockblox1d.c5
-rw-r--r--apps/plugins/rockbox_flash.c6
-rw-r--r--apps/plugins/rockboy.c4
-rw-r--r--apps/plugins/rockboy/menu.c6
-rw-r--r--apps/plugins/rockboy/rockboy.c12
-rw-r--r--apps/plugins/rockboy/rockmacros.h1
-rw-r--r--apps/plugins/rocklife.c12
-rw-r--r--apps/plugins/rockpaint.c11
-rw-r--r--apps/plugins/search.c6
-rw-r--r--apps/plugins/searchengine/searchengine.c6
-rw-r--r--apps/plugins/searchengine/searchengine.h2
-rw-r--r--apps/plugins/settings_dumper.c4
-rw-r--r--apps/plugins/shortcuts/shortcuts.h2
-rw-r--r--apps/plugins/shortcuts/shortcuts_append.c3
-rw-r--r--apps/plugins/shortcuts/shortcuts_common.c2
-rw-r--r--apps/plugins/shortcuts/shortcuts_view.c3
-rw-r--r--apps/plugins/sliding_puzzle.c6
-rw-r--r--apps/plugins/snake.c4
-rw-r--r--apps/plugins/snake2.c4
-rw-r--r--apps/plugins/snow.c6
-rw-r--r--apps/plugins/sokoban.c8
-rw-r--r--apps/plugins/solitaire.c9
-rw-r--r--apps/plugins/sort.c6
-rw-r--r--apps/plugins/spacerocks.c8
-rw-r--r--apps/plugins/splitedit.c6
-rw-r--r--apps/plugins/star.c5
-rw-r--r--apps/plugins/starfield.c11
-rw-r--r--apps/plugins/stats.c4
-rw-r--r--apps/plugins/stopwatch.c5
-rw-r--r--apps/plugins/sudoku/generator.c2
-rw-r--r--apps/plugins/sudoku/sudoku.c19
-rw-r--r--apps/plugins/superdom.c5
-rw-r--r--apps/plugins/test_codec.c8
-rw-r--r--apps/plugins/test_disk.c10
-rw-r--r--apps/plugins/test_fps.c13
-rw-r--r--apps/plugins/test_grey.c10
-rw-r--r--apps/plugins/test_greylib_bitmap_scale.c15
-rw-r--r--apps/plugins/test_resize.c7
-rw-r--r--apps/plugins/test_sampr.c12
-rw-r--r--apps/plugins/test_scanrate.c4
-rw-r--r--apps/plugins/test_touchscreen.c5
-rw-r--r--apps/plugins/test_viewports.c10
-rw-r--r--apps/plugins/text_editor.c9
-rw-r--r--apps/plugins/vbrfix.c5
-rw-r--r--apps/plugins/video.c9
-rw-r--r--apps/plugins/viewer.c10
-rw-r--r--apps/plugins/vu_meter.c5
-rw-r--r--apps/plugins/wav2wv.c15
-rw-r--r--apps/plugins/wavplay.c6
-rw-r--r--apps/plugins/wavrecord.c8
-rw-r--r--apps/plugins/wavview.c5
-rw-r--r--apps/plugins/wormlet.c11
-rw-r--r--apps/plugins/xobox.c11
-rw-r--r--apps/plugins/zxbox.c4
-rw-r--r--apps/plugins/zxbox/spmain.c9
-rw-r--r--apps/plugins/zxbox/zxbox.c11
-rw-r--r--apps/plugins/zxbox/zxconfig.h1
179 files changed, 586 insertions, 1183 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 151cb1d04d..a19a08b5fb 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -723,6 +723,7 @@ int plugin_load(const char* plugin, const void* parameter)
memset(pluginbuf + readsize, 0, plugin_size - readsize);
#endif
+ *(hdr->api) = &rockbox_api;
plugin_loaded = true;
@@ -740,7 +741,7 @@ int plugin_load(const char* plugin, const void* parameter)
invalidate_icache();
oldbars = viewportmanager_set_statusbar(false);
- rc = hdr->entry_point(&rockbox_api, parameter);
+ rc = hdr->entry_point(parameter);
viewportmanager_set_statusbar(true);
diff --git a/apps/plugin.h b/apps/plugin.h
index 7bb1c7fc5f..992012be68 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -126,12 +126,12 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 136
+#define PLUGIN_API_VERSION 137
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
-#define PLUGIN_MIN_API_VERSION 136
+#define PLUGIN_MIN_API_VERSION 137
/* plugin return codes */
enum plugin_status {
@@ -791,7 +791,8 @@ struct plugin_header {
unsigned short api_version;
unsigned char *load_addr;
unsigned char *end_addr;
- enum plugin_status(*entry_point)(const struct plugin_api*, const void*);
+ enum plugin_status(*entry_point)(const void*);
+ const struct plugin_api **api;
};
#ifdef PLUGIN
@@ -799,16 +800,18 @@ struct plugin_header {
extern unsigned char plugin_start_addr[];
extern unsigned char plugin_end_addr[];
#define PLUGIN_HEADER \
+ const struct plugin_api *rb __attribute__ ((section (".data"))); \
const struct plugin_header __header \
__attribute__ ((section (".header")))= { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
- plugin_start_addr, plugin_end_addr, plugin_start };
+ plugin_start_addr, plugin_end_addr, plugin_start, &rb };
#else /* SIMULATOR */
#define PLUGIN_HEADER \
+ const struct plugin_api *rb __attribute__ ((section (".data"))); \
const struct plugin_header __header \
__attribute__((visibility("default"))) = { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
- NULL, NULL, plugin_start };
+ NULL, NULL, plugin_start, &rb };
#endif /* SIMULATOR */
#ifdef PLUGIN_USE_IRAM
@@ -842,46 +845,44 @@ void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size,
void plugin_tsr(bool (*exit_callback)(bool reenter));
/* defined by the plugin */
-enum plugin_status plugin_start(const struct plugin_api* rockbox, const void* parameter)
+extern const struct plugin_api *rb;
+enum plugin_status plugin_start(const void* parameter)
NO_PROF_ATTR;
/* Use this macro in plugins where gcc tries to optimize by calling
* these functions directly */
-#define MEM_FUNCTION_WRAPPERS(api) \
+#define MEM_FUNCTION_WRAPPERS \
void *memcpy(void *dest, const void *src, size_t n) \
{ \
- return (api)->memcpy(dest, src, n); \
+ return rb->memcpy(dest, src, n); \
} \
void *memset(void *dest, int c, size_t n) \
{ \
- return (api)->memset(dest, c, n); \
+ return rb->memset(dest, c, n); \
} \
void *memmove(void *dest, const void *src, size_t n) \
{ \
- return (api)->memmove(dest, src, n); \
+ return rb->memmove(dest, src, n); \
} \
int memcmp(const void *s1, const void *s2, size_t n) \
{ \
- return (api)->memcmp(s1, s2, n); \
+ return rb->memcmp(s1, s2, n); \
}
-#ifndef CACHE_FUNCTION_WRAPPERS
-
+#undef CACHE_FUNCTION_WRAPPERS
#ifdef CACHE_FUNCTIONS_AS_CALL
-#define CACHE_FUNCTION_WRAPPERS(api) \
+#define CACHE_FUNCTION_WRAPPERS \
void flush_icache(void) \
{ \
- (api)->flush_icache(); \
+ rb->flush_icache(); \
} \
void invalidate_icache(void) \
{ \
- (api)->invalidate_icache(); \
+ rb->invalidate_icache(); \
}
#else
-#define CACHE_FUNCTION_WRAPPERS(api)
+#define CACHE_FUNCTION_WRAPPERS
#endif /* CACHE_FUNCTIONS_AS_CALL */
-#endif /* CACHE_FUNCTION_WRAPPERS */
-
#endif /* __PCTOOL__ */
#endif
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c
index d15e26ae36..a7aeec306f 100644
--- a/apps/plugins/alpine_cdc.c
+++ b/apps/plugins/alpine_cdc.c
@@ -136,7 +136,7 @@ void sound_normal(void); /* return to user settings */
void thread(void); /* the thread running it all */
int main(const void* parameter); /* main loop */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter); /* entry */
+enum plugin_status plugin_start(const void* parameter); /* entry */
/****************** data types ******************/
@@ -209,8 +209,6 @@ struct
unsigned int thread; /* worker thread id */
} gTread;
-static const struct plugin_api* rb; /* here is the global API struct pointer */
-
/****************** implementation ******************/
@@ -1191,10 +1189,8 @@ int main(const void* parameter)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- rb = api; /* copy to global api pointer */
-
/* now go ahead and have fun! */
return (main(parameter)==0) ? PLUGIN_OK : PLUGIN_ERROR;
}
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 7c18dc74dd..7c66c5234a 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -189,17 +189,15 @@ PLUGIN_HEADER
#endif
/****************************** Plugin Entry Point ****************************/
-static const struct plugin_api* rb;
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
int main(void);
bool exit_tsr(bool);
void thread(void);
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
return main();
}
diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c
index 45f0eb70b5..ef391987fb 100644
--- a/apps/plugins/beatbox/beatbox.c
+++ b/apps/plugins/beatbox/beatbox.c
@@ -180,8 +180,6 @@ const unsigned char * drumNames[]={
long gmbuf[BUF_SIZE*NBUF];
int quit=0;
-const struct plugin_api * rb;
-
#define STATE_STOPPED 0
#define STATE_PAUSED 1
@@ -234,13 +232,11 @@ int editState=EDITSTATE_PATTERN;
int playState=STATE_STOPPED, stepFlag=0;
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int retval = 0;
- PLUGIN_IRAM_INIT(api)
-
- rb = api;
+ PLUGIN_IRAM_INIT(rb)
rb->lcd_setfont(0);
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c
index 2aed40fd9e..274e2033fa 100644
--- a/apps/plugins/blackjack.c
+++ b/apps/plugins/blackjack.c
@@ -360,10 +360,7 @@ extern const fb_data card_back[];
#define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]]
-/* global rockbox api */
-static const struct plugin_api* rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
/* dealer and player card positions */
unsigned int dealer_x, dealer_y, player_x, player_y;
@@ -1587,7 +1584,7 @@ static int blackjack(struct game_context* bj) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
struct game_context bj;
bool exit = false;
@@ -1595,7 +1592,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
char str[19];
(void)parameter;
- rb = api;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index 755f7f7338..e932a0ebb9 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -180,8 +180,6 @@ PLUGIN_HEADER
#endif
#endif
-static const struct plugin_api* rb;
-
#define LETTER_WIDTH 11
#define LETTER_HEIGHT 16
@@ -593,14 +591,12 @@ static int loopit(void)
}
-enum plugin_status plugin_start(const struct plugin_api* api,
- const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int w, h;
char *off = "[Off] to stop";
(void)(parameter);
- rb = api;
rb->lcd_setfont(FONT_SYSFIXED);
rb->lcd_clear_display();
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index 35823b6b99..d0e4a593a0 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -209,8 +209,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#endif
-static const struct plugin_api* rb;
-
enum menu_items {
BM_START,
BM_SEL_START,
@@ -1289,7 +1287,6 @@ int game_loop(void)
rb->srand( *rb->current_tick );
- configfile_init(rb);
configfile_load(HIGH_SCORE,config,1,0);
switch(game_menu(0)) {
@@ -2090,17 +2087,16 @@ int game_loop(void)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
rb->lcd_setfont(FONT_SYSFIXED);
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
/* now go ahead and have fun! */
while (game_loop()!=1);
@@ -2110,7 +2106,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI);
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c
index 0894c75d4a..5e338588de 100644
--- a/apps/plugins/bubbles.c
+++ b/apps/plugins/bubbles.c
@@ -203,9 +203,6 @@ PLUGIN_HEADER
/* collision distance squared */
#define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10)
-/* global rockbox api */
-static const struct plugin_api* rb;
-
/* levels */
char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = {
{{ 6, 6, 4, 4, 2, 2, 3, 3},
@@ -2317,7 +2314,7 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
if (timeout < 0)
timeout = 0;
- button = pluginlib_getaction(rb,timeout,plugin_contexts,2);
+ button = pluginlib_getaction(timeout,plugin_contexts,2);
#if defined(HAS_BUTTON_HOLD) && !defined(HAVE_REMOTE_LCD_AS_MAIN)
/* FIXME: Should probably check remote hold here */
if (rb->button_hold())
@@ -2352,7 +2349,7 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
case BUBBLES_START: /* pause the game */
start = *rb->current_tick;
rb->splash(0, "Paused");
- while(pluginlib_getaction(rb,TIMEOUT_BLOCK,plugin_contexts,2)
+ while(pluginlib_getaction(TIMEOUT_BLOCK,plugin_contexts,2)
!= (BUBBLES_START));
bb->startedshot += *rb->current_tick-start;
bubbles_drawboard(bb);
@@ -2480,19 +2477,15 @@ static int bubbles(struct game_context* bb) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
struct game_context bb;
bool exit = false;
int position;
/* plugin init */
(void)parameter;
- rb = api;
/* end of plugin init */
- /* more init */
- xlcd_init(rb);
-
/* load files */
rb->splash(0, "Loading...");
bubbles_loadscores(&bb);
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c
index 7e6eb92b0e..7d93a24196 100644
--- a/apps/plugins/calculator.c
+++ b/apps/plugins/calculator.c
@@ -345,8 +345,7 @@ PLUGIN_HEADER
static struct ts_raster calc_raster = { X_0_POS, Y_1_POS, BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT };
#endif
-static const struct plugin_api* rb;
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
enum {
basicButtons,
@@ -1628,10 +1627,9 @@ int handleButton(int button){
/* -----------------------------------------------------------------------
Main();
----------------------------------------------------------------------- */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
/* now go ahead and have fun! */
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 866adceaee..07934b06a6 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -176,9 +176,7 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define CELL_WIDTH (LCD_WIDTH / 7)
#define CELL_HEIGHT (LCD_HEIGHT / 7)
-static const struct plugin_api* rb;
-
-MEM_FUNCTION_WRAPPERS(rb)
+MEM_FUNCTION_WRAPPERS
static bool leap_year;
/* days_in_month[][0] is for December */
@@ -788,7 +786,7 @@ static void prev_day(struct shown *shown, int step)
draw_calendar(shown);
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
struct today today;
struct shown shown;
@@ -797,8 +795,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
(void)(parameter);
- rb = api;
-
calendar_init(&today, &shown);
load_memo(&shown);
any_events(&shown, false);
diff --git a/apps/plugins/chessbox.c b/apps/plugins/chessbox.c
index 9e86c39b11..3eace4ca22 100644
--- a/apps/plugins/chessbox.c
+++ b/apps/plugins/chessbox.c
@@ -29,8 +29,8 @@
PLUGIN_HEADER
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox");
+ return run_overlay(parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox");
}
#endif
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index f8db7d9b7f..64f8965947 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -450,19 +450,19 @@ void cb_start_viewer(char* filename){
bool exit_viewer = false;
struct cb_command command;
- first_game = pgn_list_games(rb, filename);
+ first_game = pgn_list_games(filename);
if (first_game == NULL){
rb->splash ( HZ*2 , "No games found !" );
return;
}
do {
- selected_game = pgn_show_game_list(rb, first_game);
+ selected_game = pgn_show_game_list(first_game);
if (selected_game == NULL){
break;
}
- pgn_parse_game(rb, filename, selected_game);
+ pgn_parse_game(filename, selected_game);
if (selected_game->first_ply != NULL) {
/* init board */
@@ -769,7 +769,7 @@ void cb_play_game(void) {
GNUChess_Initialize();
/* init PGN history data structures */
- game = pgn_init_game(rb);
+ game = pgn_init_game();
/* restore saved position, if saved */
cb_restoreposition();
@@ -783,9 +783,9 @@ void cb_play_game(void) {
if ( mate ) {
rb->splash ( HZ*3 , "Checkmate!" );
rb->button_get(true);
- pgn_store_game(rb, game);
+ pgn_store_game(game);
GNUChess_Initialize();
- game = pgn_init_game(rb);
+ game = pgn_init_game();
cb_drawboard();
}
command = cb_getcommand ();
@@ -798,7 +798,7 @@ void cb_play_game(void) {
cb_drawboard();
/* Add the ply to the PGN history (in algebraic notation) */
- pgn_append_ply(rb, game, opponent, move_buffer, mate);
+ pgn_append_ply(game, opponent, move_buffer, mate);
rb->splash ( 0 , "Thinking..." );
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -812,9 +812,9 @@ void cb_play_game(void) {
* for the result of the game which is only calculated in SelectMove
*/
if (move_buffer[0] != '\0'){
- pgn_append_ply(rb, game, computer, move_buffer, mate);
+ pgn_append_ply(game, computer, move_buffer, mate);
} else {
- pgn_set_result(rb, game, mate);
+ pgn_set_result(game, mate);
}
if ( wt_command == COMMAND_QUIT ) {
@@ -827,7 +827,7 @@ void cb_play_game(void) {
#ifdef COMMAND_RESTART
case COMMAND_RESTART:
GNUChess_Initialize();
- game = pgn_init_game(rb);
+ game = pgn_init_game();
cb_drawboard();
break;
#endif
@@ -845,7 +845,7 @@ void cb_play_game(void) {
GNUChess_Initialize();
/* init PGN history data structures */
- game = pgn_init_game(rb);
+ game = pgn_init_game();
/* restore saved position, if saved */
cb_restoreposition();
@@ -874,9 +874,9 @@ void cb_play_game(void) {
* for the result of the game which is only calculated in SelectMove
*/
if (move_buffer[0] != '\0'){
- pgn_append_ply(rb, game, computer, move_buffer, mate);
+ pgn_append_ply(game, computer, move_buffer, mate);
} else {
- pgn_set_result(rb, game, mate);
+ pgn_set_result(game, mate);
}
if ( wt_command == COMMAND_QUIT ) {
@@ -904,11 +904,10 @@ void cb_play_game(void) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
/* plugin init */
- rb = api;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c
index 8c92573b75..a8be179fac 100644
--- a/apps/plugins/chessbox/chessbox_pgn.c
+++ b/apps/plugins/chessbox/chessbox_pgn.c
@@ -26,8 +26,6 @@
#define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log"
int loghandler;
-const struct plugin_api* rb;
-
short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}};
short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
short bp_offs[4][2] = {{1,1},{-1,1},{1,-1},{-1,-1}};
@@ -559,7 +557,7 @@ void write_pgn_token(int fhandler, char *buffer, size_t *line_length){
}
/* ---- api functions ---- */
-struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* filename){
+struct pgn_game_node* pgn_list_games(const char* filename){
int fhandler;
char line_buffer[128];
struct pgn_game_node size_node, *first_game = NULL;
@@ -567,7 +565,6 @@ struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* fi
unsigned short game_count = 1;
int line_count = 0;
bool header_start = true, game_start = false;
- rb = api;
if ( (fhandler = rb->open(filename, O_RDONLY)) == 0 ) return NULL;
@@ -617,16 +614,13 @@ struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* fi
return first_game;
}
-struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
- struct pgn_game_node* first_game){
+struct pgn_game_node* pgn_show_game_list(struct pgn_game_node* first_game){
int curr_selection = 0;
int button;
struct gui_synclist games_list;
int i;
struct pgn_game_node *temp_node = first_game;
- rb=api;
-
for (i=0;temp_node != NULL;i++){
temp_node = temp_node->next_node;
}
@@ -661,7 +655,7 @@ struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
}
}
-void pgn_parse_game(const struct plugin_api* api, const char* filename,
+void pgn_parse_game(const char* filename,
struct pgn_game_node* selected_game){
struct pgn_ply_node size_ply, *first_ply = NULL;
struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL;
@@ -670,7 +664,6 @@ void pgn_parse_game(const struct plugin_api* api, const char* filename,
char token_buffer[10];
unsigned short pos;
unsigned short curr_player = white;
- rb = api;
fhandler = rb->open(filename, O_RDONLY);
@@ -731,13 +724,11 @@ void pgn_parse_game(const struct plugin_api* api, const char* filename,
rb->close(fhandler);
}
-struct pgn_game_node* pgn_init_game(const struct plugin_api* api){
+struct pgn_game_node* pgn_init_game(void){
struct pgn_game_node game_size, *game;
struct pgn_ply_node ply_size, *ply;
struct tm *current_time;
- rb = api;
-
if (bufptr == NULL){
pl_malloc_init();
}
@@ -769,12 +760,10 @@ struct pgn_game_node* pgn_init_game(const struct plugin_api* api){
return game;
}
-void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
+void pgn_append_ply(struct pgn_game_node* game,
unsigned short ply_player, char *move_buffer, bool is_mate){
struct pgn_ply_node ply_size, *ply, *temp;
- rb = api;
-
ply = (struct pgn_ply_node *)pl_malloc(sizeof ply_size);
ply->player = ply_player;
ply->column_from = move_buffer[0] - 'a';
@@ -803,11 +792,9 @@ void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
temp->prev_node = ply;
}
-void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
+void pgn_set_result(struct pgn_game_node* game,
bool is_mate){
- rb = api;
-
struct pgn_ply_node *ply;
for(ply=game->first_ply;ply->next_node != NULL;ply=ply->next_node);
if (is_mate){
@@ -817,15 +804,13 @@ void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
}
}
-void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game){
+void pgn_store_game(struct pgn_game_node* game){
int fhandler;
struct pgn_ply_node *ply;
unsigned ply_count;
size_t line_length=0;
char buffer[10];
- rb = api;
-
GNUChess_Initialize();
ply_count=0;
diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h
index 351a32ac57..24830a5f48 100644
--- a/apps/plugins/chessbox/chessbox_pgn.h
+++ b/apps/plugins/chessbox/chessbox_pgn.h
@@ -408,35 +408,33 @@ struct pgn_game_node {
* the user selects a game, that obviously saves processing
* and speeds up response when the user selects the file
*/
-struct pgn_game_node* pgn_list_games(const struct plugin_api* api,
- const char* filename);
+struct pgn_game_node* pgn_list_games(const char* filename);
/* Show the list of games found in a file and allow the user
* to select a game to be parsed and showed
*/
-struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
- struct pgn_game_node* first_game);
+struct pgn_game_node* pgn_show_game_list(struct pgn_game_node* first_game);
/* Parse the pgn string of a game and assign it to the move
* list in the structure
*/
-void pgn_parse_game(const struct plugin_api* api, const char* filename,
+void pgn_parse_game(const char* filename,
struct pgn_game_node* selected_game);
/* Initialize a new game structure with default values and make
* it ready to store the history of a newly played match
*/
-struct pgn_game_node* pgn_init_game(const struct plugin_api* api);
+struct pgn_game_node* pgn_init_game(void);
/* Add a new ply to the game structure based on the positions */
-void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
+void pgn_append_ply(struct pgn_game_node* game,
unsigned short ply_player, char *move_buffer, bool is_mate);
/* Set the result of the game if it was reached during the opponent's ply
*/
-void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
+void pgn_set_result(struct pgn_game_node* game,
bool is_mate);
/* Store a complete game in the PGN history file
*/
-void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game);
+void pgn_store_game(struct pgn_game_node* game);
diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c
index 51e200d0f2..b8fef724fc 100644
--- a/apps/plugins/chessbox/gnuchess.c
+++ b/apps/plugins/chessbox/gnuchess.c
@@ -63,9 +63,6 @@
#define absv(x) ((x) < 0 ? -(x) : (x))
#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b]))
-/* ---- RockBox datatypes and variables */
-const struct plugin_api* rb;
-
/* ---- Chess datatypes and variables ---- */
struct leaf
{
diff --git a/apps/plugins/chessbox/gnuchess.h b/apps/plugins/chessbox/gnuchess.h
index b80647a287..511b8808c0 100644
--- a/apps/plugins/chessbox/gnuchess.h
+++ b/apps/plugins/chessbox/gnuchess.h
@@ -43,9 +43,6 @@ extern short GameCnt,Game50,castld[2],kingmoved[2],OperatorTime;
extern struct TimeControlRec TimeControl;
extern struct GameRec GameList[240];
-/* ---- RockBox integration ---- */
-extern const struct plugin_api* rb;
-
/* ---- The beginning of a GNUChess v2 APIfication ---- */
void SetTimeControl(void);
void GNUChess_Initialize(void);
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 86bcce01db..f8c7a2c64e 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -247,11 +247,7 @@ PLUGIN_HEADER
#define FIRST_LINE 0
#endif
-/* 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 */
-static const struct plugin_api* rb;
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
#define MAX_PLAYERS 10
static struct {
@@ -283,14 +279,13 @@ static bool pause;
#define MAX_TIME 7200
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int i;
bool done;
int nr;
(void)parameter;
- rb=api;
rb->memset(&settings, 0, sizeof(settings));
/* now go ahead and have fun! */
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c
index ceab1431dd..9452b72fb4 100644
--- a/apps/plugins/chip8.c
+++ b/apps/plugins/chip8.c
@@ -26,8 +26,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb; /* here is a global api struct pointer */
-
#define EXTERN static
#define STATIC static
#define memset rb->memset
@@ -1423,12 +1421,10 @@ bool chip8_run(const char* file)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
const char* filename;
- rb = api; /* copy to global api pointer */
-
if (parameter == NULL)
{
rb->splash(HZ, "Play a .ch8 file!");
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index 5c82b1eeea..971aeb8512 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -142,8 +142,6 @@ Still To do:
#endif
#endif
-static const struct plugin_api* rb;
-
#define NUMBER_OF_BLOCKS 8
#define NUMBER_OF_PARTICLES 3
#define MAX_TERRAIN_NODES 15
@@ -996,10 +994,9 @@ void chopper_load(bool newgame)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
int ret;
rb->lcd_setfont(FONT_SYSFIXED);
@@ -1012,12 +1009,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
rb->srand( *rb->current_tick );
- xlcd_init(rb);
- configfile_init(rb);
configfile_load(CFG_FILE, config, 1, 0);
chopper_load(true);
@@ -1027,7 +1022,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->lcd_setfont(FONT_UI);
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return ret;
}
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c
index 9279a182ee..f0001780bf 100644
--- a/apps/plugins/clock/clock.c
+++ b/apps/plugins/clock/clock.c
@@ -56,8 +56,6 @@ const struct button_mapping* plugin_contexts[]={
#define ACTION_SKIN_PREV PLA_DEC
#define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT
-extern const struct plugin_api* rb;
-
/**************************
* Cleanup on plugin return
*************************/
@@ -111,7 +109,7 @@ void format_date(char* buffer, struct time* time, enum date_format format){
/**********************************************************************
* Plugin starts here
**********************************************************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){
+enum plugin_status plugin_start(const void* parameter){
int button;
int last_second = -1;
bool redraw=true;
@@ -120,7 +118,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
struct counter counter;
bool exit_clock = false;
(void)parameter;
- rb = api;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
@@ -129,7 +126,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
load_settings();
/* init xlcd functions */
- xlcd_init(rb);
counter_init(&counter);
clock_draw_set_colors();
@@ -142,7 +138,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/*************************
* Scan for button presses
************************/
- button = pluginlib_getaction(rb, HZ/10, plugin_contexts, PLA_ARRAY_COUNT);
+ button = pluginlib_getaction(HZ/10, plugin_contexts, PLA_ARRAY_COUNT);
redraw=true;/* we'll set it to false afterwards if there was no action */
switch (button){
case ACTION_COUNTER_TOGGLE: /* start/stop counter */
diff --git a/apps/plugins/clock/clock.h b/apps/plugins/clock/clock.h
index 2bcbe7207e..e447ccce5d 100644
--- a/apps/plugins/clock/clock.h
+++ b/apps/plugins/clock/clock.h
@@ -22,7 +22,6 @@
#ifndef _CLOCK_
#define _CLOCK_
#include "clock_settings.h"
-extern const struct plugin_api* rb;
struct time{
int year, day, month;
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index 62471c5bc7..0251849c11 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -23,8 +23,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
static const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */
};
@@ -371,13 +369,12 @@ static void roll_credits(void)
#endif
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
rb->show_logo();
#ifdef HAVE_LCD_CHARCELLS
@@ -389,7 +386,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
roll_credits();
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index d43f06f4b8..9ba7a70385 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -413,8 +413,6 @@ static long matrice[3][3];
static const int nb_points = 8;
static long z_off = 600;
-static const struct plugin_api* rb;
-
static void cube_rotate(int xa, int ya, int za)
{
int i;
@@ -568,7 +566,7 @@ void cleanup(void *parameter)
#endif
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
char buffer[30];
int t_disp = 0;
@@ -587,14 +585,11 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
bool exit = false;
(void)(parameter);
- rb = api;
#ifdef HAVE_LCD_BITMAP
-#if LCD_DEPTH > 1
- xlcd_init(rb);
-#elif defined(USE_GSLIB)
+#if defined(USE_GSLIB)
gbuf = (unsigned char *)rb->plugin_get_buffer(&gbuf_size);
- if (!grey_init(rb, gbuf, gbuf_size, GREY_BUFFERED,
+ if (!grey_init(gbuf, gbuf_size, GREY_BUFFERED,
LCD_WIDTH, LCD_HEIGHT, NULL))
{
rb->splash(HZ, "Couldn't init greyscale display");
@@ -614,7 +609,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif
rb->lcd_setfont(FONT_SYSFIXED);
#else /* LCD_CHARCELLS */
- if (!pgfx_init(rb, 4, 2))
+ if (!pgfx_init(4, 2))
{
rb->splash(HZ*2, "Old LCD :(");
return PLUGIN_OK;
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c
index 145c3ce0be..5f44e11f3d 100644
--- a/apps/plugins/demystify.c
+++ b/apps/plugins/demystify.c
@@ -67,8 +67,6 @@ struct line_color
/******************************* Globals ***********************************/
-static const struct plugin_api* rb; /* global api struct pointer */
-
/*
* Compute a new random step to make the point bounce the borders of the screen
*/
@@ -258,9 +256,9 @@ void cleanup(void *parameter)
{
(void)parameter;
- backlight_use_settings(rb);
+ backlight_use_settings();
#ifdef HAVE_REMOTE_LCD
- remote_backlight_use_settings(rb);
+ remote_backlight_use_settings();
#endif
}
@@ -384,7 +382,7 @@ int plugin_main(void)
rb->yield();
else
rb->sleep(sleep_time);
- action = pluginlib_getaction(rb, TIMEOUT_NOBLOCK,
+ action = pluginlib_getaction(TIMEOUT_NOBLOCK,
plugin_contexts, NB_ACTION_CONTEXTS);
switch(action)
{
@@ -426,18 +424,17 @@ int plugin_main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int ret;
- rb = api; /* copy to global api pointer */
(void)parameter;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
#ifdef HAVE_REMOTE_LCD
- remote_backlight_force_on(rb); /* remote backlight control in lib/helper.c */
+ remote_backlight_force_on(); /* remote backlight control in lib/helper.c */
#endif
ret = plugin_main();
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c
index 77bbda3cae..46b39a67ae 100644
--- a/apps/plugins/dice.c
+++ b/apps/plugins/dice.c
@@ -46,7 +46,6 @@ struct dices
#define PRINT_BUFFER_LENGTH MAX_DICES*4
PLUGIN_HEADER
-static const struct plugin_api* rb;
static struct dices dice;
static int sides_index;
@@ -74,15 +73,13 @@ void dice_print(struct dices* dice, struct screen* display);
bool dice_menu(struct dices* dice);
/* plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
(void)parameter;
- rb = api;
int i, action;
dice_init(&dice);
rb->srand(*rb->current_tick);
- configfile_init(rb);
configfile_load(CFG_FILE, config, 2, 0);
dice.nb_sides = nb_sides_values[sides_index];
if(!dice_menu(&dice))
@@ -95,7 +92,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
FOR_NB_SCREENS(i)
dice_print( &dice, rb->screens[i] );
while(true) {
- action = pluginlib_getaction(rb, TIMEOUT_BLOCK,
+ action = pluginlib_getaction(TIMEOUT_BLOCK,
plugin_contexts, 1);
switch(action) {
case DICE_ROLL:
diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c
index 7e176e67a5..9c7e8594fa 100644
--- a/apps/plugins/dict.c
+++ b/apps/plugins/dict.c
@@ -23,8 +23,6 @@
PLUGIN_HEADER
-/* save the plugin api pointer. */
-static const struct plugin_api* rb;
/* screen info */
static int display_columns, display_lines;
@@ -152,7 +150,7 @@ long reverse (long N) {
#define DICT_DESC ROCKBOX_DIR "/rocks/apps/dict.desc"
/* the main plugin function */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
char searchword[WORDLEN]; /* word to search for */
char *description; /* pointer to description buffer */
@@ -165,7 +163,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* plugin stuff */
(void)parameter;
- rb = api;
/* get screen info */
init_screen();
diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c
index 2191764ca2..3eb61ead29 100644
--- a/apps/plugins/disktidy.c
+++ b/apps/plugins/disktidy.c
@@ -21,8 +21,7 @@
#include "plugin.h"
PLUGIN_HEADER
-static const struct plugin_api* rb;
-MEM_FUNCTION_WRAPPERS(rb)
+MEM_FUNCTION_WRAPPERS
/* function return values */
enum tidy_return
@@ -479,13 +478,12 @@ int tidy_lcd_menu(void)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
enum tidy_return status;
int ret;
(void)parameter;
- rb = api;
tidy_type_count = 0;
tidy_load_file(DEFAULT_FILES);
tidy_load_file(CUSTOM_FILES);
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 1d533d40ec..23872c221c 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -772,7 +772,7 @@ void I_InitGraphics(void)
#ifndef HAVE_LCD_COLOR
gbuf=malloc(GREYBUFSIZE);
- grey_init(rb, gbuf, GREYBUFSIZE, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
+ grey_init(gbuf, GREYBUFSIZE, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
/* switch on greyscale overlay */
grey_show(true);
#endif
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 763e9d5681..1e7c9fa13a 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -101,7 +101,6 @@ int my_close(int id)
return 0;
}
#endif
-const struct plugin_api* rb;
#define MAXARGVS 100
bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
@@ -496,7 +495,7 @@ int Oset_keys()
{ "Game Automap", NULL },
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
while(!menuquit)
@@ -560,7 +559,7 @@ static bool Doptions()
#endif
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
while(!menuquit)
@@ -583,7 +582,7 @@ int menuchoice(struct menu_item *menu, int items)
{
int m, result;
- m = menu_init(rb, menu, items,NULL, NULL, NULL, NULL);
+ m = menu_init(menu, items,NULL, NULL, NULL, NULL);
result= menu_show(m);
menu_exit(m);
@@ -633,7 +632,7 @@ int doom_menu()
while (rb->button_get(false) != BUTTON_NONE)
rb->yield();
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
while(!menuquit)
@@ -677,11 +676,10 @@ int doom_menu()
extern int systemvol;
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- PLUGIN_IRAM_INIT(api)
+ PLUGIN_IRAM_INIT(rb)
- rb = api;
(void)parameter;
doomexit=0;
@@ -741,7 +739,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
systemvol= rb->global_settings->volume-rb->global_settings->volume%((rb->sound_max(SOUND_VOLUME)-rb->sound_min(SOUND_VOLUME))/15);
general_translucency = default_translucency; // phares
- backlight_force_on(rb);
+ backlight_force_on();
#ifdef RB_PROFILE
rb->profile_thread();
#endif
@@ -755,7 +753,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#ifdef RB_PROFILE
rb->profstop();
#endif
- backlight_use_settings(rb);
+ backlight_use_settings();
M_SaveDefaults ();
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 6abf025aac..73cd902277 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -26,7 +26,6 @@
#include "autoconf.h"
#include "z_zone.h"
-extern const struct plugin_api* rb;
extern bool noprintf;
extern bool doomexit;
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c
index 827c7db586..a9ec72d2b3 100644
--- a/apps/plugins/euroconverter.c
+++ b/apps/plugins/euroconverter.c
@@ -143,8 +143,6 @@ static unsigned char *abbrev_str[12] = {
static unsigned long heuro,hhome; /*Handles for the new patterns*/
-static const struct plugin_api* rb;
-
static char *currency_str[12] = {
"France",
"Germany",
@@ -405,7 +403,7 @@ static void euro_exit(void *parameter)
/* this is the 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 end, pos;
longlong_t e,h,old_e,old_h;
@@ -415,10 +413,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
this to avoid the compiler warning about it */
(void)parameter;
- /* if you are using a global api pointer, don't forget to copy it!
- otherwise you will get lovely "I04: IllInstr" errors... :-) */
- rb = api;
-
/*Get the pattern handle*/
heuro=rb->lcd_get_locked_pattern();
hhome=rb->lcd_get_locked_pattern();
@@ -433,8 +427,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
cur_pos=3;
inc=100000;
- configfile_init(rb);
-
load_config();
/*Empty the event queue*/
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index f1b62f5b26..d8b31075ad 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -43,8 +43,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb; /* global api struct pointer */
-
#ifndef HAVE_LCD_COLOR
GREY_INFO_STRUCT
static unsigned char draw_buffer[FIRE_WIDTH];
@@ -267,7 +265,7 @@ void cleanup(void *parameter)
grey_release();
#endif
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
}
@@ -280,7 +278,7 @@ int init_grey(void)
/* get the remainder of the plugin buffer */
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- if (!grey_init(rb, gbuf, gbuf_size, GREY_ON_COP,
+ if (!grey_init(gbuf, gbuf_size, GREY_ON_COP,
FIRE_WIDTH, LCD_HEIGHT, NULL)){
rb->splash(HZ, "not enough memory");
return PLUGIN_ERROR;
@@ -312,7 +310,7 @@ int main(void)
fire_draw(&fire);
rb->yield();
- action = pluginlib_getaction(rb, 0, plugin_contexts, PLA_ARRAY_COUNT);
+ action = pluginlib_getaction(0, plugin_contexts, PLA_ARRAY_COUNT);
switch(action){
case FIRE_QUIT:
@@ -346,17 +344,16 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int ret;
- rb = api; //copy to global api pointer
(void)parameter;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
ret = main();
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c
index 64b30dc36e..80e31a0e20 100644
--- a/apps/plugins/fireworks.c
+++ b/apps/plugins/fireworks.c
@@ -24,8 +24,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
/***
* FIREWORKS.C by ZAKK ROBERTS
* Rockbox plugin simulating a fireworks display.
@@ -335,7 +333,7 @@ void fireworks_menu(void)
rb->lcd_clear_display();
rb->lcd_update();
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -396,12 +394,10 @@ void fireworks_menu(void)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
-
int j, i, autofire=0;
int thisrocket=0;
int start_tick, elapsed_tick;
@@ -409,7 +405,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* set everything up.. no BL timeout, no backdrop,
white-text-on-black-background. */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
rb->lcd_set_background(LCD_BLACK);
@@ -566,7 +562,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
}
}
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c
index 6380f6dbdb..c855fb669f 100644
--- a/apps/plugins/firmware_flash.c
+++ b/apps/plugins/firmware_flash.c
@@ -128,8 +128,6 @@ typedef struct
char name[32];
} tFlashInfo;
-static const struct plugin_api* rb; /* here is a global api struct pointer */
-
#define MASK_ADR 0xFC /* position of hardware mask value in Flash */
#define VERSION_ADR 0xFE /* position of firmware version value in Flash */
#define PLATFORM_ADR 0xFB /* position of my platform ID value in Flash */
@@ -1074,12 +1072,10 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int oldmode;
- rb = api; /* copy to global api pointer */
-
/* now go ahead and have fun! */
oldmode = rb->system_memory_guard(MEMGUARD_NONE); /*disable memory guard */
DoUserDialog((char*) parameter);
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index f4725e4fa0..fe97a6a068 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -298,7 +298,6 @@ PLUGIN_HEADER
#endif
#endif
-static const struct plugin_api* rb;
static int spots[20];
static int toggle[20];
static int cursor_pos, moves;
@@ -645,12 +644,11 @@ static bool flipit_loop(void)
}
/* called function from outside */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int i, rc;
(void)parameter;
- rb = api;
#ifdef HAVE_LCD_COLOR
rb->lcd_set_background(LCD_WHITE);
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c
index cd8db5bf8b..2cd373ea9b 100644
--- a/apps/plugins/greyscale.c
+++ b/apps/plugins/greyscale.c
@@ -104,7 +104,6 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
GREY_INFO_STRUCT
-static const struct plugin_api* rb; /* global api struct pointer */
static char pbuf[32]; /* global printf buffer */
static unsigned char *gbuf;
static size_t gbuf_size = 0;
@@ -117,7 +116,7 @@ void cleanup(void *parameter)
grey_release(); /* switch off overlay and deinitialize */
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
}
/* this is only a demo of what the framework can do */
@@ -202,7 +201,7 @@ int main(void)
};
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
rb->lcd_setfont(FONT_SYSFIXED); /* select default font */
@@ -212,7 +211,7 @@ int main(void)
/* initialize the greyscale buffer:
Archos: 112 pixels wide, 7 rows (56 pixels) high.
H1x0: 160 pixels wide, 30 rows (120 pixels) high. */
- if (!grey_init(rb, gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP,
+ if (!grey_init(gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP,
LCD_WIDTH, GFX_HEIGHT, NULL))
{
rb->splash(HZ, "Not enough memory.");
@@ -363,9 +362,8 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- rb = api; /* copy to global api pointer */
(void)parameter;
return main();
diff --git a/apps/plugins/helloworld.c b/apps/plugins/helloworld.c
index c4bd043244..e582eb77b3 100644
--- a/apps/plugins/helloworld.c
+++ b/apps/plugins/helloworld.c
@@ -26,22 +26,13 @@
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 */
-static const struct plugin_api* rb;
-
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;
- /* if you are using a global api pointer, don't forget to copy it!
- otherwise you will get lovely "I04: IllInstr" errors... :-) */
- rb = api;
-
/* now go ahead and have fun! */
rb->splash(HZ*2, "Hello world!");
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 0d50c67e73..718cb032cc 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -611,8 +611,6 @@ unsigned char fire_sprite[FIRE_HEIGHT] = {
#define CYCLETIME 40
-static const struct plugin_api* rb;
-
/* Physical x is at PLAYFIELD_X + LIVES_X + x * ALIEN_SPEED
* Physical y is at y * ALIEN_HEIGHT
*/
@@ -1600,7 +1598,6 @@ void init_invadrox(void)
rb->lcd_set_background(LCD_BLACK);
rb->lcd_set_foreground(LCD_BLACK);
- highscore_init(rb);
if (highscore_load(HISCOREFILE, &hiscore, 1) < 0) {
/* Init hiscore to 0 */
rb->strncpy(hiscore.name, "Invader", sizeof(hiscore.name));
@@ -1801,13 +1798,11 @@ void game_loop(void)
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, UNUSED const void* parameter)
+enum plugin_status plugin_start(UNUSED const void* parameter)
{
- rb = api;
-
rb->lcd_setfont(FONT_SYSFIXED);
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
/* now go ahead and have fun! */
game_loop();
@@ -1825,7 +1820,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, UNUSED const void*
/* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI);
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c
index e7ae056d38..b2273f1b86 100644
--- a/apps/plugins/iriver_flash.c
+++ b/apps/plugins/iriver_flash.c
@@ -56,8 +56,6 @@ struct flash_info
char name[32];
};
-static const struct plugin_api* rb; /* here is a global api struct pointer */
-
#ifdef IRIVER_H100_SERIES
#define SEC_SIZE 4096
#define BOOTLOADER_ERASEGUARD (BOOTLOADER_ENTRYPOINT / SEC_SIZE)
@@ -804,12 +802,10 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int oldmode;
- rb = api; /* copy to global api pointer */
-
/* now go ahead and have fun! */
oldmode = rb->system_memory_guard(MEMGUARD_NONE); /*disable memory guard */
DoUserDialog((char*) parameter);
diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c
index 7e77ae3e69..35a96a05c4 100644
--- a/apps/plugins/iriverify.c
+++ b/apps/plugins/iriverify.c
@@ -27,8 +27,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
ssize_t buf_size;
static char *filename;
static int readsize;
@@ -132,15 +130,13 @@ static int write_file(void)
return 0;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
char *buf;
int rc;
int i;
filename = (char *)parameter;
- rb = api;
-
buf = rb->plugin_get_audio_buffer((size_t *)&buf_size); /* start munching memory */
stringbuffer = buf;
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index 2380dad2b9..e13dcf8994 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -71,8 +71,6 @@ const struct picture jackpot_pictures[]={
#define SLEEP_TIME (HZ/200)
#endif /* HAVE_LCD_CHARCELLS */
-static const struct plugin_api* rb;
-
struct jackpot
{
/* A slot can display "NB_PICTURES" pictures
@@ -293,9 +291,8 @@ void jackpot_play_turn(struct jackpot* game)
jackpot_print_turn_result(game, gain, rb->screens[d]);
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- rb = api;
int action, i;
struct jackpot game;
(void)parameter;
@@ -313,7 +310,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->button_clear_queue();
while (true)
{
- action = pluginlib_getaction(rb, TIMEOUT_BLOCK,
+ action = pluginlib_getaction(TIMEOUT_BLOCK,
plugin_contexts, 1);
switch ( action )
{
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index 645135a918..7b45e554e2 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -359,9 +359,6 @@ struct jewels_menu {
{"Exit Jewels", MRES_EXIT}}}
};
-/* global rockbox api */
-static const struct plugin_api* rb;
-
/* external bitmaps */
extern const fb_data jewels[];
@@ -1767,7 +1764,7 @@ static int jewels_main(struct game_context* bj) {
continue;
case MRES_PLAYBACK:
- playback_control(rb, NULL);
+ playback_control(NULL);
rb->lcd_setfont(FONT_SYSFIXED);
inmenu = false;
selected = false;
@@ -1940,7 +1937,7 @@ static int jewels_main(struct game_context* bj) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
struct game_context bj;
bool exit = false;
int position;
@@ -1948,7 +1945,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* plugin init */
(void)parameter;
- rb = api;
/* end of plugin init */
/* load high scores */
diff --git a/apps/plugins/jpeg/jpeg.c b/apps/plugins/jpeg/jpeg.c
index d8775dd176..82d9186298 100644
--- a/apps/plugins/jpeg/jpeg.c
+++ b/apps/plugins/jpeg/jpeg.c
@@ -76,9 +76,7 @@ GREY_INFO_STRUCT
/******************************* Globals ***********************************/
-const struct plugin_api* rb; /* Exported to other .c files in this plugin */
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
static int slideshow_enabled = false; /* run slideshow */
static int running_slideshow = false; /* loading image because of slideshw */
@@ -334,7 +332,7 @@ static void display_options(void)
{ "Dithering", set_option_dithering },
};
- int m = menu_init(rb, items, ARRAYLEN(items),
+ int m = menu_init(items, ARRAYLEN(items),
NULL, NULL, NULL, NULL);
menu_run(m);
menu_exit(m);
@@ -394,7 +392,7 @@ int show_menu(void) /* return 1 to quit */
{ "Enable", -1 },
};
- 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);
@@ -418,7 +416,7 @@ int show_menu(void) /* return 1 to quit */
case MIID_SHOW_PLAYBACK_MENU:
if (plug_buf)
{
- playback_control(rb, NULL);
+ playback_control(NULL);
}
else
{
@@ -1183,10 +1181,8 @@ int load_and_show(char* filename)
/******************** Plugin entry point *********************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- rb = api;
-
int condition;
#ifdef USEGSLIB
long greysize; /* helper */
@@ -1219,7 +1215,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif
#ifdef USEGSLIB
- if (!grey_init(rb, buf, buf_size, GREY_ON_COP,
+ if (!grey_init(buf, buf_size, GREY_ON_COP,
LCD_WIDTH, LCD_HEIGHT, &greysize))
{
rb->splash(HZ, "grey buf error");
@@ -1227,13 +1223,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
}
buf += greysize;
buf_size -= greysize;
-#else
- xlcd_init(rb);
#endif
/* should be ok to just load settings since the plugin itself has
just been loaded from disk and the drive should be spinning */
- configfile_init(rb);
configfile_load(JPEG_CONFIGFILE, jpeg_config,
ARRAYLEN(jpeg_config), JPEG_SETTINGS_MINVERSION);
old_settings = jpeg_settings;
@@ -1241,7 +1234,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
buf_images = buf; buf_images_size = buf_size;
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
do
{
@@ -1263,7 +1256,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
#ifdef USEGSLIB
grey_release(); /* deinitialize */
diff --git a/apps/plugins/jpeg/jpeg_decoder.c b/apps/plugins/jpeg/jpeg_decoder.c
index ffd71a1320..71d50888c3 100644
--- a/apps/plugins/jpeg/jpeg_decoder.c
+++ b/apps/plugins/jpeg/jpeg_decoder.c
@@ -29,8 +29,6 @@
#include "jpeg_decoder.h"
-extern const struct plugin_api* rb;
-
/* for portability of below JPEG code */
#define MEMSET(p,v,c) rb->memset(p,v,c)
#define MEMCPY(d,s,c) rb->memcpy(d,s,c)
diff --git a/apps/plugins/jpeg/yuv2rgb.c b/apps/plugins/jpeg/yuv2rgb.c
index 1130f038af..c2464924fe 100644
--- a/apps/plugins/jpeg/yuv2rgb.c
+++ b/apps/plugins/jpeg/yuv2rgb.c
@@ -28,9 +28,6 @@
#include "plugin.h"
#include "yuv2rgb.h"
-/* Needed for memset and rb->lcd_framebuffer */
-extern const struct plugin_api* rb;
-
/*
* Conversion of full 0-255 range YCrCb to RGB:
* |R| |1.000000 -0.000001 1.402000| |Y'|
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 0e657f3bcc..3c874a6549 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -64,8 +64,7 @@ union hash
uint32_t words[4];
};
-static const struct plugin_api* rb;
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
static char buffer[sizeof(struct pw_entry)*MAX_ENTRIES];
static int bytes_read = 0; /* bytes read into the buffer */
static struct gui_synclist kb_list;
@@ -637,11 +636,9 @@ static int main_menu(void)
return 0;
}
-enum plugin_status plugin_start(const struct plugin_api *api,
- const void *parameter)
+enum plugin_status plugin_start(const void *parameter)
{
(void)parameter;
- rb = api;
int ret;
rb->gui_synclist_init(&kb_list, &kb_list_cb, NULL, false, 1, NULL);
@@ -652,8 +649,6 @@ enum plugin_status plugin_start(const struct plugin_api *api,
rb->gui_synclist_limit_scroll(&kb_list, false);
rb->gui_synclist_select_item(&kb_list, 0);
- md5_init(api);
-
init_ll();
ret = main_menu();
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c
index 337ea85f43..1d99ef64d3 100644
--- a/apps/plugins/lamp.c
+++ b/apps/plugins/lamp.c
@@ -99,8 +99,6 @@ PLUGIN_HEADER
# endif
#endif
-static const struct plugin_api* rb; /* global api struct pointer */
-
#ifdef HAVE_LCD_COLOR
/* RGB color sets */
#define NUM_COLORSETS 2
@@ -109,11 +107,10 @@ static int colorset[NUM_COLORSETS][3] = { { 255, 255, 255 } , /* white */
#endif /* HAVE_LCD_COLOR */
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
long button;
(void)parameter;
- rb = api;
#ifdef HAVE_LCD_COLOR
int cs = 0;
@@ -151,9 +148,9 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif /* MROBE_100 */
#endif /* HAVE_LCD_INVERT */
- backlight_force_on(rb);
+ backlight_force_on();
#ifdef HAVE_BUTTON_LIGHT
- buttonlight_force_on(rb);
+ buttonlight_force_on();
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_COLOR
@@ -220,9 +217,9 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif /*HAVE_LCD_COLOR */
/* restore */
- backlight_use_settings(rb);
+ backlight_use_settings();
#ifdef HAVE_BUTTON_LIGHT
- buttonlight_use_settings(rb);
+ buttonlight_use_settings();
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_INVERT
diff --git a/apps/plugins/lib/checkbox.c b/apps/plugins/lib/checkbox.c
index fc3a5e1e7d..221137b328 100644
--- a/apps/plugins/lib/checkbox.c
+++ b/apps/plugins/lib/checkbox.c
@@ -27,19 +27,19 @@
/*
* Print a checkbox
*/
-void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked)
+void checkbox(int x, int y, int width, int height, bool checked)
{
/* draw box */
- api->lcd_drawrect(x, y, width, height);
+ rb->lcd_drawrect(x, y, width, height);
/* clear inner area */
- api->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- api->lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
- api->lcd_set_drawmode(DRMODE_SOLID);
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
+ rb->lcd_set_drawmode(DRMODE_SOLID);
if (checked){
- api->lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1);
- api->lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2);
+ rb->lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1);
+ rb->lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2);
}
}
diff --git a/apps/plugins/lib/checkbox.h b/apps/plugins/lib/checkbox.h
index 1456bd4bb9..81a26e15ba 100644
--- a/apps/plugins/lib/checkbox.h
+++ b/apps/plugins/lib/checkbox.h
@@ -26,6 +26,6 @@
/*
* Print a checkbox
*/
-void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked);
+void checkbox(int x, int y, int width, int height, bool checked);
#endif
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c
index 4fb037cb8e..419109f904 100644
--- a/apps/plugins/lib/configfile.c
+++ b/apps/plugins/lib/configfile.c
@@ -21,27 +21,20 @@
#include "plugin.h"
#include "configfile.h"
-static const struct plugin_api *cfg_rb;
-
-void configfile_init(const struct plugin_api* newrb)
-{
- cfg_rb = newrb;
-}
-
static void get_cfg_filename(char* buf, int buf_len, const char* filename)
{
char *s;
- cfg_rb->strcpy(buf, cfg_rb->plugin_get_current_filename());
- s = cfg_rb->strrchr(buf, '/');
+ rb->strcpy(buf, rb->plugin_get_current_filename());
+ s = rb->strrchr(buf, '/');
if (!s) /* should never happen */
{
- cfg_rb->snprintf(buf, buf_len, PLUGIN_DIR "/%s", filename);
+ rb->snprintf(buf, buf_len, PLUGIN_DIR "/%s", filename);
}
else
{
s++;
*s = '\0';
- cfg_rb->strcat(s, filename);
+ rb->strcat(s, filename);
}
}
@@ -53,30 +46,30 @@ int configfile_save(const char *filename, struct configdata *cfg,
char buf[MAX_PATH];
get_cfg_filename(buf, MAX_PATH, filename);
- fd = cfg_rb->creat(buf);
+ fd = rb->creat(buf);
if(fd < 0)
return fd*10 - 1;
/* pre-allocate 10 bytes for INT */
- cfg_rb->fdprintf(fd, "file version: %10d\n", version);
+ rb->fdprintf(fd, "file version: %10d\n", version);
for(i = 0;i < num_items;i++) {
switch(cfg[i].type) {
case TYPE_INT:
/* pre-allocate 10 bytes for INT */
- cfg_rb->fdprintf(fd, "%s: %10d\n",
+ rb->fdprintf(fd, "%s: %10d\n",
cfg[i].name,
*cfg[i].val);
break;
case TYPE_ENUM:
- cfg_rb->fdprintf(fd, "%s: %s\n",
+ rb->fdprintf(fd, "%s: %s\n",
cfg[i].name,
cfg[i].values[*cfg[i].val]);
break;
case TYPE_STRING:
- cfg_rb->fdprintf(fd, "%s: %s\n",
+ rb->fdprintf(fd, "%s: %s\n",
cfg[i].name,
cfg[i].string);
break;
@@ -84,7 +77,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
}
}
- cfg_rb->close(fd);
+ rb->close(fd);
return 0;
}
@@ -100,27 +93,27 @@ int configfile_load(const char *filename, struct configdata *cfg,
int tmp;
get_cfg_filename(buf, MAX_PATH, filename);
- fd = cfg_rb->open(buf, O_RDONLY);
+ fd = rb->open(buf, O_RDONLY);
if(fd < 0)
return fd*10 - 1;
- while(cfg_rb->read_line(fd, buf, MAX_PATH) > 0) {
- cfg_rb->settings_parseline(buf, &name, &val);
+ while(rb->read_line(fd, buf, MAX_PATH) > 0) {
+ rb->settings_parseline(buf, &name, &val);
/* Bail out if the file version is too old */
- if(!cfg_rb->strcmp("file version", name)) {
- file_version = cfg_rb->atoi(val);
+ if(!rb->strcmp("file version", name)) {
+ file_version = rb->atoi(val);
if(file_version < min_version) {
- cfg_rb->close(fd);
+ rb->close(fd);
return -1;
}
}
for(i = 0;i < num_items;i++) {
- if(!cfg_rb->strcmp(cfg[i].name, name)) {
+ if(!rb->strcmp(cfg[i].name, name)) {
switch(cfg[i].type) {
case TYPE_INT:
- tmp = cfg_rb->atoi(val);
+ tmp = rb->atoi(val);
/* Only set it if it's within range */
if(tmp >= cfg[i].min && tmp <= cfg[i].max)
*cfg[i].val = tmp;
@@ -128,21 +121,21 @@ int configfile_load(const char *filename, struct configdata *cfg,
case TYPE_ENUM:
for(j = 0;j < cfg[i].max;j++) {
- if(!cfg_rb->strcmp(cfg[i].values[j], val)) {
+ if(!rb->strcmp(cfg[i].values[j], val)) {
*cfg[i].val = j;
}
}
break;
case TYPE_STRING:
- cfg_rb->strncpy(cfg[i].string, val, cfg[i].max);
+ rb->strncpy(cfg[i].string, val, cfg[i].max);
break;
}
}
}
}
- cfg_rb->close(fd);
+ rb->close(fd);
return 0;
}
@@ -154,21 +147,21 @@ int configfile_get_value(const char* filename, const char* name)
char buf[MAX_PATH];
get_cfg_filename(buf, MAX_PATH, filename);
- fd = cfg_rb->open(buf, O_RDONLY);
+ fd = rb->open(buf, O_RDONLY);
if(fd < 0)
return -1;
- while(cfg_rb->read_line(fd, buf, MAX_PATH) > 0)
+ while(rb->read_line(fd, buf, MAX_PATH) > 0)
{
- cfg_rb->settings_parseline(buf, &pname, &pval);
- if(!cfg_rb->strcmp(name, pname))
+ rb->settings_parseline(buf, &pname, &pval);
+ if(!rb->strcmp(name, pname))
{
- cfg_rb->close(fd);
- return cfg_rb->atoi(pval);
+ rb->close(fd);
+ return rb->atoi(pval);
}
}
- cfg_rb->close(fd);
+ rb->close(fd);
return -1;
}
@@ -185,20 +178,20 @@ int configfile_update_entry(const char* filename, const char* name, int val)
/* open the current config file */
get_cfg_filename(path, MAX_PATH, filename);
- fd = cfg_rb->open(path, O_RDWR);
+ fd = rb->open(path, O_RDWR);
if(fd < 0)
return -1;
/* read in the current stored settings */
- while((line_len = cfg_rb->read_line(fd, buf, 256)) > 0)
+ while((line_len = rb->read_line(fd, buf, 256)) > 0)
{
- cfg_rb->settings_parseline(buf, &pname, &pval);
- if(!cfg_rb->strcmp(name, pname))
+ rb->settings_parseline(buf, &pname, &pval);
+ if(!rb->strcmp(name, pname))
{
found = 1;
- cfg_rb->lseek(fd, pos, SEEK_SET);
+ rb->lseek(fd, pos, SEEK_SET);
/* pre-allocate 10 bytes for INT */
- cfg_rb->fdprintf(fd, "%s: %10d\n", pname, val);
+ rb->fdprintf(fd, "%s: %10d\n", pname, val);
break;
}
pos += line_len;
@@ -207,9 +200,9 @@ int configfile_update_entry(const char* filename, const char* name, int val)
/* if (name/val) is a new entry just append to file */
if (found == 0)
/* pre-allocate 10 bytes for INT */
- cfg_rb->fdprintf(fd, "%s: %10d\n", name, val);
+ rb->fdprintf(fd, "%s: %10d\n", name, val);
- cfg_rb->close(fd);
+ rb->close(fd);
return found;
}
diff --git a/apps/plugins/lib/configfile.h b/apps/plugins/lib/configfile.h
index 9c926bd02c..0804a5930d 100644
--- a/apps/plugins/lib/configfile.h
+++ b/apps/plugins/lib/configfile.h
@@ -39,8 +39,6 @@ struct configdata
NULL otherwise */
};
-void configfile_init(const struct plugin_api* newrb);
-
/* configfile_save - Given configdata entries this function will
create a config file with these entries, destroying any
previous config file of the same name */
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 8c9d40ab8d..7c990ad792 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -52,7 +52,7 @@
#define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */
/* Library initialisation and release */
-bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
+bool grey_init(unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken);
void grey_release(void);
@@ -172,7 +172,6 @@ struct _grey_info
int bheight; /* 4-pixel or 8-pixel units */
#endif
unsigned long flags; /* various flags, see #defines */
- const struct plugin_api *rb; /* plugin API pointer */
unsigned char *values; /* start of greyscale pixel values */
unsigned char *phases; /* start of greyscale pixel phases */
unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index c4eb0fc080..c73f0cdf52 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -336,16 +336,16 @@ static inline void _deferred_update(void)
int y2 = MIN(_grey_info.y + _grey_info.height, LCD_HEIGHT);
if (y1 > 0) /* refresh part above overlay, full width */
- _grey_info.rb->lcd_update_rect(0, 0, LCD_WIDTH, y1);
+ rb->lcd_update_rect(0, 0, LCD_WIDTH, y1);
if (y2 < LCD_HEIGHT) /* refresh part below overlay, full width */
- _grey_info.rb->lcd_update_rect(0, y2, LCD_WIDTH, LCD_HEIGHT - y2);
+ rb->lcd_update_rect(0, y2, LCD_WIDTH, LCD_HEIGHT - y2);
if (x1 > 0) /* refresh part to the left of overlay */
- _grey_info.rb->lcd_update_rect(0, y1, x1, y2 - y1);
+ rb->lcd_update_rect(0, y1, x1, y2 - y1);
if (x2 < LCD_WIDTH) /* refresh part to the right of overlay */
- _grey_info.rb->lcd_update_rect(x2, y1, LCD_WIDTH - x2, y2 - y1);
+ rb->lcd_update_rect(x2, y1, LCD_WIDTH - x2, y2 - y1);
}
#ifdef SIMULATOR
@@ -373,7 +373,7 @@ static unsigned long _grey_get_pixel(int x, int y)
static void _timer_isr(void)
{
#if defined(HAVE_BACKLIGHT_INVERSION) && !defined(SIMULATOR)
- unsigned long check = _grey_info.rb->is_backlight_on(true)
+ unsigned long check = rb->is_backlight_on(true)
? 0 : _GREY_BACKLIGHT_ON;
if ((_grey_info.flags & (_GREY_BACKLIGHT_ON|GREY_RAWMAPPED)) == check)
@@ -384,12 +384,12 @@ static void _timer_isr(void)
}
#endif
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
- _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
+ rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
_grey_info.bx, _grey_info.y,
_grey_info.bwidth, _grey_info.height,
_grey_info.width);
#else /* vertical packing or vertical interleaved */
- _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
+ rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
_grey_info.x, _grey_info.by,
_grey_info.width, _grey_info.bheight,
_grey_info.width);
@@ -501,7 +501,7 @@ static void fill_gvalues(void)
The function is authentic regarding memory usage on the simulator, even
if it doesn't use all of the allocated memory. */
-bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
+bool grey_init(unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken)
{
int bdim, i;
@@ -511,8 +511,6 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
unsigned *dst, *end;
#endif
- _grey_info.rb = newrb;
-
if ((unsigned) width > LCD_WIDTH
|| (unsigned) height > LCD_HEIGHT)
return false;
@@ -559,7 +557,7 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
return false;
/* Init to white */
- _grey_info.rb->memset(_grey_info.values, 0x80, plane_size);
+ rb->memset(_grey_info.values, 0x80, plane_size);
#ifndef SIMULATOR
/* Init phases with random bits */
@@ -567,7 +565,7 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
end = (unsigned*)(_grey_info.phases + plane_size);
do
- *dst++ = _grey_info.rb->rand();
+ *dst++ = rb->rand();
while (dst < end);
#endif
@@ -601,7 +599,7 @@ bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_si
else
{
#if defined(HAVE_BACKLIGHT_INVERSION) && !defined(SIMULATOR)
- if (_grey_info.rb->is_backlight_on(true))
+ if (rb->is_backlight_on(true))
_grey_info.flags |= _GREY_BACKLIGHT_ON;
#endif
fill_gvalues();
@@ -636,40 +634,40 @@ void grey_show(bool enable)
{
_grey_info.flags |= _GREY_RUNNING;
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_init(129, _grey_get_pixel);
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_init(129, _grey_get_pixel);
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#else /* !SIMULATOR */
#ifdef NEED_BOOST
- _grey_info.rb->cpu_boost(true);
+ rb->cpu_boost(true);
#endif
#if NUM_CORES > 1
- _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE,
+ rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE,
1, _timer_isr,
(_grey_info.flags & GREY_ON_COP) ? COP : CPU);
#else
- _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1,
+ rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1,
_timer_isr);
#endif
#endif /* !SIMULATOR */
- _grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
+ rb->screen_dump_set_hook(grey_screendump_hook);
}
else if (!enable && (_grey_info.flags & _GREY_RUNNING))
{
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_init(0, NULL);
+ rb->sim_lcd_ex_init(0, NULL);
#else /* !SIMULATOR */
- _grey_info.rb->timer_unregister();
+ rb->timer_unregister();
#if NUM_CORES > 1 /* Make sure the ISR has finished before calling lcd_update() */
- _grey_info.rb->sleep(HZ/100);
+ rb->sleep(HZ/100);
#endif
#ifdef NEED_BOOST
- _grey_info.rb->cpu_boost(false);
+ rb->cpu_boost(false);
#endif
#endif /* !SIMULATOR */
_grey_info.flags &= ~_GREY_RUNNING;
- _grey_info.rb->screen_dump_set_hook(NULL);
- _grey_info.rb->lcd_update(); /* restore whatever there was before */
+ rb->screen_dump_set_hook(NULL);
+ rb->lcd_update(); /* restore whatever there was before */
}
}
@@ -699,7 +697,7 @@ void grey_deferred_lcd_update(void)
#endif
}
else
- _grey_info.rb->lcd_update();
+ rb->lcd_update();
}
/*** Screenshot ***/
@@ -786,10 +784,10 @@ static void grey_screendump_hook(int fd)
unsigned char *clut_entry;
unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)];
- _grey_info.rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
+ rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
/* build clut */
- _grey_info.rb->memset(linebuf, 0, 4*BMP_VARCOLORS);
+ rb->memset(linebuf, 0, 4*BMP_VARCOLORS);
clut_entry = linebuf;
for (i = 0; i <= 128; i++)
@@ -808,17 +806,17 @@ static void grey_screendump_hook(int fd)
#endif
clut_entry++;
}
- _grey_info.rb->write(fd, linebuf, 4*BMP_VARCOLORS);
+ rb->write(fd, linebuf, 4*BMP_VARCOLORS);
/* BMP image goes bottom -> top */
for (y = LCD_HEIGHT - 1; y >= 0; y--)
{
- _grey_info.rb->memset(linebuf, 0, BMP_LINESIZE);
+ rb->memset(linebuf, 0, BMP_LINESIZE);
gy = y - _grey_info.y;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
#if LCD_DEPTH == 2
- lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
+ lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y);
for (x = 0; x < LCD_WIDTH; x += 4)
{
@@ -846,7 +844,7 @@ static void grey_screendump_hook(int fd)
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
#if LCD_DEPTH == 1
mask = 1 << (y & 7);
- lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
+ lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
for (x = 0; x < LCD_WIDTH; x++)
{
@@ -869,7 +867,7 @@ static void grey_screendump_hook(int fd)
}
#elif LCD_DEPTH == 2
shift = 2 * (y & 3);
- lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
+ lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2);
for (x = 0; x < LCD_WIDTH; x++)
{
@@ -894,7 +892,7 @@ static void grey_screendump_hook(int fd)
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
#if LCD_DEPTH == 2
shift = y & 7;
- lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
+ lcdptr = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
for (x = 0; x < LCD_WIDTH; x++)
{
@@ -919,6 +917,6 @@ static void grey_screendump_hook(int fd)
#endif /* LCD_DEPTH */
#endif /* LCD_PIXELFORMAT */
- _grey_info.rb->write(fd, linebuf, BMP_LINESIZE);
+ rb->write(fd, linebuf, BMP_LINESIZE);
}
}
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index 5879b8e35a..2ae96603df 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -63,7 +63,7 @@ void grey_clear_display(void)
int value = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_brightness : _grey_info.bg_brightness;
- _grey_info.rb->memset(_grey_info.buffer, value,
+ rb->memset(_grey_info.buffer, value,
_GREY_MULUQ(_grey_info.width, _grey_info.height));
}
@@ -196,7 +196,7 @@ void grey_hline(int x1, int x2, int y)
dst = &_grey_info.buffer[_GREY_MULUQ(_grey_info.width, y) + x1];
if (fillopt)
- _grey_info.rb->memset(dst, value, x2 - x1 + 1);
+ rb->memset(dst, value, x2 - x1 + 1);
else
{
unsigned char *dst_end = dst + x2 - x1;
@@ -381,7 +381,7 @@ void grey_fillrect(int x, int y, int width, int height)
do
{
if (fillopt)
- _grey_info.rb->memset(dst, value, width);
+ rb->memset(dst, value, width);
else
{
unsigned char *dst_row = dst;
@@ -516,7 +516,7 @@ void grey_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
do
{
- _grey_info.rb->memcpy(dst, src, width);
+ rb->memcpy(dst, src, width);
dst += _grey_info.width;
src += stride;
}
@@ -535,9 +535,9 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
{
int ch;
unsigned short *ucs;
- struct font* pf = _grey_info.rb->font_get(_grey_info.curfont);
+ struct font* pf = rb->font_get(_grey_info.curfont);
- ucs = _grey_info.rb->bidi_l2v(str, 1);
+ ucs = rb->bidi_l2v(str, 1);
while ((ch = *ucs++) != 0 && x < _grey_info.width)
{
@@ -545,7 +545,7 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
const unsigned char *bits;
/* get proportional width and glyph bits */
- width = _grey_info.rb->font_get_width(pf, ch);
+ width = rb->font_get_width(pf, ch);
if (ofs > width)
{
@@ -553,7 +553,7 @@ void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str)
continue;
}
- bits = _grey_info.rb->font_get_bits(pf, ch);
+ bits = rb->font_get_bits(pf, ch);
grey_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
@@ -577,10 +577,10 @@ void grey_ub_clear_display(void)
_grey_info.fg_brightness :
_grey_info.bg_brightness];
- _grey_info.rb->memset(_grey_info.values, value,
+ rb->memset(_grey_info.values, value,
_GREY_MULUQ(_grey_info.width, _grey_info.height));
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@@ -655,7 +655,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
}
while (++yc < ye);
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x + x, _grey_info.y + y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x + x, _grey_info.y + y,
width, height);
#endif
}
diff --git a/apps/plugins/lib/grey_parm.c b/apps/plugins/lib/grey_parm.c
index 90391d779b..00193e12f2 100644
--- a/apps/plugins/lib/grey_parm.c
+++ b/apps/plugins/lib/grey_parm.c
@@ -51,7 +51,7 @@ void grey_set_position(int x, int y)
if (_grey_info.flags & _GREY_RUNNING)
{
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width,
_grey_info.height);
grey_deferred_lcd_update();
@@ -114,5 +114,5 @@ void grey_setfont(int newfont)
/* Get width and height of a text when printed with the current font */
int grey_getstringsize(const unsigned char *str, int *w, int *h)
{
- return _grey_info.rb->font_getstringsize(str, w, h, _grey_info.curfont);
+ return rb->font_getstringsize(str, w, h, _grey_info.curfont);
}
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index 082b256d72..adecd3bc43 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -47,9 +47,9 @@ void grey_scroll_left(int count)
do
{
- _grey_info.rb->memmove(data, data + count, length);
+ rb->memmove(data, data + count, length);
data += length;
- _grey_info.rb->memset(data, blank, count);
+ rb->memset(data, blank, count);
data += count;
}
while (data < data_end);
@@ -72,8 +72,8 @@ void grey_scroll_right(int count)
do
{
- _grey_info.rb->memmove(data + count, data, length);
- _grey_info.rb->memset(data, blank, count);
+ rb->memmove(data + count, data, length);
+ rb->memset(data, blank, count);
data += _grey_info.width;
}
while (data < data_end);
@@ -93,9 +93,9 @@ void grey_scroll_up(int count)
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_brightness : _grey_info.bg_brightness;
- _grey_info.rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
+ rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
length);
- _grey_info.rb->memset(_grey_info.buffer + length, blank, shift);
+ rb->memset(_grey_info.buffer + length, blank, shift);
}
/* Scroll down */
@@ -112,9 +112,9 @@ void grey_scroll_down(int count)
blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
_grey_info.fg_brightness : _grey_info.bg_brightness;
- _grey_info.rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
+ rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
length);
- _grey_info.rb->memset(_grey_info.buffer, blank, shift);
+ rb->memset(_grey_info.buffer, blank, shift);
}
/*** Unbuffered scrolling functions ***/
@@ -137,14 +137,14 @@ void grey_ub_scroll_left(int count)
_grey_info.bg_brightness];
do
{
- _grey_info.rb->memmove(data, data + count, length);
+ rb->memmove(data, data + count, length);
data += length;
- _grey_info.rb->memset(data, blank, count);
+ rb->memset(data, blank, count);
data += count;
}
while (data < data_end);
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@@ -167,13 +167,13 @@ void grey_ub_scroll_right(int count)
_grey_info.bg_brightness];
do
{
- _grey_info.rb->memmove(data + count, data, length);
- _grey_info.rb->memset(data, blank, count);
+ rb->memmove(data + count, data, length);
+ rb->memset(data, blank, count);
data += _grey_info.width << _GREY_BSHIFT;
}
while (data < data_end);
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@@ -240,12 +240,12 @@ void grey_ub_scroll_up(int count)
int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width);
src = dst + _GREY_MULUQ(count, _grey_info.width);
- _grey_info.rb->memmove(dst, src, blen);
+ rb->memmove(dst, src, blen);
dst += blen;
}
- _grey_info.rb->memset(dst, blank, end - dst); /* Fill remainder at once. */
+ rb->memset(dst, blank, end - dst); /* Fill remainder at once. */
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
@@ -316,12 +316,12 @@ void grey_ub_scroll_down(int count)
int blen = _GREY_MULUQ(_grey_info.height - count, _grey_info.width);
dst -= blen;
- _grey_info.rb->memmove(dst, start, blen);
+ rb->memmove(dst, start, blen);
}
- _grey_info.rb->memset(start, blank, dst - start);
+ rb->memset(start, blank, dst - start);
/* Fill remainder at once. */
#ifdef SIMULATOR
- _grey_info.rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
+ rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
_grey_info.width, _grey_info.height);
#endif
}
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c
index 02ec7a5470..c70d8264a5 100644
--- a/apps/plugins/lib/helper.c
+++ b/apps/plugins/lib/helper.c
@@ -23,7 +23,7 @@
#include "helper.h"
/* Force the backlight on */
-void backlight_force_on(const struct plugin_api* rb)
+void backlight_force_on(void)
{
if(!rb)
return;
@@ -36,7 +36,7 @@ void backlight_force_on(const struct plugin_api* rb)
}
/* Reset backlight operation to its settings */
-void backlight_use_settings(const struct plugin_api* rb)
+void backlight_use_settings(void)
{
if (!rb)
return;
@@ -49,7 +49,7 @@ void backlight_use_settings(const struct plugin_api* rb)
#ifdef HAVE_REMOTE_LCD
/* Force the backlight on */
-void remote_backlight_force_on(const struct plugin_api* rb)
+void remote_backlight_force_on(void)
{
if (!rb)
return;
@@ -62,7 +62,7 @@ void remote_backlight_force_on(const struct plugin_api* rb)
}
/* Reset backlight operation to its settings */
-void remote_backlight_use_settings(const struct plugin_api* rb)
+void remote_backlight_use_settings(void)
{
if (!rb)
return;
@@ -77,7 +77,7 @@ void remote_backlight_use_settings(const struct plugin_api* rb)
#ifdef HAVE_BUTTON_LIGHT
/* Force the buttonlight on */
-void buttonlight_force_on(const struct plugin_api* rb)
+void buttonlight_force_on(void)
{
if (!rb)
return;
@@ -86,7 +86,7 @@ void buttonlight_force_on(const struct plugin_api* rb)
}
/* Reset buttonlight operation to its settings */
-void buttonlight_use_settings(const struct plugin_api* rb)
+void buttonlight_use_settings(void)
{
if (!rb)
return;
@@ -95,15 +95,14 @@ void buttonlight_use_settings(const struct plugin_api* rb)
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
-void backlight_brightness_set(const struct plugin_api *rb,
- int brightness)
+void backlight_brightness_set(int brightness)
{
if (!rb)
return;
rb->backlight_set_brightness(brightness);
}
-void backlight_brightness_use_setting(const struct plugin_api *rb)
+void backlight_brightness_use_setting(void)
{
if (!rb)
return;
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h
index aa309bbb69..92c1c2f934 100644
--- a/apps/plugins/lib/helper.h
+++ b/apps/plugins/lib/helper.h
@@ -26,24 +26,23 @@
/**
* Backlight on/off operations
*/
-void backlight_force_on(const struct plugin_api* rb);
-void backlight_use_settings(const struct plugin_api* rb);
+void backlight_force_on(void);
+void backlight_use_settings(void);
#ifdef HAVE_REMOTE_LCD
-void remote_backlight_force_on(const struct plugin_api* rb);
-void remote_backlight_use_settings(const struct plugin_api* rb);
+void remote_backlight_force_on(void);
+void remote_backlight_use_settings(void);
#endif
#ifdef HAVE_BUTTON_LIGHT
-void buttonlight_force_on(const struct plugin_api* rb);
-void buttonlight_use_settings(const struct plugin_api* rb);
+void buttonlight_force_on(void);
+void buttonlight_use_settings(void);
#endif
/**
* Backlight brightness adjustment settings
*/
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
-void backlight_brightness_set(const struct plugin_api *rb,
- int brightness);
-void backlight_brightness_use_setting(const struct plugin_api *rb);
+void backlight_brightness_set(int brightness);
+void backlight_brightness_use_setting(void);
#endif
diff --git a/apps/plugins/lib/highscore.c b/apps/plugins/lib/highscore.c
index f475651eab..9d3b19ea48 100644
--- a/apps/plugins/lib/highscore.c
+++ b/apps/plugins/lib/highscore.c
@@ -21,13 +21,6 @@
#include "plugin.h"
#include "highscore.h"
-static const struct plugin_api *rb;
-
-void highscore_init(const struct plugin_api* newrb)
-{
- rb = newrb;
-}
-
int highscore_save(char *filename, struct highscore *scores, int num_scores)
{
int i;
diff --git a/apps/plugins/lib/highscore.h b/apps/plugins/lib/highscore.h
index c3d806e746..db09172c7d 100644
--- a/apps/plugins/lib/highscore.h
+++ b/apps/plugins/lib/highscore.h
@@ -28,7 +28,6 @@ struct highscore
int level;
};
-void highscore_init(const struct plugin_api* newrb);
int highscore_save(char *filename, struct highscore *scores, int num_scores);
int highscore_load(char *filename, struct highscore *scores, int num_scores);
int highscore_update(int score, int level, struct highscore *scores, int num_scores);
diff --git a/apps/plugins/lib/md5.c b/apps/plugins/lib/md5.c
index 05535de12c..145a62da53 100644
--- a/apps/plugins/lib/md5.c
+++ b/apps/plugins/lib/md5.c
@@ -27,13 +27,6 @@
#include "plugin.h"
#include "md5.h"
-static const struct plugin_api *rb;
-
-void md5_init( const struct plugin_api *api )
-{
- rb = api;
-}
-
#ifdef ROCKBOX_BIG_ENDIAN
static inline uint32_t GetDWLE( const void * _p )
{
diff --git a/apps/plugins/lib/md5.h b/apps/plugins/lib/md5.h
index e19c749664..f70d47a788 100644
--- a/apps/plugins/lib/md5.h
+++ b/apps/plugins/lib/md5.h
@@ -27,8 +27,6 @@
#ifndef _VLC_MD5_H
# define _VLC_MD5_H
-void md5_init( const struct plugin_api * );
-
/*****************************************************************************
* md5_s: MD5 message structure
*****************************************************************************
diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c
index a48a61bca6..9c371d531e 100644
--- a/apps/plugins/lib/oldmenuapi.c
+++ b/apps/plugins/lib/oldmenuapi.c
@@ -29,8 +29,6 @@
#include "plugin.h"
#include "oldmenuapi.h"
-const struct plugin_api *rb = NULL;
-
struct menu {
struct menu_item* items;
int (*callback)(int, int);
@@ -67,12 +65,11 @@ static int menu_find_free(void)
return(i);
}
-int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
+int menu_init(const struct menu_item* mitems,
int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3)
{
int menu=menu_find_free();
- rb = api;
if(menu==-1)/* Out of menus */
return -1;
menus[menu].items = (struct menu_item*)mitems; /* de-const */
diff --git a/apps/plugins/lib/oldmenuapi.h b/apps/plugins/lib/oldmenuapi.h
index 858580ce21..7f877997cf 100644
--- a/apps/plugins/lib/oldmenuapi.h
+++ b/apps/plugins/lib/oldmenuapi.h
@@ -33,7 +33,7 @@ struct menu_item {
bool (*function) (void); /* return true if USB was connected */
};
-int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
+int menu_init(const struct menu_item* mitems,
int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3);
void menu_exit(int menu);
diff --git a/apps/plugins/lib/overlay.c b/apps/plugins/lib/overlay.c
index 706d6c14a7..44bca1d989 100644
--- a/apps/plugins/lib/overlay.c
+++ b/apps/plugins/lib/overlay.c
@@ -46,7 +46,7 @@
The linker script for the overlay should use a base address towards the
end of the audiobuffer, just low enough to make the overlay fit. */
-enum plugin_status run_overlay(const struct plugin_api* rb, const void* parameter,
+enum plugin_status run_overlay(const void* parameter,
unsigned char *filename, unsigned char *name)
{
int fd, readsize;
@@ -107,6 +107,7 @@ enum plugin_status run_overlay(const struct plugin_api* rb, const void* paramete
rb->memset(header.load_addr + readsize, 0,
header.end_addr - (header.load_addr + readsize));
- return header.entry_point(rb, parameter);
+ *(header.api) = rb;
+ return header.entry_point(parameter);
}
#endif
diff --git a/apps/plugins/lib/overlay.h b/apps/plugins/lib/overlay.h
index 97c6ccf28b..357dc93e39 100644
--- a/apps/plugins/lib/overlay.h
+++ b/apps/plugins/lib/overlay.h
@@ -28,7 +28,7 @@
#include "plugin.h"
/* load and run a plugin linked as an overlay. */
-enum plugin_status run_overlay(const struct plugin_api* api, const void* parameter,
+enum plugin_status run_overlay(const void* parameter,
unsigned char *filename, unsigned char *name);
#endif /* !SIMULATOR */
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c
index b82e8bea16..7c28230642 100644
--- a/apps/plugins/lib/playback_control.c
+++ b/apps/plugins/lib/playback_control.c
@@ -22,70 +22,69 @@
#include "plugin.h"
#include "playback_control.h"
-const struct plugin_api* api = 0;
struct viewport *parentvp = NULL;
static bool prevtrack(void)
{
- api->audio_prev();
+ rb->audio_prev();
return false;
}
static bool play(void)
{
- int audio_status = api->audio_status();
- if (!audio_status && api->global_status->resume_index != -1)
+ int audio_status = rb->audio_status();
+ if (!audio_status && rb->global_status->resume_index != -1)
{
- if (api->playlist_resume() != -1)
+ if (rb->playlist_resume() != -1)
{
- api->playlist_start(api->global_status->resume_index,
- api->global_status->resume_offset);
+ rb->playlist_start(rb->global_status->resume_index,
+ rb->global_status->resume_offset);
}
}
else if (audio_status & AUDIO_STATUS_PAUSE)
- api->audio_resume();
+ rb->audio_resume();
else
- api->audio_pause();
+ rb->audio_pause();
return false;
}
static bool stop(void)
{
- api->audio_stop();
+ rb->audio_stop();
return false;
}
static bool nexttrack(void)
{
- api->audio_next();
+ rb->audio_next();
return false;
}
static bool volume(void)
{
const struct settings_list* vol =
- api->find_setting(&api->global_settings->volume, NULL);
- return api->option_screen((struct settings_list*)vol, parentvp, false, "Volume");
+ rb->find_setting(&rb->global_settings->volume, NULL);
+ return rb->option_screen((struct settings_list*)vol, parentvp, false, "Volume");
}
static bool shuffle(void)
{
const struct settings_list* shuffle =
- api->find_setting(&api->global_settings->playlist_shuffle, NULL);
- return api->option_screen((struct settings_list*)shuffle, parentvp, false, "Shuffle");
+ rb->find_setting(&rb->global_settings->playlist_shuffle, NULL);
+ return rb->option_screen((struct settings_list*)shuffle, parentvp, false, "Shuffle");
}
static bool repeat_mode(void)
{
const struct settings_list* repeat =
- api->find_setting(&api->global_settings->repeat_mode, NULL);
- int old_repeat = api->global_settings->repeat_mode;
+ rb->find_setting(&rb->global_settings->repeat_mode, NULL);
+ int old_repeat = rb->global_settings->repeat_mode;
- api->option_screen((struct settings_list*)repeat, parentvp, false, "Repeat");
+ rb->option_screen((struct settings_list*)repeat, parentvp, false, "Repeat");
- if (old_repeat != api->global_settings->repeat_mode &&
- (api->audio_status() & AUDIO_STATUS_PLAY))
- api->audio_flush_and_reload_tracks();
+ if (old_repeat != rb->global_settings->repeat_mode &&
+ (rb->audio_status() & AUDIO_STATUS_PLAY))
+ rb->audio_flush_and_reload_tracks();
return false;
}
@@ -107,17 +106,13 @@ MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON,
&prevtrack_item, &playpause_item, &stop_item, &nexttrack_item,
&volume_item, &shuffle_item, &repeat_mode_item);
-void playback_control_init(const struct plugin_api* newapi,
- struct viewport parent[NB_SCREENS])
+void playback_control_init(struct viewport parent[NB_SCREENS])
{
- api = newapi;
parentvp = parent;
}
-bool playback_control(const struct plugin_api* newapi,
- struct viewport parent[NB_SCREENS])
+bool playback_control(struct viewport parent[NB_SCREENS])
{
- api = newapi;
parentvp = parent;
- return api->do_menu(&playback_control_menu, NULL, parent, false) == MENU_ATTACHED_USB;
+ return rb->do_menu(&playback_control_menu, NULL, parent, false) == MENU_ATTACHED_USB;
}
diff --git a/apps/plugins/lib/playback_control.h b/apps/plugins/lib/playback_control.h
index b8fa840d28..43719615ad 100644
--- a/apps/plugins/lib/playback_control.h
+++ b/apps/plugins/lib/playback_control.h
@@ -27,11 +27,9 @@
So, make sure you use the same viewport for the rb->do_menu() call
that you use in the playback_control_init() call
*/
-void playback_control_init(const struct plugin_api* newapi,
- struct viewport parent[NB_SCREENS]);
+void playback_control_init(struct viewport parent[NB_SCREENS]);
/* Use this if your menu still uses the old menu api */
-bool playback_control(const struct plugin_api* api,
- struct viewport parent[NB_SCREENS]);
+bool playback_control(struct viewport parent[NB_SCREENS]);
#endif /* __PLAYBACK_CONTROL_H__ */
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c
index c332c02711..d07043c572 100644
--- a/apps/plugins/lib/playergfx.c
+++ b/apps/plugins/lib/playergfx.c
@@ -28,7 +28,6 @@
/*** globals ***/
-static const struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */
static int char_width;
static int char_height;
static int pixel_height;
@@ -40,14 +39,13 @@ static int drawmode = DRMODE_SOLID;
/*** Special functions ***/
/* library init */
-bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight)
+bool pgfx_init(int cwidth, int cheight)
{
int i;
if (((unsigned) cwidth * (unsigned) cheight) > 8 || (unsigned) cheight > 2)
return false;
- pgfx_rb = newrb;
char_width = cwidth;
char_height = cheight;
pixel_height = 7 * char_height;
@@ -55,7 +53,7 @@ bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight)
for (i = 0; i < cwidth * cheight; i++)
{
- if ((gfx_chars[i] = pgfx_rb->lcd_get_locked_pattern()) == 0)
+ if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0)
{
pgfx_release();
return false;
@@ -72,7 +70,7 @@ void pgfx_release(void)
for (i = 0; i < 8; i++)
if (gfx_chars[i])
- pgfx_rb->lcd_unlock_pattern(gfx_chars[i]);
+ rb->lcd_unlock_pattern(gfx_chars[i]);
}
/* place the display */
@@ -84,12 +82,12 @@ void pgfx_display(int cx, int cy)
for (i = 0; i < width; i++)
for (j = 0; j < height; j++)
- pgfx_rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]);
+ rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]);
}
void pgfx_display_block(int cx, int cy, int x, int y)
{
- pgfx_rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]);
+ rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]);
}
@@ -100,9 +98,9 @@ void pgfx_update(void)
int i;
for (i = 0; i < char_width * char_height; i++)
- pgfx_rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
+ rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
- pgfx_rb->lcd_update();
+ rb->lcd_update();
}
/*** Parameter handling ***/
@@ -203,7 +201,7 @@ void pgfx_clear_display(void)
{
unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0x1F : 0;
- pgfx_rb->memset(gfx_buffer, bits, char_width * pixel_height);
+ rb->memset(gfx_buffer, bits, char_width * pixel_height);
}
/* Set a single pixel */
diff --git a/apps/plugins/lib/playergfx.h b/apps/plugins/lib/playergfx.h
index ff9cd5fa7d..9f1305af12 100644
--- a/apps/plugins/lib/playergfx.h
+++ b/apps/plugins/lib/playergfx.h
@@ -28,7 +28,7 @@
#ifdef HAVE_LCD_CHARCELLS /* Player only :) */
-bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight);
+bool pgfx_init(int cwidth, int cheight);
void pgfx_release(void);
void pgfx_display(int cx, int cy);
void pgfx_display_block(int cx, int cy, int x, int y);
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c
index 2ec6cf6cf2..8e2f1253c0 100644
--- a/apps/plugins/lib/pluginlib_actions.c
+++ b/apps/plugins/lib/pluginlib_actions.c
@@ -524,12 +524,12 @@ static const struct button_mapping* get_context_map(int context)
else return NULL;
}
-int pluginlib_getaction(const struct plugin_api *api,int timeout,
+int pluginlib_getaction(int timeout,
const struct button_mapping *plugin_contexts[],
int count)
{
plugin_context_order = (struct button_mapping **)plugin_contexts;
plugin_context_count = count;
last_context = 0;
- return api->get_custom_action(CONTEXT_CUSTOM,timeout,get_context_map);
+ return rb->get_custom_action(CONTEXT_CUSTOM,timeout,get_context_map);
}
diff --git a/apps/plugins/lib/pluginlib_actions.h b/apps/plugins/lib/pluginlib_actions.h
index 5f06a0b476..cc5f8b4eb8 100644
--- a/apps/plugins/lib/pluginlib_actions.h
+++ b/apps/plugins/lib/pluginlib_actions.h
@@ -60,7 +60,7 @@ extern const struct button_mapping generic_left_right_fire[];
extern const struct button_mapping generic_actions[];
extern const struct button_mapping generic_increase_decrease[];
-int pluginlib_getaction(const struct plugin_api *api,int timeout,
+int pluginlib_getaction(int timeout,
const struct button_mapping *plugin_contexts[],
int count);
diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c
index b1dd53b15e..b9cfc4ded3 100644
--- a/apps/plugins/lib/pluginlib_bmp.c
+++ b/apps/plugins/lib/pluginlib_bmp.c
@@ -34,7 +34,7 @@
/**
* Save to 24 bit bitmap.
*/
-int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb )
+int save_bmp_file( char* filename, struct bitmap *bm )
{
/* I'm not really sure about this one :) */
int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0);
@@ -125,14 +125,7 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst)
#else /* LCD_DEPTH == 1 */
#include "wrappers.h"
-static const struct plugin_api *rb;
-
/* import the core bmp loader */
#include "../../recorder/bmp.c"
-/* initialize rb for use by the bmp loader */
-void bmp_init(const struct plugin_api *api)
-{
- rb = api;
-}
#endif
diff --git a/apps/plugins/lib/pluginlib_bmp.h b/apps/plugins/lib/pluginlib_bmp.h
index 0e7a0a4933..17844a8e38 100644
--- a/apps/plugins/lib/pluginlib_bmp.h
+++ b/apps/plugins/lib/pluginlib_bmp.h
@@ -24,12 +24,11 @@
#include "lcd.h"
#include "plugin.h"
-#if LCD_DEPTH > 1 /* save is only available for color, resize for >1bpp */
#ifdef HAVE_LCD_COLOR
/**
* Save bitmap to file
*/
-int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb );
+int save_bmp_file( char* filename, struct bitmap *bm );
#endif
/**
@@ -44,13 +43,4 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst);
*/
void smooth_resize_bitmap(struct bitmap *src, struct bitmap *dst);
-#else
-/*
- BMP loader is built with scaling support in pluginlib on 1bpp targets, as
- these do not provide scaling support in the core BMP loader. bmp_init is
- needed to copy the plugin API pointer for the pluginlib loader's use.
-*/
-void bmp_init(const struct plugin_api *api);
-#endif
-
#endif
diff --git a/apps/plugins/lib/pluginlib_resize.h b/apps/plugins/lib/pluginlib_resize.h
deleted file mode 100644
index 46a8977675..0000000000
--- a/apps/plugins/lib/pluginlib_resize.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/***************************************************************************
-* __________ __ ___.
-* Open \______ \ ____ ____ | | _\_ |__ _______ ___
-* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-* \/ \/ \/ \/ \/
-* $Id$
-*
-* Copyright (C) 2009 by Andrew Mahone
-*
-* This is a header for the pluginlib extensions to the core resize.c file
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
-* KIND, either express or implied.
-*
-****************************************************************************/
-
-#ifndef _LIB_RESIZE_H_
-#define _LIB_RESIZE_H_
-
-void resize_init(const struct plugin_api *api);
-
-#endif
diff --git a/apps/plugins/lib/profile_plugin.c b/apps/plugins/lib/profile_plugin.c
index 1225bf1006..9224997423 100644
--- a/apps/plugins/lib/profile_plugin.c
+++ b/apps/plugins/lib/profile_plugin.c
@@ -23,22 +23,15 @@
#include "plugin.h"
-static const struct plugin_api *local_rb = NULL; /* global api struct pointer */
-
-void profile_init(const struct plugin_api* pa)
-{
- local_rb = pa;
-}
-
void __cyg_profile_func_enter(void *this_fn, void *call_site) {
#ifdef CPU_COLDFIRE
(void)call_site;
- local_rb->profile_func_enter(this_fn, __builtin_return_address(1));
+ rb->profile_func_enter(this_fn, __builtin_return_address(1));
#else
- local_rb->profile_func_enter(this_fn, call_site);
+ rb->profile_func_enter(this_fn, call_site);
#endif
}
void __cyg_profile_func_exit(void *this_fn, void *call_site) {
- local_rb->profile_func_exit(this_fn,call_site);
+ rb->profile_func_exit(this_fn,call_site);
}
diff --git a/apps/plugins/lib/profile_plugin.h b/apps/plugins/lib/profile_plugin.h
index fae2a87382..ce0581a7cb 100644
--- a/apps/plugins/lib/profile_plugin.h
+++ b/apps/plugins/lib/profile_plugin.h
@@ -26,8 +26,6 @@
#include "plugin.h"
-void profile_init(const struct plugin_api* pa);
-
void __cyg_profile_func_enter(void *this_fn, void *call_site)
NO_PROF_ATTR ICODE_ATTR;
void __cyg_profile_func_exit(void *this_fn, void *call_site)
diff --git a/apps/plugins/lib/xlcd.h b/apps/plugins/lib/xlcd.h
index da27af19a3..b6d0867e01 100644
--- a/apps/plugins/lib/xlcd.h
+++ b/apps/plugins/lib/xlcd.h
@@ -28,7 +28,6 @@
#ifdef HAVE_LCD_BITMAP
-void xlcd_init(const struct plugin_api* newrb);
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
void xlcd_filltriangle_screen(struct screen* display,
int x1, int y1, int x2, int y2, int x3, int y3);
@@ -50,9 +49,6 @@ void xlcd_scroll_right(int count);
void xlcd_scroll_up(int count);
void xlcd_scroll_down(int count);
-/* internal stuff */
-extern const struct plugin_api *_xlcd_rb; /* global api struct pointer */
-
#endif /* HAVE_LCD_BITMAP */
#endif /* __XLCD_H__ */
diff --git a/apps/plugins/lib/xlcd_core.c b/apps/plugins/lib/xlcd_core.c
index a035a80e7b..87e73b5485 100644
--- a/apps/plugins/lib/xlcd_core.c
+++ b/apps/plugins/lib/xlcd_core.c
@@ -27,17 +27,5 @@
#ifdef HAVE_LCD_BITMAP
#include "xlcd.h"
-/*** globals ***/
-
-const struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */
-
-/*** functions ***/
-
-/* library init */
-void xlcd_init(const struct plugin_api* newrb)
-{
- _xlcd_rb = newrb;
-}
-
#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/plugins/lib/xlcd_draw.c b/apps/plugins/lib/xlcd_draw.c
index 01fbc5ef5c..3be15718f6 100644
--- a/apps/plugins/lib/xlcd_draw.c
+++ b/apps/plugins/lib/xlcd_draw.c
@@ -155,7 +155,7 @@ void xlcd_filltriangle(int x1, int y1,
int x3, int y3)
{
/* default is main screen */
- xlcd_filltriangle_screen(_xlcd_rb->screens[SCREEN_MAIN],
+ xlcd_filltriangle_screen(rb->screens[SCREEN_MAIN],
x1, y1, x2, y2, x3, y3);
}
@@ -276,7 +276,7 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
src += stride * src_y + src_x; /* move starting point */
src_end = src + stride * height;
- dst = _xlcd_rb->lcd_framebuffer + LCD_WIDTH * y + x;
+ dst = rb->lcd_framebuffer + LCD_WIDTH * y + x;
do
{
@@ -336,7 +336,7 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
src += 3 * (stride * src_y + src_x); /* move starting point */
src_end = src + 3 * stride * height;
- dst = _xlcd_rb->lcd_framebuffer + LCD_WIDTH * y + x;
+ dst = rb->lcd_framebuffer + LCD_WIDTH * y + x;
do
{
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c
index f25e702518..6b70e2cfd2 100644
--- a/apps/plugins/lib/xlcd_scroll.c
+++ b/apps/plugins/lib/xlcd_scroll.c
@@ -50,12 +50,12 @@ void xlcd_scroll_left(int count)
if (blockcount)
{
- unsigned char *data = _xlcd_rb->lcd_framebuffer;
+ unsigned char *data = rb->lcd_framebuffer;
unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
do
{
- _xlcd_rb->memmove(data, data + blockcount, blocklen);
+ rb->memmove(data, data + blockcount, blocklen);
data += LCD_FBWIDTH;
}
while (data < data_end);
@@ -63,9 +63,9 @@ void xlcd_scroll_left(int count)
if (bitcount)
{
int bx, y;
- unsigned char *addr = _xlcd_rb->lcd_framebuffer + blocklen;
+ unsigned char *addr = rb->lcd_framebuffer + blocklen;
#if LCD_DEPTH == 2
- unsigned fill = 0x55 * (~_xlcd_rb->lcd_get_background() & 3);
+ unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
#endif
for (y = 0; y < LCD_HEIGHT; y++)
@@ -82,10 +82,10 @@ void xlcd_scroll_left(int count)
addr += LCD_FBWIDTH;
}
}
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(LCD_WIDTH - count, 0, count, LCD_HEIGHT);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(LCD_WIDTH - count, 0, count, LCD_HEIGHT);
+ rb->lcd_set_drawmode(oldmode);
}
/* Scroll right */
@@ -105,12 +105,12 @@ void xlcd_scroll_right(int count)
if (blockcount)
{
- unsigned char *data = _xlcd_rb->lcd_framebuffer;
+ unsigned char *data = rb->lcd_framebuffer;
unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
do
{
- _xlcd_rb->memmove(data + blockcount, data, blocklen);
+ rb->memmove(data + blockcount, data, blocklen);
data += LCD_FBWIDTH;
}
while (data < data_end);
@@ -118,9 +118,9 @@ void xlcd_scroll_right(int count)
if (bitcount)
{
int bx, y;
- unsigned char *addr = _xlcd_rb->lcd_framebuffer + blockcount;
+ unsigned char *addr = rb->lcd_framebuffer + blockcount;
#if LCD_DEPTH == 2
- unsigned fill = 0x55 * (~_xlcd_rb->lcd_get_background() & 3);
+ unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
#endif
for (y = 0; y < LCD_HEIGHT; y++)
@@ -137,10 +137,10 @@ void xlcd_scroll_right(int count)
addr += LCD_FBWIDTH;
}
}
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
+ rb->lcd_set_drawmode(oldmode);
}
#else /* LCD_PIXELFORMAT vertical packed or >= 8bit / pixel */
@@ -154,21 +154,21 @@ void xlcd_scroll_left(int count)
if ((unsigned)count >= LCD_WIDTH)
return;
- data = _xlcd_rb->lcd_framebuffer;
+ data = rb->lcd_framebuffer;
data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
length = LCD_WIDTH - count;
do
{
- _xlcd_rb->memmove(data, data + count, length * sizeof(fb_data));
+ rb->memmove(data, data + count, length * sizeof(fb_data));
data += LCD_WIDTH;
}
while (data < data_end);
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(length, 0, count, LCD_HEIGHT);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(length, 0, count, LCD_HEIGHT);
+ rb->lcd_set_drawmode(oldmode);
}
/* Scroll right */
@@ -180,21 +180,21 @@ void xlcd_scroll_right(int count)
if ((unsigned)count >= LCD_WIDTH)
return;
- data = _xlcd_rb->lcd_framebuffer;
+ data = rb->lcd_framebuffer;
data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
length = LCD_WIDTH - count;
do
{
- _xlcd_rb->memmove(data + count, data, length * sizeof(fb_data));
+ rb->memmove(data + count, data, length * sizeof(fb_data));
data += LCD_WIDTH;
}
while (data < data_end);
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
+ rb->lcd_set_drawmode(oldmode);
}
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */
@@ -211,14 +211,14 @@ void xlcd_scroll_up(int count)
length = LCD_HEIGHT - count;
- _xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer,
- _xlcd_rb->lcd_framebuffer + count * LCD_FBWIDTH,
+ rb->memmove(rb->lcd_framebuffer,
+ rb->lcd_framebuffer + count * LCD_FBWIDTH,
length * LCD_FBWIDTH * sizeof(fb_data));
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(0, length, LCD_WIDTH, count);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, length, LCD_WIDTH, count);
+ rb->lcd_set_drawmode(oldmode);
}
/* Scroll down */
@@ -231,14 +231,14 @@ void xlcd_scroll_down(int count)
length = LCD_HEIGHT - count;
- _xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer + count * LCD_FBWIDTH,
- _xlcd_rb->lcd_framebuffer,
+ rb->memmove(rb->lcd_framebuffer + count * LCD_FBWIDTH,
+ rb->lcd_framebuffer,
length * LCD_FBWIDTH * sizeof(fb_data));
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
+ rb->lcd_set_drawmode(oldmode);
}
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING,
@@ -265,8 +265,8 @@ void xlcd_scroll_up(int count)
if (blockcount)
{
- _xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer,
- _xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
+ rb->memmove(rb->lcd_framebuffer,
+ rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
blocklen * LCD_FBWIDTH * sizeof(fb_data));
}
if (bitcount)
@@ -336,7 +336,7 @@ void xlcd_scroll_up(int count)
"bt .su_cloop \n"
: /* outputs */
: /* inputs */
- [addr]"r"(_xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
+ [addr]"r"(rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
[wide]"r"(LCD_FBWIDTH),
[rows]"r"(blocklen),
[cnt] "r"(bitcount)
@@ -374,17 +374,17 @@ void xlcd_scroll_up(int count)
: /* inputs */
[wide]"r"(LCD_FBWIDTH),
[rows]"r"(blocklen),
- [addr]"a"(_xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
+ [addr]"a"(rb->lcd_framebuffer + blocklen * LCD_FBWIDTH),
[cnt] "d"(bitcount),
- [bkg] "d"(0x55 * (~_xlcd_rb->lcd_get_background() & 3))
+ [bkg] "d"(0x55 * (~rb->lcd_get_background() & 3))
: /* clobbers */
"a1", "d0", "d1", "d2", "d3"
);
#else /* C version */
int x, by;
- unsigned char *addr = _xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
+ unsigned char *addr = rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
#if LCD_DEPTH == 2
- unsigned fill = 0x55 * (~_xlcd_rb->lcd_get_background() & 3);
+ unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
#else
const unsigned fill = 0;
#endif
@@ -407,10 +407,10 @@ void xlcd_scroll_up(int count)
#if LCD_DEPTH == 2
int x, by;
- fb_data *addr = _xlcd_rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
+ fb_data *addr = rb->lcd_framebuffer + blocklen * LCD_FBWIDTH;
unsigned fill, mask;
- fill = patterns[_xlcd_rb->lcd_get_background() & 3] << 8;
+ fill = patterns[rb->lcd_get_background() & 3] << 8;
mask = (0xFFu >> bitcount) << bitcount;
mask |= mask << 8;
@@ -432,10 +432,10 @@ void xlcd_scroll_up(int count)
#endif /* LCD_PIXELFORMAT */
}
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(0, LCD_HEIGHT - count, LCD_WIDTH, count);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, LCD_HEIGHT - count, LCD_WIDTH, count);
+ rb->lcd_set_drawmode(oldmode);
}
/* Scroll up */
@@ -459,8 +459,8 @@ void xlcd_scroll_down(int count)
if (blockcount)
{
- _xlcd_rb->memmove(_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
- _xlcd_rb->lcd_framebuffer,
+ rb->memmove(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH,
+ rb->lcd_framebuffer,
blocklen * LCD_FBWIDTH * sizeof(fb_data));
}
if (bitcount)
@@ -529,7 +529,7 @@ void xlcd_scroll_down(int count)
"bt .sd_cloop \n"
: /* outputs */
: /* inputs */
- [addr]"r"(_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
+ [addr]"r"(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
[wide]"r"(LCD_WIDTH),
[rows]"r"(blocklen),
[cnt] "r"(bitcount)
@@ -564,17 +564,17 @@ void xlcd_scroll_down(int count)
: /* inputs */
[wide]"r"(LCD_WIDTH),
[rows]"r"(blocklen),
- [addr]"a"(_xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
+ [addr]"a"(rb->lcd_framebuffer + blockcount * LCD_FBWIDTH),
[cnt] "d"(bitcount),
- [bkg] "d"((0x55 * (~_xlcd_rb->lcd_get_background() & 3)) << bitcount)
+ [bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount)
: /* clobbers */
"a1", "d0", "d1", "d2", "d3"
);
#else /* C version */
int x, by;
- unsigned char *addr = _xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
+ unsigned char *addr = rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
#if LCD_DEPTH == 2
- unsigned fill = (0x55 * (~_xlcd_rb->lcd_get_background() & 3)) << bitcount;
+ unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
#else
const unsigned fill = 0;
#endif
@@ -597,10 +597,10 @@ void xlcd_scroll_down(int count)
#if LCD_DEPTH == 2
int x, by;
- fb_data *addr = _xlcd_rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
+ fb_data *addr = rb->lcd_framebuffer + blockcount * LCD_FBWIDTH;
unsigned fill, mask;
- fill = patterns[_xlcd_rb->lcd_get_background() & 3] >> (8 - bitcount);
+ fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount);
mask = (0xFFu >> bitcount) << bitcount;
mask |= mask << 8;
@@ -622,10 +622,10 @@ void xlcd_scroll_down(int count)
#endif /* LCD_PIXELFORMAT */
}
- oldmode = _xlcd_rb->lcd_get_drawmode();
- _xlcd_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- _xlcd_rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
- _xlcd_rb->lcd_set_drawmode(oldmode);
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
+ rb->lcd_set_drawmode(oldmode);
}
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index c96b45adf0..f0d53215ce 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -195,12 +195,11 @@ const unsigned char rockbox16x7[] = {
#endif
#endif
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
int button;
int timer = 10;
int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2);
int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2);
- const struct plugin_api* rb = api;
int dx;
int dy;
#ifdef HAVE_LCD_CHARCELLS
@@ -211,7 +210,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
(void)parameter;
#ifdef HAVE_LCD_CHARCELLS
- if (!pgfx_init(rb, 4, 2)) {
+ if (!pgfx_init(4, 2)) {
rb->splash(HZ*2, "Old LCD :(");
return PLUGIN_OK;
}
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index 379022ec96..a763dffa29 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -323,8 +323,6 @@ PLUGIN_HEADER
#define MYXLCD(fn) xlcd_ ## fn
#endif
-static const struct plugin_api* rb;
-
/* Fixed point format s5.26: sign, 5 bits integer part, 26 bits fractional part */
static long x_min;
static long x_max;
@@ -711,13 +709,12 @@ void cleanup(void *parameter)
#define REDRAW_PARTIAL 1
#define REDRAW_FULL 2
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button;
int lastbutton = BUTTON_NONE;
int redraw = REDRAW_FULL;
- rb = api;
(void)parameter;
#ifdef USEGSLIB
@@ -725,15 +722,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
/* initialize the greyscale buffer.*/
- if (!grey_init(rb, gbuf, gbuf_size, GREY_ON_COP,
+ if (!grey_init(gbuf, gbuf_size, GREY_ON_COP,
LCD_WIDTH, LCD_HEIGHT, NULL))
{
rb->splash(HZ, "Couldn't init greyscale display");
return 0;
}
grey_show(true); /* switch on greyscale overlay */
-#else
- xlcd_init(rb);
#endif
#if LCD_DEPTH > 1
diff --git a/apps/plugins/matrix.c b/apps/plugins/matrix.c
index 986eb72e48..a3b0b850d8 100644
--- a/apps/plugins/matrix.c
+++ b/apps/plugins/matrix.c
@@ -136,9 +136,6 @@ extern const fb_data matrix_normal[];
#define SLEEP HZ/50
-/* Codec api pointer */
-static const struct plugin_api* rb;
-
/* Each position is of this type */
typedef struct cmatrix {
int val;
@@ -302,13 +299,12 @@ static void matrix_loop(void)
}
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
int button;
int sleep = SLEEP;
bool frozen = false;
(void)parameter;
- rb = api;
rb->lcd_set_background(LCD_BLACK);
rb->lcd_set_backdrop(NULL);
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c
index 67c0623dec..881d804400 100644
--- a/apps/plugins/maze.c
+++ b/apps/plugins/maze.c
@@ -85,9 +85,6 @@ static const struct button_mapping *plugin_contexts[]
#define BORDER_S(y) ((y) == MAZE_HEIGHT-1)
#define BORDER_W(x) ((x) == 0)
-/* the API */
-static const struct plugin_api* rb;
-
// we can and should change this to make square boxes
#if ( LCD_WIDTH == 112 )
#define MAZE_WIDTH 16
@@ -493,17 +490,16 @@ static void maze_move_player_left(struct maze* maze)
/**********************************/
/* this is the plugin entry point */
/**********************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button, lastbutton = BUTTON_NONE;
int quit = 0;
int i;
struct maze maze;
(void)parameter;
- rb = api;
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
/* Seed the RNG */
rb->srand(*rb->current_tick);
@@ -531,7 +527,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
while(!quit) {
#ifdef __PLUGINLIB_ACTIONS_H__
- button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2);
+ button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
#else
button = rb->button_get(true);
#endif
@@ -591,6 +587,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
}
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return ((quit == 1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED);
}
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c
index fac12def4f..8981986144 100644
--- a/apps/plugins/mazezam.c
+++ b/apps/plugins/mazezam.c
@@ -28,13 +28,11 @@
/* Include standard plugin macro */
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
/* The plugin actions of interest. */
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
/* Use the standard plugin buttons rather than a hard-to-maintain list of
* MazezaM specific buttons. */
@@ -252,7 +250,7 @@ static void store_lcd_settings(void)
******************************************************************************/
static void restore_lcd_settings(void) {
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
/* Restore the old settings */
#if LCD_DEPTH > 1
@@ -267,7 +265,7 @@ static void restore_lcd_settings(void) {
******************************************************************************/
static void plugin_lcd_settings(void) {
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
/* Set the new settings */
#ifdef HAVE_LCD_COLOR
@@ -546,7 +544,7 @@ static void level_loop(struct level_info* li, short* shift, short *x, short *y)
while (state >= STATE_IN_LEVEL) {
draw_level(li, shift, *x, *y);
rb->lcd_update();
- button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2);
+ button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
blocked = false;
switch (button) {
@@ -643,7 +641,7 @@ static void in_game_menu(void)
break;
case 2: /* Audio playback */
- playback_control(rb, NULL);
+ playback_control(NULL);
state = STATE_IN_LEVEL;
break;
@@ -918,17 +916,12 @@ static void main_menu(void)
/*****************************************************************************
* Plugin entry point
******************************************************************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
enum plugin_status plugin_state;
/* Usual plugin stuff */
(void)parameter;
- rb = api;
-
-
- /* initialise the config file module */
- configfile_init(rb);
store_lcd_settings();
diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c
index 6479f204a2..03db427f29 100644
--- a/apps/plugins/md5sum.c
+++ b/apps/plugins/md5sum.c
@@ -24,9 +24,7 @@
PLUGIN_HEADER
-static const struct plugin_api *rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
#define BUFFERSIZE 16384
@@ -183,7 +181,7 @@ static void hash_check( int out, const char *path )
rb->close( list );
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
const char *arg = (const char *)parameter; /* input file name, if any */
int out = -1; /* output file descriptor */
@@ -191,8 +189,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
void (*action)( int, const char * ) = NULL;
- md5_init( api );
- rb = api;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost( true );
#endif
@@ -225,7 +221,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
dir = rb->opendir( arg );
if( dir )
{
- api->closedir( dir );
+ rb->closedir( dir );
/* Hash the directory's content recursively */
action = hash_dir;
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index d792642265..e93b2ad244 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -667,9 +667,7 @@ const struct button_mapping *plugin_contexts[] =
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
-static const struct plugin_api* rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
static int bpm = 120;
static int period = 0;
@@ -891,13 +889,12 @@ void tap(void)
reset_tap = false;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button;
enum plugin_status status;
(void)parameter;
- rb = api;
if (MET_IS_PLAYING)
MET_PLAY_STOP; /* stop audio IS */
@@ -923,14 +920,14 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
while (true){
reset_tap = true;
#if CONFIG_CODEC == SWCODEC
- button = pluginlib_getaction(rb,1,plugin_contexts,PLA_ARRAY_COUNT);
+ button = pluginlib_getaction(1,plugin_contexts,PLA_ARRAY_COUNT);
if (need_to_play)
{
need_to_play = false;
play_tock();
}
#else
- button = pluginlib_getaction(rb,TIMEOUT_BLOCK,
+ button = pluginlib_getaction(TIMEOUT_BLOCK,
plugin_contexts,PLA_ARRAY_COUNT);
#endif /* SWCODEC */
switch (button) {
diff --git a/apps/plugins/midi/guspat.c b/apps/plugins/midi/guspat.c
index 419cfa3ad0..124f779671 100644
--- a/apps/plugins/midi/guspat.c
+++ b/apps/plugins/midi/guspat.c
@@ -22,8 +22,6 @@
#include "guspat.h"
#include "midiutil.h"
-extern struct plugin_api * rb;
-
/* This came from one of the Gravis documents */
const uint32_t gustable[]=
{
diff --git a/apps/plugins/midi/midifile.c b/apps/plugins/midi/midifile.c
index dd659033e8..84e8b567bc 100644
--- a/apps/plugins/midi/midifile.c
+++ b/apps/plugins/midi/midifile.c
@@ -21,8 +21,6 @@
#include "plugin.h"
#include "midiutil.h"
-extern struct plugin_api * rb;
-
struct Track * readTrack(int file);
int readID(int file);
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c
index 5f4613a37b..b506b680fd 100644
--- a/apps/plugins/midi/midiplay.c
+++ b/apps/plugins/midi/midiplay.c
@@ -211,18 +211,16 @@ int32_t gmbuf[BUF_SIZE*NBUF];
static unsigned int samples_in_buf;
int quit=0;
-const struct plugin_api * rb;
static int midimain(const void * filename);
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int retval = 0;
- PLUGIN_IRAM_INIT(api)
+ PLUGIN_IRAM_INIT(rb)
- rb = api;
if(parameter == NULL)
{
rb->splash(HZ*2, " Play .MID file ");
diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c
index 510a30d87f..f1b6668be2 100644
--- a/apps/plugins/midi/midiutil.c
+++ b/apps/plugins/midi/midiutil.c
@@ -21,8 +21,6 @@
#include "plugin.h"
#include "midiutil.h"
-extern struct plugin_api * rb;
-
int chVol[16] IBSS_ATTR; /* Channel volume */
int chPan[16] IBSS_ATTR; /* Channel panning */
int chPat[16] IBSS_ATTR; /* Channel patch */
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c
index 34478e4d4f..11dd0e3f96 100644
--- a/apps/plugins/midi/sequencer.c
+++ b/apps/plugins/midi/sequencer.c
@@ -23,7 +23,6 @@
#include "guspat.h"
#include "synth.h"
-extern struct plugin_api * rb;
extern int playingTime IBSS_ATTR;
extern int samplesThisSecond IBSS_ATTR;
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index 1d759be288..f2fbe063e7 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -23,8 +23,6 @@
#include "midiutil.h"
#include "synth.h"
-extern struct plugin_api * rb;
-
void readTextBlock(int file, char * buf)
{
char c = 0;
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index 183ce0fd9b..7cffdaf230 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -243,12 +243,6 @@ enum minesweeper_status {
#endif
#endif
-/* 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
- */
-static const struct plugin_api *rb;
-
extern const fb_data minesweeper_tiles[];
#ifdef HAVE_LCD_COLOR
@@ -795,12 +789,11 @@ enum minesweeper_status minesweeper( void )
}
/* 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 = false;
(void)parameter;
- rb = api;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index c8031e8b3b..adb0d423f2 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -157,7 +157,7 @@ PLUGIN_HEADER
#endif
#endif
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button;
int timer = 10;
@@ -165,11 +165,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
int y=0;
int sx = 3;
int sy = 3;
- const struct plugin_api* rb = api;
(void)parameter;
#ifdef HAVE_LCD_CHARCELLS
- if (!pgfx_init(rb, 4, 2))
+ if (!pgfx_init(4, 2))
{
rb->splash(HZ*2, "Old LCD :(");
return PLUGIN_OK;
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index 1de89bda97..b77058e97e 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -17,9 +17,7 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-static const struct plugin_api* rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
#define SAMP_PER_FRAME 1152
#define SAMPL2 576
@@ -2496,7 +2494,7 @@ void get_mp3_filename(const char *wav_name)
#endif
#endif
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int rat, srat, nrat; /* for rate selection */
int cont = 1, butt;
@@ -2512,13 +2510,12 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
if (parameter == NULL)
return PLUGIN_ERROR;
- PLUGIN_IRAM_INIT(api)
+ PLUGIN_IRAM_INIT(rb)
#ifdef CPU_COLDFIRE
coldfire_set_macsr(0); /* integer mode */
#endif
- rb = api;
rb->lcd_setfont(FONT_SYSFIXED);
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/apps/plugins/mpegplayer/decode.c b/apps/plugins/mpegplayer/decode.c
index 80a396d15b..a19b929bef 100644
--- a/apps/plugins/mpegplayer/decode.c
+++ b/apps/plugins/mpegplayer/decode.c
@@ -29,8 +29,6 @@
#include "mpeg2dec_config.h"
-extern const struct plugin_api* rb;
-
#include "mpeg2.h"
#include "attributes.h"
#include "mpeg2_internal.h"
diff --git a/apps/plugins/mpegplayer/header.c b/apps/plugins/mpegplayer/header.c
index f5571835c1..001cafe7d5 100644
--- a/apps/plugins/mpegplayer/header.c
+++ b/apps/plugins/mpegplayer/header.c
@@ -30,8 +30,6 @@
#include "mpeg2dec_config.h"
-extern const struct plugin_api* rb;
-
#include "mpeg2.h"
#include "attributes.h"
#include "mpeg2_internal.h"
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index cf7af09469..3e83f8bc17 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -308,11 +308,11 @@ void mpeg_backlight_update_brightness(int value)
if (value >= 0)
{
value += MIN_BRIGHTNESS_SETTING;
- backlight_brightness_set(rb, value);
+ backlight_brightness_set(value);
}
else
{
- backlight_brightness_use_setting(rb);
+ backlight_brightness_use_setting();
}
}
@@ -820,7 +820,7 @@ static int show_start_menu(uint32_t duration)
format_menu_item(&items[MPEG_START_RESUME], sizeof (resume_str),
"Resume at: %s", hms_str);
- menu_id = menu_init(rb, items, ARRAYLEN(items),
+ menu_id = menu_init(items, ARRAYLEN(items),
mpeg_menu_sysevent_callback, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -925,7 +925,7 @@ static void display_options(void)
#endif
};
- menu_id = menu_init(rb, items, ARRAYLEN(items),
+ menu_id = menu_init(items, ARRAYLEN(items),
mpeg_menu_sysevent_callback, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -1007,7 +1007,7 @@ static void audio_options(void)
{ "Dithering", NULL },
};
- menu_id = menu_init(rb, items, ARRAYLEN(items),
+ menu_id = menu_init(items, ARRAYLEN(items),
mpeg_menu_sysevent_callback, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -1115,7 +1115,7 @@ int mpeg_menu(unsigned flags)
if (flags & MPEG_MENU_HIDE_QUIT_ITEM)
item_count--;
- menu_id = menu_init(rb, items, item_count,
+ menu_id = menu_init(items, item_count,
mpeg_menu_sysevent_callback, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -1189,8 +1189,6 @@ void init_settings(const char* filename)
settings.equalizer = false;
settings.dithering = false;
- configfile_init(rb);
-
if (configfile_load(SETTINGS_FILENAME, config,
sizeof(config)/sizeof(*config),
SETTINGS_MIN_VERSION) < 0)
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 0b5bb518fe..fbd3dc6b2c 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -280,9 +280,7 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#endif
#endif
-const struct plugin_api* rb;
-
-CACHE_FUNCTION_WRAPPERS(rb);
+CACHE_FUNCTION_WRAPPERS;
/* One thing we can do here for targets with remotes is having a display
* always on the remote instead of always forcing a popup on the main display */
@@ -622,7 +620,7 @@ static void wvs_backlight_on_video_mode(bool video_on)
if (video_on) {
/* Turn off backlight timeout */
/* backlight control in lib/helper.c */
- backlight_force_on(rb);
+ backlight_force_on();
#if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR)
rb->lcd_set_enable_hook(NULL);
#endif
@@ -631,7 +629,7 @@ static void wvs_backlight_on_video_mode(bool video_on)
rb->lcd_set_enable_hook(wvs_lcd_enable_hook);
#endif
/* Revert to user's backlight settings */
- backlight_use_settings(rb);
+ backlight_use_settings();
}
}
@@ -1625,7 +1623,7 @@ static void button_loop(void)
rb->lcd_setfont(FONT_UI);
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int status = PLUGIN_ERROR; /* assume failure */
int result;
@@ -1634,17 +1632,15 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
if (parameter == NULL) {
/* No file = GTFO */
- api->splash(HZ*2, "No File");
+ rb->splash(HZ*2, "No File");
return PLUGIN_ERROR;
}
/* Disable all talking before initializing IRAM */
- api->talk_disable(true);
+ rb->talk_disable(true);
/* Initialize IRAM - stops audio and voice as well */
- PLUGIN_IRAM_INIT(api)
-
- rb = api;
+ PLUGIN_IRAM_INIT(rb)
#ifdef HAVE_LCD_COLOR
rb->lcd_set_backdrop(NULL);
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h
index 323f8f34f1..6247a6d3e1 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -23,9 +23,6 @@
#ifndef MPEGPLAYER_H
#define MPEGPLAYER_H
-/* Global API pointer */
-extern const struct plugin_api* rb;
-
#ifdef HAVE_SCHEDULER_BOOSTCTRL
#define trigger_cpu_boost rb->trigger_cpu_boost
#define cancel_cpu_boost rb->cancel_cpu_boost
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index 222ffb7d6b..065843a344 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -998,7 +998,7 @@ int stream_init(void)
long greysize;
/* Greylib init handles all necessary cache alignment */
- if (!grey_init(rb, mem, memsize, GREY_BUFFERED|GREY_ON_COP,
+ if (!grey_init(mem, memsize, GREY_BUFFERED|GREY_ON_COP,
LCD_WIDTH, LCD_HEIGHT, &greysize))
{
rb->splash(HZ, "greylib init failed!");
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c
index 1500407f49..4f8f33b03b 100644
--- a/apps/plugins/nim.c
+++ b/apps/plugins/nim.c
@@ -62,8 +62,6 @@ static unsigned char str[12]; /*String use to display the first line*/
static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/
static bool end; /*If true game is finished*/
-static const struct plugin_api* rb;
-
/*Display that the action it's impossible*/
static void impossible(void)
@@ -141,7 +139,7 @@ static void nim_exit(void *parameter)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int y,z,button;
int x,v,min;
@@ -152,10 +150,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
this to avoid the compiler warning about it */
(void)parameter;
- /* if you are using a global api pointer, don't forget to copy it!
- otherwise you will get lovely "I04: IllInstr" errors... :-) */
- rb = api;
-
/*Get the pattern handle*/
h1=rb->lcd_get_locked_pattern();
h2=rb->lcd_get_locked_pattern();
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index 5915604b74..ab3c5b2e39 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -295,8 +295,6 @@ enum { OSC_HORIZ, OSC_VERT, MAX_OSC };
/* global variables */
-const struct plugin_api* rb; /* global api struct pointer */
-
/* settings */
struct osc_config {
int delay; /* in ticks */
@@ -693,10 +691,10 @@ void cleanup(void *parameter)
rb->lcd_set_background(LCD_DEFAULT_BG);
#endif
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button, vol;
int lastbutton = BUTTON_NONE;
@@ -705,10 +703,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
bool tell_speed;
(void)parameter;
- rb = api;
-
- xlcd_init(rb);
- configfile_init(rb);
configfile_load(cfg_filename, disk_config,
sizeof(disk_config) / sizeof(disk_config[0]),
@@ -724,7 +718,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
rb->lcd_getstringsize("A", NULL, &font_height);
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c
index d5c73993a8..d4fa0ada20 100644
--- a/apps/plugins/pacbox/arcade.c
+++ b/apps/plugins/pacbox/arcade.c
@@ -29,8 +29,6 @@
#include <string.h>
#include "plugin.h"
-extern const struct plugin_api* rb;
-
#ifndef HAVE_LCD_COLOR
/* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */
static fb_data rgb_to_gray(unsigned int r, unsigned int g, unsigned int b)
diff --git a/apps/plugins/pacbox/hardware.c b/apps/plugins/pacbox/hardware.c
index 919eb89a94..f5a7184475 100644
--- a/apps/plugins/pacbox/hardware.c
+++ b/apps/plugins/pacbox/hardware.c
@@ -27,8 +27,6 @@
#include "plugin.h"
#include "hardware.h"
-extern const struct plugin_api* rb;
-
/* The main data for Pacman */
unsigned char ram_[20*1024] IBSS_ATTR; // ROM (16K) and RAM (4K)
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index c4ee037b5a..ef5d4f5c0e 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -34,8 +34,6 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-const struct plugin_api* rb;
-
struct pacman_settings {
int difficulty;
int numlives;
@@ -181,7 +179,7 @@ static bool pacbox_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);
rb->button_clear_queue();
@@ -363,12 +361,11 @@ static int gameProc( void )
return 0;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- PLUGIN_IRAM_INIT(api)
- rb = api;
+ PLUGIN_IRAM_INIT(rb)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);
@@ -386,8 +383,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
settings.ghostnames = 0; /* Normal names */
settings.showfps = 0; /* Do not show FPS */
- configfile_init(rb);
-
if (configfile_load(SETTINGS_FILENAME, config,
sizeof(config)/sizeof(*config),
SETTINGS_MIN_VERSION
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c
index 25f8adfbed..712d102a32 100644
--- a/apps/plugins/pegbox.c
+++ b/apps/plugins/pegbox.c
@@ -32,8 +32,6 @@
#define ITEM_HEIGHT (BMPHEIGHT_pegbox_menu_items/9)
#endif
-static const struct plugin_api* rb;
-
PLUGIN_HEADER
/* final game return status */
@@ -1436,12 +1434,11 @@ static int pegbox(struct game_context* pb) {
/*****************************************************************************
* 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 = false;
struct game_context pb;
(void)parameter;
- rb = api;
rb->lcd_setfont(FONT_SYSFIXED);
#if LCD_DEPTH > 1
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index d06f99dfd8..1489c40801 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -34,8 +34,6 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
-static const struct plugin_api *rb; /* global api struct pointer */
-
const struct button_mapping *plugin_contexts[]
= {generic_actions, generic_directions};
@@ -1451,7 +1449,7 @@ void cleanup(void *parameter)
{
(void) parameter;
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
int i;
for (i = 0; i < slide_cache_in_use; i++) {
@@ -1952,7 +1950,7 @@ int main(void)
slide_cache_stack_index = min_slide_cache-1;
slide_cache_in_use = 0;
#ifdef USEGSLIB
- if (!grey_init(rb, plugin_buf, plugin_buf_size, GREY_BUFFERED|GREY_ON_COP,
+ if (!grey_init(plugin_buf, plugin_buf_size, GREY_BUFFERED|GREY_ON_COP,
LCD_WIDTH, LCD_HEIGHT, NULL))
rb->splash(HZ, "Greylib init failed!");
grey_setfont(FONT_UI);
@@ -2050,7 +2048,7 @@ int main(void)
rb->yield();
/*/ Handle buttons */
- button = pluginlib_getaction(rb, instant_update ? 0 : HZ/16,
+ button = pluginlib_getaction(instant_update ? 0 : HZ/16,
plugin_contexts, NB_ACTION_CONTEXTS);
switch (button) {
@@ -2130,18 +2128,16 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(const struct plugin_api *api,
- const void *parameter)
+enum plugin_status plugin_start(const void *parameter)
{
int ret;
- rb = api; /* copy to global api pointer */
(void) parameter;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);
#endif
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index 8e85bf08c4..6bd4d095ce 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -38,7 +38,6 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
-static const struct plugin_api* rb; /* global api struct pointer */
static unsigned char wave_array[256]; /* Pre calculated wave array */
#ifdef HAVE_LCD_COLOR
static fb_data colours[256]; /* Smooth transition of shades */
@@ -245,7 +244,7 @@ void cleanup(void *parameter)
grey_release();
#endif
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
}
/*
@@ -274,7 +273,7 @@ int main(void)
/* get the remainder of the plugin buffer */
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- grey_init(rb, gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
+ grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
/* switch on greyscale overlay */
grey_show(true);
#endif
@@ -365,17 +364,16 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int ret;
- rb = api; /* copy to global api pointer */
(void)parameter;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
ret = main();
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c
index 220bcf641c..905e7689f8 100644
--- a/apps/plugins/pong.c
+++ b/apps/plugins/pong.c
@@ -194,8 +194,6 @@ PLUGIN_HEADER
#endif
#endif
-static const struct plugin_api* rb;
-
struct pong {
int ballx; /* current X*RES position of the ball */
int bally; /* current Y*RES position of the ball */
@@ -491,7 +489,7 @@ void showscore(struct pong *p)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
struct pong pong;
int game = 1;
@@ -515,8 +513,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
this to avoid the compiler warning about it */
(void)parameter;
- rb = api; /* use the "standard" rb pointer */
-
/* Clear screen */
rb->lcd_clear_display();
diff --git a/apps/plugins/ppmviewer.c b/apps/plugins/ppmviewer.c
index 6db24ff804..56193b3c47 100644
--- a/apps/plugins/ppmviewer.c
+++ b/apps/plugins/ppmviewer.c
@@ -41,8 +41,6 @@ PLUGIN_HEADER
static fb_data buffer[PPM_MAXSIZE];
static fb_data lcd_buf[LCD_WIDTH * LCD_HEIGHT];
-static const struct plugin_api* rb; /* global api struct pointer */
-
int ppm_read_magic_number(int fd)
{
char i1, i2;
@@ -270,7 +268,7 @@ int read_ppm(int fd,
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
static char filename[MAX_PATH];
int fd;
@@ -285,8 +283,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
if(!parameter) return PLUGIN_ERROR;
- rb = api;
-
rb->strcpy(filename, parameter);
fd = rb->open(filename, O_RDONLY);
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 0af98106d2..5fee435808 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -22,9 +22,7 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
bool its_a_dir = false;
@@ -254,9 +252,8 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len)
return buffer;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- rb = api;
struct gui_synclist properties_lists;
int button;
bool prev_show_statusbar;
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index 9c568df3be..8d211aaa8f 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -23,7 +23,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
static bool abort;
static int fd;
static int dirs_count;
@@ -327,7 +326,7 @@ int edit_list(void)
{ "Remove Folder", NULL },
{ "Remove Folder Tree", NULL },
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
switch (menu_show(m))
@@ -362,7 +361,7 @@ int edit_list(void)
{ "Save and Exit", NULL },
{ "Ignore Changes and Exit", NULL },
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
switch (menu_show(m))
@@ -484,7 +483,7 @@ int main_menu(void)
{ "Import List From Textfile", NULL },
{ "Quit", NULL },
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
switch (menu_show(m))
@@ -550,11 +549,10 @@ int main_menu(void)
return exit?1:0;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
abort = false;
while (!main_menu())
diff --git a/apps/plugins/reversi/reversi-game.h b/apps/plugins/reversi/reversi-game.h
index 4be91821b7..eac2f4ae3a 100644
--- a/apps/plugins/reversi/reversi-game.h
+++ b/apps/plugins/reversi/reversi-game.h
@@ -59,8 +59,6 @@ typedef struct _reversi_board_t {
* stored in history[1] etc.
*/
move_t history[BOARD_SIZE*BOARD_SIZE - INIT_STONES];
-
- const struct plugin_api *rb;
} reversi_board_t;
diff --git a/apps/plugins/reversi/reversi-gui.c b/apps/plugins/reversi/reversi-gui.c
index d8cdc0a952..5249a93efd 100644
--- a/apps/plugins/reversi/reversi-gui.c
+++ b/apps/plugins/reversi/reversi-gui.c
@@ -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;
diff --git a/apps/plugins/reversi/reversi-strategy-naive.c b/apps/plugins/reversi/reversi-strategy-naive.c
index 95d5e6010d..37a25d10da 100644
--- a/apps/plugins/reversi/reversi-strategy-naive.c
+++ b/apps/plugins/reversi/reversi-strategy-naive.c
@@ -32,7 +32,7 @@ static move_t naive_move_func(const reversi_board_t *game, int player) {
int row = 0;
int col = 0;
if(!num_moves) return MOVE_INVALID;
- r = game->rb->rand()%num_moves;
+ r = rb->rand()%num_moves;
while(true) {
if(reversi_is_valid_move(game, row, col, player)) {
r--;
diff --git a/apps/plugins/reversi/reversi-strategy-simple.c b/apps/plugins/reversi/reversi-strategy-simple.c
index 326fa3f7ef..fdf34f505b 100644
--- a/apps/plugins/reversi/reversi-strategy-simple.c
+++ b/apps/plugins/reversi/reversi-strategy-simple.c
@@ -31,11 +31,10 @@
static void reversi_copy_board(reversi_board_t *dst,
const reversi_board_t *src) {
int i;
- dst->rb = src->rb;
- dst->rb->memcpy(dst->history,src->history,
+ rb->memcpy(dst->history,src->history,
(BOARD_SIZE*BOARD_SIZE - INIT_STONES)*sizeof(move_t));
for(i=0;i<BOARD_SIZE;i++) {
- dst->rb->memcpy(dst->board[i],src->board[i],BOARD_SIZE*sizeof(int));
+ rb->memcpy(dst->board[i],src->board[i],BOARD_SIZE*sizeof(int));
}
}
@@ -92,7 +91,7 @@ static move_t simple_move_func(const reversi_board_t *game, int player) {
if(!count) return MOVE_INVALID;
/* chose one of the moves which scores highest */
- r = game->rb->rand()%count;
+ r = rb->rand()%count;
row = 0;
col = 0;
while(true) {
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c
index 58d9d12665..056b799a52 100644
--- a/apps/plugins/robotfindskitten.c
+++ b/apps/plugins/robotfindskitten.c
@@ -620,18 +620,13 @@ bool exit_rfk;
offset function and using that everywhere. So not right now. */
int screen[X_MAX + 1][Y_MAX + 1];
-/* 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 */
-static const struct plugin_api* rb;
-
/******************************************************************************
*
* Begin meaty routines that do the dirty work.
*
*****************************************************************************/
-MEM_FUNCTION_WRAPPERS(rb)
+MEM_FUNCTION_WRAPPERS
static void drawchar(int x, int y, char c)
{
@@ -695,7 +690,7 @@ static void play_game()
old_y = robot.y;
}
#ifdef __PLUGINLIB_ACTIONS_H__
- input = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2);
+ input = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
#else
input = rb->button_get(true);
#endif
@@ -1037,10 +1032,9 @@ static void initialize_screen()
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
exit_rfk = false;
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 89971c3153..639728b370 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -570,9 +570,6 @@ extern const fb_data rockblox_background[];
*/
-/* must have variable */
-static const struct plugin_api *rb;
-
static bool gameover = false;
/* c=current f=figure o=orientation n=next */
static int lines = 0, level = 0, score = 0, cx, cy, cf, co, nf;
@@ -1072,13 +1069,13 @@ static int rockblox_loop (void)
#ifdef HAS_BUTTON_HOLD
if (rb->button_hold ()) {
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
rb->splash(0, "Paused");
while (rb->button_hold ())
rb->sleep(HZ/10);
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
/* get rid of the splash text */
rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT);
@@ -1223,17 +1220,15 @@ static int rockblox_loop (void)
return PLUGIN_OK;
}
-enum plugin_status plugin_start (const struct plugin_api *api, const void *parameter)
+enum plugin_status plugin_start (const void *parameter)
{
int ret;
(void) parameter;
- rb = api;
rb->srand (*rb->current_tick);
/* Load HighScore if any */
- highscore_init(rb);
highscore_load(HIGH_SCORE,Highest,MAX_HIGH_SCORES);
#if LCD_DEPTH > 1
@@ -1243,14 +1238,14 @@ enum plugin_status plugin_start (const struct plugin_api *api, const void *param
#ifdef HAVE_LCD_BITMAP
rb->lcd_setfont (FONT_SYSFIXED);
#else
- if (!pgfx_init(rb, 4, 2))
+ if (!pgfx_init(4, 2))
{
rb->splash(HZ*2, "Old LCD :(");
return PLUGIN_OK;
}
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
init_rockblox ();
ret = rockblox_loop ();
@@ -1262,7 +1257,7 @@ enum plugin_status plugin_start (const struct plugin_api *api, const void *param
#endif
/* Save user's HighScore */
highscore_save(HIGH_SCORE,Highest,MAX_HIGH_SCORES);
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return ret;
}
diff --git a/apps/plugins/rockblox1d.c b/apps/plugins/rockblox1d.c
index 7c948e2d4f..0c6186b0ff 100644
--- a/apps/plugins/rockblox1d.c
+++ b/apps/plugins/rockblox1d.c
@@ -152,8 +152,6 @@ PLUGIN_HEADER
# define NEXT_Y (int)((LCD_HEIGHT * 0.8)/2-NEXT_H/2)
#endif
-static const struct plugin_api* rb; /* global api struct pointer */
-
void draw_brick(int pos, int length) {
int i = pos;
rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID);
@@ -165,7 +163,7 @@ void draw_brick(int pos, int length) {
}
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int i;
int f_width, f_height;
@@ -184,7 +182,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
unsigned long int score = 34126;
char score_buf[10];
- rb = api;
(void)parameter;
#if LCD_DEPTH > 1
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c
index d0dc73875e..5f2117d746 100644
--- a/apps/plugins/rockbox_flash.c
+++ b/apps/plugins/rockbox_flash.c
@@ -97,8 +97,6 @@ typedef struct
char name[32];
} tFlashInfo;
-static const struct plugin_api* rb; /* here is a global api struct pointer */
-
static UINT8* sector; /* better not place this on the stack... */
/***************** Flash Functions *****************/
@@ -942,12 +940,10 @@ static void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int oldmode;
- rb = api; /* copy to global api pointer */
-
if (parameter == NULL)
{
rb->splash(HZ*3, "Play .ucl file!");
diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c
index f3d25e21cd..3f3788ea88 100644
--- a/apps/plugins/rockboy.c
+++ b/apps/plugins/rockboy.c
@@ -29,8 +29,8 @@
PLUGIN_HEADER
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy");
+ return run_overlay(parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy");
}
#endif
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index fe0b72d133..d10e2b6e1a 100644
--- a/apps/plugins/rockboy/menu.c
+++ b/apps/plugins/rockboy/menu.c
@@ -106,7 +106,7 @@ int do_user_menu(void) {
pcm_init();
- m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
+ m = menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
while(!done)
{
@@ -314,7 +314,7 @@ static void do_slot_menu(bool is_load) {
for (i = 0; i < num_items; i++)
slot_info(buf[i], 20, i);
- m = menu_init(rb,items, num_items, NULL, NULL, NULL, NULL);
+ m = menu_init(items, num_items, NULL, NULL, NULL, NULL);
while(!done)
{
@@ -391,7 +391,7 @@ static void do_opt_menu(void)
#endif
};
- m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
+ m = menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
options.dirty=1; /* Assume that the settings have been changed */
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 6733bf8551..ae0d218ccb 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -29,10 +29,6 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-/* 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 */
-const struct plugin_api* rb;
int shut,cleanshut;
char *errormsg;
@@ -324,13 +320,9 @@ static int gnuboy_main(const char *rom)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- PLUGIN_IRAM_INIT(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;
+ PLUGIN_IRAM_INIT(rb)
rb->lcd_setfont(0);
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h
index 34e8d0cd3f..414b889003 100644
--- a/apps/plugins/rockboy/rockmacros.h
+++ b/apps/plugins/rockboy/rockmacros.h
@@ -28,7 +28,6 @@
#define malloc(a) my_malloc(a)
void *my_malloc(size_t size);
-extern const struct plugin_api* rb;
extern int shut,cleanshut;
void vid_init(void);
inline void vid_begin(void);
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c
index e22cb33cae..2d162fc595 100644
--- a/apps/plugins/rocklife.c
+++ b/apps/plugins/rocklife.c
@@ -79,7 +79,6 @@ PLUGIN_HEADER
#define PATTERN_ACORN 3
#define PATTERN_GLIDER_GUN 4 /* not yet implemented */
-static const struct plugin_api* rb;
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
@@ -395,7 +394,7 @@ static void next_generation(char *pgrid, char *pnext_grid){
/**********************************/
/* this is the plugin entry point */
/**********************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button = 0;
int quit = 0;
@@ -406,9 +405,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
char *ptemp;
(void)parameter;
- rb = api;
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#ifdef HAVE_LCD_COLOR
@@ -427,7 +425,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
show_grid(pgrid);
while(!quit) {
- button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2);
+ button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
switch(button) {
case ROCKLIFE_NEXT:
case ROCKLIFE_NEXT_REP:
@@ -452,7 +450,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* show new generation */
rb->yield();
show_grid(pgrid);
- button = pluginlib_getaction(rb, 0, plugin_contexts, 2);
+ button = pluginlib_getaction(0, plugin_contexts, 2);
switch(button) {
case ROCKLIFE_PLAY_PAUSE:
case ROCKLIFE_QUIT:
@@ -489,7 +487,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->yield();
}
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 96ae7c5af5..9cfbf7c915 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -295,9 +295,7 @@ extern int errno;
int errno;
#endif
-static const struct plugin_api* rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
static int drawcolor=0; /* Current color (in palette) */
static int bgdrawcolor=9; /* Current background color (in palette) */
@@ -3009,14 +3007,11 @@ static int save_bitmap( char *file )
bm.height = ROWS;
bm.width = COLS;
bm.format = FORMAT_NATIVE;
- return save_bmp_file( file, &bm, rb );
+ return save_bmp_file( file, &bm );
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- /** must have stuff **/
- rb = api;
-
rb->lcd_set_foreground(COLOR_WHITE);
rb->lcd_set_backdrop(NULL);
rb->lcd_fillrect(0,0,LCD_WIDTH,LCD_HEIGHT);
diff --git a/apps/plugins/search.c b/apps/plugins/search.c
index d1c7f041da..4c6d569806 100644
--- a/apps/plugins/search.c
+++ b/apps/plugins/search.c
@@ -24,8 +24,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
#define BUFFER_SIZE 16384
static int fd;
@@ -146,14 +144,12 @@ static bool search_init(const char* file){
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int ok;
const char *filename = parameter;
char *p;
- rb = api;
-
DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]);
/* Check the extension. We only allow .m3u files. */
if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u") &&
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c
index 5b4c5e275d..ddcd0ead0d 100644
--- a/apps/plugins/searchengine/searchengine.c
+++ b/apps/plugins/searchengine/searchengine.c
@@ -28,7 +28,6 @@ PLUGIN_HEADER
void *audio_bufferbase;
void *audio_bufferpointer;
size_t audio_buffer_free;
-const struct plugin_api* rb;
int w, h, y;
void *my_malloc(size_t size)
@@ -58,13 +57,10 @@ void setmallocpos(void *pointer)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
unsigned char *result,buf[500];
int parsefd,hits;
- /* 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;
diff --git a/apps/plugins/searchengine/searchengine.h b/apps/plugins/searchengine/searchengine.h
index 900d4e2976..090adb7051 100644
--- a/apps/plugins/searchengine/searchengine.h
+++ b/apps/plugins/searchengine/searchengine.h
@@ -40,8 +40,6 @@ rb->lcd_update()
rb->lcd_update()
#endif
-extern const struct plugin_api* rb;
-
void *my_malloc(size_t size);
void setmallocpos(void *pointer);
diff --git a/apps/plugins/settings_dumper.c b/apps/plugins/settings_dumper.c
index b9acdcf5fc..25b4098001 100644
--- a/apps/plugins/settings_dumper.c
+++ b/apps/plugins/settings_dumper.c
@@ -22,7 +22,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
#define FILENAME "/settings_dumper.txt"
static int setting_count = 0;
@@ -117,14 +116,13 @@ static void write_setting(const struct settings_list *setting, int fd, unsigned
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api,
+enum plugin_status plugin_start(
const void* parameter)
{
const struct settings_list *list;
int setting_count, i;
int fd;
(void)parameter;
- rb = api;
fd = rb->open(FILENAME, O_CREAT|O_TRUNC|O_WRONLY);
if (fd < 0)
diff --git a/apps/plugins/shortcuts/shortcuts.h b/apps/plugins/shortcuts/shortcuts.h
index 2196a75125..bfe3540c4d 100644
--- a/apps/plugins/shortcuts/shortcuts.h
+++ b/apps/plugins/shortcuts/shortcuts.h
@@ -34,8 +34,6 @@
#define SHORTCUTS_FILENAME "/shortcuts.link"
-extern const struct plugin_api* rb;
-
typedef struct sc_entry_s
{
char path[MAX_PATH+1];
diff --git a/apps/plugins/shortcuts/shortcuts_append.c b/apps/plugins/shortcuts/shortcuts_append.c
index 0d74767a87..69b2a445f3 100644
--- a/apps/plugins/shortcuts/shortcuts_append.c
+++ b/apps/plugins/shortcuts/shortcuts_append.c
@@ -51,9 +51,8 @@ bool append_entry_to_file(sc_file_t *file, char *path, bool is_dir)
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* void_parameter)
+enum plugin_status plugin_start(const void* void_parameter)
{
- rb = api;
bool found;
bool its_a_dir;
diff --git a/apps/plugins/shortcuts/shortcuts_common.c b/apps/plugins/shortcuts/shortcuts_common.c
index 0ea18c06a2..fbf6d81d61 100644
--- a/apps/plugins/shortcuts/shortcuts_common.c
+++ b/apps/plugins/shortcuts/shortcuts_common.c
@@ -21,7 +21,7 @@
****************************************************************************/
#include "shortcuts.h"
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
#define SHORTCUTS_FILENAME "/shortcuts.link"
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c
index eb3cb9506c..d3d11f3ff3 100644
--- a/apps/plugins/shortcuts/shortcuts_view.c
+++ b/apps/plugins/shortcuts/shortcuts_view.c
@@ -198,9 +198,8 @@ bool ends_with(char *string, char *suffix)
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* void_parameter)
+enum plugin_status plugin_start(const void* void_parameter)
{
- rb = api;
bool leave_loop;
/* This is a viewer, so a parameter must have been specified */
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index 7aa1ed36a8..9a46dac664 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -223,8 +223,6 @@ PLUGIN_HEADER
#define IMAGE_HEIGHT BMPHEIGHT_sliding_puzzle
#define IMAGE_SIZE IMAGE_WIDTH
-static const struct plugin_api* rb;
-
/* use a square image, (the default Archos bitmap looks square on its display)
Puzzle image dimension is min(lcd_height,lcd_width)
4x4 is more convenient for square puzzles
@@ -622,13 +620,11 @@ static int puzzle_loop(void)
}
}
-enum plugin_status plugin_start(const struct plugin_api* api,
+enum plugin_status plugin_start(
const void* parameter)
{
int i, w, h;
- rb = api;
-
initial_bmp_path=(const char *)parameter;
picmode = PICMODE_INITIAL_PICTURE;
img_buf_path[0] = '\0';
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c
index 56e8c7854b..6d1277564b 100644
--- a/apps/plugins/snake.c
+++ b/apps/plugins/snake.c
@@ -187,7 +187,6 @@ PLUGIN_HEADER
static int board[BOARD_WIDTH][BOARD_HEIGHT],snakelength;
static unsigned int score,hiscore=0,level=1;
static short dir,frames,apple,dead=0;
-static const struct plugin_api* rb;
void die (void)
{
@@ -445,10 +444,9 @@ void game_init(void) {
}
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)(parameter);
- rb = api;
game_init();
rb->lcd_clear_display();
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c
index 5b470f5f82..8cd8794057 100644
--- a/apps/plugins/snake2.c
+++ b/apps/plugins/snake2.c
@@ -399,7 +399,6 @@ static int apple;
static int level = 4, speed = 5,dead = 0, quit = 0;
static int sillydir = 0, num_levels = 0;
static int level_from_file = 0;
-static const struct plugin_api* rb;
static int headx, heady, tailx, taily, applecountdown = 5;
static int game_type = 0;
static int num_apples_to_get=1;
@@ -1443,10 +1442,9 @@ void game_init(void)
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)(parameter);
- rb = api;
/* Lets use the default font */
rb->lcd_setfont(FONT_SYSFIXED);
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index 8e3d712f8f..4996cd3fd5 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -81,7 +81,6 @@ PLUGIN_HEADER
#endif
static short particles[NUM_PARTICLES][2];
-static const struct plugin_api* rb;
#ifdef HAVE_LCD_BITMAP
#if LCD_WIDTH >= 160
@@ -196,14 +195,13 @@ static void snow_init(void)
#endif
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button;
(void)(parameter);
- rb = api;
#ifdef HAVE_LCD_CHARCELLS
- if (!pgfx_init(rb, 4, 2))
+ if (!pgfx_init(4, 2))
{
rb->splash(HZ*2, "Old LCD :(");
return PLUGIN_OK;
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 98faf7961f..96dc17591c 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -452,8 +452,7 @@ static struct BufferedBoards {
} buffered_boards;
-static const struct plugin_api* rb;
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */
@@ -1257,7 +1256,7 @@ static int sokoban_menu(void)
break;
case 2: /* Audio playback control */
- playback_control(rb, NULL);
+ playback_control(NULL);
menu_quit = false;
break;
@@ -1613,12 +1612,11 @@ static bool sokoban_loop(void)
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int w, h;
(void)(parameter);
- rb = api;
rb->lcd_setfont(SOKOBAN_FONT);
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 0a9bf99f51..2f5f2dc4a8 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -30,7 +30,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
#define min(a,b) (a<b?a:b)
/**
@@ -795,7 +794,7 @@ int solitaire_menu(bool in_game)
items[i++].desc = "Quit";
create_draw_option_string();
- m = menu_init(rb, items, i, NULL, NULL, NULL, NULL);
+ m = menu_init(items, i, NULL, NULL, NULL, NULL);
while (result < 0)
{
switch (menu_show(m))
@@ -831,7 +830,7 @@ int solitaire_menu(bool in_game)
break;
case 3:
- playback_control(rb, NULL);
+ playback_control(NULL);
break;
case 4:
@@ -1904,17 +1903,15 @@ int solitaire( int skipmenu )
* Plugin entry point
*/
-enum plugin_status plugin_start( const struct plugin_api* api, const void* parameter )
+enum plugin_status plugin_start(const void* parameter )
{
int result;
/* plugin init */
(void)parameter;
- rb = api;
rb->splash( HZ, "Welcome to Solitaire!" );
- configfile_init(rb);
configfile_load(CONFIG_FILENAME, config,
sizeof(config) / sizeof(config[0]), CFGFILE_VERSION);
rb->memcpy(&sol, &sol_disk, sizeof(sol)); /* copy to running config */
diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c
index 5292400b0f..24be560398 100644
--- a/apps/plugins/sort.c
+++ b/apps/plugins/sort.c
@@ -59,8 +59,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
ssize_t buf_size;
static char *filename;
static int num_entries;
@@ -178,15 +176,13 @@ static int write_file(void)
return 0;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
char *buf;
int rc;
filename = (char *)parameter;
- rb = api;
-
buf = rb->plugin_get_audio_buffer((size_t *)&buf_size); /* start munching memory */
stringbuffer = buf;
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c
index 6c2496a781..b4cddd9a12 100644
--- a/apps/plugins/spacerocks.c
+++ b/apps/plugins/spacerocks.c
@@ -25,7 +25,6 @@
PLUGIN_HEADER
/******************************* Globals ***********************************/
-static const struct plugin_api* rb; /* global api struct pointer */
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define AST_PAUSE BUTTON_ON
@@ -2074,11 +2073,10 @@ enum plugin_status start_game(void)
}
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
enum plugin_status retval;
(void)(parameter);
- rb = api;
game_state = ATTRACT_MODE;
@@ -2088,12 +2086,12 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* universal font */
rb->lcd_setfont(FONT_SYSFIXED);
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
iohiscore();
retval = start_game();
iohiscore();
rb->lcd_setfont(FONT_UI);
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return retval;
}
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
index dda46a0f29..28b4de8909 100644
--- a/apps/plugins/splitedit.c
+++ b/apps/plugins/splitedit.c
@@ -98,9 +98,6 @@ unsigned char SCALE_BMP[][13] =
#define SE_SAVE 4
#define SE_COUNT 5
-/* the global api pointer */
-static const struct plugin_api* rb;
-
/* contains the file name of the song that is to be split */
static char path_mp3[MAX_PATH];
@@ -1250,12 +1247,11 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
return retval;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
struct mp3entry* mp3;
(void)parameter;
- rb = api;
rb->lcd_clear_display();
rb->lcd_update();
mp3 = rb->audio_current_track();
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index 2c4be27c34..fd727fa34b 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -328,8 +328,6 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
static int char_width = -1;
static int char_height = -1;
-static const struct plugin_api* rb;
-
/* this arrays contains a group of levels loaded into memory */
static unsigned char* levels =
"****************\n"
@@ -1116,10 +1114,9 @@ static int star_menu(void)
/**
* Main entry point
*/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c
index 7f39d5121b..bd75df3835 100644
--- a/apps/plugins/starfield.c
+++ b/apps/plugins/starfield.c
@@ -26,8 +26,6 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
-static const struct plugin_api* rb; /* global api struct pointer */
-
/* Key assignement */
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
@@ -188,8 +186,6 @@ static const struct plugin_api* rb; /* global api struct pointer */
#define MSG_DISP_TIME 30
-static const struct plugin_api* rb; /* global api struct pointer */
-
/*
* Each star's stuffs
*/
@@ -442,7 +438,7 @@ int plugin_main(void)
case(STARFIELD_QUIT):
case(SYS_USB_CONNECTED):
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c*/
+ backlight_use_settings(); /* backlight control in lib/helper.c*/
return PLUGIN_OK;
break;
}
@@ -451,14 +447,13 @@ int plugin_main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int ret;
- rb = api; /* copy to global api pointer */
(void)parameter;
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
ret = plugin_main();
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c
index ff47389e5d..95611e6f2e 100644
--- a/apps/plugins/stats.c
+++ b/apps/plugins/stats.c
@@ -22,7 +22,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
static int files, dirs, musicfiles, largestdir;
static int lasttick;
static bool abort;
@@ -200,13 +199,12 @@ void traversedir(char* location, char* name)
largestdir = files_in_dir;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button;
(void)parameter;
- rb = api;
files = 0;
dirs = 0;
musicfiles = 0;
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c
index d53937acb2..9395dde31e 100644
--- a/apps/plugins/stopwatch.c
+++ b/apps/plugins/stopwatch.c
@@ -205,8 +205,6 @@ PLUGIN_HEADER
#endif
#endif
-static const struct plugin_api* rb;
-
static int stopwatch = 0;
static long start_at = 0;
static int prev_total = 0;
@@ -331,7 +329,7 @@ void save_stopwatch(void)
rb->close(fd);
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
char buf[32];
int button;
@@ -341,7 +339,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
int lines;
(void)parameter;
- rb = api;
#ifdef HAVE_LCD_BITMAP
int h;
diff --git a/apps/plugins/sudoku/generator.c b/apps/plugins/sudoku/generator.c
index 56dce48cc2..3d37bde22a 100644
--- a/apps/plugins/sudoku/generator.c
+++ b/apps/plugins/sudoku/generator.c
@@ -35,8 +35,6 @@
#include "sudoku.h"
#include "templates.h"
-extern const struct plugin_api* rb;
-
#define assert(x)
/* Common state encoding in a 32-bit integer:
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c
index de90de360c..88fd0bd8ec 100644
--- a/apps/plugins/sudoku/sudoku.c
+++ b/apps/plugins/sudoku/sudoku.c
@@ -78,12 +78,6 @@ Example ".ss" file, and one with a saved state:
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 */
-
-const struct plugin_api* rb;
-
/* Default game - used to initialise sudoku.ss if it doesn't exist. */
static const char default_game[9][9] =
{
@@ -1191,14 +1185,14 @@ bool sudoku_menu(struct sudoku_state_t* state)
[SM_QUIT] = { "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);
switch (result) {
case SM_AUDIO_PLAYBACK:
- playback_control(rb, NULL);
+ playback_control(NULL);
break;
#ifdef HAVE_LCD_COLOR
@@ -1263,7 +1257,7 @@ int sudoku_edit_menu(struct sudoku_state_t* state)
{ "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);
@@ -1314,7 +1308,7 @@ void move_cursor(struct sudoku_state_t* state, int newx, int newy)
}
/* 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;
int button;
@@ -1323,13 +1317,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
int rc = PLUGIN_OK;
long ticks;
struct sudoku_state_t state;
-
- /* plugin init */
- rb = api;
- /* end of plugin init */
#if defined(HAVE_LCD_COLOR) || defined(SUDOKU_BUTTON_POSSIBLE)
- configfile_init(rb);
configfile_load(cfg_filename, disk_config,
sizeof(disk_config) / sizeof(disk_config[0]),
CFGFILE_MINVERSION);
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c
index 652b474336..5d9cf7ff00 100644
--- a/apps/plugins/superdom.c
+++ b/apps/plugins/superdom.c
@@ -20,7 +20,6 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
-static const struct plugin_api* rb;
extern const fb_data superdom_boarditems[];
char buf[255];
@@ -2241,13 +2240,11 @@ int average_strength(bool colour) {
return totalpower/100;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int tempmenu;
bool statusbar_setting;
- rb = api;
-
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
rb->lcd_set_foreground(LCD_BLACK);
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index aae2c1905b..48fceb9cf2 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -34,9 +34,7 @@ PLUGIN_HEADER
#define TESTCODEC_EXITBUTTON BUTTON_SELECT
#endif
-static const struct plugin_api* rb;
-
-CACHE_FUNCTION_WRAPPERS(rb)
+CACHE_FUNCTION_WRAPPERS
/* Log functions copied from test_disk.c */
static int line = 0;
@@ -644,7 +642,7 @@ exit:
}
/* plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int result, selection = 0;
enum plugin_status res = PLUGIN_OK;
@@ -655,8 +653,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
char dirpath[MAX_PATH];
char filename[MAX_PATH];
- rb = api;
-
if (parameter == NULL)
{
rb->splash(HZ*2, "No File");
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 085435e4c9..2fa841b314 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -36,7 +36,6 @@ PLUGIN_HEADER
#endif
#define TEST_TIME 10 /* in seconds */
-static const struct plugin_api* rb;
static unsigned char* audiobuf;
static ssize_t audiobuflen;
@@ -405,7 +404,7 @@ static bool test_speed(void)
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
static const struct menu_item items[] = {
{ "Disk speed", test_speed },
@@ -416,7 +415,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
DIR *dir;
(void)parameter;
- rb = api;
if ((dir = rb->opendir(testbasedir)) == NULL)
{
@@ -440,15 +438,15 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
rb->srand(*rb->current_tick);
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
- m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init(items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
menu_run(m);
menu_exit(m);
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
rb->rmdir(testbasedir);
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index 6d347738b7..c688a54de0 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -41,8 +41,6 @@ PLUGIN_IRAM_DECLARE
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
/* Screen logging */
static int line;
static int max_line;
@@ -286,7 +284,7 @@ static void time_greyscale(void)
int fps, load;
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- if (!grey_init(rb, gbuf, gbuf_size, GREY_ON_COP,
+ if (!grey_init(gbuf, gbuf_size, GREY_ON_COP,
LCD_WIDTH, LCD_HEIGHT, NULL))
{
log_text("greylib: out of memory.");
@@ -334,7 +332,7 @@ static void time_greyscale(void)
#endif
/* plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
#ifndef SIMULATOR
char str[32];
@@ -342,15 +340,14 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
#endif
/* standard stuff */
- PLUGIN_IRAM_INIT(api)
+ PLUGIN_IRAM_INIT(rb)
(void)parameter;
- rb = api;
log_init();
#ifndef SIMULATOR
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
#endif
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
log_text("Main LCD Update");
time_main_update();
@@ -375,7 +372,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
(cpu_freq + 500000) / 1000000);
log_text(str);
#endif
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
/* wait until user closes plugin */
while (rb->button_get(true) != FPS_QUIT);
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c
index 1b65c34f4e..84dcdae3e2 100644
--- a/apps/plugins/test_grey.c
+++ b/apps/plugins/test_grey.c
@@ -108,7 +108,6 @@ static const unsigned char dither_matrix[16][16] = {
static unsigned char input_levels[STEPS+1];
static unsigned char lcd_levels[STEPS+1];
-static const struct plugin_api* rb;
static unsigned char *gbuf;
static size_t gbuf_size = 0;
@@ -139,7 +138,7 @@ static void fill_rastered(int bx, int by, int bw, int bh, int step)
}
/* 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 done = false;
int cur_step = 1;
@@ -148,11 +147,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* standard stuff */
(void)parameter;
- rb = api;
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- if (!grey_init(rb, gbuf, gbuf_size,
+ if (!grey_init(gbuf, gbuf_size,
GREY_BUFFERED|GREY_RAWMAPPED|GREY_ON_COP,
LCD_WIDTH, LCD_HEIGHT, NULL))
{
@@ -162,7 +160,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
for (i = 0; i <= STEPS; i++)
input_levels[i] = lcd_levels[i] = (255 * i + (STEPS/2)) / STEPS;
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
grey_set_background(0); /* set background to black */
grey_clear_display();
@@ -240,6 +238,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
}
grey_release();
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}
diff --git a/apps/plugins/test_greylib_bitmap_scale.c b/apps/plugins/test_greylib_bitmap_scale.c
index 34d3cf2732..2117c6f7d4 100644
--- a/apps/plugins/test_greylib_bitmap_scale.c
+++ b/apps/plugins/test_greylib_bitmap_scale.c
@@ -35,12 +35,10 @@ GREY_INFO_STRUCT
static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT +
BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)];
-static const struct plugin_api* rb; /* global api struct pointer */
-
-MEM_FUNCTION_WRAPPERS(rb)
+MEM_FUNCTION_WRAPPERS
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
void * plugin_buf;
size_t plugin_buf_len;
@@ -54,15 +52,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
if(!parameter) return PLUGIN_ERROR;
- rb = api;
-
rb->strcpy(filename, parameter);
-#if LCD_DEPTH == 1
- bmp_init(rb);
- resize_init(rb);
-#endif
-
ret = BMP_LOAD(filename, &grey_bm, sizeof(grey_bm_buf),
FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT,
&format_grey);
@@ -74,7 +65,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
}
plugin_buf = rb->plugin_get_buffer(&plugin_buf_len);
- if(!grey_init(rb, plugin_buf, plugin_buf_len, 0, LCD_WIDTH, LCD_HEIGHT,
+ if(!grey_init(plugin_buf, plugin_buf_len, 0, LCD_WIDTH, LCD_HEIGHT,
NULL))
{
rb->splash(HZ*2,"grey init failed");
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c
index e98fa80ba5..a6a183a54b 100644
--- a/apps/plugins/test_resize.c
+++ b/apps/plugins/test_resize.c
@@ -30,8 +30,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
const struct button_mapping *plugin_contexts[]
= {generic_actions, generic_directions};
@@ -64,11 +62,10 @@ static fb_data output_bmp_data[MAX_OUTPUT_WIDTH*MAX_OUTPUT_HEIGHT];
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
b = rb->lcd_framebuffer;
rb->lcd_set_background(LCD_RGBPACK(0,0,0));
@@ -113,7 +110,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
output_bmp.height);
rb->lcd_update();
- button = pluginlib_getaction(rb, HZ,
+ button = pluginlib_getaction(HZ,
plugin_contexts, NB_ACTION_CONTEXTS);
switch (button) {
case BUTTON_QUIT:
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c
index a23b907048..edfe261ab9 100644
--- a/apps/plugins/test_sampr.c
+++ b/apps/plugins/test_sampr.c
@@ -32,8 +32,6 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE;
-const struct plugin_api *rb;
-
static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT;
static unsigned long hw_sampr IDATA_ATTR = HW_SAMPR_DEFAULT;
@@ -275,8 +273,7 @@ static void play_tone(bool volume_set)
/* Tests hardware sample rate switching */
/* TODO: needs a volume control */
-enum plugin_status plugin_start(const struct plugin_api *api,
- const void *parameter)
+enum plugin_status plugin_start(const void *parameter)
{
enum
{
@@ -304,12 +301,11 @@ enum plugin_status plugin_start(const struct plugin_api *api,
int m;
/* Disable all talking before initializing IRAM */
- api->talk_disable(true);
+ rb->talk_disable(true);
- PLUGIN_IRAM_INIT(api);
- rb = api;
+ PLUGIN_IRAM_INIT(rb);
- m = menu_init(rb, items, ARRAYLEN(items),
+ m = menu_init(items, ARRAYLEN(items),
NULL, NULL, NULL, NULL);
while (!exit)
diff --git a/apps/plugins/test_scanrate.c b/apps/plugins/test_scanrate.c
index e869d3be12..2504bd36ac 100644
--- a/apps/plugins/test_scanrate.c
+++ b/apps/plugins/test_scanrate.c
@@ -113,7 +113,6 @@ PLUGIN_HEADER
#define NEED_BOOST
#endif
-static const struct plugin_api* rb;
static unsigned char bitbuffer[2][BUF_HEIGHT][BUF_WIDTH];
static int curbuf = 0;
static int scan_rate = DEFAULT_SCAN_RATE;
@@ -216,10 +215,9 @@ int plugin_main(void)
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
return plugin_main();
}
diff --git a/apps/plugins/test_touchscreen.c b/apps/plugins/test_touchscreen.c
index 84c8e96cb5..4d0c8a6744 100644
--- a/apps/plugins/test_touchscreen.c
+++ b/apps/plugins/test_touchscreen.c
@@ -30,17 +30,14 @@ PLUGIN_HEADER
#define TOUCHSCREEN_TOGGLE BUTTON_RC_MODE
#endif
-static const struct plugin_api* rb;
-
/* plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int button = 0;
enum touchscreen_mode mode = TOUCHSCREEN_BUTTON;
/* standard stuff */
(void)parameter;
- rb = api;
rb->touchscreen_set_mode(mode);
diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c
index 50a9396372..5a2ec542cc 100644
--- a/apps/plugins/test_viewports.c
+++ b/apps/plugins/test_viewports.c
@@ -23,8 +23,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_LCD_COLOR
@@ -147,14 +145,12 @@ static struct viewport rvp1 =
#endif
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
char buf[80];
int i,y;
- rb = api;
-
rb->screens[SCREEN_MAIN]->set_viewport(&vp0);
rb->screens[SCREEN_MAIN]->clear_viewport();
rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Viewport testing plugin - this is a scrolling title");
@@ -262,12 +258,10 @@ static struct viewport vp2 =
};
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- rb = api;
-
rb->screens[SCREEN_MAIN]->set_viewport(&vp0);
rb->screens[SCREEN_MAIN]->clear_viewport();
rb->screens[SCREEN_MAIN]->puts_scroll(0,0,"Rockbox");
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index abb278728f..f03cdcfb71 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -28,7 +28,6 @@
#endif
#define MAX_LINE_LEN 2048
PLUGIN_HEADER
-static const struct plugin_api* rb;
static char buffer[MAX_CHARS];
static char eol[3];
@@ -264,7 +263,7 @@ int do_item_menu(int cur_sel, char* copy_buffer)
ret = MENU_RET_SAVE;
break;
case 6: /* playback menu */
- playback_control(rb, NULL);
+ playback_control(NULL);
ret = MENU_RET_UPDATE;
break;
default:
@@ -308,7 +307,7 @@ int hex_to_rgb(const char* hex, int* color)
#endif /* HAVE_LCD_COLOR */
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int fd;
static char temp_line[MAX_LINE_LEN];
@@ -324,8 +323,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
bool edit_colors_file = false;
#endif
- rb = api;
-
copy_buffer[0]='\0';
prev_show_statusbar = rb->global_settings->statusbar;
rb->global_settings->statusbar = false;
@@ -481,7 +478,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
case 0:
break;
case 1:
- playback_control(rb, NULL);
+ playback_control(NULL);
break;
case 2: //save to disk
save_changes(1);
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c
index 8313994e29..3e152be3fc 100644
--- a/apps/plugins/vbrfix.c
+++ b/apps/plugins/vbrfix.c
@@ -22,8 +22,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
static char *audiobuf;
static ssize_t audiobuflen;
unsigned char xingbuf[1500];
@@ -263,9 +261,8 @@ static bool vbr_fix(const char *selected_file)
return false;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter)
+enum plugin_status plugin_start(const void *parameter)
{
- rb = api;
if (!parameter)
return PLUGIN_ERROR;
diff --git a/apps/plugins/video.c b/apps/plugins/video.c
index a31b7c5415..bd2ddb5de6 100644
--- a/apps/plugins/video.c
+++ b/apps/plugins/video.c
@@ -143,7 +143,6 @@ typedef struct /* the little header for all audio blocks */
/****************** globals ******************/
-static const struct plugin_api* rb; /* here is a global api struct pointer */
static char gPrint[32]; /* a global printf buffer, saves stack */
@@ -587,7 +586,7 @@ void Cleanup(void *fd)
rb->mp3_play_stop(); /* stop audio ISR */
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
/* restore normal contrast */
rb->lcd_set_contrast(rb->global_settings->contrast);
@@ -956,7 +955,7 @@ int main(char* filename)
{
gPlay.bHasVideo = true;
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
}
/* prepare audio playback, if contained */
@@ -1014,10 +1013,8 @@ int main(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- rb = api; /* copy to global api pointer */
-
if (parameter == NULL)
{
rb->splash(HZ*2, "Play .rvf file!");
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index fd460e50e0..7e03c559f4 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -418,7 +418,6 @@ static unsigned char *screen_top_ptr;
static unsigned char *next_screen_ptr;
static unsigned char *next_screen_to_draw_ptr;
static unsigned char *next_line_ptr;
-static const struct plugin_api* rb;
#ifdef HAVE_LCD_BITMAP
static struct font *pf;
#endif
@@ -1451,7 +1450,7 @@ static bool viewer_options_menu(void)
{"Scroll Mode", scroll_mode_setting},
{"Auto-Scroll Speed", autoscroll_speed_setting },
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
result = menu_run(m);
@@ -1475,7 +1474,7 @@ static void viewer_menu(void)
{"Return", NULL },
};
- m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
+ m = menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
result=menu_show(m);
switch (result)
{
@@ -1488,7 +1487,7 @@ static void viewer_menu(void)
done = viewer_options_menu();
break;
case 2: /* playback control */
- playback_control(rb, NULL);
+ playback_control(NULL);
break;
case 3: /* return */
break;
@@ -1497,14 +1496,13 @@ static void viewer_menu(void)
viewer_draw(col);
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* file)
+enum plugin_status plugin_start(const void* file)
{
int button, i, ok;
int lastbutton = BUTTON_NONE;
bool autoscroll = false;
long old_tick;
- rb = api;
old_tick = *rb->current_tick;
/* get the plugin buffer */
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index bedf0ddc35..007be361b2 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -293,8 +293,6 @@ PLUGIN_HEADER
#endif
#endif
-const struct plugin_api* rb;
-
#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
#define mas_codec_readreg(x) rand()%MAX_PEAK
#endif
@@ -727,12 +725,11 @@ void digital_meter(void) {
rb->lcd_hline(0,LCD_WIDTH-1,half_height+3);
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
+enum plugin_status plugin_start(const void* parameter) {
int button;
int lastbutton = BUTTON_NONE;
(void) parameter;
- rb = api;
calc_scales();
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c
index 1a37ee22ec..a1d4e630b8 100644
--- a/apps/plugins/wav2wv.c
+++ b/apps/plugins/wav2wv.c
@@ -29,8 +29,6 @@ PLUGIN_HEADER
#define SAMPLES_PER_BLOCK 22050
-static const struct plugin_api* rb;
-
void *memset(void *s, int c, size_t n) {
return(rb->memset(s,c,n));
}
@@ -287,19 +285,8 @@ static int wav2wv(const char *infile)
return error;
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter)
+enum plugin_status plugin_start(const void *parameter)
{
-#ifdef RB_PROFILE
- /* This doesn't start profiling or anything, it just gives the
- * profiling functions that are compiled in someplace to call,
- * this is needed here to let this compile with profiling support
- * since it calls code from a codec that is compiled with profiling
- * support */
- profile_init(api);
-#endif
-
- rb = api;
-
if (!parameter)
return PLUGIN_ERROR;
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c
index dc0992abac..50b671f52c 100644
--- a/apps/plugins/wavplay.c
+++ b/apps/plugins/wavplay.c
@@ -3137,8 +3137,6 @@ void dma_end_isr(void) __attribute__((interrupt_handler));
/* variables */
-static const struct plugin_api *rb;
-
static unsigned char *aud_buf;
static ssize_t aud_size;
static unsigned char *plug_buf;
@@ -3649,12 +3647,10 @@ int play_file(char* filename)
}
/* plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
ssize_t buf_size;
- rb = api;
-
if (!parameter)
{
rb->splash(HZ, "Play WAV file!");
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c
index c26e2c4973..69d243e12b 100644
--- a/apps/plugins/wavrecord.c
+++ b/apps/plugins/wavrecord.c
@@ -3172,10 +3172,6 @@ enum {
void rec_tick(void) __attribute__((interrupt_handler));
-/* variables */
-
-static const struct plugin_api *rb;
-
/* settings */
struct rec_config {
int samplerate; /* index */
@@ -3749,7 +3745,7 @@ static int recording_menu(void)
}
/* plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
ssize_t buf_size;
int align;
@@ -3757,7 +3753,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
const char *recbasedir;
(void)parameter;
- rb = api;
plug_buf = rb->plugin_get_buffer(&buf_size);
if (buf_size < 6700) /* needed for i2c transfer */
@@ -3784,7 +3779,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
aud_size -= align;
aud_size &= ~3;
- configfile_init(rb);
configfile_load(cfg_filename, disk_config,
sizeof(disk_config) / sizeof(disk_config[0]),
CFGFILE_MINVERSION);
diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c
index 7a26a3911f..9de59a2525 100644
--- a/apps/plugins/wavview.c
+++ b/apps/plugins/wavview.c
@@ -22,8 +22,6 @@
PLUGIN_HEADER
-static const struct plugin_api* rb;
-
/* temp byte buffer */
uint8_t samples[10 * 1024]; /* read 10KB at the time */
@@ -354,12 +352,11 @@ void show_help(void)
rb->lcd_update();
}
-enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter)
+enum plugin_status plugin_start(const void *parameter)
{
unsigned int quit = 0;
unsigned int action = 0;
unsigned int dodisplay = 1;
- rb = api;
int retval;
if (!parameter)
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c
index 42b93c2f2e..abb2653501 100644
--- a/apps/plugins/wormlet.c
+++ b/apps/plugins/wormlet.c
@@ -462,9 +462,6 @@ static int player3_dir = EAST;
control a worm */
static int players = 1;
-/* the rockbox plugin api */
-static const struct plugin_api* rb;
-
#define SETTINGS_VERSION 1
#define SETTINGS_MIN_VERSION 1
#define SETTINGS_FILENAME "wormlet.cfg"
@@ -2468,7 +2465,7 @@ bool launch_wormlet(void)
rb->lcd_clear_display();
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
/* start the game */
while (game_result == 1)
@@ -2478,7 +2475,7 @@ bool launch_wormlet(void)
{
case 2:
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
return false;
break;
}
@@ -2490,17 +2487,15 @@ bool launch_wormlet(void)
/**
* Main entry point
*/
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
int result;
int menu_quit = 0;
int new_setting;
(void)(parameter);
- rb = api;
default_settings();
- configfile_init(rb);
if (configfile_load(SETTINGS_FILENAME, config,
sizeof(config)/sizeof(*config),
SETTINGS_MIN_VERSION ) < 0)
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index 3cf66637d1..260728cb63 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -297,9 +297,7 @@ static int speed = 6; /* CYCLETIME = (11-speed)*10 ms */
static int difficulty = 75; /* Percentage of screen that needs to be filled
* in order to win the game */
-static const struct plugin_api *rb;
-
-MEM_FUNCTION_WRAPPERS(rb);
+MEM_FUNCTION_WRAPPERS;
static bool quit = false;
@@ -1014,12 +1012,11 @@ static int xobox_loop (void)
}
/* plugin main procedure */
-enum plugin_status plugin_start (const struct plugin_api *api, const void *parameter)
+enum plugin_status plugin_start (const void *parameter)
{
int ret = PLUGIN_OK;
(void) parameter;
- rb = api;
rb->lcd_setfont (FONT_SYSFIXED);
#if LCD_DEPTH>=2
@@ -1027,7 +1024,7 @@ enum plugin_status plugin_start (const struct plugin_api *api, const void *param
#endif
/* Turn off backlight timeout */
- backlight_force_on(rb); /* backlight control in lib/helper.c */
+ backlight_force_on(); /* backlight control in lib/helper.c */
quit = false;
@@ -1038,7 +1035,7 @@ enum plugin_status plugin_start (const struct plugin_api *api, const void *param
}
/* Turn on backlight timeout (revert to settings) */
- backlight_use_settings(rb); /* backlight control in lib/helper.c */
+ backlight_use_settings(); /* backlight control in lib/helper.c */
rb->lcd_setfont (FONT_UI);
return ret;
diff --git a/apps/plugins/zxbox.c b/apps/plugins/zxbox.c
index 3c1c78f9d2..3edff78554 100644
--- a/apps/plugins/zxbox.c
+++ b/apps/plugins/zxbox.c
@@ -26,8 +26,8 @@
PLUGIN_HEADER
/* this is the plugin entry point */
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- return run_overlay(api, parameter, VIEWERS_DIR "/zxbox.ovl", "ZXBox");
+ return run_overlay(parameter, VIEWERS_DIR "/zxbox.ovl", "ZXBox");
}
#endif
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c
index bc5df48059..e304d8b52d 100644
--- a/apps/plugins/zxbox/spmain.c
+++ b/apps/plugins/zxbox/spmain.c
@@ -98,7 +98,6 @@ int spcf_read_conf_file(const char *filename)
settings.frameskip = 0;
- configfile_init(rb);
if (configfile_load(filename, config,
sizeof(config)/sizeof(*config),
SETTINGS_MIN_VERSION
@@ -143,7 +142,7 @@ static void set_keys(void){
{ "Map Fire/Jump key", NULL },
};
- m = menu_init(rb,items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -203,7 +202,7 @@ static void select_keymap(void){
{ "7658S", NULL },
};
- m = menu_init(rb,items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -268,7 +267,7 @@ static void options_menu(void){
};
- m = menu_init(rb,items, sizeof(items) / sizeof(*items),
+ m = menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
rb->button_clear_queue();
@@ -362,7 +361,7 @@ static bool zxbox_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);
rb->button_clear_queue();
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index fbb61c1352..f33b51b9f6 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -24,8 +24,6 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-const struct plugin_api* rb;
-
#include "spkey_p.h"
spkeyboard kb_mkey;
@@ -61,11 +59,10 @@ static size_t gbuf_size = 0;
long video_frames IBSS_ATTR = 0 ;
long start_time IBSS_ATTR = 0;
-enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
{
- PLUGIN_IRAM_INIT(api)
+ PLUGIN_IRAM_INIT(rb)
- rb = api;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
@@ -78,10 +75,10 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
/* get the remainder of the plugin buffer */
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
#ifdef USE_BUFFERED_GREY
- grey_init(rb, gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP, LCD_WIDTH,
+ grey_init(gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP, LCD_WIDTH,
LCD_HEIGHT, NULL);
#else
- grey_init(rb, gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
+ grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
#endif /* USE_BUFFERED_GREY */
/* switch on greyscale overlay */
grey_show(true);
diff --git a/apps/plugins/zxbox/zxconfig.h b/apps/plugins/zxbox/zxconfig.h
index d0a6c5a7ea..590da99f15 100644
--- a/apps/plugins/zxbox/zxconfig.h
+++ b/apps/plugins/zxbox/zxconfig.h
@@ -5,7 +5,6 @@
extern int load_tap;
extern bool clear_kbd;
extern bool exit_requested;
-extern const struct plugin_api* rb;
extern void press_key(int c);
extern long video_frames;
extern long start_time;