loader-initialized global plugin API:
struct plugin_api *rb is declared in PLUGIN_HEADER, and pointed to by __header.api the loader uses this pointer to initialize rb before calling entry_point entry_point is no longer passed a pointer to the plugin API all plugins, and pluginlib functions, are modified to refer to the global rb pluginlib functions which only served to copy the API pointer are removed git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19776 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
35677cbc54
commit
23d9812273
179 changed files with 586 additions and 1183 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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! */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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! */
|
||||
|
|
|
@ -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!");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#ifndef _CLOCK_
|
||||
#define _CLOCK_
|
||||
#include "clock_settings.h"
|
||||
extern const struct plugin_api* rb;
|
||||
|
||||
struct time{
|
||||
int year, day, month;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ();
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "autoconf.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
extern const struct plugin_api* rb;
|
||||
extern bool noprintf;
|
||||
extern bool doomexit;
|
||||
|
||||
|
|
|
@ -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*/
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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!");
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'|
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#ifndef _VLC_MD5_H
|
||||
# define _VLC_MD5_H
|
||||
|
||||
void md5_init( const struct plugin_api * );
|
||||
|
||||
/*****************************************************************************
|
||||
* md5_s: MD5 message structure
|
||||
*****************************************************************************
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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__ */
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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[]=
|
||||
{
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "plugin.h"
|
||||
#include "midiutil.h"
|
||||
|
||||
extern struct plugin_api * rb;
|
||||
|
||||
struct Track * readTrack(int file);
|
||||
int readID(int file);
|
||||
|
||||
|
|
|
@ -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 ");
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "midiutil.h"
|
||||
#include "synth.h"
|
||||
|
||||
extern struct plugin_api * rb;
|
||||
|
||||
void readTextBlock(int file, char * buf)
|
||||
{
|
||||
char c = 0;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
|
||||
#include "mpeg2dec_config.h"
|
||||
|
||||
extern const struct plugin_api* rb;
|
||||
|
||||
#include "mpeg2.h"
|
||||
#include "attributes.h"
|
||||
#include "mpeg2_internal.h"
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "mpeg2dec_config.h"
|
||||
|
||||
extern const struct plugin_api* rb;
|
||||
|
||||
#include "mpeg2.h"
|
||||
#include "attributes.h"
|
||||
#include "mpeg2_internal.h"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue