diff options
author | Steve Bavin <pondlife@pondlife.me> | 2008-05-13 09:57:56 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2008-05-13 09:57:56 +0000 |
commit | 652657781805d9cc10d744a49fb23eb17019fbbf (patch) | |
tree | 2d1a6ae597a17531f726b57fd9f8cbaa2a46a07f | |
parent | a94e40d5153ab698fa8a1b6b57d91fcb6acc905e (diff) | |
download | rockbox-652657781805d9cc10d744a49fb23eb17019fbbf.tar.gz rockbox-652657781805d9cc10d744a49fb23eb17019fbbf.zip |
Plugin parameters should be const.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17492 a1c6a512-1295-4272-9138-f99709370657
159 files changed, 363 insertions, 371 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 230013e127..10ac016e3a 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -600,7 +600,7 @@ static const struct plugin_api rockbox_api = { | |||
600 | #endif /* HAVE_BUTTON_LIGHT */ | 600 | #endif /* HAVE_BUTTON_LIGHT */ |
601 | }; | 601 | }; |
602 | 602 | ||
603 | int plugin_load(const char* plugin, void* parameter) | 603 | int plugin_load(const char* plugin, const void* parameter) |
604 | { | 604 | { |
605 | int rc; | 605 | int rc; |
606 | struct plugin_header *hdr; | 606 | struct plugin_header *hdr; |
@@ -719,8 +719,7 @@ int plugin_load(const char* plugin, void* parameter) | |||
719 | 719 | ||
720 | invalidate_icache(); | 720 | invalidate_icache(); |
721 | 721 | ||
722 | rc = hdr->entry_point((struct plugin_api*) &rockbox_api, parameter); | 722 | rc = hdr->entry_point(&rockbox_api, parameter); |
723 | /* explicitly casting the pointer here to avoid touching every plugin. */ | ||
724 | 723 | ||
725 | button_clear_queue(); | 724 | button_clear_queue(); |
726 | 725 | ||
diff --git a/apps/plugin.h b/apps/plugin.h index 1562fe640f..87b129319a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -120,12 +120,12 @@ | |||
120 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 120 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
121 | 121 | ||
122 | /* increase this every time the api struct changes */ | 122 | /* increase this every time the api struct changes */ |
123 | #define PLUGIN_API_VERSION 111 | 123 | #define PLUGIN_API_VERSION 112 |
124 | 124 | ||
125 | /* update this to latest version if a change to the api struct breaks | 125 | /* update this to latest version if a change to the api struct breaks |
126 | backwards compatibility (and please take the opportunity to sort in any | 126 | backwards compatibility (and please take the opportunity to sort in any |
127 | new function which are "waiting" at the end of the function table) */ | 127 | new function which are "waiting" at the end of the function table) */ |
128 | #define PLUGIN_MIN_API_VERSION 108 | 128 | #define PLUGIN_MIN_API_VERSION 112 |
129 | 129 | ||
130 | /* plugin return codes */ | 130 | /* plugin return codes */ |
131 | enum plugin_status { | 131 | enum plugin_status { |
@@ -291,7 +291,7 @@ struct plugin_api { | |||
291 | void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen); | 291 | void (*viewport_set_defaults)(struct viewport *vp, enum screen_type screen); |
292 | /* list */ | 292 | /* list */ |
293 | void (*gui_synclist_init)(struct gui_synclist * lists, | 293 | void (*gui_synclist_init)(struct gui_synclist * lists, |
294 | list_get_name callback_get_item_name,void * data, | 294 | list_get_name callback_get_item_name, void * data, |
295 | bool scroll_all,int selected_size, | 295 | bool scroll_all,int selected_size, |
296 | struct viewport parent[NB_SCREENS]); | 296 | struct viewport parent[NB_SCREENS]); |
297 | void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); | 297 | void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); |
@@ -754,7 +754,7 @@ struct plugin_header { | |||
754 | unsigned short api_version; | 754 | unsigned short api_version; |
755 | unsigned char *load_addr; | 755 | unsigned char *load_addr; |
756 | unsigned char *end_addr; | 756 | unsigned char *end_addr; |
757 | enum plugin_status(*entry_point)(struct plugin_api*, void*); | 757 | enum plugin_status(*entry_point)(const struct plugin_api*, const void*); |
758 | }; | 758 | }; |
759 | 759 | ||
760 | #ifdef PLUGIN | 760 | #ifdef PLUGIN |
@@ -792,7 +792,7 @@ extern unsigned char plugin_end_addr[]; | |||
792 | #endif /* PLUGIN_USE_IRAM */ | 792 | #endif /* PLUGIN_USE_IRAM */ |
793 | #endif /* PLUGIN */ | 793 | #endif /* PLUGIN */ |
794 | 794 | ||
795 | int plugin_load(const char* plugin, void* parameter); | 795 | int plugin_load(const char* plugin, const void* parameter); |
796 | void* plugin_get_buffer(size_t *buffer_size); | 796 | void* plugin_get_buffer(size_t *buffer_size); |
797 | void* plugin_get_audio_buffer(size_t *buffer_size); | 797 | void* plugin_get_audio_buffer(size_t *buffer_size); |
798 | #ifdef PLUGIN_USE_IRAM | 798 | #ifdef PLUGIN_USE_IRAM |
@@ -806,7 +806,7 @@ void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, | |||
806 | void plugin_tsr(bool (*exit_callback)(bool reenter)); | 806 | void plugin_tsr(bool (*exit_callback)(bool reenter)); |
807 | 807 | ||
808 | /* defined by the plugin */ | 808 | /* defined by the plugin */ |
809 | enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter) | 809 | enum plugin_status plugin_start(const struct plugin_api* rockbox, const void* parameter) |
810 | NO_PROF_ATTR; | 810 | NO_PROF_ATTR; |
811 | 811 | ||
812 | /* Use this macro in plugins where gcc tries to optimize by calling | 812 | /* Use this macro in plugins where gcc tries to optimize by calling |
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index 89fc8401ac..6f921e3af8 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c | |||
@@ -133,8 +133,8 @@ void sound_neutral(void); /* set to everything flat and 0 dB volume */ | |||
133 | void sound_normal(void); /* return to user settings */ | 133 | void sound_normal(void); /* return to user settings */ |
134 | 134 | ||
135 | void thread(void); /* the thread running it all */ | 135 | void thread(void); /* the thread running it all */ |
136 | int main(void* parameter); /* main loop */ | 136 | int main(const void* parameter); /* main loop */ |
137 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter); /* entry */ | 137 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter); /* entry */ |
138 | 138 | ||
139 | 139 | ||
140 | /****************** data types ******************/ | 140 | /****************** data types ******************/ |
@@ -207,7 +207,7 @@ struct | |||
207 | struct thread_entry *thread; /* worker thread id */ | 207 | struct thread_entry *thread; /* worker thread id */ |
208 | } gTread; | 208 | } gTread; |
209 | 209 | ||
210 | static struct plugin_api* rb; /* here is the global API struct pointer */ | 210 | static const struct plugin_api* rb; /* here is the global API struct pointer */ |
211 | 211 | ||
212 | 212 | ||
213 | /****************** implementation ******************/ | 213 | /****************** implementation ******************/ |
@@ -1133,7 +1133,7 @@ bool exit_tsr(bool reenter) | |||
1133 | /****************** main ******************/ | 1133 | /****************** main ******************/ |
1134 | 1134 | ||
1135 | 1135 | ||
1136 | int main(void* parameter) | 1136 | int main(const void* parameter) |
1137 | { | 1137 | { |
1138 | (void)parameter; | 1138 | (void)parameter; |
1139 | #ifdef DEBUG | 1139 | #ifdef DEBUG |
@@ -1189,7 +1189,7 @@ int main(void* parameter) | |||
1189 | /***************** Plugin Entry Point *****************/ | 1189 | /***************** Plugin Entry Point *****************/ |
1190 | 1190 | ||
1191 | 1191 | ||
1192 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1192 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1193 | { | 1193 | { |
1194 | rb = api; /* copy to global api pointer */ | 1194 | rb = api; /* copy to global api pointer */ |
1195 | 1195 | ||
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index e2f76062c6..de92c91fa3 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -169,14 +169,14 @@ PLUGIN_HEADER | |||
169 | #endif | 169 | #endif |
170 | 170 | ||
171 | /****************************** Plugin Entry Point ****************************/ | 171 | /****************************** Plugin Entry Point ****************************/ |
172 | static struct plugin_api* rb; | 172 | static const struct plugin_api* rb; |
173 | MEM_FUNCTION_WRAPPERS(rb); | 173 | MEM_FUNCTION_WRAPPERS(rb); |
174 | int main(void); | 174 | int main(void); |
175 | bool exit_tsr(bool); | 175 | bool exit_tsr(bool); |
176 | void thread(void); | 176 | void thread(void); |
177 | 177 | ||
178 | 178 | ||
179 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 179 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
180 | { | 180 | { |
181 | (void)parameter; | 181 | (void)parameter; |
182 | rb = api; | 182 | rb = api; |
diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c index e24c8e7d0c..7cc7c167f9 100644 --- a/apps/plugins/beatbox/beatbox.c +++ b/apps/plugins/beatbox/beatbox.c | |||
@@ -178,7 +178,7 @@ const unsigned char * drumNames[]={ | |||
178 | long gmbuf[BUF_SIZE*NBUF]; | 178 | long gmbuf[BUF_SIZE*NBUF]; |
179 | 179 | ||
180 | int quit=0; | 180 | int quit=0; |
181 | struct plugin_api * rb; | 181 | const struct plugin_api * rb; |
182 | 182 | ||
183 | 183 | ||
184 | #define STATE_STOPPED 0 | 184 | #define STATE_STOPPED 0 |
@@ -232,7 +232,7 @@ int editState=EDITSTATE_PATTERN; | |||
232 | int playState=STATE_STOPPED, stepFlag=0; | 232 | int playState=STATE_STOPPED, stepFlag=0; |
233 | 233 | ||
234 | 234 | ||
235 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 235 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
236 | { | 236 | { |
237 | int retval = 0; | 237 | int retval = 0; |
238 | 238 | ||
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index c3d4926683..a23a833128 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -313,7 +313,7 @@ extern const fb_data card_back[]; | |||
313 | #define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]] | 313 | #define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]] |
314 | 314 | ||
315 | /* global rockbox api */ | 315 | /* global rockbox api */ |
316 | static struct plugin_api* rb; | 316 | static const struct plugin_api* rb; |
317 | 317 | ||
318 | MEM_FUNCTION_WRAPPERS(rb); | 318 | MEM_FUNCTION_WRAPPERS(rb); |
319 | 319 | ||
@@ -1529,7 +1529,8 @@ static int blackjack(struct game_context* bj) { | |||
1529 | /***************************************************************************** | 1529 | /***************************************************************************** |
1530 | * plugin entry point. | 1530 | * plugin entry point. |
1531 | ******************************************************************************/ | 1531 | ******************************************************************************/ |
1532 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 1532 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1533 | { | ||
1533 | struct game_context bj; | 1534 | struct game_context bj; |
1534 | bool exit = false; | 1535 | bool exit = false; |
1535 | unsigned int position; | 1536 | unsigned int position; |
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c index c8a40dec4a..7ad73f6aa4 100644 --- a/apps/plugins/bounce.c +++ b/apps/plugins/bounce.c | |||
@@ -167,7 +167,7 @@ PLUGIN_HEADER | |||
167 | #endif | 167 | #endif |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | static struct plugin_api* rb; | 170 | static const struct plugin_api* rb; |
171 | 171 | ||
172 | #define LETTER_WIDTH 11 | 172 | #define LETTER_WIDTH 11 |
173 | #define LETTER_HEIGHT 16 | 173 | #define LETTER_HEIGHT 16 |
@@ -573,7 +573,7 @@ static int loopit(void) | |||
573 | } | 573 | } |
574 | 574 | ||
575 | 575 | ||
576 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 576 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
577 | { | 577 | { |
578 | int w, h; | 578 | int w, h; |
579 | char *off = "[Off] to stop"; | 579 | char *off = "[Off] to stop"; |
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index f0059ba633..756b4de0ec 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -195,7 +195,7 @@ PLUGIN_HEADER | |||
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | 197 | ||
198 | static struct plugin_api* rb; | 198 | static const struct plugin_api* rb; |
199 | 199 | ||
200 | enum menu_items { | 200 | enum menu_items { |
201 | BM_START, | 201 | BM_START, |
@@ -2015,7 +2015,7 @@ int game_loop(void) | |||
2015 | } | 2015 | } |
2016 | 2016 | ||
2017 | /* this is the plugin entry point */ | 2017 | /* this is the plugin entry point */ |
2018 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 2018 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
2019 | { | 2019 | { |
2020 | (void)parameter; | 2020 | (void)parameter; |
2021 | rb = api; | 2021 | rb = api; |
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index bc76c15962..32e921338f 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c | |||
@@ -192,7 +192,7 @@ PLUGIN_HEADER | |||
192 | #define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10) | 192 | #define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10) |
193 | 193 | ||
194 | /* global rockbox api */ | 194 | /* global rockbox api */ |
195 | static struct plugin_api* rb; | 195 | static const struct plugin_api* rb; |
196 | 196 | ||
197 | /* levels */ | 197 | /* levels */ |
198 | char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = { | 198 | char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = { |
@@ -2585,7 +2585,7 @@ static int bubbles(struct game_context* bb) { | |||
2585 | /***************************************************************************** | 2585 | /***************************************************************************** |
2586 | * plugin entry point. | 2586 | * plugin entry point. |
2587 | ******************************************************************************/ | 2587 | ******************************************************************************/ |
2588 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 2588 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
2589 | struct game_context bb; | 2589 | struct game_context bb; |
2590 | bool exit = false; | 2590 | bool exit = false; |
2591 | int position; | 2591 | int position; |
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 89bec041c9..47facaadf4 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c | |||
@@ -290,7 +290,7 @@ PLUGIN_HEADER | |||
290 | #endif | 290 | #endif |
291 | #endif | 291 | #endif |
292 | 292 | ||
293 | static struct plugin_api* rb; | 293 | static const struct plugin_api* rb; |
294 | MEM_FUNCTION_WRAPPERS(rb); | 294 | MEM_FUNCTION_WRAPPERS(rb); |
295 | 295 | ||
296 | enum { | 296 | enum { |
@@ -1536,7 +1536,7 @@ void sciButtonsProcess(void){ | |||
1536 | /* ----------------------------------------------------------------------- | 1536 | /* ----------------------------------------------------------------------- |
1537 | Main(); | 1537 | Main(); |
1538 | ----------------------------------------------------------------------- */ | 1538 | ----------------------------------------------------------------------- */ |
1539 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1539 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1540 | { | 1540 | { |
1541 | (void)parameter; | 1541 | (void)parameter; |
1542 | rb = api; | 1542 | rb = api; |
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 8798406b2e..70ca2b4b17 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | PLUGIN_HEADER | 26 | PLUGIN_HEADER |
27 | 27 | ||
28 | static struct plugin_api* rb; | 28 | static const struct plugin_api* rb; |
29 | 29 | ||
30 | static bool leap_year; | 30 | static bool leap_year; |
31 | static int days_in_month[2][13] = { | 31 | static int days_in_month[2][13] = { |
@@ -659,7 +659,7 @@ static void prev_day(struct shown *shown, int step) | |||
659 | draw_calendar(shown); | 659 | draw_calendar(shown); |
660 | } | 660 | } |
661 | 661 | ||
662 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 662 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
663 | { | 663 | { |
664 | struct today today; | 664 | struct today today; |
665 | struct shown shown; | 665 | struct shown shown; |
diff --git a/apps/plugins/chessbox.c b/apps/plugins/chessbox.c index fc3b703b2c..e6fca80a70 100644 --- a/apps/plugins/chessbox.c +++ b/apps/plugins/chessbox.c | |||
@@ -27,7 +27,7 @@ | |||
27 | PLUGIN_HEADER | 27 | PLUGIN_HEADER |
28 | 28 | ||
29 | /* this is the plugin entry point */ | 29 | /* this is the plugin entry point */ |
30 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 30 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
31 | { | 31 | { |
32 | return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox"); | 32 | return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox"); |
33 | } | 33 | } |
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index f9e1020461..a90ddd68cb 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c | |||
@@ -902,7 +902,7 @@ void cb_play_game(void) { | |||
902 | /***************************************************************************** | 902 | /***************************************************************************** |
903 | * plugin entry point. | 903 | * plugin entry point. |
904 | ******************************************************************************/ | 904 | ******************************************************************************/ |
905 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 905 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
906 | 906 | ||
907 | /* plugin init */ | 907 | /* plugin init */ |
908 | 908 | ||
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 94bda2eaaa..a2b05af255 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" | 24 | #define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" |
25 | int loghandler; | 25 | int loghandler; |
26 | 26 | ||
27 | struct plugin_api* rb; | 27 | const struct plugin_api* rb; |
28 | 28 | ||
29 | short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; | 29 | short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; |
30 | short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; | 30 | short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; |
@@ -556,7 +556,7 @@ void write_pgn_token(int fhandler, char *buffer, size_t *line_length){ | |||
556 | } | 556 | } |
557 | 557 | ||
558 | /* ---- api functions ---- */ | 558 | /* ---- api functions ---- */ |
559 | struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename){ | 559 | struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* filename){ |
560 | int fhandler; | 560 | int fhandler; |
561 | char line_buffer[128]; | 561 | char line_buffer[128]; |
562 | struct pgn_game_node size_node, *first_game = NULL; | 562 | struct pgn_game_node size_node, *first_game = NULL; |
@@ -614,7 +614,7 @@ struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename | |||
614 | return first_game; | 614 | return first_game; |
615 | } | 615 | } |
616 | 616 | ||
617 | struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, | 617 | struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api, |
618 | struct pgn_game_node* first_game){ | 618 | struct pgn_game_node* first_game){ |
619 | int curr_selection = 0; | 619 | int curr_selection = 0; |
620 | int button; | 620 | int button; |
@@ -659,7 +659,7 @@ struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, | |||
659 | } | 659 | } |
660 | } | 660 | } |
661 | 661 | ||
662 | void pgn_parse_game(struct plugin_api* api, const char* filename, | 662 | void pgn_parse_game(const struct plugin_api* api, const char* filename, |
663 | struct pgn_game_node* selected_game){ | 663 | struct pgn_game_node* selected_game){ |
664 | struct pgn_ply_node size_ply, *first_ply = NULL; | 664 | struct pgn_ply_node size_ply, *first_ply = NULL; |
665 | struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL; | 665 | struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL; |
@@ -729,7 +729,7 @@ void pgn_parse_game(struct plugin_api* api, const char* filename, | |||
729 | rb->close(fhandler); | 729 | rb->close(fhandler); |
730 | } | 730 | } |
731 | 731 | ||
732 | struct pgn_game_node* pgn_init_game(struct plugin_api* api){ | 732 | struct pgn_game_node* pgn_init_game(const struct plugin_api* api){ |
733 | struct pgn_game_node game_size, *game; | 733 | struct pgn_game_node game_size, *game; |
734 | struct pgn_ply_node ply_size, *ply; | 734 | struct pgn_ply_node ply_size, *ply; |
735 | struct tm *current_time; | 735 | struct tm *current_time; |
@@ -767,7 +767,7 @@ struct pgn_game_node* pgn_init_game(struct plugin_api* api){ | |||
767 | return game; | 767 | return game; |
768 | } | 768 | } |
769 | 769 | ||
770 | void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, | 770 | void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game, |
771 | unsigned short ply_player, char *move_buffer, bool is_mate){ | 771 | unsigned short ply_player, char *move_buffer, bool is_mate){ |
772 | struct pgn_ply_node ply_size, *ply, *temp; | 772 | struct pgn_ply_node ply_size, *ply, *temp; |
773 | 773 | ||
@@ -801,7 +801,7 @@ void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, | |||
801 | temp->prev_node = ply; | 801 | temp->prev_node = ply; |
802 | } | 802 | } |
803 | 803 | ||
804 | void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, | 804 | void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game, |
805 | bool is_mate){ | 805 | bool is_mate){ |
806 | 806 | ||
807 | rb = api; | 807 | rb = api; |
@@ -815,7 +815,7 @@ void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, | |||
815 | } | 815 | } |
816 | } | 816 | } |
817 | 817 | ||
818 | void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game){ | 818 | void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game){ |
819 | int fhandler; | 819 | int fhandler; |
820 | struct pgn_ply_node *ply; | 820 | struct pgn_ply_node *ply; |
821 | unsigned ply_count; | 821 | unsigned ply_count; |
diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h index 672bacaf6e..a457619887 100644 --- a/apps/plugins/chessbox/chessbox_pgn.h +++ b/apps/plugins/chessbox/chessbox_pgn.h | |||
@@ -350,35 +350,35 @@ struct pgn_game_node { | |||
350 | * the user selects a game, that obviously saves processing | 350 | * the user selects a game, that obviously saves processing |
351 | * and speeds up response when the user selects the file | 351 | * and speeds up response when the user selects the file |
352 | */ | 352 | */ |
353 | struct pgn_game_node* pgn_list_games(struct plugin_api* api, | 353 | struct pgn_game_node* pgn_list_games(const struct plugin_api* api, |
354 | const char* filename); | 354 | const char* filename); |
355 | 355 | ||
356 | /* Show the list of games found in a file and allow the user | 356 | /* Show the list of games found in a file and allow the user |
357 | * to select a game to be parsed and showed | 357 | * to select a game to be parsed and showed |
358 | */ | 358 | */ |
359 | struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, | 359 | struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api, |
360 | struct pgn_game_node* first_game); | 360 | struct pgn_game_node* first_game); |
361 | 361 | ||
362 | /* Parse the pgn string of a game and assign it to the move | 362 | /* Parse the pgn string of a game and assign it to the move |
363 | * list in the structure | 363 | * list in the structure |
364 | */ | 364 | */ |
365 | void pgn_parse_game(struct plugin_api* api, const char* filename, | 365 | void pgn_parse_game(const struct plugin_api* api, const char* filename, |
366 | struct pgn_game_node* selected_game); | 366 | struct pgn_game_node* selected_game); |
367 | 367 | ||
368 | /* Initialize a new game structure with default values and make | 368 | /* Initialize a new game structure with default values and make |
369 | * it ready to store the history of a newly played match | 369 | * it ready to store the history of a newly played match |
370 | */ | 370 | */ |
371 | struct pgn_game_node* pgn_init_game(struct plugin_api* api); | 371 | struct pgn_game_node* pgn_init_game(const struct plugin_api* api); |
372 | 372 | ||
373 | /* Add a new ply to the game structure based on the positions */ | 373 | /* Add a new ply to the game structure based on the positions */ |
374 | void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, | 374 | void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game, |
375 | unsigned short ply_player, char *move_buffer, bool is_mate); | 375 | unsigned short ply_player, char *move_buffer, bool is_mate); |
376 | 376 | ||
377 | /* Set the result of the game if it was reached during the opponent's ply | 377 | /* Set the result of the game if it was reached during the opponent's ply |
378 | */ | 378 | */ |
379 | void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, | 379 | void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game, |
380 | bool is_mate); | 380 | bool is_mate); |
381 | 381 | ||
382 | /* Store a complete game in the PGN history file | 382 | /* Store a complete game in the PGN history file |
383 | */ | 383 | */ |
384 | void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game); | 384 | void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game); |
diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c index 3574dd6fbe..51e200d0f2 100644 --- a/apps/plugins/chessbox/gnuchess.c +++ b/apps/plugins/chessbox/gnuchess.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) | 64 | #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) |
65 | 65 | ||
66 | /* ---- RockBox datatypes and variables */ | 66 | /* ---- RockBox datatypes and variables */ |
67 | struct plugin_api* rb; | 67 | const struct plugin_api* rb; |
68 | 68 | ||
69 | /* ---- Chess datatypes and variables ---- */ | 69 | /* ---- Chess datatypes and variables ---- */ |
70 | struct leaf | 70 | struct leaf |
diff --git a/apps/plugins/chessbox/gnuchess.h b/apps/plugins/chessbox/gnuchess.h index 6a4a6bdd4e..b80647a287 100644 --- a/apps/plugins/chessbox/gnuchess.h +++ b/apps/plugins/chessbox/gnuchess.h | |||
@@ -44,7 +44,7 @@ extern struct TimeControlRec TimeControl; | |||
44 | extern struct GameRec GameList[240]; | 44 | extern struct GameRec GameList[240]; |
45 | 45 | ||
46 | /* ---- RockBox integration ---- */ | 46 | /* ---- RockBox integration ---- */ |
47 | extern struct plugin_api* rb; | 47 | extern const struct plugin_api* rb; |
48 | 48 | ||
49 | /* ---- The beginning of a GNUChess v2 APIfication ---- */ | 49 | /* ---- The beginning of a GNUChess v2 APIfication ---- */ |
50 | void SetTimeControl(void); | 50 | void SetTimeControl(void); |
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index d3e39e04ad..0235473438 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c | |||
@@ -224,7 +224,7 @@ PLUGIN_HEADER | |||
224 | /* here is a global api struct pointer. while not strictly necessary, | 224 | /* here is a global api struct pointer. while not strictly necessary, |
225 | it's nice not to have to pass the api pointer in all function calls | 225 | it's nice not to have to pass the api pointer in all function calls |
226 | in the plugin */ | 226 | in the plugin */ |
227 | static struct plugin_api* rb; | 227 | static const struct plugin_api* rb; |
228 | MEM_FUNCTION_WRAPPERS(rb); | 228 | MEM_FUNCTION_WRAPPERS(rb); |
229 | #define MAX_PLAYERS 10 | 229 | #define MAX_PLAYERS 10 |
230 | 230 | ||
@@ -257,7 +257,7 @@ static bool pause; | |||
257 | #define MAX_TIME 7200 | 257 | #define MAX_TIME 7200 |
258 | 258 | ||
259 | /* this is the plugin entry point */ | 259 | /* this is the plugin entry point */ |
260 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 260 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
261 | { | 261 | { |
262 | int i; | 262 | int i; |
263 | bool done; | 263 | bool done; |
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index e00e4213e8..d62ff5a7bf 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | PLUGIN_HEADER | 25 | PLUGIN_HEADER |
26 | 26 | ||
27 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 27 | static const struct plugin_api* rb; /* here is a global api struct pointer */ |
28 | 28 | ||
29 | #define EXTERN static | 29 | #define EXTERN static |
30 | #define STATIC static | 30 | #define STATIC static |
@@ -1287,7 +1287,7 @@ static void chip8_interrupt (void) | |||
1287 | starttimer = newtimer - runtime; | 1287 | starttimer = newtimer - runtime; |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | static bool chip8_init(char* file) | 1290 | static bool chip8_init(const char* file) |
1291 | { | 1291 | { |
1292 | int numread; | 1292 | int numread; |
1293 | int fd; | 1293 | int fd; |
@@ -1307,14 +1307,16 @@ static bool chip8_init(char* file) | |||
1307 | 1307 | ||
1308 | rb->close(fd); | 1308 | rb->close(fd); |
1309 | /* is there a c8k file (chip8 keys) ? */ | 1309 | /* is there a c8k file (chip8 keys) ? */ |
1310 | char c8kname[MAX_PATH]; | ||
1311 | rb->strcpy(c8kname, file); | ||
1310 | for(i=0; i<16; i++) { | 1312 | for(i=0; i<16; i++) { |
1311 | chip8_virtual_keys[i] = 0; | 1313 | chip8_virtual_keys[i] = 0; |
1312 | chip8_keymap[i] = i; | 1314 | chip8_keymap[i] = i; |
1313 | } | 1315 | } |
1314 | len = rb->strlen(file); | 1316 | len = rb->strlen(c8kname); |
1315 | file[len-2] = '8'; | 1317 | c8kname[len-2] = '8'; |
1316 | file[len-1] = 'k'; | 1318 | c8kname[len-1] = 'k'; |
1317 | fd = rb->open(file, O_RDONLY); | 1319 | fd = rb->open(c8kname, O_RDONLY); |
1318 | if (fd!=-1) { | 1320 | if (fd!=-1) { |
1319 | rb->lcd_puts(0, 6, "File&Keymap OK."); | 1321 | rb->lcd_puts(0, 6, "File&Keymap OK."); |
1320 | numread = rb->read(fd, chip8_keymap, 16); | 1322 | numread = rb->read(fd, chip8_keymap, 16); |
@@ -1340,7 +1342,7 @@ static bool chip8_init(char* file) | |||
1340 | return true; | 1342 | return true; |
1341 | } | 1343 | } |
1342 | 1344 | ||
1343 | bool chip8_run(char* file) | 1345 | bool chip8_run(const char* file) |
1344 | { | 1346 | { |
1345 | int ok; | 1347 | int ok; |
1346 | 1348 | ||
@@ -1406,9 +1408,9 @@ bool chip8_run(char* file) | |||
1406 | 1408 | ||
1407 | /***************** Plugin Entry Point *****************/ | 1409 | /***************** Plugin Entry Point *****************/ |
1408 | 1410 | ||
1409 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1411 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1410 | { | 1412 | { |
1411 | char* filename; | 1413 | const char* filename; |
1412 | 1414 | ||
1413 | rb = api; /* copy to global api pointer */ | 1415 | rb = api; /* copy to global api pointer */ |
1414 | 1416 | ||
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 2ab7c09d1c..09d281ea81 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c | |||
@@ -125,7 +125,7 @@ Still To do: | |||
125 | #endif | 125 | #endif |
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | static struct plugin_api* rb; | 128 | static const struct plugin_api* rb; |
129 | 129 | ||
130 | #define NUMBER_OF_BLOCKS 8 | 130 | #define NUMBER_OF_BLOCKS 8 |
131 | #define NUMBER_OF_PARTICLES 3 | 131 | #define NUMBER_OF_PARTICLES 3 |
@@ -979,7 +979,7 @@ void chopper_load(bool newgame) | |||
979 | } | 979 | } |
980 | 980 | ||
981 | /* this is the plugin entry point */ | 981 | /* this is the plugin entry point */ |
982 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 982 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
983 | { | 983 | { |
984 | (void)parameter; | 984 | (void)parameter; |
985 | rb = api; | 985 | rb = api; |
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c index 07057d21b2..588112cf63 100644 --- a/apps/plugins/clock/clock.c +++ b/apps/plugins/clock/clock.c | |||
@@ -54,7 +54,7 @@ const struct button_mapping* plugin_contexts[]={ | |||
54 | #define ACTION_SKIN_PREV PLA_DEC | 54 | #define ACTION_SKIN_PREV PLA_DEC |
55 | #define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT | 55 | #define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT |
56 | 56 | ||
57 | extern struct plugin_api* rb; | 57 | extern const struct plugin_api* rb; |
58 | 58 | ||
59 | /************************** | 59 | /************************** |
60 | * Cleanup on plugin return | 60 | * Cleanup on plugin return |
@@ -109,7 +109,7 @@ void format_date(char* buffer, struct time* time, enum date_format format){ | |||
109 | /********************************************************************** | 109 | /********************************************************************** |
110 | * Plugin starts here | 110 | * Plugin starts here |
111 | **********************************************************************/ | 111 | **********************************************************************/ |
112 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ | 112 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){ |
113 | int button; | 113 | int button; |
114 | int last_second = -1; | 114 | int last_second = -1; |
115 | bool redraw=true; | 115 | bool redraw=true; |
diff --git a/apps/plugins/clock/clock.h b/apps/plugins/clock/clock.h index eeb04380a2..76822ec162 100644 --- a/apps/plugins/clock/clock.h +++ b/apps/plugins/clock/clock.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #ifndef _CLOCK_ | 20 | #ifndef _CLOCK_ |
21 | #define _CLOCK_ | 21 | #define _CLOCK_ |
22 | #include "clock_settings.h" | 22 | #include "clock_settings.h" |
23 | extern struct plugin_api* rb; | 23 | extern const struct plugin_api* rb; |
24 | 24 | ||
25 | struct time{ | 25 | struct time{ |
26 | int year, day, month; | 26 | int year, day, month; |
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c index c0967c6235..dc19e0ebff 100644 --- a/apps/plugins/credits.c +++ b/apps/plugins/credits.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | 23 | ||
24 | static struct plugin_api* rb; | 24 | static const struct plugin_api* rb; |
25 | 25 | ||
26 | const char* const credits[] = { | 26 | const char* const credits[] = { |
27 | #include "credits.raw" /* generated list of names from docs/CREDITS */ | 27 | #include "credits.raw" /* generated list of names from docs/CREDITS */ |
@@ -367,7 +367,7 @@ void roll_credits(void) | |||
367 | 367 | ||
368 | #endif | 368 | #endif |
369 | 369 | ||
370 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 370 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
371 | { | 371 | { |
372 | (void)parameter; | 372 | (void)parameter; |
373 | rb = api; | 373 | rb = api; |
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index aed27329ec..bc5564b473 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c | |||
@@ -425,7 +425,7 @@ static long matrice[3][3]; | |||
425 | static const int nb_points = 8; | 425 | static const int nb_points = 8; |
426 | static long z_off = 600; | 426 | static long z_off = 600; |
427 | 427 | ||
428 | static struct plugin_api* rb; | 428 | static const struct plugin_api* rb; |
429 | 429 | ||
430 | static void cube_rotate(int xa, int ya, int za) | 430 | static void cube_rotate(int xa, int ya, int za) |
431 | { | 431 | { |
@@ -580,7 +580,7 @@ void cleanup(void *parameter) | |||
580 | #endif | 580 | #endif |
581 | } | 581 | } |
582 | 582 | ||
583 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 583 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
584 | { | 584 | { |
585 | char buffer[30]; | 585 | char buffer[30]; |
586 | int t_disp = 0; | 586 | int t_disp = 0; |
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c index 580783f18d..df92184b08 100644 --- a/apps/plugins/demystify.c +++ b/apps/plugins/demystify.c | |||
@@ -65,7 +65,7 @@ struct line_color | |||
65 | 65 | ||
66 | /******************************* Globals ***********************************/ | 66 | /******************************* Globals ***********************************/ |
67 | 67 | ||
68 | static struct plugin_api* rb; /* global api struct pointer */ | 68 | static const struct plugin_api* rb; /* global api struct pointer */ |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Compute a new random step to make the point bounce the borders of the screen | 71 | * Compute a new random step to make the point bounce the borders of the screen |
@@ -424,7 +424,7 @@ int plugin_main(void) | |||
424 | 424 | ||
425 | /*************************** Plugin entry point ****************************/ | 425 | /*************************** Plugin entry point ****************************/ |
426 | 426 | ||
427 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 427 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
428 | { | 428 | { |
429 | int ret; | 429 | int ret; |
430 | 430 | ||
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c index 7688d91a07..cde89e1144 100644 --- a/apps/plugins/dice.c +++ b/apps/plugins/dice.c | |||
@@ -44,7 +44,7 @@ struct dices | |||
44 | #define PRINT_BUFFER_LENGTH MAX_DICES*4 | 44 | #define PRINT_BUFFER_LENGTH MAX_DICES*4 |
45 | PLUGIN_HEADER | 45 | PLUGIN_HEADER |
46 | 46 | ||
47 | static struct plugin_api* rb; | 47 | static const struct plugin_api* rb; |
48 | static struct dices dice; | 48 | static struct dices dice; |
49 | static int sides_index; | 49 | static int sides_index; |
50 | 50 | ||
@@ -72,7 +72,7 @@ void dice_print(struct dices* dice, struct screen* display); | |||
72 | bool dice_menu(struct dices* dice); | 72 | bool dice_menu(struct dices* dice); |
73 | 73 | ||
74 | /* plugin entry point */ | 74 | /* plugin entry point */ |
75 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 75 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
76 | (void)parameter; | 76 | (void)parameter; |
77 | rb = api; | 77 | rb = api; |
78 | int i, action; | 78 | int i, action; |
diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c index a149f0089a..26670f7aa4 100644 --- a/apps/plugins/dict.c +++ b/apps/plugins/dict.c | |||
@@ -22,7 +22,7 @@ | |||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | 23 | ||
24 | /* save the plugin api pointer. */ | 24 | /* save the plugin api pointer. */ |
25 | static struct plugin_api* rb; | 25 | static const struct plugin_api* rb; |
26 | /* screen info */ | 26 | /* screen info */ |
27 | static int display_columns, display_lines; | 27 | static int display_columns, display_lines; |
28 | 28 | ||
@@ -138,7 +138,7 @@ long reverse (long N) { | |||
138 | #define DICT_DESC ROCKBOX_DIR "/rocks/apps/dict.desc" | 138 | #define DICT_DESC ROCKBOX_DIR "/rocks/apps/dict.desc" |
139 | 139 | ||
140 | /* the main plugin function */ | 140 | /* the main plugin function */ |
141 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 141 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
142 | { | 142 | { |
143 | char searchword[WORDLEN]; /* word to search for */ | 143 | char searchword[WORDLEN]; /* word to search for */ |
144 | char *description; /* pointer to description buffer */ | 144 | char *description; /* pointer to description buffer */ |
diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index dd75408d48..ed29206d6b 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | 20 | ||
21 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
22 | static struct plugin_api* rb; | 22 | static const struct plugin_api* rb; |
23 | 23 | ||
24 | /* function return values */ | 24 | /* function return values */ |
25 | enum tidy_return | 25 | enum tidy_return |
@@ -412,7 +412,7 @@ int tidy_lcd_menu(void) | |||
412 | } | 412 | } |
413 | 413 | ||
414 | /* this is the plugin entry point */ | 414 | /* this is the plugin entry point */ |
415 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 415 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
416 | { | 416 | { |
417 | enum tidy_system system = TIDY_ALL; | 417 | enum tidy_system system = TIDY_ALL; |
418 | enum tidy_return status; | 418 | enum tidy_return status; |
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index f23e856fdc..b36e677c49 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c | |||
@@ -99,7 +99,7 @@ int my_close(int id) | |||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | #endif | 101 | #endif |
102 | struct plugin_api* rb; | 102 | const struct plugin_api* rb; |
103 | #define MAXARGVS 100 | 103 | #define MAXARGVS 100 |
104 | 104 | ||
105 | bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates | 105 | bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates |
@@ -675,7 +675,7 @@ int doom_menu() | |||
675 | 675 | ||
676 | extern int systemvol; | 676 | extern int systemvol; |
677 | /* this is the plugin entry point */ | 677 | /* this is the plugin entry point */ |
678 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 678 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
679 | { | 679 | { |
680 | PLUGIN_IRAM_INIT(api) | 680 | PLUGIN_IRAM_INIT(api) |
681 | 681 | ||
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h index 2ddbb94fcf..1611807b40 100644 --- a/apps/plugins/doom/rockmacros.h +++ b/apps/plugins/doom/rockmacros.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "autoconf.h" | 24 | #include "autoconf.h" |
25 | #include "z_zone.h" | 25 | #include "z_zone.h" |
26 | 26 | ||
27 | extern struct plugin_api* rb; | 27 | extern const struct plugin_api* rb; |
28 | extern bool noprintf; | 28 | extern bool noprintf; |
29 | extern bool doomexit; | 29 | extern bool doomexit; |
30 | 30 | ||
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index 224fb85703..fe45bef6c3 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c | |||
@@ -140,7 +140,7 @@ static unsigned char *abbrev_str[12] = { | |||
140 | 140 | ||
141 | static unsigned long heuro,hhome; /*Handles for the new patterns*/ | 141 | static unsigned long heuro,hhome; /*Handles for the new patterns*/ |
142 | 142 | ||
143 | static struct plugin_api* rb; | 143 | static const struct plugin_api* rb; |
144 | 144 | ||
145 | static char *currency_str[12] = { | 145 | static char *currency_str[12] = { |
146 | "France", | 146 | "France", |
@@ -402,7 +402,7 @@ static void euro_exit(void *parameter) | |||
402 | 402 | ||
403 | 403 | ||
404 | /* this is the plugin entry point */ | 404 | /* this is the plugin entry point */ |
405 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 405 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
406 | { | 406 | { |
407 | bool end, pos; | 407 | bool end, pos; |
408 | longlong_t e,h,old_e,old_h; | 408 | longlong_t e,h,old_e,old_h; |
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c index c26822c8dc..2755436c7c 100644 --- a/apps/plugins/fire.c +++ b/apps/plugins/fire.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | PLUGIN_HEADER | 42 | PLUGIN_HEADER |
43 | 43 | ||
44 | static struct plugin_api* rb; /* global api struct pointer */ | 44 | static const struct plugin_api* rb; /* global api struct pointer */ |
45 | 45 | ||
46 | #ifndef HAVE_LCD_COLOR | 46 | #ifndef HAVE_LCD_COLOR |
47 | GREY_INFO_STRUCT | 47 | GREY_INFO_STRUCT |
@@ -344,7 +344,7 @@ int main(void) | |||
344 | 344 | ||
345 | /*************************** Plugin entry point ****************************/ | 345 | /*************************** Plugin entry point ****************************/ |
346 | 346 | ||
347 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 347 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
348 | { | 348 | { |
349 | int ret; | 349 | int ret; |
350 | 350 | ||
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c index 361930f1c8..d06cbdf912 100644 --- a/apps/plugins/fireworks.c +++ b/apps/plugins/fireworks.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | PLUGIN_HEADER | 23 | PLUGIN_HEADER |
24 | 24 | ||
25 | static struct plugin_api* rb; | 25 | static const struct plugin_api* rb; |
26 | 26 | ||
27 | /*** | 27 | /*** |
28 | * FIREWORKS.C by ZAKK ROBERTS | 28 | * FIREWORKS.C by ZAKK ROBERTS |
@@ -385,7 +385,7 @@ void fireworks_menu(void) | |||
385 | } | 385 | } |
386 | 386 | ||
387 | /* this is the plugin entry point */ | 387 | /* this is the plugin entry point */ |
388 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 388 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
389 | { | 389 | { |
390 | (void)parameter; | 390 | (void)parameter; |
391 | 391 | ||
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c index f4daab2fcd..6cbb252cd1 100644 --- a/apps/plugins/firmware_flash.c +++ b/apps/plugins/firmware_flash.c | |||
@@ -126,7 +126,7 @@ typedef struct | |||
126 | char name[32]; | 126 | char name[32]; |
127 | } tFlashInfo; | 127 | } tFlashInfo; |
128 | 128 | ||
129 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 129 | static const struct plugin_api* rb; /* here is a global api struct pointer */ |
130 | 130 | ||
131 | #define MASK_ADR 0xFC /* position of hardware mask value in Flash */ | 131 | #define MASK_ADR 0xFC /* position of hardware mask value in Flash */ |
132 | #define VERSION_ADR 0xFE /* position of firmware version value in Flash */ | 132 | #define VERSION_ADR 0xFE /* position of firmware version value in Flash */ |
@@ -1072,7 +1072,7 @@ void DoUserDialog(char* filename) | |||
1072 | 1072 | ||
1073 | /***************** Plugin Entry Point *****************/ | 1073 | /***************** Plugin Entry Point *****************/ |
1074 | 1074 | ||
1075 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1075 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1076 | { | 1076 | { |
1077 | int oldmode; | 1077 | int oldmode; |
1078 | 1078 | ||
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index 874ddf41f7..7e865b0ea8 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c | |||
@@ -244,7 +244,7 @@ PLUGIN_HEADER | |||
244 | #endif | 244 | #endif |
245 | #endif | 245 | #endif |
246 | 246 | ||
247 | static struct plugin_api* rb; | 247 | static const struct plugin_api* rb; |
248 | static int spots[20]; | 248 | static int spots[20]; |
249 | static int toggle[20]; | 249 | static int toggle[20]; |
250 | static int cursor_pos, moves; | 250 | static int cursor_pos, moves; |
@@ -591,7 +591,7 @@ static bool flipit_loop(void) | |||
591 | } | 591 | } |
592 | 592 | ||
593 | /* called function from outside */ | 593 | /* called function from outside */ |
594 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 594 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
595 | { | 595 | { |
596 | int i, rc; | 596 | int i, rc; |
597 | 597 | ||
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c index 17449b9f62..cffa8f1940 100644 --- a/apps/plugins/greyscale.c +++ b/apps/plugins/greyscale.c | |||
@@ -102,7 +102,7 @@ PLUGIN_HEADER | |||
102 | /******************************* Globals ***********************************/ | 102 | /******************************* Globals ***********************************/ |
103 | 103 | ||
104 | GREY_INFO_STRUCT | 104 | GREY_INFO_STRUCT |
105 | static struct plugin_api* rb; /* global api struct pointer */ | 105 | static const struct plugin_api* rb; /* global api struct pointer */ |
106 | static char pbuf[32]; /* global printf buffer */ | 106 | static char pbuf[32]; /* global printf buffer */ |
107 | static unsigned char *gbuf; | 107 | static unsigned char *gbuf; |
108 | static size_t gbuf_size = 0; | 108 | static size_t gbuf_size = 0; |
@@ -361,7 +361,7 @@ int main(void) | |||
361 | 361 | ||
362 | /*************************** Plugin entry point ****************************/ | 362 | /*************************** Plugin entry point ****************************/ |
363 | 363 | ||
364 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 364 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
365 | { | 365 | { |
366 | rb = api; /* copy to global api pointer */ | 366 | rb = api; /* copy to global api pointer */ |
367 | (void)parameter; | 367 | (void)parameter; |
diff --git a/apps/plugins/helloworld.c b/apps/plugins/helloworld.c index eca9d2e85a..ebad484d9c 100644 --- a/apps/plugins/helloworld.c +++ b/apps/plugins/helloworld.c | |||
@@ -27,10 +27,10 @@ PLUGIN_HEADER | |||
27 | /* here is a global api struct pointer. while not strictly necessary, | 27 | /* here is a global api struct pointer. while not strictly necessary, |
28 | it's nice not to have to pass the api pointer in all function calls | 28 | it's nice not to have to pass the api pointer in all function calls |
29 | in the plugin */ | 29 | in the plugin */ |
30 | static struct plugin_api* rb; | 30 | static const struct plugin_api* rb; |
31 | 31 | ||
32 | /* this is the plugin entry point */ | 32 | /* this is the plugin entry point */ |
33 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 33 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
34 | { | 34 | { |
35 | /* if you don't use the parameter, you can do like | 35 | /* if you don't use the parameter, you can do like |
36 | this to avoid the compiler warning about it */ | 36 | this to avoid the compiler warning about it */ |
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index 946e36d05a..1294ed35c3 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c | |||
@@ -595,7 +595,7 @@ unsigned char fire_sprite[FIRE_HEIGHT] = { | |||
595 | #define CYCLETIME 40 | 595 | #define CYCLETIME 40 |
596 | 596 | ||
597 | 597 | ||
598 | static struct plugin_api* rb; | 598 | static const struct plugin_api* rb; |
599 | 599 | ||
600 | /* Physical x is at PLAYFIELD_X + LIVES_X + x * ALIEN_SPEED | 600 | /* Physical x is at PLAYFIELD_X + LIVES_X + x * ALIEN_SPEED |
601 | * Physical y is at y * ALIEN_HEIGHT | 601 | * Physical y is at y * ALIEN_HEIGHT |
@@ -1785,7 +1785,7 @@ void game_loop(void) | |||
1785 | 1785 | ||
1786 | 1786 | ||
1787 | /* this is the plugin entry point */ | 1787 | /* this is the plugin entry point */ |
1788 | enum plugin_status plugin_start(struct plugin_api* api, UNUSED void* parameter) | 1788 | enum plugin_status plugin_start(const struct plugin_api* api, UNUSED const void* parameter) |
1789 | { | 1789 | { |
1790 | rb = api; | 1790 | rb = api; |
1791 | 1791 | ||
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c index d9ea73b622..af002acb2f 100644 --- a/apps/plugins/iriver_flash.c +++ b/apps/plugins/iriver_flash.c | |||
@@ -54,7 +54,7 @@ struct flash_info | |||
54 | char name[32]; | 54 | char name[32]; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 57 | static const struct plugin_api* rb; /* here is a global api struct pointer */ |
58 | 58 | ||
59 | #ifdef IRIVER_H100_SERIES | 59 | #ifdef IRIVER_H100_SERIES |
60 | #define SEC_SIZE 4096 | 60 | #define SEC_SIZE 4096 |
@@ -802,7 +802,7 @@ void DoUserDialog(char* filename) | |||
802 | 802 | ||
803 | /***************** Plugin Entry Point *****************/ | 803 | /***************** Plugin Entry Point *****************/ |
804 | 804 | ||
805 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 805 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
806 | { | 806 | { |
807 | int oldmode; | 807 | int oldmode; |
808 | 808 | ||
diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c index b578cf7e0c..abff78266d 100644 --- a/apps/plugins/iriverify.c +++ b/apps/plugins/iriverify.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | PLUGIN_HEADER | 26 | PLUGIN_HEADER |
27 | 27 | ||
28 | static struct plugin_api* rb; | 28 | static const struct plugin_api* rb; |
29 | 29 | ||
30 | ssize_t buf_size; | 30 | ssize_t buf_size; |
31 | static char *filename; | 31 | static char *filename; |
@@ -130,7 +130,7 @@ static int write_file(void) | |||
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | 132 | ||
133 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 133 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
134 | { | 134 | { |
135 | char *buf; | 135 | char *buf; |
136 | int rc; | 136 | int rc; |
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c index de99eae2a9..5950551b44 100644 --- a/apps/plugins/jackpot.c +++ b/apps/plugins/jackpot.c | |||
@@ -69,7 +69,7 @@ const struct picture jackpot_pictures[]={ | |||
69 | #define SLEEP_TIME (HZ/200) | 69 | #define SLEEP_TIME (HZ/200) |
70 | #endif /* HAVE_LCD_CHARCELLS */ | 70 | #endif /* HAVE_LCD_CHARCELLS */ |
71 | 71 | ||
72 | static struct plugin_api* rb; | 72 | static const struct plugin_api* rb; |
73 | 73 | ||
74 | struct jackpot | 74 | struct jackpot |
75 | { | 75 | { |
@@ -290,7 +290,7 @@ void jackpot_play_turn(struct jackpot* game) | |||
290 | jackpot_print_turn_result(game, gain, rb->screens[d]); | 290 | jackpot_print_turn_result(game, gain, rb->screens[d]); |
291 | } | 291 | } |
292 | 292 | ||
293 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 293 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
294 | { | 294 | { |
295 | rb = api; | 295 | rb = api; |
296 | int action, i; | 296 | int action, i; |
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index ddd659d2a1..7eec89eaa3 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c | |||
@@ -339,7 +339,7 @@ struct jewels_menu { | |||
339 | }; | 339 | }; |
340 | 340 | ||
341 | /* global rockbox api */ | 341 | /* global rockbox api */ |
342 | static struct plugin_api* rb; | 342 | static const struct plugin_api* rb; |
343 | 343 | ||
344 | /* external bitmaps */ | 344 | /* external bitmaps */ |
345 | extern const fb_data jewels[]; | 345 | extern const fb_data jewels[]; |
@@ -1898,7 +1898,7 @@ static int jewels_main(struct game_context* bj) { | |||
1898 | /***************************************************************************** | 1898 | /***************************************************************************** |
1899 | * plugin entry point. | 1899 | * plugin entry point. |
1900 | ******************************************************************************/ | 1900 | ******************************************************************************/ |
1901 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 1901 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
1902 | struct game_context bj; | 1902 | struct game_context bj; |
1903 | bool exit = false; | 1903 | bool exit = false; |
1904 | int position; | 1904 | int position; |
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index e95c10bbfa..a05eaa72dc 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c | |||
@@ -279,7 +279,7 @@ GREY_INFO_STRUCT | |||
279 | 279 | ||
280 | /******************************* Globals ***********************************/ | 280 | /******************************* Globals ***********************************/ |
281 | 281 | ||
282 | static struct plugin_api* rb; | 282 | static const struct plugin_api* rb; |
283 | MEM_FUNCTION_WRAPPERS(rb); | 283 | MEM_FUNCTION_WRAPPERS(rb); |
284 | 284 | ||
285 | /* for portability of below JPEG code */ | 285 | /* for portability of below JPEG code */ |
@@ -3318,7 +3318,7 @@ int load_and_show(char* filename) | |||
3318 | 3318 | ||
3319 | /******************** Plugin entry point *********************/ | 3319 | /******************** Plugin entry point *********************/ |
3320 | 3320 | ||
3321 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 3321 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
3322 | { | 3322 | { |
3323 | rb = api; | 3323 | rb = api; |
3324 | 3324 | ||
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c index 943cc97fce..2f91545edc 100644 --- a/apps/plugins/lamp.c +++ b/apps/plugins/lamp.c | |||
@@ -92,7 +92,7 @@ PLUGIN_HEADER | |||
92 | # endif | 92 | # endif |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | static struct plugin_api* rb; /* global api struct pointer */ | 95 | static const struct plugin_api* rb; /* global api struct pointer */ |
96 | 96 | ||
97 | #ifdef HAVE_LCD_COLOR | 97 | #ifdef HAVE_LCD_COLOR |
98 | /* RGB color sets */ | 98 | /* RGB color sets */ |
@@ -102,7 +102,7 @@ static int colorset[NUM_COLORSETS][3] = { { 255, 255, 255 } , /* white */ | |||
102 | #endif /* HAVE_LCD_COLOR */ | 102 | #endif /* HAVE_LCD_COLOR */ |
103 | 103 | ||
104 | /* this is the plugin entry point */ | 104 | /* this is the plugin entry point */ |
105 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 105 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
106 | { | 106 | { |
107 | (void)parameter; | 107 | (void)parameter; |
108 | rb = api; | 108 | rb = api; |
diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c index 20adc6de86..c46093a8d9 100644 --- a/apps/plugins/lib/bmp.c +++ b/apps/plugins/lib/bmp.c | |||
@@ -30,7 +30,7 @@ | |||
30 | /** | 30 | /** |
31 | * Save to 24 bit bitmap. | 31 | * Save to 24 bit bitmap. |
32 | */ | 32 | */ |
33 | int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb ) | 33 | int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb ) |
34 | { | 34 | { |
35 | /* I'm not really sure about this one :) */ | 35 | /* I'm not really sure about this one :) */ |
36 | int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0); | 36 | int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0); |
diff --git a/apps/plugins/lib/bmp.h b/apps/plugins/lib/bmp.h index 10f71865f7..9114df1ee5 100644 --- a/apps/plugins/lib/bmp.h +++ b/apps/plugins/lib/bmp.h | |||
@@ -26,7 +26,7 @@ | |||
26 | /** | 26 | /** |
27 | * Save bitmap to file | 27 | * Save bitmap to file |
28 | */ | 28 | */ |
29 | int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb ); | 29 | int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb ); |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | /** | 32 | /** |
diff --git a/apps/plugins/lib/checkbox.c b/apps/plugins/lib/checkbox.c index 5acc52a728..039d5f9cbf 100644 --- a/apps/plugins/lib/checkbox.c +++ b/apps/plugins/lib/checkbox.c | |||
@@ -25,7 +25,7 @@ | |||
25 | /* | 25 | /* |
26 | * Print a checkbox | 26 | * Print a checkbox |
27 | */ | 27 | */ |
28 | void checkbox(struct plugin_api *api, int x, int y, int width, int height, bool checked) | 28 | void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked) |
29 | { | 29 | { |
30 | /* draw box */ | 30 | /* draw box */ |
31 | api->lcd_drawrect(x, y, width, height); | 31 | api->lcd_drawrect(x, y, width, height); |
diff --git a/apps/plugins/lib/checkbox.h b/apps/plugins/lib/checkbox.h index 2a5ffea0aa..72de4952ca 100644 --- a/apps/plugins/lib/checkbox.h +++ b/apps/plugins/lib/checkbox.h | |||
@@ -24,6 +24,6 @@ | |||
24 | /* | 24 | /* |
25 | * Print a checkbox | 25 | * Print a checkbox |
26 | */ | 26 | */ |
27 | void checkbox(struct plugin_api *api, int x, int y, int width, int height, bool checked); | 27 | void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked); |
28 | 28 | ||
29 | #endif | 29 | #endif |
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index b0d134fae9..516bf616cb 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c | |||
@@ -19,9 +19,9 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "configfile.h" | 20 | #include "configfile.h" |
21 | 21 | ||
22 | static struct plugin_api *cfg_rb; | 22 | static const struct plugin_api *cfg_rb; |
23 | 23 | ||
24 | void configfile_init(struct plugin_api* newrb) | 24 | void configfile_init(const struct plugin_api* newrb) |
25 | { | 25 | { |
26 | cfg_rb = newrb; | 26 | cfg_rb = newrb; |
27 | } | 27 | } |
diff --git a/apps/plugins/lib/configfile.h b/apps/plugins/lib/configfile.h index 7aa69f3ecf..fe4b43c485 100644 --- a/apps/plugins/lib/configfile.h +++ b/apps/plugins/lib/configfile.h | |||
@@ -37,7 +37,7 @@ struct configdata | |||
37 | NULL otherwise */ | 37 | NULL otherwise */ |
38 | }; | 38 | }; |
39 | 39 | ||
40 | void configfile_init(struct plugin_api* newrb); | 40 | void configfile_init(const struct plugin_api* newrb); |
41 | 41 | ||
42 | /* configfile_save - Given configdata entries this function will | 42 | /* configfile_save - Given configdata entries this function will |
43 | create a config file with these entries, destroying any | 43 | create a config file with these entries, destroying any |
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h index 81912b1995..4a15bd38ea 100644 --- a/apps/plugins/lib/grey.h +++ b/apps/plugins/lib/grey.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */ | 50 | #define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */ |
51 | 51 | ||
52 | /* Library initialisation and release */ | 52 | /* Library initialisation and release */ |
53 | bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | 53 | bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, |
54 | unsigned features, int width, int height, long *buf_taken); | 54 | unsigned features, int width, int height, long *buf_taken); |
55 | void grey_release(void); | 55 | void grey_release(void); |
56 | 56 | ||
@@ -168,16 +168,16 @@ struct _grey_info | |||
168 | int by; /* 4-pixel or 8-pixel units */ | 168 | int by; /* 4-pixel or 8-pixel units */ |
169 | int bheight; /* 4-pixel or 8-pixel units */ | 169 | int bheight; /* 4-pixel or 8-pixel units */ |
170 | #endif | 170 | #endif |
171 | unsigned long flags; /* various flags, see #defines */ | 171 | unsigned long flags; /* various flags, see #defines */ |
172 | struct plugin_api *rb; /* plugin API pointer */ | 172 | const struct plugin_api *rb; /* plugin API pointer */ |
173 | unsigned char *values; /* start of greyscale pixel values */ | 173 | unsigned char *values; /* start of greyscale pixel values */ |
174 | unsigned char *phases; /* start of greyscale pixel phases */ | 174 | unsigned char *phases; /* start of greyscale pixel phases */ |
175 | unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */ | 175 | unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */ |
176 | unsigned char gvalue[256]; /* calculated brightness -> greyvalue table */ | 176 | unsigned char gvalue[256]; /* calculated brightness -> greyvalue table */ |
177 | int fg_brightness; /* current foreground brightness */ | 177 | int fg_brightness; /* current foreground brightness */ |
178 | int bg_brightness; /* current background brightness */ | 178 | int bg_brightness; /* current background brightness */ |
179 | int drawmode; /* current draw mode */ | 179 | int drawmode; /* current draw mode */ |
180 | int curfont; /* current selected font */ | 180 | int curfont; /* current selected font */ |
181 | }; | 181 | }; |
182 | 182 | ||
183 | /* Global variable, defined in the plugin */ | 183 | /* Global variable, defined in the plugin */ |
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c index e2260cdf11..e7f02dd6cb 100644 --- a/apps/plugins/lib/grey_core.c +++ b/apps/plugins/lib/grey_core.c | |||
@@ -478,7 +478,7 @@ static void fill_gvalues(void) | |||
478 | 478 | ||
479 | The function is authentic regarding memory usage on the simulator, even | 479 | The function is authentic regarding memory usage on the simulator, even |
480 | if it doesn't use all of the allocated memory. */ | 480 | if it doesn't use all of the allocated memory. */ |
481 | bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | 481 | bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, |
482 | unsigned features, int width, int height, long *buf_taken) | 482 | unsigned features, int width, int height, long *buf_taken) |
483 | { | 483 | { |
484 | int bdim, i; | 484 | int bdim, i; |
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c index 8ac822b407..691a17f15c 100644 --- a/apps/plugins/lib/helper.c +++ b/apps/plugins/lib/helper.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "helper.h" | 21 | #include "helper.h" |
22 | 22 | ||
23 | /* Force the backlight on */ | 23 | /* Force the backlight on */ |
24 | void backlight_force_on(struct plugin_api* rb) | 24 | void backlight_force_on(const struct plugin_api* rb) |
25 | { | 25 | { |
26 | if(!rb) | 26 | if(!rb) |
27 | return; | 27 | return; |
@@ -34,7 +34,7 @@ void backlight_force_on(struct plugin_api* rb) | |||
34 | } | 34 | } |
35 | 35 | ||
36 | /* Reset backlight operation to its settings */ | 36 | /* Reset backlight operation to its settings */ |
37 | void backlight_use_settings(struct plugin_api* rb) | 37 | void backlight_use_settings(const struct plugin_api* rb) |
38 | { | 38 | { |
39 | if (!rb) | 39 | if (!rb) |
40 | return; | 40 | return; |
@@ -47,7 +47,7 @@ void backlight_use_settings(struct plugin_api* rb) | |||
47 | 47 | ||
48 | #ifdef HAVE_REMOTE_LCD | 48 | #ifdef HAVE_REMOTE_LCD |
49 | /* Force the backlight on */ | 49 | /* Force the backlight on */ |
50 | void remote_backlight_force_on(struct plugin_api* rb) | 50 | void remote_backlight_force_on(const struct plugin_api* rb) |
51 | { | 51 | { |
52 | if (!rb) | 52 | if (!rb) |
53 | return; | 53 | return; |
@@ -60,7 +60,7 @@ void remote_backlight_force_on(struct plugin_api* rb) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | /* Reset backlight operation to its settings */ | 62 | /* Reset backlight operation to its settings */ |
63 | void remote_backlight_use_settings(struct plugin_api* rb) | 63 | void remote_backlight_use_settings(const struct plugin_api* rb) |
64 | { | 64 | { |
65 | if (!rb) | 65 | if (!rb) |
66 | return; | 66 | return; |
@@ -75,7 +75,7 @@ void remote_backlight_use_settings(struct plugin_api* rb) | |||
75 | 75 | ||
76 | #ifdef HAVE_BUTTON_LIGHT | 76 | #ifdef HAVE_BUTTON_LIGHT |
77 | /* Force the buttonlight on */ | 77 | /* Force the buttonlight on */ |
78 | void buttonlight_force_on(struct plugin_api* rb) | 78 | void buttonlight_force_on(const struct plugin_api* rb) |
79 | { | 79 | { |
80 | if (!rb) | 80 | if (!rb) |
81 | return; | 81 | return; |
@@ -84,7 +84,7 @@ void buttonlight_force_on(struct plugin_api* rb) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /* Reset buttonlight operation to its settings */ | 86 | /* Reset buttonlight operation to its settings */ |
87 | void buttonlight_use_settings(struct plugin_api* rb) | 87 | void buttonlight_use_settings(const struct plugin_api* rb) |
88 | { | 88 | { |
89 | if (!rb) | 89 | if (!rb) |
90 | return; | 90 | return; |
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h index 4d1328bd0c..d34e6334f0 100644 --- a/apps/plugins/lib/helper.h +++ b/apps/plugins/lib/helper.h | |||
@@ -24,14 +24,14 @@ | |||
24 | /** | 24 | /** |
25 | * Backlight on/off operations | 25 | * Backlight on/off operations |
26 | */ | 26 | */ |
27 | void backlight_force_on(struct plugin_api* rb); | 27 | void backlight_force_on(const struct plugin_api* rb); |
28 | void backlight_use_settings(struct plugin_api* rb); | 28 | void backlight_use_settings(const struct plugin_api* rb); |
29 | #ifdef HAVE_REMOTE_LCD | 29 | #ifdef HAVE_REMOTE_LCD |
30 | void remote_backlight_force_on(struct plugin_api* rb); | 30 | void remote_backlight_force_on(const struct plugin_api* rb); |
31 | void remote_backlight_use_settings(struct plugin_api* rb); | 31 | void remote_backlight_use_settings(const struct plugin_api* rb); |
32 | #endif | 32 | #endif |
33 | #ifdef HAVE_BUTTON_LIGHT | 33 | #ifdef HAVE_BUTTON_LIGHT |
34 | void buttonlight_force_on(struct plugin_api* rb); | 34 | void buttonlight_force_on(const struct plugin_api* rb); |
35 | void buttonlight_use_settings(struct plugin_api* rb); | 35 | void buttonlight_use_settings(const struct plugin_api* rb); |
36 | #endif | 36 | #endif |
37 | #endif | 37 | #endif |
diff --git a/apps/plugins/lib/highscore.c b/apps/plugins/lib/highscore.c index df7a71bcdf..94b6a7b947 100644 --- a/apps/plugins/lib/highscore.c +++ b/apps/plugins/lib/highscore.c | |||
@@ -19,9 +19,9 @@ | |||
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "highscore.h" | 20 | #include "highscore.h" |
21 | 21 | ||
22 | static struct plugin_api *rb; | 22 | static const struct plugin_api *rb; |
23 | 23 | ||
24 | void highscore_init(struct plugin_api* newrb) | 24 | void highscore_init(const struct plugin_api* newrb) |
25 | { | 25 | { |
26 | rb = newrb; | 26 | rb = newrb; |
27 | } | 27 | } |
diff --git a/apps/plugins/lib/highscore.h b/apps/plugins/lib/highscore.h index ba7da241f1..b6501cf568 100644 --- a/apps/plugins/lib/highscore.h +++ b/apps/plugins/lib/highscore.h | |||
@@ -26,7 +26,7 @@ struct highscore | |||
26 | int level; | 26 | int level; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | void highscore_init(struct plugin_api* newrb); | 29 | void highscore_init(const struct plugin_api* newrb); |
30 | int highscore_save(char *filename, struct highscore *scores, int num_scores); | 30 | int highscore_save(char *filename, struct highscore *scores, int num_scores); |
31 | int highscore_load(char *filename, struct highscore *scores, int num_scores); | 31 | int highscore_load(char *filename, struct highscore *scores, int num_scores); |
32 | int highscore_update(int score, int level, struct highscore *scores, int num_scores); | 32 | int highscore_update(int score, int level, struct highscore *scores, int num_scores); |
diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c index 27e4fdd49e..51fb4f3eb2 100644 --- a/apps/plugins/lib/oldmenuapi.c +++ b/apps/plugins/lib/oldmenuapi.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "plugin.h" | 27 | #include "plugin.h" |
28 | #include "oldmenuapi.h" | 28 | #include "oldmenuapi.h" |
29 | 29 | ||
30 | struct plugin_api *rb = NULL; | 30 | const struct plugin_api *rb = NULL; |
31 | 31 | ||
32 | struct menu { | 32 | struct menu { |
33 | struct menu_item* items; | 33 | struct menu_item* items; |
@@ -65,7 +65,7 @@ static int menu_find_free(void) | |||
65 | return(i); | 65 | return(i); |
66 | } | 66 | } |
67 | 67 | ||
68 | int menu_init(struct plugin_api *api, const struct menu_item* mitems, | 68 | int menu_init(const struct plugin_api *api, const struct menu_item* mitems, |
69 | int count, int (*callback)(int, int), | 69 | int count, int (*callback)(int, int), |
70 | const char *button1, const char *button2, const char *button3) | 70 | const char *button1, const char *button2, const char *button3) |
71 | { | 71 | { |
diff --git a/apps/plugins/lib/oldmenuapi.h b/apps/plugins/lib/oldmenuapi.h index 34f6226d59..ccfd1400dd 100644 --- a/apps/plugins/lib/oldmenuapi.h +++ b/apps/plugins/lib/oldmenuapi.h | |||
@@ -31,7 +31,7 @@ struct menu_item { | |||
31 | bool (*function) (void); /* return true if USB was connected */ | 31 | bool (*function) (void); /* return true if USB was connected */ |
32 | }; | 32 | }; |
33 | 33 | ||
34 | int menu_init(struct plugin_api *api, const struct menu_item* mitems, | 34 | int menu_init(const struct plugin_api *api, const struct menu_item* mitems, |
35 | int count, int (*callback)(int, int), | 35 | int count, int (*callback)(int, int), |
36 | const char *button1, const char *button2, const char *button3); | 36 | const char *button1, const char *button2, const char *button3); |
37 | void menu_exit(int menu); | 37 | void menu_exit(int menu); |
diff --git a/apps/plugins/lib/overlay.c b/apps/plugins/lib/overlay.c index 53cc4a84f0..63fb776f02 100644 --- a/apps/plugins/lib/overlay.c +++ b/apps/plugins/lib/overlay.c | |||
@@ -44,7 +44,7 @@ | |||
44 | The linker script for the overlay should use a base address towards the | 44 | The linker script for the overlay should use a base address towards the |
45 | end of the audiobuffer, just low enough to make the overlay fit. */ | 45 | end of the audiobuffer, just low enough to make the overlay fit. */ |
46 | 46 | ||
47 | enum plugin_status run_overlay(struct plugin_api* rb, void* parameter, | 47 | enum plugin_status run_overlay(const struct plugin_api* rb, const void* parameter, |
48 | unsigned char *filename, unsigned char *name) | 48 | unsigned char *filename, unsigned char *name) |
49 | { | 49 | { |
50 | int fd, readsize; | 50 | int fd, readsize; |
diff --git a/apps/plugins/lib/overlay.h b/apps/plugins/lib/overlay.h index bbf7549274..ba9b1fa308 100644 --- a/apps/plugins/lib/overlay.h +++ b/apps/plugins/lib/overlay.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "plugin.h" | 26 | #include "plugin.h" |
27 | 27 | ||
28 | /* load and run a plugin linked as an overlay. */ | 28 | /* load and run a plugin linked as an overlay. */ |
29 | enum plugin_status run_overlay(struct plugin_api* api, void* parameter, | 29 | enum plugin_status run_overlay(const struct plugin_api* api, const void* parameter, |
30 | unsigned char *filename, unsigned char *name); | 30 | unsigned char *filename, unsigned char *name); |
31 | 31 | ||
32 | #endif /* !SIMULATOR */ | 32 | #endif /* !SIMULATOR */ |
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 7e74728ab4..b0456248a8 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | #include "playback_control.h" | 21 | #include "playback_control.h" |
22 | 22 | ||
23 | struct plugin_api* api = 0; | 23 | const struct plugin_api* api = 0; |
24 | struct viewport *parentvp = NULL; | 24 | struct viewport *parentvp = NULL; |
25 | 25 | ||
26 | static bool prevtrack(void) | 26 | static bool prevtrack(void) |
@@ -105,14 +105,14 @@ MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON, | |||
105 | &prevtrack_item, &playpause_item, &stop_item, &nexttrack_item, | 105 | &prevtrack_item, &playpause_item, &stop_item, &nexttrack_item, |
106 | &volume_item, &shuffle_item, &repeat_mode_item); | 106 | &volume_item, &shuffle_item, &repeat_mode_item); |
107 | 107 | ||
108 | void playback_control_init(struct plugin_api* newapi, | 108 | void playback_control_init(const struct plugin_api* newapi, |
109 | struct viewport parent[NB_SCREENS]) | 109 | struct viewport parent[NB_SCREENS]) |
110 | { | 110 | { |
111 | api = newapi; | 111 | api = newapi; |
112 | parentvp = parent; | 112 | parentvp = parent; |
113 | } | 113 | } |
114 | 114 | ||
115 | bool playback_control(struct plugin_api* newapi, | 115 | bool playback_control(const struct plugin_api* newapi, |
116 | struct viewport parent[NB_SCREENS]) | 116 | struct viewport parent[NB_SCREENS]) |
117 | { | 117 | { |
118 | api = newapi; | 118 | api = newapi; |
diff --git a/apps/plugins/lib/playback_control.h b/apps/plugins/lib/playback_control.h index a3a0d7afbc..23b586095e 100644 --- a/apps/plugins/lib/playback_control.h +++ b/apps/plugins/lib/playback_control.h | |||
@@ -25,11 +25,11 @@ | |||
25 | So, make sure you use the same viewport for the rb->do_menu() call | 25 | So, make sure you use the same viewport for the rb->do_menu() call |
26 | that you use in the playback_control_init() call | 26 | that you use in the playback_control_init() call |
27 | */ | 27 | */ |
28 | void playback_control_init(struct plugin_api* newapi, | 28 | void playback_control_init(const struct plugin_api* newapi, |
29 | struct viewport parent[NB_SCREENS]); | 29 | struct viewport parent[NB_SCREENS]); |
30 | 30 | ||
31 | /* Use this if your menu still uses the old menu api */ | 31 | /* Use this if your menu still uses the old menu api */ |
32 | bool playback_control(struct plugin_api* api, | 32 | bool playback_control(const struct plugin_api* api, |
33 | struct viewport parent[NB_SCREENS]); | 33 | struct viewport parent[NB_SCREENS]); |
34 | 34 | ||
35 | #endif /* __PLAYBACK_CONTROL_H__ */ | 35 | #endif /* __PLAYBACK_CONTROL_H__ */ |
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c index 8853078fa1..4139a6c605 100644 --- a/apps/plugins/lib/playergfx.c +++ b/apps/plugins/lib/playergfx.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | /*** globals ***/ | 27 | /*** globals ***/ |
28 | 28 | ||
29 | static struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */ | 29 | static const struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */ |
30 | static int char_width; | 30 | static int char_width; |
31 | static int char_height; | 31 | static int char_height; |
32 | static int pixel_height; | 32 | static int pixel_height; |
@@ -38,7 +38,7 @@ static int drawmode = DRMODE_SOLID; | |||
38 | /*** Special functions ***/ | 38 | /*** Special functions ***/ |
39 | 39 | ||
40 | /* library init */ | 40 | /* library init */ |
41 | bool pgfx_init(struct plugin_api* newrb, int cwidth, int cheight) | 41 | bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight) |
42 | { | 42 | { |
43 | int i; | 43 | int i; |
44 | 44 | ||
diff --git a/apps/plugins/lib/playergfx.h b/apps/plugins/lib/playergfx.h index 5f49831609..504599ae39 100644 --- a/apps/plugins/lib/playergfx.h +++ b/apps/plugins/lib/playergfx.h | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #ifdef HAVE_LCD_CHARCELLS /* Player only :) */ | 27 | #ifdef HAVE_LCD_CHARCELLS /* Player only :) */ |
28 | 28 | ||
29 | bool pgfx_init(struct plugin_api* newrb, int cwidth, int cheight); | 29 | bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight); |
30 | void pgfx_release(void); | 30 | void pgfx_release(void); |
31 | void pgfx_display(int cx, int cy); | 31 | void pgfx_display(int cx, int cy); |
32 | void pgfx_display_block(int cx, int cy, int x, int y); | 32 | void pgfx_display_block(int cx, int cy, int x, int y); |
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c index be78bf1408..a63ffb352a 100644 --- a/apps/plugins/lib/pluginlib_actions.c +++ b/apps/plugins/lib/pluginlib_actions.c | |||
@@ -464,7 +464,7 @@ static const struct button_mapping* get_context_map(int context) | |||
464 | else return NULL; | 464 | else return NULL; |
465 | } | 465 | } |
466 | 466 | ||
467 | int pluginlib_getaction(struct plugin_api *api,int timeout, | 467 | int pluginlib_getaction(const struct plugin_api *api,int timeout, |
468 | const struct button_mapping *plugin_contexts[], | 468 | const struct button_mapping *plugin_contexts[], |
469 | int count) | 469 | int count) |
470 | { | 470 | { |
diff --git a/apps/plugins/lib/pluginlib_actions.h b/apps/plugins/lib/pluginlib_actions.h index c11a087904..601cd73a8c 100644 --- a/apps/plugins/lib/pluginlib_actions.h +++ b/apps/plugins/lib/pluginlib_actions.h | |||
@@ -58,7 +58,7 @@ extern const struct button_mapping generic_left_right_fire[]; | |||
58 | extern const struct button_mapping generic_actions[]; | 58 | extern const struct button_mapping generic_actions[]; |
59 | extern const struct button_mapping generic_increase_decrease[]; | 59 | extern const struct button_mapping generic_increase_decrease[]; |
60 | 60 | ||
61 | int pluginlib_getaction(struct plugin_api *api,int timeout, | 61 | int pluginlib_getaction(const struct plugin_api *api,int timeout, |
62 | const struct button_mapping *plugin_contexts[], | 62 | const struct button_mapping *plugin_contexts[], |
63 | int count); | 63 | int count); |
64 | 64 | ||
diff --git a/apps/plugins/lib/profile_plugin.c b/apps/plugins/lib/profile_plugin.c index 38c6d81598..6f31288c8f 100644 --- a/apps/plugins/lib/profile_plugin.c +++ b/apps/plugins/lib/profile_plugin.c | |||
@@ -21,9 +21,9 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | static struct plugin_api *local_rb = NULL; /* global api struct pointer */ | 24 | static const struct plugin_api *local_rb = NULL; /* global api struct pointer */ |
25 | 25 | ||
26 | void profile_init(struct plugin_api* pa) | 26 | void profile_init(const struct plugin_api* pa) |
27 | { | 27 | { |
28 | local_rb = pa; | 28 | local_rb = pa; |
29 | } | 29 | } |
diff --git a/apps/plugins/lib/profile_plugin.h b/apps/plugins/lib/profile_plugin.h index 71cff37033..6bc19734d8 100644 --- a/apps/plugins/lib/profile_plugin.h +++ b/apps/plugins/lib/profile_plugin.h | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "plugin.h" | 25 | #include "plugin.h" |
26 | 26 | ||
27 | void profile_init(struct plugin_api* pa); | 27 | void profile_init(const struct plugin_api* pa); |
28 | 28 | ||
29 | void __cyg_profile_func_enter(void *this_fn, void *call_site) | 29 | void __cyg_profile_func_enter(void *this_fn, void *call_site) |
30 | NO_PROF_ATTR ICODE_ATTR; | 30 | NO_PROF_ATTR ICODE_ATTR; |
diff --git a/apps/plugins/lib/xlcd.h b/apps/plugins/lib/xlcd.h index 59a048228b..a1e2389f39 100644 --- a/apps/plugins/lib/xlcd.h +++ b/apps/plugins/lib/xlcd.h | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #ifdef HAVE_LCD_BITMAP | 27 | #ifdef HAVE_LCD_BITMAP |
28 | 28 | ||
29 | void xlcd_init(struct plugin_api* newrb); | 29 | void xlcd_init(const struct plugin_api* newrb); |
30 | void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3); | 30 | void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3); |
31 | void xlcd_filltriangle_screen(struct screen* display, | 31 | void xlcd_filltriangle_screen(struct screen* display, |
32 | int x1, int y1, int x2, int y2, int x3, int y3); | 32 | int x1, int y1, int x2, int y2, int x3, int y3); |
@@ -49,7 +49,7 @@ void xlcd_scroll_up(int count); | |||
49 | void xlcd_scroll_down(int count); | 49 | void xlcd_scroll_down(int count); |
50 | 50 | ||
51 | /* internal stuff */ | 51 | /* internal stuff */ |
52 | extern struct plugin_api *_xlcd_rb; /* global api struct pointer */ | 52 | extern const struct plugin_api *_xlcd_rb; /* global api struct pointer */ |
53 | 53 | ||
54 | #endif /* HAVE_LCD_BITMAP */ | 54 | #endif /* HAVE_LCD_BITMAP */ |
55 | #endif /* __XLCD_H__ */ | 55 | #endif /* __XLCD_H__ */ |
diff --git a/apps/plugins/lib/xlcd_core.c b/apps/plugins/lib/xlcd_core.c index e8cc688591..7f8e566865 100644 --- a/apps/plugins/lib/xlcd_core.c +++ b/apps/plugins/lib/xlcd_core.c | |||
@@ -27,12 +27,12 @@ | |||
27 | 27 | ||
28 | /*** globals ***/ | 28 | /*** globals ***/ |
29 | 29 | ||
30 | struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */ | 30 | const struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */ |
31 | 31 | ||
32 | /*** functions ***/ | 32 | /*** functions ***/ |
33 | 33 | ||
34 | /* library init */ | 34 | /* library init */ |
35 | void xlcd_init(struct plugin_api* newrb) | 35 | void xlcd_init(const struct plugin_api* newrb) |
36 | { | 36 | { |
37 | _xlcd_rb = newrb; | 37 | _xlcd_rb = newrb; |
38 | } | 38 | } |
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c index f08ca3a62a..79ff6acb62 100644 --- a/apps/plugins/logo.c +++ b/apps/plugins/logo.c | |||
@@ -176,12 +176,12 @@ const unsigned char rockbox16x7[] = { | |||
176 | #endif | 176 | #endif |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 179 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
180 | int button; | 180 | int button; |
181 | int timer = 10; | 181 | int timer = 10; |
182 | int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2); | 182 | int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2); |
183 | int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2); | 183 | int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2); |
184 | struct plugin_api* rb = api; | 184 | const struct plugin_api* rb = api; |
185 | int dx; | 185 | int dx; |
186 | int dy; | 186 | int dy; |
187 | #ifdef HAVE_LCD_CHARCELLS | 187 | #ifdef HAVE_LCD_CHARCELLS |
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c index 1576b875dd..8b045e74de 100644 --- a/apps/plugins/mandelbrot.c +++ b/apps/plugins/mandelbrot.c | |||
@@ -273,7 +273,7 @@ PLUGIN_HEADER | |||
273 | #define MYXLCD(fn) xlcd_ ## fn | 273 | #define MYXLCD(fn) xlcd_ ## fn |
274 | #endif | 274 | #endif |
275 | 275 | ||
276 | static struct plugin_api* rb; | 276 | static const struct plugin_api* rb; |
277 | 277 | ||
278 | /* Fixed point format s5.26: sign, 5 bits integer part, 26 bits fractional part */ | 278 | /* Fixed point format s5.26: sign, 5 bits integer part, 26 bits fractional part */ |
279 | static long x_min; | 279 | static long x_min; |
@@ -661,7 +661,7 @@ void cleanup(void *parameter) | |||
661 | #define REDRAW_PARTIAL 1 | 661 | #define REDRAW_PARTIAL 1 |
662 | #define REDRAW_FULL 2 | 662 | #define REDRAW_FULL 2 |
663 | 663 | ||
664 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 664 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
665 | { | 665 | { |
666 | int button; | 666 | int button; |
667 | int lastbutton = BUTTON_NONE; | 667 | int lastbutton = BUTTON_NONE; |
diff --git a/apps/plugins/matrix.c b/apps/plugins/matrix.c index 33509dc69a..65a4a6b785 100644 --- a/apps/plugins/matrix.c +++ b/apps/plugins/matrix.c | |||
@@ -119,7 +119,7 @@ extern const fb_data matrix_normal[]; | |||
119 | #define SLEEP HZ/50 | 119 | #define SLEEP HZ/50 |
120 | 120 | ||
121 | /* Codec api pointer */ | 121 | /* Codec api pointer */ |
122 | static struct plugin_api* rb; | 122 | static const struct plugin_api* rb; |
123 | 123 | ||
124 | /* Each position is of this type */ | 124 | /* Each position is of this type */ |
125 | typedef struct cmatrix { | 125 | typedef struct cmatrix { |
@@ -284,7 +284,7 @@ static void matrix_loop(void) | |||
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 287 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
288 | int button; | 288 | int button; |
289 | int sleep = SLEEP; | 289 | int sleep = SLEEP; |
290 | bool frozen = false; | 290 | bool frozen = false; |
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c index cebdc46cff..f18dd68eb6 100644 --- a/apps/plugins/maze.c +++ b/apps/plugins/maze.c | |||
@@ -79,7 +79,7 @@ PLUGIN_HEADER | |||
79 | #define BORDER_W 0x00000080 | 79 | #define BORDER_W 0x00000080 |
80 | #define PATH 0x00000100 | 80 | #define PATH 0x00000100 |
81 | 81 | ||
82 | static struct plugin_api* rb; | 82 | static const struct plugin_api* rb; |
83 | 83 | ||
84 | #ifdef __PLUGINLIB_ACTIONS_H__ | 84 | #ifdef __PLUGINLIB_ACTIONS_H__ |
85 | const struct button_mapping *plugin_contexts[] | 85 | const struct button_mapping *plugin_contexts[] |
@@ -470,7 +470,7 @@ void maze_move_player_right(struct maze* maze) | |||
470 | /**********************************/ | 470 | /**********************************/ |
471 | /* this is the plugin entry point */ | 471 | /* this is the plugin entry point */ |
472 | /**********************************/ | 472 | /**********************************/ |
473 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 473 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
474 | { | 474 | { |
475 | int button, lastbutton = BUTTON_NONE; | 475 | int button, lastbutton = BUTTON_NONE; |
476 | int quit = 0; | 476 | int quit = 0; |
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 2ee6e20059..93d9ec4c9a 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c | |||
@@ -26,7 +26,7 @@ | |||
26 | /* Include standard plugin macro */ | 26 | /* Include standard plugin macro */ |
27 | PLUGIN_HEADER | 27 | PLUGIN_HEADER |
28 | 28 | ||
29 | static struct plugin_api* rb; | 29 | static const struct plugin_api* rb; |
30 | 30 | ||
31 | /* The plugin actions of interest. */ | 31 | /* The plugin actions of interest. */ |
32 | const struct button_mapping *plugin_contexts[] | 32 | const struct button_mapping *plugin_contexts[] |
@@ -916,7 +916,7 @@ static void main_menu(void) | |||
916 | /***************************************************************************** | 916 | /***************************************************************************** |
917 | * Plugin entry point | 917 | * Plugin entry point |
918 | ******************************************************************************/ | 918 | ******************************************************************************/ |
919 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 919 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
920 | { | 920 | { |
921 | enum plugin_status plugin_state; | 921 | enum plugin_status plugin_state; |
922 | 922 | ||
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index a778429195..85b1260a86 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c | |||
@@ -78,7 +78,7 @@ const struct button_mapping *plugin_contexts[]={ | |||
78 | }; | 78 | }; |
79 | #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) | 79 | #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) |
80 | 80 | ||
81 | static struct plugin_api* rb; | 81 | static const struct plugin_api* rb; |
82 | 82 | ||
83 | MEM_FUNCTION_WRAPPERS(rb); | 83 | MEM_FUNCTION_WRAPPERS(rb); |
84 | 84 | ||
@@ -299,7 +299,7 @@ void tap(void) | |||
299 | reset_tap = false; | 299 | reset_tap = false; |
300 | } | 300 | } |
301 | 301 | ||
302 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ | 302 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){ |
303 | int button; | 303 | int button; |
304 | enum plugin_status status; | 304 | enum plugin_status status; |
305 | 305 | ||
diff --git a/apps/plugins/midi/midifile.c b/apps/plugins/midi/midifile.c index 5f98e895a2..6411b8e658 100644 --- a/apps/plugins/midi/midifile.c +++ b/apps/plugins/midi/midifile.c | |||
@@ -26,7 +26,7 @@ int readID(int file); | |||
26 | 26 | ||
27 | struct MIDIfile midi_file IBSS_ATTR; | 27 | struct MIDIfile midi_file IBSS_ATTR; |
28 | 28 | ||
29 | struct MIDIfile * loadFile(char * filename) | 29 | struct MIDIfile * loadFile(const char * filename) |
30 | { | 30 | { |
31 | struct MIDIfile * mfload; | 31 | struct MIDIfile * mfload; |
32 | int file = rb->open (filename, O_RDONLY); | 32 | int file = rb->open (filename, O_RDONLY); |
diff --git a/apps/plugins/midi/midifile.h b/apps/plugins/midi/midifile.h index a1024d500b..25ab2f5b19 100644 --- a/apps/plugins/midi/midifile.h +++ b/apps/plugins/midi/midifile.h | |||
@@ -17,5 +17,5 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | struct MIDIfile * loadFile(char * filename); | 20 | struct MIDIfile * loadFile(const char * filename); |
21 | 21 | ||
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index e97d7acf1c..69be53e75d 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c | |||
@@ -191,11 +191,11 @@ int32_t gmbuf[BUF_SIZE*NBUF]; | |||
191 | static unsigned int samples_in_buf; | 191 | static unsigned int samples_in_buf; |
192 | 192 | ||
193 | int quit=0; | 193 | int quit=0; |
194 | struct plugin_api * rb; | 194 | const struct plugin_api * rb; |
195 | 195 | ||
196 | static int midimain(void * filename); | 196 | static int midimain(const void * filename); |
197 | 197 | ||
198 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 198 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
199 | { | 199 | { |
200 | int retval = 0; | 200 | int retval = 0; |
201 | 201 | ||
@@ -292,7 +292,7 @@ void get_more(unsigned char** start, size_t* size) | |||
292 | #endif | 292 | #endif |
293 | } | 293 | } |
294 | 294 | ||
295 | static int midimain(void * filename) | 295 | static int midimain(const void * filename) |
296 | { | 296 | { |
297 | int notesUsed = 0; | 297 | int notesUsed = 0; |
298 | int a=0; | 298 | int a=0; |
diff --git a/apps/plugins/midi2wav.c b/apps/plugins/midi2wav.c index ad41451d88..6e4e7d1bc1 100644 --- a/apps/plugins/midi2wav.c +++ b/apps/plugins/midi2wav.c | |||
@@ -54,20 +54,14 @@ long bpm; | |||
54 | #include "midi/synth.c" | 54 | #include "midi/synth.c" |
55 | 55 | ||
56 | 56 | ||
57 | |||
58 | |||
59 | int fd=-1; /* File descriptor where the output is written */ | 57 | int fd=-1; /* File descriptor where the output is written */ |
60 | 58 | ||
61 | extern long tempo; /* The sequencer keeps track of this */ | 59 | extern long tempo; /* The sequencer keeps track of this */ |
62 | 60 | ||
63 | 61 | const struct plugin_api * rb; | |
64 | struct plugin_api * rb; | ||
65 | |||
66 | |||
67 | |||
68 | 62 | ||
69 | 63 | ||
70 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 64 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
71 | { | 65 | { |
72 | (void)parameter; | 66 | (void)parameter; |
73 | rb = api; | 67 | rb = api; |
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index e4b8c939b4..7b1587ce6f 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c | |||
@@ -221,7 +221,7 @@ enum minesweeper_status { | |||
221 | * it's nice not to have to pass the api pointer in all function calls | 221 | * it's nice not to have to pass the api pointer in all function calls |
222 | * in the plugin | 222 | * in the plugin |
223 | */ | 223 | */ |
224 | static struct plugin_api *rb; | 224 | static const struct plugin_api *rb; |
225 | 225 | ||
226 | extern const fb_data minesweeper_tiles[]; | 226 | extern const fb_data minesweeper_tiles[]; |
227 | 227 | ||
@@ -731,7 +731,7 @@ enum minesweeper_status minesweeper( void ) | |||
731 | } | 731 | } |
732 | 732 | ||
733 | /* plugin entry point */ | 733 | /* plugin entry point */ |
734 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 734 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
735 | { | 735 | { |
736 | bool exit = false; | 736 | bool exit = false; |
737 | 737 | ||
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 9545f89f59..4d7b0af795 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c | |||
@@ -141,7 +141,7 @@ PLUGIN_HEADER | |||
141 | #endif | 141 | #endif |
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 144 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
145 | { | 145 | { |
146 | int button; | 146 | int button; |
147 | int timer = 10; | 147 | int timer = 10; |
@@ -149,7 +149,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
149 | int y=0; | 149 | int y=0; |
150 | int sx = 3; | 150 | int sx = 3; |
151 | int sy = 3; | 151 | int sy = 3; |
152 | struct plugin_api* rb = api; | 152 | const struct plugin_api* rb = api; |
153 | (void)parameter; | 153 | (void)parameter; |
154 | 154 | ||
155 | #ifdef HAVE_LCD_CHARCELLS | 155 | #ifdef HAVE_LCD_CHARCELLS |
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index a344bdc7dc..db9c9d4e67 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c | |||
@@ -16,7 +16,7 @@ | |||
16 | PLUGIN_HEADER | 16 | PLUGIN_HEADER |
17 | PLUGIN_IRAM_DECLARE | 17 | PLUGIN_IRAM_DECLARE |
18 | 18 | ||
19 | static struct plugin_api* rb; | 19 | static const struct plugin_api* rb; |
20 | 20 | ||
21 | MEM_FUNCTION_WRAPPERS(rb); | 21 | MEM_FUNCTION_WRAPPERS(rb); |
22 | 22 | ||
@@ -806,7 +806,7 @@ static const int win_const[18][4] = { | |||
806 | { 134, -146,-3352,-3072 } }; | 806 | { 134, -146,-3352,-3072 } }; |
807 | 807 | ||
808 | 808 | ||
809 | static char* wav_filename; | 809 | static const char* wav_filename; |
810 | static int mp3file, wavfile, wav_size, frames; | 810 | static int mp3file, wavfile, wav_size, frames; |
811 | static uint32 enc_buffer[16384]; /* storage for 65536 Bytes */ | 811 | static uint32 enc_buffer[16384]; /* storage for 65536 Bytes */ |
812 | static int enc_chunk = 0; /* encode chunk counter */ | 812 | static int enc_chunk = 0; /* encode chunk counter */ |
@@ -2278,7 +2278,7 @@ void compress(void) | |||
2278 | int num_file; | 2278 | int num_file; |
2279 | char mp3_name[80]; | 2279 | char mp3_name[80]; |
2280 | 2280 | ||
2281 | void get_mp3_filename(char *wav_name) | 2281 | void get_mp3_filename(const char *wav_name) |
2282 | { | 2282 | { |
2283 | int slen = rb->strlen(wav_name); | 2283 | int slen = rb->strlen(wav_name); |
2284 | rb->strncpy(mp3_name, wav_name, 79); | 2284 | rb->strncpy(mp3_name, wav_name, 79); |
@@ -2353,7 +2353,7 @@ void get_mp3_filename(char *wav_name) | |||
2353 | #endif | 2353 | #endif |
2354 | #endif | 2354 | #endif |
2355 | 2355 | ||
2356 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 2356 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
2357 | { | 2357 | { |
2358 | int rat, srat, nrat; /* for rate selection */ | 2358 | int rat, srat, nrat; /* for rate selection */ |
2359 | int cont = 1, butt; | 2359 | int cont = 1, butt; |
diff --git a/apps/plugins/mpegplayer/decode.c b/apps/plugins/mpegplayer/decode.c index ab3a800d9b..1c85fa7a92 100644 --- a/apps/plugins/mpegplayer/decode.c +++ b/apps/plugins/mpegplayer/decode.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include "mpeg2dec_config.h" | 26 | #include "mpeg2dec_config.h" |
27 | 27 | ||
28 | extern struct plugin_api* rb; | 28 | extern const struct plugin_api* rb; |
29 | 29 | ||
30 | #include "mpeg2.h" | 30 | #include "mpeg2.h" |
31 | #include "attributes.h" | 31 | #include "attributes.h" |
diff --git a/apps/plugins/mpegplayer/header.c b/apps/plugins/mpegplayer/header.c index 3dd3d280dd..d8d005b692 100644 --- a/apps/plugins/mpegplayer/header.c +++ b/apps/plugins/mpegplayer/header.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include "mpeg2dec_config.h" | 27 | #include "mpeg2dec_config.h" |
28 | 28 | ||
29 | extern struct plugin_api* rb; | 29 | extern const struct plugin_api* rb; |
30 | 30 | ||
31 | #include "mpeg2.h" | 31 | #include "mpeg2.h" |
32 | #include "attributes.h" | 32 | #include "attributes.h" |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 8e46b24eee..82703ca840 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -257,7 +257,7 @@ PLUGIN_IRAM_DECLARE | |||
257 | #endif | 257 | #endif |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | struct plugin_api* rb; | 260 | const struct plugin_api* rb; |
261 | 261 | ||
262 | CACHE_FUNCTION_WRAPPERS(rb); | 262 | CACHE_FUNCTION_WRAPPERS(rb); |
263 | ALIGN_BUFFER_WRAPPER(rb); | 263 | ALIGN_BUFFER_WRAPPER(rb); |
@@ -1544,7 +1544,7 @@ static void button_loop(void) | |||
1544 | backlight_use_settings(rb); | 1544 | backlight_use_settings(rb); |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1547 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1548 | { | 1548 | { |
1549 | int status = PLUGIN_ERROR; /* assume failure */ | 1549 | int status = PLUGIN_ERROR; /* assume failure */ |
1550 | int result; | 1550 | int result; |
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h index b92af38e6c..fa13a1e378 100644 --- a/apps/plugins/mpegplayer/mpegplayer.h +++ b/apps/plugins/mpegplayer/mpegplayer.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define MPEGPLAYER_H | 22 | #define MPEGPLAYER_H |
23 | 23 | ||
24 | /* Global API pointer */ | 24 | /* Global API pointer */ |
25 | extern struct plugin_api* rb; | 25 | extern const struct plugin_api* rb; |
26 | 26 | ||
27 | #ifdef HAVE_SCHEDULER_BOOSTCTRL | 27 | #ifdef HAVE_SCHEDULER_BOOSTCTRL |
28 | #define trigger_cpu_boost rb->trigger_cpu_boost | 28 | #define trigger_cpu_boost rb->trigger_cpu_boost |
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c index b13cfe415b..ae3297d458 100644 --- a/apps/plugins/nim.c +++ b/apps/plugins/nim.c | |||
@@ -59,7 +59,7 @@ static unsigned char str[12]; /*String use to display the first line*/ | |||
59 | static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/ | 59 | static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/ |
60 | 60 | ||
61 | static bool end; /*If true game is finished*/ | 61 | static bool end; /*If true game is finished*/ |
62 | static struct plugin_api* rb; | 62 | static const struct plugin_api* rb; |
63 | 63 | ||
64 | 64 | ||
65 | /*Display that the action it's impossible*/ | 65 | /*Display that the action it's impossible*/ |
@@ -138,7 +138,7 @@ static void nim_exit(void *parameter) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | /* this is the plugin entry point */ | 140 | /* this is the plugin entry point */ |
141 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 141 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
142 | { | 142 | { |
143 | int y,z,button; | 143 | int y,z,button; |
144 | int x,v,min; | 144 | int x,v,min; |
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index eae1a7bc4c..e126ff57d0 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c | |||
@@ -249,7 +249,7 @@ enum { OSC_HORIZ, OSC_VERT, MAX_OSC }; | |||
249 | 249 | ||
250 | /* global variables */ | 250 | /* global variables */ |
251 | 251 | ||
252 | struct plugin_api* rb; /* global api struct pointer */ | 252 | const struct plugin_api* rb; /* global api struct pointer */ |
253 | 253 | ||
254 | /* settings */ | 254 | /* settings */ |
255 | struct osc_config { | 255 | struct osc_config { |
@@ -650,7 +650,7 @@ void cleanup(void *parameter) | |||
650 | backlight_use_settings(rb); /* backlight control in lib/helper.c */ | 650 | backlight_use_settings(rb); /* backlight control in lib/helper.c */ |
651 | } | 651 | } |
652 | 652 | ||
653 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 653 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
654 | { | 654 | { |
655 | int button, vol; | 655 | int button, vol; |
656 | int lastbutton = BUTTON_NONE; | 656 | int lastbutton = BUTTON_NONE; |
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c index db7bf0bb89..5244ed8d8c 100644 --- a/apps/plugins/pacbox/arcade.c +++ b/apps/plugins/pacbox/arcade.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include "plugin.h" | 28 | #include "plugin.h" |
29 | 29 | ||
30 | extern struct plugin_api* rb; | 30 | extern const struct plugin_api* rb; |
31 | 31 | ||
32 | #ifndef HAVE_LCD_COLOR | 32 | #ifndef HAVE_LCD_COLOR |
33 | /* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */ | 33 | /* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */ |
diff --git a/apps/plugins/pacbox/hardware.c b/apps/plugins/pacbox/hardware.c index 23658cf61e..376fe3273f 100644 --- a/apps/plugins/pacbox/hardware.c +++ b/apps/plugins/pacbox/hardware.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "plugin.h" | 25 | #include "plugin.h" |
26 | #include "hardware.h" | 26 | #include "hardware.h" |
27 | 27 | ||
28 | extern struct plugin_api* rb; | 28 | extern const struct plugin_api* rb; |
29 | 29 | ||
30 | /* The main data for Pacman */ | 30 | /* The main data for Pacman */ |
31 | 31 | ||
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index fad27358d2..1eb040e24d 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c | |||
@@ -32,7 +32,7 @@ | |||
32 | PLUGIN_HEADER | 32 | PLUGIN_HEADER |
33 | PLUGIN_IRAM_DECLARE | 33 | PLUGIN_IRAM_DECLARE |
34 | 34 | ||
35 | struct plugin_api* rb; | 35 | const struct plugin_api* rb; |
36 | 36 | ||
37 | struct pacman_settings { | 37 | struct pacman_settings { |
38 | int difficulty; | 38 | int difficulty; |
@@ -361,7 +361,7 @@ static int gameProc( void ) | |||
361 | return 0; | 361 | return 0; |
362 | } | 362 | } |
363 | 363 | ||
364 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 364 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
365 | { | 365 | { |
366 | (void)parameter; | 366 | (void)parameter; |
367 | 367 | ||
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index e41c724da6..ed58ac605d 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #endif | 25 | #endif |
26 | #include "pegbox_pieces.h" | 26 | #include "pegbox_pieces.h" |
27 | 27 | ||
28 | static struct plugin_api* rb; | 28 | static const struct plugin_api* rb; |
29 | 29 | ||
30 | PLUGIN_HEADER | 30 | PLUGIN_HEADER |
31 | 31 | ||
@@ -1256,7 +1256,7 @@ static int pegbox(struct game_context* pb) { | |||
1256 | /***************************************************************************** | 1256 | /***************************************************************************** |
1257 | * plugin entry point. | 1257 | * plugin entry point. |
1258 | ******************************************************************************/ | 1258 | ******************************************************************************/ |
1259 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 1259 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
1260 | bool exit = false; | 1260 | bool exit = false; |
1261 | struct game_context pb; | 1261 | struct game_context pb; |
1262 | 1262 | ||
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index e5494d661a..bea028eadc 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -34,7 +34,7 @@ PLUGIN_HEADER | |||
34 | 34 | ||
35 | /******************************* Globals ***********************************/ | 35 | /******************************* Globals ***********************************/ |
36 | 36 | ||
37 | static struct plugin_api *rb; /* global api struct pointer */ | 37 | static const struct plugin_api *rb; /* global api struct pointer */ |
38 | 38 | ||
39 | const struct button_mapping *plugin_contexts[] | 39 | const struct button_mapping *plugin_contexts[] |
40 | = {generic_actions, generic_directions}; | 40 | = {generic_actions, generic_directions}; |
@@ -2080,7 +2080,7 @@ int main(void) | |||
2080 | 2080 | ||
2081 | /*************************** Plugin entry point ****************************/ | 2081 | /*************************** Plugin entry point ****************************/ |
2082 | 2082 | ||
2083 | enum plugin_status plugin_start(struct plugin_api *api, void *parameter) | 2083 | enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) |
2084 | { | 2084 | { |
2085 | int ret; | 2085 | int ret; |
2086 | 2086 | ||
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c index e8ae7645b4..027a8355da 100644 --- a/apps/plugins/plasma.c +++ b/apps/plugins/plasma.c | |||
@@ -36,7 +36,7 @@ PLUGIN_HEADER | |||
36 | 36 | ||
37 | /******************************* Globals ***********************************/ | 37 | /******************************* Globals ***********************************/ |
38 | 38 | ||
39 | static struct plugin_api* rb; /* global api struct pointer */ | 39 | static const struct plugin_api* rb; /* global api struct pointer */ |
40 | static unsigned char wave_array[256]; /* Pre calculated wave array */ | 40 | static unsigned char wave_array[256]; /* Pre calculated wave array */ |
41 | #ifdef HAVE_LCD_COLOR | 41 | #ifdef HAVE_LCD_COLOR |
42 | static fb_data colours[256]; /* Smooth transition of shades */ | 42 | static fb_data colours[256]; /* Smooth transition of shades */ |
@@ -343,7 +343,7 @@ int main(void) | |||
343 | 343 | ||
344 | /*************************** Plugin entry point ****************************/ | 344 | /*************************** Plugin entry point ****************************/ |
345 | 345 | ||
346 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 346 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
347 | { | 347 | { |
348 | int ret; | 348 | int ret; |
349 | 349 | ||
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c index 8163915fb6..c7382a58b2 100644 --- a/apps/plugins/pong.c +++ b/apps/plugins/pong.c | |||
@@ -174,7 +174,7 @@ PLUGIN_HEADER | |||
174 | #endif | 174 | #endif |
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | static struct plugin_api* rb; | 177 | static const struct plugin_api* rb; |
178 | 178 | ||
179 | struct pong { | 179 | struct pong { |
180 | int ballx; /* current X*RES position of the ball */ | 180 | int ballx; /* current X*RES position of the ball */ |
@@ -453,7 +453,7 @@ void showscore(struct pong *p) | |||
453 | } | 453 | } |
454 | 454 | ||
455 | /* this is the plugin entry point */ | 455 | /* this is the plugin entry point */ |
456 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 456 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
457 | { | 457 | { |
458 | struct pong pong; | 458 | struct pong pong; |
459 | int game = 1; | 459 | int game = 1; |
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 27805154b3..05d05a746b 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
22 | 22 | ||
23 | static struct plugin_api* rb; | 23 | static const struct plugin_api* rb; |
24 | 24 | ||
25 | MEM_FUNCTION_WRAPPERS(rb); | 25 | MEM_FUNCTION_WRAPPERS(rb); |
26 | 26 | ||
@@ -252,21 +252,23 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len) | |||
252 | return buffer; | 252 | return buffer; |
253 | } | 253 | } |
254 | 254 | ||
255 | enum plugin_status plugin_start(struct plugin_api* api, void* file) | 255 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
256 | { | 256 | { |
257 | rb = api; | 257 | rb = api; |
258 | struct gui_synclist properties_lists; | 258 | struct gui_synclist properties_lists; |
259 | int button; | 259 | int button; |
260 | bool prev_show_statusbar; | 260 | bool prev_show_statusbar; |
261 | bool quit = false; | 261 | bool quit = false; |
262 | char file[MAX_PATH]; | ||
263 | rb->strcpy(file, (const char *) parameter); | ||
262 | 264 | ||
263 | /* determine if it's a file or a directory */ | 265 | /* determine if it's a file or a directory */ |
264 | bool found = false; | 266 | bool found = false; |
265 | DIR* dir; | 267 | DIR* dir; |
266 | struct dirent* entry; | 268 | struct dirent* entry; |
267 | char* ptr = rb->strrchr((char*)file, '/') + 1; | 269 | char* ptr = rb->strrchr(file, '/') + 1; |
268 | int dirlen = (ptr - (char*)file); | 270 | int dirlen = (ptr - file); |
269 | rb->strncpy(str_dirname, (char*)file, dirlen); | 271 | rb->strncpy(str_dirname, file, dirlen); |
270 | str_dirname[dirlen] = 0; | 272 | str_dirname[dirlen] = 0; |
271 | 273 | ||
272 | dir = rb->opendir(str_dirname); | 274 | dir = rb->opendir(str_dirname); |
@@ -288,13 +290,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) | |||
288 | if(!found) | 290 | if(!found) |
289 | { | 291 | { |
290 | /* weird: we couldn't find the entry. This Should Never Happen (TM) */ | 292 | /* weird: we couldn't find the entry. This Should Never Happen (TM) */ |
291 | rb->splash(0, "File/Dir not found: %s", (char*)file); | 293 | rb->splash(0, "File/Dir not found: %s", file); |
292 | rb->action_userabort(TIMEOUT_BLOCK); | 294 | rb->action_userabort(TIMEOUT_BLOCK); |
293 | return PLUGIN_OK; | 295 | return PLUGIN_OK; |
294 | } | 296 | } |
295 | 297 | ||
296 | /* get the info depending on its_a_dir */ | 298 | /* get the info depending on its_a_dir */ |
297 | if(!(its_a_dir ? dir_properties((char*)file):file_properties((char*)file))) | 299 | if(!(its_a_dir ? dir_properties(file) : file_properties(file))) |
298 | { | 300 | { |
299 | /* something went wrong (to do: tell user what it was (nesting,...) */ | 301 | /* something went wrong (to do: tell user what it was (nesting,...) */ |
300 | rb->splash(0, "Failed to gather information"); | 302 | rb->splash(0, "Failed to gather information"); |
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 413dc029b4..4df764285f 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | 23 | ||
24 | static struct plugin_api* rb; | 24 | static const struct plugin_api* rb; |
25 | static bool abort; | 25 | static bool abort; |
26 | static int fd; | 26 | static int fd; |
27 | static int dirs_count; | 27 | static int dirs_count; |
@@ -544,7 +544,7 @@ int main_menu(void) | |||
544 | return 0; | 544 | return 0; |
545 | } | 545 | } |
546 | 546 | ||
547 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 547 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
548 | { | 548 | { |
549 | (void)parameter; | 549 | (void)parameter; |
550 | 550 | ||
diff --git a/apps/plugins/reversi/reversi-game.h b/apps/plugins/reversi/reversi-game.h index de05df78f9..9558f000bf 100644 --- a/apps/plugins/reversi/reversi-game.h +++ b/apps/plugins/reversi/reversi-game.h | |||
@@ -58,7 +58,7 @@ typedef struct _reversi_board_t { | |||
58 | */ | 58 | */ |
59 | move_t history[BOARD_SIZE*BOARD_SIZE - INIT_STONES]; | 59 | move_t history[BOARD_SIZE*BOARD_SIZE - INIT_STONES]; |
60 | 60 | ||
61 | struct plugin_api *rb; | 61 | const struct plugin_api *rb; |
62 | } reversi_board_t; | 62 | } reversi_board_t; |
63 | 63 | ||
64 | 64 | ||
diff --git a/apps/plugins/reversi/reversi-gui.c b/apps/plugins/reversi/reversi-gui.c index 1995923f4f..a7e695529b 100644 --- a/apps/plugins/reversi/reversi-gui.c +++ b/apps/plugins/reversi/reversi-gui.c | |||
@@ -52,7 +52,7 @@ PLUGIN_HEADER | |||
52 | /* The global api struct pointer. While not strictly necessary, | 52 | /* The global api struct pointer. While not strictly necessary, |
53 | it's nice not to have to pass the api pointer in all function | 53 | it's nice not to have to pass the api pointer in all function |
54 | calls in the plugin */ | 54 | calls in the plugin */ |
55 | static struct plugin_api* rb; | 55 | static const struct plugin_api* rb; |
56 | 56 | ||
57 | /* Thickness of the grid lines */ | 57 | /* Thickness of the grid lines */ |
58 | #define LINE_THCK 1 | 58 | #define LINE_THCK 1 |
@@ -543,7 +543,7 @@ static void reversi_gui_move_cursor(int new_row, int new_col) { | |||
543 | 543 | ||
544 | 544 | ||
545 | /* plugin entry point */ | 545 | /* plugin entry point */ |
546 | enum plugin_status plugin_start(struct plugin_api *api, void *parameter) { | 546 | enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) { |
547 | bool exit, draw_screen; | 547 | bool exit, draw_screen; |
548 | int button; | 548 | int button; |
549 | int lastbutton = BUTTON_NONE; | 549 | int lastbutton = BUTTON_NONE; |
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c index a2786b7e2d..a2208a30d5 100644 --- a/apps/plugins/robotfindskitten.c +++ b/apps/plugins/robotfindskitten.c | |||
@@ -180,7 +180,7 @@ int screen[X_MAX + 1][Y_MAX + 1]; | |||
180 | /* here is a global api struct pointer. while not strictly necessary, | 180 | /* here is a global api struct pointer. while not strictly necessary, |
181 | it's nice not to have to pass the api pointer in all function calls | 181 | it's nice not to have to pass the api pointer in all function calls |
182 | in the plugin */ | 182 | in the plugin */ |
183 | static struct plugin_api* rb; | 183 | static const struct plugin_api* rb; |
184 | 184 | ||
185 | /****************************************************************************** | 185 | /****************************************************************************** |
186 | * | 186 | * |
@@ -593,7 +593,7 @@ static void initialize_screen() | |||
593 | } | 593 | } |
594 | 594 | ||
595 | /* this is the plugin entry point */ | 595 | /* this is the plugin entry point */ |
596 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 596 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
597 | { | 597 | { |
598 | (void)parameter; | 598 | (void)parameter; |
599 | rb = api; | 599 | rb = api; |
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 62e7c747e1..3df427da48 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c | |||
@@ -507,7 +507,7 @@ extern const fb_data rockblox_background[]; | |||
507 | 507 | ||
508 | 508 | ||
509 | /* must have variable */ | 509 | /* must have variable */ |
510 | static struct plugin_api *rb; | 510 | static const struct plugin_api *rb; |
511 | 511 | ||
512 | static bool gameover = false; | 512 | static bool gameover = false; |
513 | /* c=current f=figure o=orientation n=next */ | 513 | /* c=current f=figure o=orientation n=next */ |
@@ -1159,7 +1159,7 @@ static int rockblox_loop (void) | |||
1159 | return PLUGIN_OK; | 1159 | return PLUGIN_OK; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | enum plugin_status plugin_start (struct plugin_api *api, void *parameter) | 1162 | enum plugin_status plugin_start (const struct plugin_api *api, const void *parameter) |
1163 | { | 1163 | { |
1164 | int ret; | 1164 | int ret; |
1165 | 1165 | ||
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c index ed0fd17f53..fd855ff520 100644 --- a/apps/plugins/rockbox_flash.c +++ b/apps/plugins/rockbox_flash.c | |||
@@ -95,7 +95,7 @@ typedef struct | |||
95 | char name[32]; | 95 | char name[32]; |
96 | } tFlashInfo; | 96 | } tFlashInfo; |
97 | 97 | ||
98 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 98 | static const struct plugin_api* rb; /* here is a global api struct pointer */ |
99 | 99 | ||
100 | static UINT8* sector; /* better not place this on the stack... */ | 100 | static UINT8* sector; /* better not place this on the stack... */ |
101 | 101 | ||
@@ -1017,7 +1017,7 @@ void DoUserDialog(char* filename) | |||
1017 | 1017 | ||
1018 | /***************** Plugin Entry Point *****************/ | 1018 | /***************** Plugin Entry Point *****************/ |
1019 | 1019 | ||
1020 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1020 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1021 | { | 1021 | { |
1022 | int oldmode; | 1022 | int oldmode; |
1023 | 1023 | ||
diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c index 67f10043ba..c4b1ff0425 100644 --- a/apps/plugins/rockboy.c +++ b/apps/plugins/rockboy.c | |||
@@ -27,7 +27,7 @@ | |||
27 | PLUGIN_HEADER | 27 | PLUGIN_HEADER |
28 | 28 | ||
29 | /* this is the plugin entry point */ | 29 | /* this is the plugin entry point */ |
30 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 30 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
31 | { | 31 | { |
32 | return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy"); | 32 | return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy"); |
33 | } | 33 | } |
diff --git a/apps/plugins/rockboy/loader.c b/apps/plugins/rockboy/loader.c index d48a06957e..71ab4e78d7 100644 --- a/apps/plugins/rockboy/loader.c +++ b/apps/plugins/rockboy/loader.c | |||
@@ -99,7 +99,7 @@ static const unsigned char ramsize_table[5] = | |||
99 | 0, 1, 1, 4, 16 | 99 | 0, 1, 1, 4, 16 |
100 | }; | 100 | }; |
101 | 101 | ||
102 | static char *romfile; | 102 | static const char *romfile; |
103 | static char sramfile[500]; | 103 | static char sramfile[500]; |
104 | static char rtcfile[500]; | 104 | static char rtcfile[500]; |
105 | static char saveprefix[500]; | 105 | static char saveprefix[500]; |
@@ -284,7 +284,7 @@ void cleanup(void) | |||
284 | /* IDEA - if error, write emergency savestate..? */ | 284 | /* IDEA - if error, write emergency savestate..? */ |
285 | } | 285 | } |
286 | 286 | ||
287 | void loader_init(char *s) | 287 | void loader_init(const char *s) |
288 | { | 288 | { |
289 | romfile = s; | 289 | romfile = s; |
290 | if(rom_load()) | 290 | if(rom_load()) |
diff --git a/apps/plugins/rockboy/loader.h b/apps/plugins/rockboy/loader.h index 33217d55f3..5ade6e7d8a 100644 --- a/apps/plugins/rockboy/loader.h +++ b/apps/plugins/rockboy/loader.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #ifndef __LOADER_H__ | 3 | #ifndef __LOADER_H__ |
4 | #define __LOADER_H__ | 4 | #define __LOADER_H__ |
5 | 5 | ||
6 | void loader_init(char *s); | 6 | void loader_init(const char *s); |
7 | void cleanup(void); | 7 | void cleanup(void); |
8 | 8 | ||
9 | #endif | 9 | #endif |
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 58696a1f61..a0e87d041d 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c | |||
@@ -30,7 +30,7 @@ PLUGIN_IRAM_DECLARE | |||
30 | /* here is a global api struct pointer. while not strictly necessary, | 30 | /* here is a global api struct pointer. while not strictly necessary, |
31 | it's nice not to have to pass the api pointer in all function calls | 31 | it's nice not to have to pass the api pointer in all function calls |
32 | in the plugin */ | 32 | in the plugin */ |
33 | struct plugin_api* rb; | 33 | const struct plugin_api* rb; |
34 | int shut,cleanshut; | 34 | int shut,cleanshut; |
35 | char *errormsg; | 35 | char *errormsg; |
36 | 36 | ||
@@ -275,7 +275,7 @@ void doevents(void) | |||
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | static int gnuboy_main(char *rom) | 278 | static int gnuboy_main(const char *rom) |
279 | { | 279 | { |
280 | rb->lcd_puts(0,0,"Init video"); | 280 | rb->lcd_puts(0,0,"Init video"); |
281 | vid_init(); | 281 | vid_init(); |
@@ -297,7 +297,7 @@ static int gnuboy_main(char *rom) | |||
297 | } | 297 | } |
298 | 298 | ||
299 | /* this is the plugin entry point */ | 299 | /* this is the plugin entry point */ |
300 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 300 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
301 | { | 301 | { |
302 | PLUGIN_IRAM_INIT(api) | 302 | PLUGIN_IRAM_INIT(api) |
303 | 303 | ||
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h index 89cb845ec2..18e4d5c255 100644 --- a/apps/plugins/rockboy/rockmacros.h +++ b/apps/plugins/rockboy/rockmacros.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #define malloc(a) my_malloc(a) | 26 | #define malloc(a) my_malloc(a) |
27 | void *my_malloc(size_t size); | 27 | void *my_malloc(size_t size); |
28 | 28 | ||
29 | extern struct plugin_api* rb; | 29 | extern const struct plugin_api* rb; |
30 | extern int shut,cleanshut; | 30 | extern int shut,cleanshut; |
31 | void vid_init(void); | 31 | void vid_init(void); |
32 | inline void vid_begin(void); | 32 | inline void vid_begin(void); |
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c index 49e1e8fc33..507f131322 100644 --- a/apps/plugins/rocklife.c +++ b/apps/plugins/rocklife.c | |||
@@ -77,7 +77,7 @@ PLUGIN_HEADER | |||
77 | #define PATTERN_ACORN 3 | 77 | #define PATTERN_ACORN 3 |
78 | #define PATTERN_GLIDER_GUN 4 /* not yet implemented */ | 78 | #define PATTERN_GLIDER_GUN 4 /* not yet implemented */ |
79 | 79 | ||
80 | static struct plugin_api* rb; | 80 | static const struct plugin_api* rb; |
81 | const struct button_mapping *plugin_contexts[] | 81 | const struct button_mapping *plugin_contexts[] |
82 | = {generic_directions, generic_actions}; | 82 | = {generic_directions, generic_actions}; |
83 | 83 | ||
@@ -393,7 +393,7 @@ static void next_generation(char *pgrid, char *pnext_grid){ | |||
393 | /**********************************/ | 393 | /**********************************/ |
394 | /* this is the plugin entry point */ | 394 | /* this is the plugin entry point */ |
395 | /**********************************/ | 395 | /**********************************/ |
396 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 396 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
397 | { | 397 | { |
398 | int button = 0; | 398 | int button = 0; |
399 | int quit = 0; | 399 | int quit = 0; |
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 997cbef0f3..e612d458bb 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -256,7 +256,7 @@ static void inv_cursor(bool update); | |||
256 | static void restore_screen(void); | 256 | static void restore_screen(void); |
257 | static void clear_drawing(void); | 257 | static void clear_drawing(void); |
258 | static void goto_menu(void); | 258 | static void goto_menu(void); |
259 | static int load_bitmap( char *filename ); | 259 | static int load_bitmap( const char *filename ); |
260 | static int save_bitmap( char *filename ); | 260 | static int save_bitmap( char *filename ); |
261 | static void draw_rect_full( int x1, int y1, int x2, int y2 ); | 261 | static void draw_rect_full( int x1, int y1, int x2, int y2 ); |
262 | extern int errno; | 262 | extern int errno; |
@@ -269,7 +269,7 @@ extern int errno; | |||
269 | int errno; | 269 | int errno; |
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | static struct plugin_api* rb; | 272 | static const struct plugin_api* rb; |
273 | 273 | ||
274 | MEM_FUNCTION_WRAPPERS(rb); | 274 | MEM_FUNCTION_WRAPPERS(rb); |
275 | 275 | ||
@@ -2953,7 +2953,7 @@ static bool rockpaint_loop( void ) | |||
2953 | return PLUGIN_OK; | 2953 | return PLUGIN_OK; |
2954 | } | 2954 | } |
2955 | 2955 | ||
2956 | static int load_bitmap( char *file ) | 2956 | static int load_bitmap( const char *file ) |
2957 | { | 2957 | { |
2958 | struct bitmap bm; | 2958 | struct bitmap bm; |
2959 | bool ret; | 2959 | bool ret; |
@@ -2992,7 +2992,7 @@ static int save_bitmap( char *file ) | |||
2992 | return save_bmp_file( file, &bm, rb ); | 2992 | return save_bmp_file( file, &bm, rb ); |
2993 | } | 2993 | } |
2994 | 2994 | ||
2995 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 2995 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
2996 | { | 2996 | { |
2997 | /** must have stuff **/ | 2997 | /** must have stuff **/ |
2998 | rb = api; | 2998 | rb = api; |
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index 097f4ac7d5..5f034ef8ae 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | PLUGIN_HEADER | 23 | PLUGIN_HEADER |
24 | 24 | ||
25 | static struct plugin_api* rb; | 25 | static const struct plugin_api* rb; |
26 | 26 | ||
27 | #define BUFFER_SIZE 16384 | 27 | #define BUFFER_SIZE 16384 |
28 | 28 | ||
@@ -114,7 +114,7 @@ static void clear_display(void){ | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | static bool search_init(char* file){ | 117 | static bool search_init(const char* file){ |
118 | rb->memset(search_string, 0, sizeof(search_string)); | 118 | rb->memset(search_string, 0, sizeof(search_string)); |
119 | 119 | ||
120 | if (!rb->kbd_input(search_string,sizeof search_string)){ | 120 | if (!rb->kbd_input(search_string,sizeof search_string)){ |
@@ -144,10 +144,10 @@ static bool search_init(char* file){ | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* this is the plugin entry point */ | 146 | /* this is the plugin entry point */ |
147 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 147 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
148 | { | 148 | { |
149 | int ok; | 149 | int ok; |
150 | char *filename = parameter; | 150 | const char *filename = parameter; |
151 | char *p; | 151 | char *p; |
152 | 152 | ||
153 | rb = api; | 153 | rb = api; |
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c index 62d3a91fa7..944714eb2f 100644 --- a/apps/plugins/searchengine/searchengine.c +++ b/apps/plugins/searchengine/searchengine.c | |||
@@ -26,7 +26,7 @@ PLUGIN_HEADER | |||
26 | void *audio_bufferbase; | 26 | void *audio_bufferbase; |
27 | void *audio_bufferpointer; | 27 | void *audio_bufferpointer; |
28 | size_t audio_buffer_free; | 28 | size_t audio_buffer_free; |
29 | struct plugin_api* rb; | 29 | const struct plugin_api* rb; |
30 | int w, h, y; | 30 | int w, h, y; |
31 | 31 | ||
32 | void *my_malloc(size_t size) | 32 | void *my_malloc(size_t size) |
@@ -56,7 +56,7 @@ void setmallocpos(void *pointer) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | /* this is the plugin entry point */ | 58 | /* this is the plugin entry point */ |
59 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 59 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
60 | { | 60 | { |
61 | unsigned char *result,buf[500]; | 61 | unsigned char *result,buf[500]; |
62 | int parsefd,hits; | 62 | int parsefd,hits; |
diff --git a/apps/plugins/searchengine/searchengine.h b/apps/plugins/searchengine/searchengine.h index 07248ef37e..b0f6597971 100644 --- a/apps/plugins/searchengine/searchengine.h +++ b/apps/plugins/searchengine/searchengine.h | |||
@@ -38,7 +38,7 @@ rb->lcd_update() | |||
38 | rb->lcd_update() | 38 | rb->lcd_update() |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | extern struct plugin_api* rb; | 41 | extern const struct plugin_api* rb; |
42 | 42 | ||
43 | void *my_malloc(size_t size); | 43 | void *my_malloc(size_t size); |
44 | void setmallocpos(void *pointer); | 44 | void setmallocpos(void *pointer); |
diff --git a/apps/plugins/shortcuts/shortcuts.h b/apps/plugins/shortcuts/shortcuts.h index 34f200d193..2d2c705a66 100644 --- a/apps/plugins/shortcuts/shortcuts.h +++ b/apps/plugins/shortcuts/shortcuts.h | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define SHORTCUTS_FILENAME "/shortcuts.link" | 33 | #define SHORTCUTS_FILENAME "/shortcuts.link" |
34 | 34 | ||
35 | extern struct plugin_api* rb; | 35 | extern const struct plugin_api* rb; |
36 | 36 | ||
37 | typedef struct sc_entry_s | 37 | typedef struct sc_entry_s |
38 | { | 38 | { |
diff --git a/apps/plugins/shortcuts/shortcuts_append.c b/apps/plugins/shortcuts/shortcuts_append.c index afd03929ae..4174bdd2d8 100644 --- a/apps/plugins/shortcuts/shortcuts_append.c +++ b/apps/plugins/shortcuts/shortcuts_append.c | |||
@@ -49,7 +49,7 @@ bool append_entry_to_file(sc_file_t *file, char *path, bool is_dir) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | enum plugin_status plugin_start(struct plugin_api* api, void* void_parameter) | 52 | enum plugin_status plugin_start(const struct plugin_api* api, const void* void_parameter) |
53 | { | 53 | { |
54 | rb = api; | 54 | rb = api; |
55 | bool found; | 55 | bool found; |
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index 5e7d9c2b00..47f0203b87 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c | |||
@@ -198,7 +198,7 @@ bool ends_with(char *string, char *suffix) | |||
198 | } | 198 | } |
199 | 199 | ||
200 | 200 | ||
201 | enum plugin_status plugin_start(struct plugin_api* api, void* void_parameter) | 201 | enum plugin_status plugin_start(const struct plugin_api* api, const void* void_parameter) |
202 | { | 202 | { |
203 | rb = api; | 203 | rb = api; |
204 | bool leave_loop; | 204 | bool leave_loop; |
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 1e99a7adaf..36c95b9dda 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c | |||
@@ -184,7 +184,7 @@ PLUGIN_HEADER | |||
184 | #define IMAGE_HEIGHT BMPHEIGHT_sliding_puzzle | 184 | #define IMAGE_HEIGHT BMPHEIGHT_sliding_puzzle |
185 | #define IMAGE_SIZE IMAGE_WIDTH | 185 | #define IMAGE_SIZE IMAGE_WIDTH |
186 | 186 | ||
187 | static struct plugin_api* rb; | 187 | static const struct plugin_api* rb; |
188 | 188 | ||
189 | /* use a square image, (the default Archos bitmap looks square on its display) | 189 | /* use a square image, (the default Archos bitmap looks square on its display) |
190 | Puzzle image dimension is min(lcd_height,lcd_width) | 190 | Puzzle image dimension is min(lcd_height,lcd_width) |
@@ -603,7 +603,7 @@ static int puzzle_loop(void) | |||
603 | } | 603 | } |
604 | } | 604 | } |
605 | 605 | ||
606 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 606 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
607 | { | 607 | { |
608 | int i, w, h; | 608 | int i, w, h; |
609 | 609 | ||
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c index 6203a07a23..471b72f6b1 100644 --- a/apps/plugins/snake.c +++ b/apps/plugins/snake.c | |||
@@ -174,7 +174,7 @@ PLUGIN_HEADER | |||
174 | static int board[BOARD_WIDTH][BOARD_HEIGHT],snakelength; | 174 | static int board[BOARD_WIDTH][BOARD_HEIGHT],snakelength; |
175 | static unsigned int score,hiscore=0,level=1; | 175 | static unsigned int score,hiscore=0,level=1; |
176 | static short dir,frames,apple,dead=0; | 176 | static short dir,frames,apple,dead=0; |
177 | static struct plugin_api* rb; | 177 | static const struct plugin_api* rb; |
178 | 178 | ||
179 | void die (void) | 179 | void die (void) |
180 | { | 180 | { |
@@ -432,7 +432,7 @@ void game_init(void) { | |||
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 435 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
436 | { | 436 | { |
437 | (void)(parameter); | 437 | (void)(parameter); |
438 | rb = api; | 438 | rb = api; |
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 0452294195..625e5c5a6a 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c | |||
@@ -354,7 +354,7 @@ static int apple; | |||
354 | static int level = 4, speed = 5,dead = 0, quit = 0; | 354 | static int level = 4, speed = 5,dead = 0, quit = 0; |
355 | static int sillydir = 0, num_levels = 0; | 355 | static int sillydir = 0, num_levels = 0; |
356 | static int level_from_file = 0; | 356 | static int level_from_file = 0; |
357 | static struct plugin_api* rb; | 357 | static const struct plugin_api* rb; |
358 | static int headx, heady, tailx, taily, applecountdown = 5; | 358 | static int headx, heady, tailx, taily, applecountdown = 5; |
359 | static int game_type = 0; | 359 | static int game_type = 0; |
360 | static int num_apples_to_get=1; | 360 | static int num_apples_to_get=1; |
@@ -1398,7 +1398,7 @@ void game_init(void) | |||
1398 | 1398 | ||
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1401 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1402 | { | 1402 | { |
1403 | (void)(parameter); | 1403 | (void)(parameter); |
1404 | rb = api; | 1404 | rb = api; |
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c index 6550050646..becc7d871a 100644 --- a/apps/plugins/snow.c +++ b/apps/plugins/snow.c | |||
@@ -70,7 +70,7 @@ PLUGIN_HEADER | |||
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | static short particles[NUM_PARTICLES][2]; | 72 | static short particles[NUM_PARTICLES][2]; |
73 | static struct plugin_api* rb; | 73 | static const struct plugin_api* rb; |
74 | 74 | ||
75 | #ifdef HAVE_LCD_BITMAP | 75 | #ifdef HAVE_LCD_BITMAP |
76 | #if LCD_WIDTH >= 160 | 76 | #if LCD_WIDTH >= 160 |
@@ -185,7 +185,7 @@ static void snow_init(void) | |||
185 | #endif | 185 | #endif |
186 | } | 186 | } |
187 | 187 | ||
188 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 188 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
189 | { | 189 | { |
190 | int button; | 190 | int button; |
191 | (void)(parameter); | 191 | (void)(parameter); |
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 2b12a3da58..bc5bf42e8d 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -372,7 +372,7 @@ static struct BufferedBoards { | |||
372 | } buffered_boards; | 372 | } buffered_boards; |
373 | 373 | ||
374 | 374 | ||
375 | static struct plugin_api* rb; | 375 | static const struct plugin_api* rb; |
376 | MEM_FUNCTION_WRAPPERS(rb); | 376 | MEM_FUNCTION_WRAPPERS(rb); |
377 | 377 | ||
378 | static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */ | 378 | static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */ |
@@ -1576,7 +1576,7 @@ static bool sokoban_loop(void) | |||
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | 1578 | ||
1579 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1579 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1580 | { | 1580 | { |
1581 | int w, h; | 1581 | int w, h; |
1582 | 1582 | ||
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 0907054a1c..d16b65c549 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | PLUGIN_HEADER | 29 | PLUGIN_HEADER |
30 | 30 | ||
31 | static struct plugin_api* rb; | 31 | static const struct plugin_api* rb; |
32 | #define min(a,b) (a<b?a:b) | 32 | #define min(a,b) (a<b?a:b) |
33 | 33 | ||
34 | /** | 34 | /** |
@@ -1843,7 +1843,7 @@ int solitaire( int skipmenu ) | |||
1843 | * Plugin entry point | 1843 | * Plugin entry point |
1844 | */ | 1844 | */ |
1845 | 1845 | ||
1846 | enum plugin_status plugin_start( struct plugin_api* api, void* parameter ) | 1846 | enum plugin_status plugin_start( const struct plugin_api* api, const void* parameter ) |
1847 | { | 1847 | { |
1848 | int result; | 1848 | int result; |
1849 | 1849 | ||
diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c index f99549ebd7..571978cf1c 100644 --- a/apps/plugins/sort.c +++ b/apps/plugins/sort.c | |||
@@ -57,7 +57,7 @@ | |||
57 | 57 | ||
58 | PLUGIN_HEADER | 58 | PLUGIN_HEADER |
59 | 59 | ||
60 | static struct plugin_api* rb; | 60 | static const struct plugin_api* rb; |
61 | 61 | ||
62 | ssize_t buf_size; | 62 | ssize_t buf_size; |
63 | static char *filename; | 63 | static char *filename; |
@@ -176,7 +176,7 @@ static int write_file(void) | |||
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 179 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
180 | { | 180 | { |
181 | char *buf; | 181 | char *buf; |
182 | int rc; | 182 | int rc; |
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index bfddb453dc..8db5ff92cf 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c | |||
@@ -25,7 +25,7 @@ | |||
25 | PLUGIN_HEADER | 25 | PLUGIN_HEADER |
26 | 26 | ||
27 | /******************************* Globals ***********************************/ | 27 | /******************************* Globals ***********************************/ |
28 | static struct plugin_api* rb; /* global api struct pointer */ | 28 | static const struct plugin_api* rb; /* global api struct pointer */ |
29 | /* variable button definitions */ | 29 | /* variable button definitions */ |
30 | #if CONFIG_KEYPAD == RECORDER_PAD | 30 | #if CONFIG_KEYPAD == RECORDER_PAD |
31 | #define AST_PAUSE BUTTON_ON | 31 | #define AST_PAUSE BUTTON_ON |
@@ -2022,7 +2022,7 @@ enum plugin_status start_game(void) | |||
2022 | } | 2022 | } |
2023 | } | 2023 | } |
2024 | 2024 | ||
2025 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 2025 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
2026 | { | 2026 | { |
2027 | enum plugin_status retval; | 2027 | enum plugin_status retval; |
2028 | (void)(parameter); | 2028 | (void)(parameter); |
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index ab4ce415b7..419ce7a676 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c | |||
@@ -97,7 +97,7 @@ unsigned char SCALE_BMP[][13] = | |||
97 | #define SE_COUNT 5 | 97 | #define SE_COUNT 5 |
98 | 98 | ||
99 | /* the global api pointer */ | 99 | /* the global api pointer */ |
100 | static struct plugin_api* rb; | 100 | static const struct plugin_api* rb; |
101 | 101 | ||
102 | /* contains the file name of the song that is to be split */ | 102 | /* contains the file name of the song that is to be split */ |
103 | static char path_mp3[MAX_PATH]; | 103 | static char path_mp3[MAX_PATH]; |
@@ -1248,7 +1248,7 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split, | |||
1248 | return retval; | 1248 | return retval; |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1251 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1252 | { | 1252 | { |
1253 | struct mp3entry* mp3; | 1253 | struct mp3entry* mp3; |
1254 | 1254 | ||
diff --git a/apps/plugins/star.c b/apps/plugins/star.c index 46780f9ea7..1b7c4d01b5 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c | |||
@@ -310,7 +310,7 @@ static char board[STAR_HEIGHT][STAR_WIDTH]; | |||
310 | static int char_width = -1; | 310 | static int char_width = -1; |
311 | static int char_height = -1; | 311 | static int char_height = -1; |
312 | 312 | ||
313 | static struct plugin_api* rb; | 313 | static const struct plugin_api* rb; |
314 | 314 | ||
315 | /* this arrays contains a group of levels loaded into memory */ | 315 | /* this arrays contains a group of levels loaded into memory */ |
316 | static unsigned char* levels = | 316 | static unsigned char* levels = |
@@ -1101,7 +1101,7 @@ static int star_menu(void) | |||
1101 | /** | 1101 | /** |
1102 | * Main entry point | 1102 | * Main entry point |
1103 | */ | 1103 | */ |
1104 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1104 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1105 | { | 1105 | { |
1106 | (void)parameter; | 1106 | (void)parameter; |
1107 | rb = api; | 1107 | rb = api; |
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c index 754af24f8c..130e077cc7 100644 --- a/apps/plugins/starfield.c +++ b/apps/plugins/starfield.c | |||
@@ -24,7 +24,7 @@ PLUGIN_HEADER | |||
24 | 24 | ||
25 | /******************************* Globals ***********************************/ | 25 | /******************************* Globals ***********************************/ |
26 | 26 | ||
27 | static struct plugin_api* rb; /* global api struct pointer */ | 27 | static const struct plugin_api* rb; /* global api struct pointer */ |
28 | 28 | ||
29 | /* Key assignement */ | 29 | /* Key assignement */ |
30 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 30 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
@@ -169,7 +169,7 @@ static struct plugin_api* rb; /* global api struct pointer */ | |||
169 | 169 | ||
170 | #define MSG_DISP_TIME 30 | 170 | #define MSG_DISP_TIME 30 |
171 | 171 | ||
172 | static struct plugin_api* rb; /* global api struct pointer */ | 172 | static const struct plugin_api* rb; /* global api struct pointer */ |
173 | 173 | ||
174 | /* | 174 | /* |
175 | * Each star's stuffs | 175 | * Each star's stuffs |
@@ -432,7 +432,7 @@ int plugin_main(void) | |||
432 | 432 | ||
433 | /*************************** Plugin entry point ****************************/ | 433 | /*************************** Plugin entry point ****************************/ |
434 | 434 | ||
435 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 435 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
436 | { | 436 | { |
437 | int ret; | 437 | int ret; |
438 | 438 | ||
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index a65fde4704..be73e23406 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
22 | 22 | ||
23 | static struct plugin_api* rb; | 23 | static const struct plugin_api* rb; |
24 | static int files, dirs, musicfiles, largestdir; | 24 | static int files, dirs, musicfiles, largestdir; |
25 | static int lasttick; | 25 | static int lasttick; |
26 | static bool abort; | 26 | static bool abort; |
@@ -183,7 +183,7 @@ void traversedir(char* location, char* name) | |||
183 | largestdir = files_in_dir; | 183 | largestdir = files_in_dir; |
184 | } | 184 | } |
185 | 185 | ||
186 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 186 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
187 | { | 187 | { |
188 | int button; | 188 | int button; |
189 | 189 | ||
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index 18ad1c48cb..ece19b1e82 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c | |||
@@ -171,7 +171,7 @@ PLUGIN_HEADER | |||
171 | #endif | 171 | #endif |
172 | #endif | 172 | #endif |
173 | 173 | ||
174 | static struct plugin_api* rb; | 174 | static const struct plugin_api* rb; |
175 | 175 | ||
176 | static int stopwatch = 0; | 176 | static int stopwatch = 0; |
177 | static long start_at = 0; | 177 | static long start_at = 0; |
@@ -228,7 +228,7 @@ static void ticks_to_string(int ticks,int lap,int buflen, char * buf) | |||
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 231 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
232 | { | 232 | { |
233 | char buf[32]; | 233 | char buf[32]; |
234 | int button; | 234 | int button; |
diff --git a/apps/plugins/sudoku/generator.c b/apps/plugins/sudoku/generator.c index eaef8c0f17..56dce48cc2 100644 --- a/apps/plugins/sudoku/generator.c +++ b/apps/plugins/sudoku/generator.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "sudoku.h" | 35 | #include "sudoku.h" |
36 | #include "templates.h" | 36 | #include "templates.h" |
37 | 37 | ||
38 | extern struct plugin_api* rb; | 38 | extern const struct plugin_api* rb; |
39 | 39 | ||
40 | #define assert(x) | 40 | #define assert(x) |
41 | 41 | ||
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index d76b68ef27..64a6c8d7c9 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c | |||
@@ -80,7 +80,7 @@ PLUGIN_HEADER | |||
80 | it's nice not to have to pass the api pointer in all function calls | 80 | it's nice not to have to pass the api pointer in all function calls |
81 | in the plugin */ | 81 | in the plugin */ |
82 | 82 | ||
83 | struct plugin_api* rb; | 83 | const struct plugin_api* rb; |
84 | 84 | ||
85 | /* Default game - used to initialise sudoku.ss if it doesn't exist. */ | 85 | /* Default game - used to initialise sudoku.ss if it doesn't exist. */ |
86 | static const char default_game[9][9] = | 86 | static const char default_game[9][9] = |
@@ -1188,7 +1188,7 @@ void move_cursor(struct sudoku_state_t* state, int newx, int newy) | |||
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | /* plugin entry point */ | 1190 | /* plugin entry point */ |
1191 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 1191 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
1192 | { | 1192 | { |
1193 | bool exit; | 1193 | bool exit; |
1194 | int button; | 1194 | int button; |
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index e99d456454..4f5cc53086 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c | |||
@@ -18,7 +18,7 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | PLUGIN_HEADER | 20 | PLUGIN_HEADER |
21 | static struct plugin_api* rb; | 21 | static const struct plugin_api* rb; |
22 | 22 | ||
23 | extern const fb_data superdom_boarditems[]; | 23 | extern const fb_data superdom_boarditems[]; |
24 | char buf[255]; | 24 | char buf[255]; |
@@ -2153,7 +2153,7 @@ void computer_war(void) { | |||
2153 | } | 2153 | } |
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | int load_game(char* file) { | 2156 | static int load_game(const char* file) { |
2157 | int fd; | 2157 | int fd; |
2158 | 2158 | ||
2159 | fd = rb->open(file, O_RDONLY); | 2159 | fd = rb->open(file, O_RDONLY); |
@@ -2222,7 +2222,7 @@ int average_strength(bool colour) { | |||
2222 | return totalpower/100; | 2222 | return totalpower/100; |
2223 | } | 2223 | } |
2224 | 2224 | ||
2225 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 2225 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
2226 | { | 2226 | { |
2227 | int tempmenu; | 2227 | int tempmenu; |
2228 | bool statusbar_setting; | 2228 | bool statusbar_setting; |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 69d905a37e..40b1bfdd32 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -30,7 +30,7 @@ PLUGIN_HEADER | |||
30 | #define TESTCODEC_EXITBUTTON BUTTON_SELECT | 30 | #define TESTCODEC_EXITBUTTON BUTTON_SELECT |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | static struct plugin_api* rb; | 33 | static const struct plugin_api* rb; |
34 | 34 | ||
35 | CACHE_FUNCTION_WRAPPERS(rb) | 35 | CACHE_FUNCTION_WRAPPERS(rb) |
36 | 36 | ||
@@ -629,7 +629,7 @@ exit: | |||
629 | } | 629 | } |
630 | 630 | ||
631 | /* plugin entry point */ | 631 | /* plugin entry point */ |
632 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 632 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
633 | { | 633 | { |
634 | uintptr_t* codec_stack_copy; | 634 | uintptr_t* codec_stack_copy; |
635 | int result, selection = 0; | 635 | int result, selection = 0; |
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c index 27dbdb3334..93464807c3 100644 --- a/apps/plugins/test_disk.c +++ b/apps/plugins/test_disk.c | |||
@@ -34,7 +34,7 @@ PLUGIN_HEADER | |||
34 | #endif | 34 | #endif |
35 | #define TEST_TIME 10 /* in seconds */ | 35 | #define TEST_TIME 10 /* in seconds */ |
36 | 36 | ||
37 | static struct plugin_api* rb; | 37 | static const struct plugin_api* rb; |
38 | static unsigned char* audiobuf; | 38 | static unsigned char* audiobuf; |
39 | static ssize_t audiobuflen; | 39 | static ssize_t audiobuflen; |
40 | 40 | ||
@@ -404,7 +404,7 @@ static bool test_speed(void) | |||
404 | 404 | ||
405 | 405 | ||
406 | /* this is the plugin entry point */ | 406 | /* this is the plugin entry point */ |
407 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 407 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
408 | { | 408 | { |
409 | static const struct menu_item items[] = { | 409 | static const struct menu_item items[] = { |
410 | { "Disk speed", test_speed }, | 410 | { "Disk speed", test_speed }, |
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c index 46a94a91ec..0852e0a9fb 100644 --- a/apps/plugins/test_fps.c +++ b/apps/plugins/test_fps.c | |||
@@ -39,7 +39,7 @@ PLUGIN_IRAM_DECLARE | |||
39 | 39 | ||
40 | PLUGIN_HEADER | 40 | PLUGIN_HEADER |
41 | 41 | ||
42 | static struct plugin_api* rb; | 42 | static const struct plugin_api* rb; |
43 | 43 | ||
44 | /* Screen logging */ | 44 | /* Screen logging */ |
45 | static int line; | 45 | static int line; |
@@ -334,7 +334,7 @@ static void time_greyscale(void) | |||
334 | #endif | 334 | #endif |
335 | 335 | ||
336 | /* plugin entry point */ | 336 | /* plugin entry point */ |
337 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 337 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
338 | { | 338 | { |
339 | #ifndef SIMULATOR | 339 | #ifndef SIMULATOR |
340 | char str[32]; | 340 | char str[32]; |
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c index a413854332..5d836633de 100644 --- a/apps/plugins/test_grey.c +++ b/apps/plugins/test_grey.c | |||
@@ -105,7 +105,7 @@ static const unsigned char dither_matrix[16][16] = { | |||
105 | static unsigned char input_levels[STEPS+1]; | 105 | static unsigned char input_levels[STEPS+1]; |
106 | static unsigned char lcd_levels[STEPS+1]; | 106 | static unsigned char lcd_levels[STEPS+1]; |
107 | 107 | ||
108 | static struct plugin_api* rb; | 108 | static const struct plugin_api* rb; |
109 | static unsigned char *gbuf; | 109 | static unsigned char *gbuf; |
110 | static size_t gbuf_size = 0; | 110 | static size_t gbuf_size = 0; |
111 | 111 | ||
@@ -136,7 +136,7 @@ static void fill_rastered(int bx, int by, int bw, int bh, int step) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | /* plugin entry point */ | 138 | /* plugin entry point */ |
139 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 139 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
140 | { | 140 | { |
141 | bool done = false; | 141 | bool done = false; |
142 | int cur_step = 1; | 142 | int cur_step = 1; |
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c index c50bc5f91c..218da2a625 100644 --- a/apps/plugins/test_resize.c +++ b/apps/plugins/test_resize.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | PLUGIN_HEADER | 29 | PLUGIN_HEADER |
30 | 30 | ||
31 | static struct plugin_api* rb; | 31 | static const struct plugin_api* rb; |
32 | 32 | ||
33 | const struct button_mapping *plugin_contexts[] | 33 | const struct button_mapping *plugin_contexts[] |
34 | = {generic_actions, generic_directions}; | 34 | = {generic_actions, generic_directions}; |
@@ -62,7 +62,7 @@ static fb_data output_bmp_data[MAX_OUTPUT_WIDTH*MAX_OUTPUT_HEIGHT]; | |||
62 | 62 | ||
63 | 63 | ||
64 | /* this is the plugin entry point */ | 64 | /* this is the plugin entry point */ |
65 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 65 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
66 | { | 66 | { |
67 | (void)parameter; | 67 | (void)parameter; |
68 | 68 | ||
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c index 2cd95d7983..a036844880 100644 --- a/apps/plugins/test_sampr.c +++ b/apps/plugins/test_sampr.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | 23 | ||
24 | struct plugin_api *rb; | 24 | const struct plugin_api *rb; |
25 | 25 | ||
26 | enum | 26 | enum |
27 | { | 27 | { |
@@ -253,7 +253,7 @@ void set_waveform(void) | |||
253 | 253 | ||
254 | /* Tests hardware sample rate switching */ | 254 | /* Tests hardware sample rate switching */ |
255 | /* TODO: needs a volume control */ | 255 | /* TODO: needs a volume control */ |
256 | enum plugin_status plugin_start(struct plugin_api *api, void *parameter) | 256 | enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) |
257 | { | 257 | { |
258 | static const struct menu_item items[] = | 258 | static const struct menu_item items[] = |
259 | { | 259 | { |
diff --git a/apps/plugins/test_scanrate.c b/apps/plugins/test_scanrate.c index bd189bc85e..995e64a257 100644 --- a/apps/plugins/test_scanrate.c +++ b/apps/plugins/test_scanrate.c | |||
@@ -107,7 +107,7 @@ PLUGIN_HEADER | |||
107 | #define NEED_BOOST | 107 | #define NEED_BOOST |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | static struct plugin_api* rb; | 110 | static const struct plugin_api* rb; |
111 | static unsigned char bitbuffer[2][BUF_HEIGHT][BUF_WIDTH]; | 111 | static unsigned char bitbuffer[2][BUF_HEIGHT][BUF_WIDTH]; |
112 | static int curbuf = 0; | 112 | static int curbuf = 0; |
113 | static int scan_rate = DEFAULT_SCAN_RATE; | 113 | static int scan_rate = DEFAULT_SCAN_RATE; |
@@ -210,7 +210,7 @@ int plugin_main(void) | |||
210 | 210 | ||
211 | 211 | ||
212 | /* this is the plugin entry point */ | 212 | /* this is the plugin entry point */ |
213 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 213 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
214 | { | 214 | { |
215 | (void)parameter; | 215 | (void)parameter; |
216 | rb = api; | 216 | rb = api; |
diff --git a/apps/plugins/test_touchpad.c b/apps/plugins/test_touchpad.c index 2970f6fbf4..a9ad96eb32 100644 --- a/apps/plugins/test_touchpad.c +++ b/apps/plugins/test_touchpad.c | |||
@@ -28,10 +28,10 @@ PLUGIN_HEADER | |||
28 | #define TOUCHPAD_TOGGLE BUTTON_RC_MODE | 28 | #define TOUCHPAD_TOGGLE BUTTON_RC_MODE |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | static struct plugin_api* rb; | 31 | static const struct plugin_api* rb; |
32 | 32 | ||
33 | /* plugin entry point */ | 33 | /* plugin entry point */ |
34 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 34 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
35 | { | 35 | { |
36 | int button = 0; | 36 | int button = 0; |
37 | enum touchpad_mode mode = TOUCHPAD_BUTTON; | 37 | enum touchpad_mode mode = TOUCHPAD_BUTTON; |
diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c index 1f1e99a0ff..bb1b4b9af9 100644 --- a/apps/plugins/test_viewports.c +++ b/apps/plugins/test_viewports.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | 23 | ||
24 | static struct plugin_api* rb; | 24 | static const struct plugin_api* rb; |
25 | 25 | ||
26 | #ifdef HAVE_LCD_BITMAP | 26 | #ifdef HAVE_LCD_BITMAP |
27 | 27 | ||
@@ -157,7 +157,7 @@ static struct viewport rvp1 = | |||
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | 159 | ||
160 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 160 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
161 | { | 161 | { |
162 | (void)parameter; | 162 | (void)parameter; |
163 | char buf[80]; | 163 | char buf[80]; |
@@ -278,7 +278,7 @@ static struct viewport vp2 = | |||
278 | }; | 278 | }; |
279 | 279 | ||
280 | 280 | ||
281 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 281 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
282 | { | 282 | { |
283 | (void)parameter; | 283 | (void)parameter; |
284 | 284 | ||
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 617155fb2b..0edde54e75 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | #define MAX_LINE_LEN 2048 | 27 | #define MAX_LINE_LEN 2048 |
28 | PLUGIN_HEADER | 28 | PLUGIN_HEADER |
29 | static struct plugin_api* rb; | 29 | static const struct plugin_api* rb; |
30 | 30 | ||
31 | static char buffer[MAX_CHARS]; | 31 | static char buffer[MAX_CHARS]; |
32 | static char eol[3]; | 32 | static char eol[3]; |
@@ -118,8 +118,8 @@ int _do_action(int action, char* str, int line) | |||
118 | char *list_get_name_cb(int selected_item, void* data, | 118 | char *list_get_name_cb(int selected_item, void* data, |
119 | char* buf, size_t buf_len) | 119 | char* buf, size_t buf_len) |
120 | { | 120 | { |
121 | char *b = &buffer[do_action(ACTION_GET,0,selected_item)]; | ||
122 | (void)data; | 121 | (void)data; |
122 | char *b = &buffer[do_action(ACTION_GET,0,selected_item)]; | ||
123 | if (rb->strlen(b) >= buf_len) | 123 | if (rb->strlen(b) >= buf_len) |
124 | { | 124 | { |
125 | char t = b[buf_len-10]; | 125 | char t = b[buf_len-10]; |
@@ -306,7 +306,7 @@ int hex_to_rgb(const char* hex, int* color) | |||
306 | #endif /* HAVE_LCD_COLOR */ | 306 | #endif /* HAVE_LCD_COLOR */ |
307 | 307 | ||
308 | /* this is the plugin entry point */ | 308 | /* this is the plugin entry point */ |
309 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 309 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
310 | { | 310 | { |
311 | int fd; | 311 | int fd; |
312 | static char temp_line[MAX_LINE_LEN]; | 312 | static char temp_line[MAX_LINE_LEN]; |
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index 665a2aae5e..85a61cbfc3 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
22 | 22 | ||
23 | static struct plugin_api* rb; | 23 | static const struct plugin_api* rb; |
24 | 24 | ||
25 | static char *audiobuf; | 25 | static char *audiobuf; |
26 | static ssize_t audiobuflen; | 26 | static ssize_t audiobuflen; |
@@ -36,7 +36,7 @@ static void xingupdate(int percent) | |||
36 | rb->lcd_update(); | 36 | rb->lcd_update(); |
37 | } | 37 | } |
38 | 38 | ||
39 | static int insert_data_in_file(char *fname, int fpos, char *buf, int num_bytes) | 39 | static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_bytes) |
40 | { | 40 | { |
41 | int readlen; | 41 | int readlen; |
42 | int rc; | 42 | int rc; |
@@ -126,7 +126,7 @@ static const unsigned char empty_id3_header[] = | |||
126 | 0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */ | 126 | 0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */ |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static bool vbr_fix(char *selected_file) | 129 | static bool vbr_fix(const char *selected_file) |
130 | { | 130 | { |
131 | struct mp3entry entry; | 131 | struct mp3entry entry; |
132 | int fd; | 132 | int fd; |
@@ -261,7 +261,7 @@ static bool vbr_fix(char *selected_file) | |||
261 | return false; | 261 | return false; |
262 | } | 262 | } |
263 | 263 | ||
264 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) | 264 | enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter) |
265 | { | 265 | { |
266 | rb = api; | 266 | rb = api; |
267 | 267 | ||
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index 3e7e53aec8..f1f6533f4f 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -141,7 +141,7 @@ typedef struct /* the little header for all audio blocks */ | |||
141 | 141 | ||
142 | /****************** globals ******************/ | 142 | /****************** globals ******************/ |
143 | 143 | ||
144 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 144 | static const struct plugin_api* rb; /* here is a global api struct pointer */ |
145 | static char gPrint[32]; /* a global printf buffer, saves stack */ | 145 | static char gPrint[32]; /* a global printf buffer, saves stack */ |
146 | 146 | ||
147 | 147 | ||
@@ -986,7 +986,7 @@ int main(char* filename) | |||
986 | 986 | ||
987 | /***************** Plugin Entry Point *****************/ | 987 | /***************** Plugin Entry Point *****************/ |
988 | 988 | ||
989 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 989 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
990 | { | 990 | { |
991 | rb = api; /* copy to global api pointer */ | 991 | rb = api; /* copy to global api pointer */ |
992 | 992 | ||
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 885ac70bea..cd0d3694ba 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -357,7 +357,7 @@ static int display_lines; /* number of lines on the display */ | |||
357 | static int draw_columns; /* number of (pixel) columns available for text */ | 357 | static int draw_columns; /* number of (pixel) columns available for text */ |
358 | static int par_indent_spaces; /* number of spaces to indent first paragraph */ | 358 | static int par_indent_spaces; /* number of spaces to indent first paragraph */ |
359 | static int fd; | 359 | static int fd; |
360 | static char *file_name; | 360 | static const char *file_name; |
361 | static long file_size; | 361 | static long file_size; |
362 | static long start_position; /* position in the file after the viewer is started */ | 362 | static long start_position; /* position in the file after the viewer is started */ |
363 | static bool mac_text; | 363 | static bool mac_text; |
@@ -368,7 +368,7 @@ static unsigned char *screen_top_ptr; | |||
368 | static unsigned char *next_screen_ptr; | 368 | static unsigned char *next_screen_ptr; |
369 | static unsigned char *next_screen_to_draw_ptr; | 369 | static unsigned char *next_screen_to_draw_ptr; |
370 | static unsigned char *next_line_ptr; | 370 | static unsigned char *next_line_ptr; |
371 | static struct plugin_api* rb; | 371 | static const struct plugin_api* rb; |
372 | #ifdef HAVE_LCD_BITMAP | 372 | #ifdef HAVE_LCD_BITMAP |
373 | static struct font *pf; | 373 | static struct font *pf; |
374 | #endif | 374 | #endif |
@@ -1457,7 +1457,7 @@ static void viewer_menu(void) | |||
1457 | viewer_draw(col); | 1457 | viewer_draw(col); |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | enum plugin_status plugin_start(struct plugin_api* api, void* file) | 1460 | enum plugin_status plugin_start(const struct plugin_api* api, const void* file) |
1461 | { | 1461 | { |
1462 | int button, i, ok; | 1462 | int button, i, ok; |
1463 | int lastbutton = BUTTON_NONE; | 1463 | int lastbutton = BUTTON_NONE; |
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index bdbab8ccf5..861adcc64c 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c | |||
@@ -648,7 +648,7 @@ void digital_meter(void) { | |||
648 | rb->lcd_hline(0,LCD_WIDTH-1,half_height+3); | 648 | rb->lcd_hline(0,LCD_WIDTH-1,half_height+3); |
649 | } | 649 | } |
650 | 650 | ||
651 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 651 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
652 | int button; | 652 | int button; |
653 | int lastbutton = BUTTON_NONE; | 653 | int lastbutton = BUTTON_NONE; |
654 | 654 | ||
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index f3e191d30d..45f99f7071 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c | |||
@@ -27,7 +27,7 @@ PLUGIN_HEADER | |||
27 | 27 | ||
28 | #define SAMPLES_PER_BLOCK 22050 | 28 | #define SAMPLES_PER_BLOCK 22050 |
29 | 29 | ||
30 | static struct plugin_api* rb; | 30 | static const struct plugin_api* rb; |
31 | 31 | ||
32 | void *memset(void *s, int c, size_t n) { | 32 | void *memset(void *s, int c, size_t n) { |
33 | return(rb->memset(s,c,n)); | 33 | return(rb->memset(s,c,n)); |
@@ -102,34 +102,35 @@ static void wvupdate (int32_t start_tick, | |||
102 | 102 | ||
103 | static int32_t temp_buffer [TEMP_SAMPLES] IDATA_ATTR; | 103 | static int32_t temp_buffer [TEMP_SAMPLES] IDATA_ATTR; |
104 | 104 | ||
105 | static int wav2wv (char *filename) | 105 | static int wav2wv(const char *infile) |
106 | { | 106 | { |
107 | int in_fd, out_fd, num_chans, error = false, last_buttons; | 107 | int in_fd, out_fd, num_chans, error = false, last_buttons; |
108 | unsigned int32_t total_bytes_read = 0, total_bytes_written = 0; | 108 | unsigned int32_t total_bytes_read = 0, total_bytes_written = 0; |
109 | unsigned int32_t total_samples, samples_remaining; | 109 | unsigned int32_t total_samples, samples_remaining; |
110 | int32_t *input_buffer = (int32_t *) audiobuf; | 110 | int32_t *input_buffer = (int32_t *) audiobuf; |
111 | unsigned char *output_buffer = (unsigned char *)(audiobuf + 0x100000); | 111 | unsigned char *output_buffer = (unsigned char *)(audiobuf + 0x100000); |
112 | char *extension, save_a; | 112 | char outfile[MAX_PATH]; |
113 | const char *inextension; | ||
114 | char *outextension; | ||
113 | WavpackConfig config; | 115 | WavpackConfig config; |
114 | WavpackContext *wpc; | 116 | WavpackContext *wpc; |
115 | int32_t start_tick; | 117 | int32_t start_tick; |
116 | 118 | ||
117 | rb->lcd_clear_display(); | 119 | rb->lcd_clear_display(); |
118 | rb->lcd_puts_scroll(0, 0, (unsigned char *)filename); | 120 | rb->lcd_puts_scroll(0, 0, (unsigned char *)infile); |
119 | #ifdef HAVE_LCD_BITMAP | 121 | #ifdef HAVE_LCD_BITMAP |
120 | rb->lcd_update(); | 122 | rb->lcd_update(); |
121 | #endif | 123 | #endif |
122 | 124 | ||
123 | last_buttons = rb->button_status (); | 125 | last_buttons = rb->button_status (); |
124 | start_tick = *rb->current_tick; | 126 | start_tick = *rb->current_tick; |
125 | extension = filename + rb->strlen (filename) - 3; | 127 | inextension = infile + rb->strlen(infile) - 3; |
126 | 128 | if (rb->strcasecmp (inextension, "wav")) { | |
127 | if (rb->strcasecmp (extension, "wav")) { | ||
128 | rb->splash(HZ*2, "only for wav files!"); | 129 | rb->splash(HZ*2, "only for wav files!"); |
129 | return 1; | 130 | return 1; |
130 | } | 131 | } |
131 | 132 | ||
132 | in_fd = rb->open(filename, O_RDONLY); | 133 | in_fd = rb->open(infile, O_RDONLY); |
133 | 134 | ||
134 | if (in_fd < 0) { | 135 | if (in_fd < 0) { |
135 | rb->splash(HZ*2, "could not open file!"); | 136 | rb->splash(HZ*2, "could not open file!"); |
@@ -171,14 +172,12 @@ static int wav2wv (char *filename) | |||
171 | } | 172 | } |
172 | 173 | ||
173 | WavpackAddWrapper (wpc, &raw_header, sizeof (raw_header)); | 174 | WavpackAddWrapper (wpc, &raw_header, sizeof (raw_header)); |
174 | save_a = extension [1]; | ||
175 | extension [1] = extension [2]; | ||
176 | extension [2] = 0; | ||
177 | |||
178 | out_fd = rb->creat (filename); | ||
179 | 175 | ||
180 | extension [2] = extension [1]; | 176 | rb->strcpy(outfile, infile); |
181 | extension [1] = save_a; | 177 | outextension = outfile + rb->strlen(outfile) - 3; |
178 | outextension[1] = outextension[2]; | ||
179 | outextension[2] = 0; | ||
180 | out_fd = rb->creat(outfile); | ||
182 | 181 | ||
183 | if (out_fd < 0) { | 182 | if (out_fd < 0) { |
184 | rb->splash(HZ*2, "could not create file!"); | 183 | rb->splash(HZ*2, "could not create file!"); |
@@ -278,12 +277,7 @@ static int wav2wv (char *filename) | |||
278 | rb->close (in_fd); | 277 | rb->close (in_fd); |
279 | 278 | ||
280 | if (error) { | 279 | if (error) { |
281 | save_a = extension [1]; | 280 | rb->remove (outfile); |
282 | extension [1] = extension [2]; | ||
283 | extension [2] = 0; | ||
284 | rb->remove (filename); | ||
285 | extension [2] = extension [1]; | ||
286 | extension [1] = save_a; | ||
287 | } | 281 | } |
288 | else | 282 | else |
289 | rb->splash(HZ*3, "operation successful"); | 283 | rb->splash(HZ*3, "operation successful"); |
@@ -291,7 +285,7 @@ static int wav2wv (char *filename) | |||
291 | return error; | 285 | return error; |
292 | } | 286 | } |
293 | 287 | ||
294 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) | 288 | enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter) |
295 | { | 289 | { |
296 | #ifdef RB_PROFILE | 290 | #ifdef RB_PROFILE |
297 | /* This doesn't start profiling or anything, it just gives the | 291 | /* This doesn't start profiling or anything, it just gives the |
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c index e20fa55d84..0ef7ef3584 100644 --- a/apps/plugins/wavplay.c +++ b/apps/plugins/wavplay.c | |||
@@ -3135,7 +3135,7 @@ void dma_end_isr(void) __attribute__((interrupt_handler)); | |||
3135 | 3135 | ||
3136 | /* variables */ | 3136 | /* variables */ |
3137 | 3137 | ||
3138 | static struct plugin_api *rb; | 3138 | static const struct plugin_api *rb; |
3139 | 3139 | ||
3140 | static unsigned char *aud_buf; | 3140 | static unsigned char *aud_buf; |
3141 | static ssize_t aud_size; | 3141 | static ssize_t aud_size; |
@@ -3647,7 +3647,7 @@ int play_file(char* filename) | |||
3647 | } | 3647 | } |
3648 | 3648 | ||
3649 | /* plugin entry point */ | 3649 | /* plugin entry point */ |
3650 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 3650 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
3651 | { | 3651 | { |
3652 | ssize_t buf_size; | 3652 | ssize_t buf_size; |
3653 | 3653 | ||
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index f6969ff7b5..77e71b8b25 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c | |||
@@ -3178,7 +3178,7 @@ void rec_tick(void) __attribute__((interrupt_handler)); | |||
3178 | 3178 | ||
3179 | /* variables */ | 3179 | /* variables */ |
3180 | 3180 | ||
3181 | static struct plugin_api *rb; | 3181 | static const struct plugin_api *rb; |
3182 | 3182 | ||
3183 | /* settings */ | 3183 | /* settings */ |
3184 | struct rec_config { | 3184 | struct rec_config { |
@@ -3752,7 +3752,7 @@ static int recording_menu(void) | |||
3752 | } | 3752 | } |
3753 | 3753 | ||
3754 | /* plugin entry point */ | 3754 | /* plugin entry point */ |
3755 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 3755 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
3756 | { | 3756 | { |
3757 | ssize_t buf_size; | 3757 | ssize_t buf_size; |
3758 | int align; | 3758 | int align; |
diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c index 9ce873476f..40031ac7f6 100644 --- a/apps/plugins/wavview.c +++ b/apps/plugins/wavview.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
22 | 22 | ||
23 | static struct plugin_api* rb; | 23 | static const struct plugin_api* rb; |
24 | 24 | ||
25 | /* temp byte buffer */ | 25 | /* temp byte buffer */ |
26 | uint8_t samples[10 * 1024]; /* read 10KB at the time */ | 26 | uint8_t samples[10 * 1024]; /* read 10KB at the time */ |
@@ -100,7 +100,7 @@ void little_endian_to_native (void *data, char *format) | |||
100 | /* read WAV file | 100 | /* read WAV file |
101 | display some info about it | 101 | display some info about it |
102 | store peak info in aufiobuf for display routine */ | 102 | store peak info in aufiobuf for display routine */ |
103 | static int readwavpeaks(char *filename) | 103 | static int readwavpeaks(const char *filename) |
104 | { | 104 | { |
105 | register uint32_t bytes_read; | 105 | register uint32_t bytes_read; |
106 | register uint32_t fppmp_count; | 106 | register uint32_t fppmp_count; |
@@ -352,7 +352,7 @@ void show_help(void) | |||
352 | rb->lcd_update(); | 352 | rb->lcd_update(); |
353 | } | 353 | } |
354 | 354 | ||
355 | enum plugin_status plugin_start(struct plugin_api* api, void *parameter) | 355 | enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter) |
356 | { | 356 | { |
357 | unsigned int quit = 0; | 357 | unsigned int quit = 0; |
358 | unsigned int action = 0; | 358 | unsigned int action = 0; |
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index f84fad9e4b..f862c1b345 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c | |||
@@ -417,7 +417,7 @@ static int player3_dir = EAST; | |||
417 | static int players = 1; | 417 | static int players = 1; |
418 | 418 | ||
419 | /* the rockbox plugin api */ | 419 | /* the rockbox plugin api */ |
420 | static struct plugin_api* rb; | 420 | static const struct plugin_api* rb; |
421 | 421 | ||
422 | #define SETTINGS_VERSION 1 | 422 | #define SETTINGS_VERSION 1 |
423 | #define SETTINGS_MIN_VERSION 1 | 423 | #define SETTINGS_MIN_VERSION 1 |
@@ -2444,7 +2444,7 @@ bool launch_wormlet(void) | |||
2444 | /** | 2444 | /** |
2445 | * Main entry point | 2445 | * Main entry point |
2446 | */ | 2446 | */ |
2447 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 2447 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
2448 | { | 2448 | { |
2449 | int result; | 2449 | int result; |
2450 | int menu_quit = 0; | 2450 | int menu_quit = 0; |
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 331650eddc..5054fd21b1 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c | |||
@@ -258,7 +258,7 @@ static int speed = 6; /* CYCLETIME = (11-speed)*10 ms */ | |||
258 | static int difficulty = 75; /* Percentage of screen that needs to be filled | 258 | static int difficulty = 75; /* Percentage of screen that needs to be filled |
259 | * in order to win the game */ | 259 | * in order to win the game */ |
260 | 260 | ||
261 | static struct plugin_api *rb; | 261 | static const struct plugin_api *rb; |
262 | 262 | ||
263 | MEM_FUNCTION_WRAPPERS(rb); | 263 | MEM_FUNCTION_WRAPPERS(rb); |
264 | 264 | ||
@@ -974,7 +974,7 @@ static int xobox_loop (void) | |||
974 | } | 974 | } |
975 | 975 | ||
976 | /* plugin main procedure */ | 976 | /* plugin main procedure */ |
977 | enum plugin_status plugin_start (struct plugin_api *api, void *parameter) | 977 | enum plugin_status plugin_start (const struct plugin_api *api, const void *parameter) |
978 | { | 978 | { |
979 | int ret = PLUGIN_OK; | 979 | int ret = PLUGIN_OK; |
980 | 980 | ||
diff --git a/apps/plugins/zxbox.c b/apps/plugins/zxbox.c index 61d9eea4ac..14f8b0911b 100644 --- a/apps/plugins/zxbox.c +++ b/apps/plugins/zxbox.c | |||
@@ -24,7 +24,7 @@ | |||
24 | PLUGIN_HEADER | 24 | PLUGIN_HEADER |
25 | 25 | ||
26 | /* this is the plugin entry point */ | 26 | /* this is the plugin entry point */ |
27 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 27 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
28 | { | 28 | { |
29 | return run_overlay(api, parameter, PLUGIN_APPS_DIR "/zxbox.ovl", "ZXBox"); | 29 | return run_overlay(api, parameter, PLUGIN_APPS_DIR "/zxbox.ovl", "ZXBox"); |
30 | } | 30 | } |
diff --git a/apps/plugins/zxbox/spconf.c b/apps/plugins/zxbox/spconf.c index d316ad0fbf..5a14959adc 100644 --- a/apps/plugins/zxbox/spconf.c +++ b/apps/plugins/zxbox/spconf.c | |||
@@ -103,7 +103,7 @@ static int find_extension(const char *ext) | |||
103 | 103 | ||
104 | 104 | ||
105 | /* now actually a snapshot/tape loader*/ | 105 | /* now actually a snapshot/tape loader*/ |
106 | void spcf_read_command_line(void* parameter) | 106 | void spcf_read_command_line(const void* parameter) |
107 | { | 107 | { |
108 | int ix; | 108 | int ix; |
109 | 109 | ||
diff --git a/apps/plugins/zxbox/spconf.h b/apps/plugins/zxbox/spconf.h index b7b89a22f7..7de5d2e857 100644 --- a/apps/plugins/zxbox/spconf.h +++ b/apps/plugins/zxbox/spconf.h | |||
@@ -31,7 +31,7 @@ extern int spcf_init_tapefile_type; | |||
31 | 31 | ||
32 | 32 | ||
33 | /*extern int spcf_read_conf_file(const char *filename);*/ | 33 | /*extern int spcf_read_conf_file(const char *filename);*/ |
34 | extern void spcf_read_command_line(void* parameter); | 34 | extern void spcf_read_command_line(const void* parameter); |
35 | extern void spcf_read_xresources(void); | 35 | extern void spcf_read_xresources(void); |
36 | extern int spcf_find_file_type(char *filename, int *ftp, int *ftsubp); | 36 | extern int spcf_find_file_type(char *filename, int *ftp, int *ftsubp); |
37 | 37 | ||
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index 51344763f9..136dcf0f24 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c | |||
@@ -519,17 +519,17 @@ static void run_singlemode(void) | |||
519 | } | 519 | } |
520 | 520 | ||
521 | 521 | ||
522 | void check_params(void* parameter) | 522 | void check_params(const void* parameter) |
523 | { | 523 | { |
524 | spcf_read_conf_file(GLOBALCFG); | 524 | spcf_read_conf_file(GLOBALCFG); |
525 | spcf_read_command_line(parameter); | 525 | spcf_read_command_line(parameter); |
526 | } | 526 | } |
527 | 527 | ||
528 | static void init_load(void *parameter) | 528 | static void init_load(const void *parameter) |
529 | { | 529 | { |
530 | if(load_immed) snsh_z80_load_intern(loadim, loadim_size); | 530 | if(load_immed) snsh_z80_load_intern(loadim, loadim_size); |
531 | 531 | ||
532 | check_params (parameter); | 532 | check_params(parameter); |
533 | if(spcf_init_snapshot != NULL) { | 533 | if(spcf_init_snapshot != NULL) { |
534 | #ifndef USE_GREY | 534 | #ifndef USE_GREY |
535 | rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot); | 535 | rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot); |
@@ -548,7 +548,7 @@ static void init_load(void *parameter) | |||
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | void start_spectemu(void *parameter) | 551 | void start_spectemu(const void *parameter) |
552 | { | 552 | { |
553 | spti_init(); | 553 | spti_init(); |
554 | init_load(parameter); | 554 | init_load(parameter); |
diff --git a/apps/plugins/zxbox/spmain.h b/apps/plugins/zxbox/spmain.h index 8168b261f6..5fb926ece9 100644 --- a/apps/plugins/zxbox/spmain.h +++ b/apps/plugins/zxbox/spmain.h | |||
@@ -21,8 +21,8 @@ | |||
21 | #ifndef SPMAIN_H | 21 | #ifndef SPMAIN_H |
22 | #define SPMAIN_H | 22 | #define SPMAIN_H |
23 | 23 | ||
24 | extern void check_params(void* parameter); | 24 | extern void check_params(const void* parameter); |
25 | extern void start_spectemu(void* parameter); | 25 | extern void start_spectemu(const void* parameter); |
26 | extern struct zxbox_settings settings; | 26 | extern struct zxbox_settings settings; |
27 | struct zxbox_settings { | 27 | struct zxbox_settings { |
28 | int invert_colors; | 28 | int invert_colors; |
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c index 3d94981ce5..873ecdf6c3 100644 --- a/apps/plugins/zxbox/zxbox.c +++ b/apps/plugins/zxbox/zxbox.c | |||
@@ -22,7 +22,7 @@ | |||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | PLUGIN_IRAM_DECLARE | 23 | PLUGIN_IRAM_DECLARE |
24 | 24 | ||
25 | struct plugin_api* rb; | 25 | const struct plugin_api* rb; |
26 | 26 | ||
27 | #include "spkey_p.h" | 27 | #include "spkey_p.h" |
28 | 28 | ||
@@ -59,7 +59,7 @@ static size_t gbuf_size = 0; | |||
59 | long video_frames IBSS_ATTR = 0 ; | 59 | long video_frames IBSS_ATTR = 0 ; |
60 | long start_time IBSS_ATTR = 0; | 60 | long start_time IBSS_ATTR = 0; |
61 | 61 | ||
62 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 62 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) |
63 | { | 63 | { |
64 | PLUGIN_IRAM_INIT(api) | 64 | PLUGIN_IRAM_INIT(api) |
65 | 65 | ||
diff --git a/apps/plugins/zxbox/zxconfig.h b/apps/plugins/zxbox/zxconfig.h index f83c091ab9..d0a6c5a7ea 100644 --- a/apps/plugins/zxbox/zxconfig.h +++ b/apps/plugins/zxbox/zxconfig.h | |||
@@ -5,7 +5,7 @@ | |||
5 | extern int load_tap; | 5 | extern int load_tap; |
6 | extern bool clear_kbd; | 6 | extern bool clear_kbd; |
7 | extern bool exit_requested; | 7 | extern bool exit_requested; |
8 | extern struct plugin_api* rb; | 8 | extern const struct plugin_api* rb; |
9 | extern void press_key(int c); | 9 | extern void press_key(int c); |
10 | extern long video_frames; | 10 | extern long video_frames; |
11 | extern long start_time; | 11 | extern long start_time; |