From c39f95465b9844f70f375f1690e0bf75c7ee7cc1 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 19 Jul 2020 13:42:04 -0400 Subject: do_menu pass internal synclist reference to callback keep running into the rigid nature of do_menu it isn't too bad when you don't need voice but once you do the fun awaits do_menu likes to talk on menu enter which is in a loop when you use do_menu I would like to move the processing to the callback TOO BAD you only get an action and the menu_item_ex struct you sent it when calling the function Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a --- apps/plugins/2048.c | 5 ++++- apps/plugins/blackjack.c | 5 ++++- apps/plugins/brickmania.c | 5 ++++- apps/plugins/bubbles.c | 5 ++++- apps/plugins/calendar.c | 5 ++++- apps/plugins/chopper.c | 5 ++++- apps/plugins/clix.c | 5 ++++- apps/plugins/codebuster.c | 5 ++++- apps/plugins/disktidy.c | 5 ++++- apps/plugins/jewels.c | 5 ++++- apps/plugins/keybox.c | 6 +++++- apps/plugins/lua/rocklib.c | 9 ++++++--- apps/plugins/mazezam.c | 5 ++++- apps/plugins/mpegplayer/mpeg_misc.c | 7 +++++-- apps/plugins/mpegplayer/mpeg_misc.h | 3 ++- apps/plugins/pegbox.c | 6 +++++- apps/plugins/puzzles/rockbox.c | 5 ++++- apps/plugins/rockblox.c | 5 ++++- apps/plugins/snake.c | 5 ++++- apps/plugins/solitaire.c | 5 ++++- apps/plugins/spacerocks.c | 5 ++++- apps/plugins/xobox.c | 5 ++++- apps/plugins/xworld/sys.c | 5 ++++- 23 files changed, 95 insertions(+), 26 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/2048.c b/apps/plugins/2048.c index 15d3f41191..5dd5a7e99f 100644 --- a/apps/plugins/2048.c +++ b/apps/plugins/2048.c @@ -989,8 +989,11 @@ static enum plugin_status do_game(bool newgame) /* decide if this_item should be shown in the main menu */ /* used to hide resume option when there is no save */ -static int mainmenu_cb(int action, const struct menu_item_ex *this_item) +static int mainmenu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int idx = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !loaded && (idx == 0 || idx == 5)) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 4511d3fad5..d685de9617 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c @@ -1418,8 +1418,11 @@ static bool blackjack_help(void) { return false; } -static int blackjack_menu_cb(int action, const struct menu_item_ex *this_item) +static int blackjack_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !resume && (i==0 || i==5)) diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index b0a1b6565b..182ba4f040 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -1530,8 +1530,11 @@ static int brickmania_help(void) return 0; } -static int brickmania_menu_cb(int action, const struct menu_item_ex *this_item) +static int brickmania_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !resume && (i==0 || i==6)) diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index e96010ec02..2d163d8bc9 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -2414,8 +2414,11 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock, return BB_NONE; } -static int bubbles_menu_cb(int action, const struct menu_item_ex *this_item) +static int bubbles_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !resume && (i==0)) diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 4d89530ca9..ded0a70d26 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -876,8 +876,11 @@ static void add_memo(struct shown *shown, int type) rb->splash(HZ/2, "Event not added"); } -static int edit_menu_cb(int action, const struct menu_item_ex *this_item) +static int edit_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = (intptr_t)this_item; if (action == ACTION_REQUEST_MENUITEM && memos_in_shown_memory <= 0 && (i==0 || i==1)) diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 71e24deb8f..a206192974 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c @@ -767,8 +767,11 @@ static void chopDrawScene(void) } static bool _ingame; -static int chopMenuCb(int action, const struct menu_item_ex *this_item) +static int chopMenuCb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; if(action == ACTION_REQUEST_MENUITEM && !_ingame && ((intptr_t)this_item)==0) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c index e80fdeab8b..748090358c 100644 --- a/apps/plugins/clix.c +++ b/apps/plugins/clix.c @@ -744,8 +744,11 @@ static bool clix_help(void) } static bool _ingame; -static int clix_menu_cb(int action, const struct menu_item_ex *this_item) +static int clix_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; if(action == ACTION_REQUEST_MENUITEM && !_ingame && ((intptr_t)this_item)==0) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/codebuster.c b/apps/plugins/codebuster.c index ca36d5d01b..956991575d 100644 --- a/apps/plugins/codebuster.c +++ b/apps/plugins/codebuster.c @@ -363,8 +363,11 @@ static void settings_menu(void) { } static bool resume; -static int menu_cb(int action, const struct menu_item_ex *this_item) +static int menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = ((intptr_t)this_item); if ((action == ACTION_REQUEST_MENUITEM) && (!resume && (i==0))) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index 6f131e37a6..013e7a37bd 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c @@ -645,8 +645,11 @@ static bool tidy_types_selected(void) return false; } -static int disktidy_menu_cb(int action, const struct menu_item_ex *this_item) +static int disktidy_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int item = ((intptr_t)this_item); if (action == ACTION_REQUEST_MENUITEM && diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 87a9d2fabf..cae3befb5e 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -1471,8 +1471,11 @@ static bool jewels_help(void) } static bool _ingame; -static int jewels_menu_cb(int action, const struct menu_item_ex *this_item) +static int jewels_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !_ingame && (i==0 || i==6)) diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index d692c88419..914761e73b 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -104,9 +104,13 @@ static void do_decrypt(uint32_t* v, uint32_t* k) v[0]=v0; v[1]=v1; } -static int context_item_cb(int action, const struct menu_item_ex *this_item) +static int context_item_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { int i = (intptr_t)this_item; + (void)this_list; + if (action == ACTION_REQUEST_MENUITEM && pw_list.num_entries == 0 && (i != 0 && i != 5)) diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 6b24984130..6820c30dc3 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c @@ -220,9 +220,12 @@ static lua_State* store_luastate(lua_State *L, bool bStore) return LStored; } -static int menu_callback(int action, const struct menu_item_ex *this_item) +static int menu_callback(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { (void) this_item; + (void) this_list; static int lua_ref = LUA_NOREF; lua_State *L = store_luastate(NULL, false); if(!L) @@ -259,7 +262,7 @@ RB_WRAP(do_menu) { /*lua callback function cb(action) return action end */ ref_lua = luaL_ref(L, LUA_REGISTRYINDEX); - menu_callback(ref_lua, NULL); + menu_callback(ref_lua, NULL, NULL); store_luastate(L, true); menu_desc.menu_callback = &menu_callback; } @@ -277,7 +280,7 @@ RB_WRAP(do_menu) { store_luastate(NULL, true); luaL_unref (L, LUA_REGISTRYINDEX, ref_lua); - menu_callback(LUA_NOREF, NULL); + menu_callback(LUA_NOREF, NULL, NULL); } lua_pushinteger(L, result); diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 759ca6477d..423b09288d 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c @@ -853,8 +853,11 @@ static void resume_save_data (struct resume_data *r, struct resume_data *old) * Manages the main menu ******************************************************************************/ static bool have_continue; -static int main_menu_cb(int action, const struct menu_item_ex *this_item) +static int main_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; if(action == ACTION_REQUEST_MENUITEM && !have_continue && ((intptr_t)this_item)==0) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/mpegplayer/mpeg_misc.c b/apps/plugins/mpegplayer/mpeg_misc.c index 7b73c7c376..c85285f4f8 100644 --- a/apps/plugins/mpegplayer/mpeg_misc.c +++ b/apps/plugins/mpegplayer/mpeg_misc.c @@ -183,8 +183,11 @@ long mpeg_sysevent(void) return mpeg_sysevent_id; } -int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu) +int mpeg_sysevent_callback(int btn, + const struct menu_item_ex *menu, + struct gui_synclist *this_list) { + (void) this_list; switch (btn) { case SYS_USB_CONNECTED: @@ -218,6 +221,6 @@ int mpeg_button_get(int timeout) /* Produce keyclick */ rb->keyclick_click(true, button); - return mpeg_sysevent_callback(button, NULL); + return mpeg_sysevent_callback(button, NULL, NULL); } diff --git a/apps/plugins/mpegplayer/mpeg_misc.h b/apps/plugins/mpegplayer/mpeg_misc.h index 6626bba594..e04db0e19d 100644 --- a/apps/plugins/mpegplayer/mpeg_misc.h +++ b/apps/plugins/mpegplayer/mpeg_misc.h @@ -241,7 +241,8 @@ void mpeg_sysevent_set(void); long mpeg_sysevent(void); /* Call with a system event code and used as menu callback */ -int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu); +int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu, + struct gui_synclist *this_list); /* Handle recorded event */ void mpeg_sysevent_handle(void); diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index b638f2feeb..e000e98d33 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c @@ -1316,8 +1316,12 @@ static bool pegbox_help(void) * pegbox_menu() is the game menu ************************************************************************/ static bool _ingame; -static int pegbox_menu_cb(int action, const struct menu_item_ex *this_item) +static int pegbox_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; + int i = (intptr_t)this_item; if( action == ACTION_REQUEST_MENUITEM ) { diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index 45733c12a3..3bae2e1e64 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c @@ -2827,8 +2827,11 @@ static void debug_menu(void) } #endif -static int pausemenu_cb(int action, const struct menu_item_ex *this_item) +static int pausemenu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = (intptr_t) this_item; if(action == ACTION_REQUEST_MENUITEM) { diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 93479c5c56..b6cf6e5470 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c @@ -1512,8 +1512,11 @@ static bool rockblox_help(void) return false; } -static int rockblox_menu_cb(int action, const struct menu_item_ex *this_item) +static int rockblox_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !resume && (i==0 || i==5)) diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c index c885f4ccae..f60ddfe3de 100644 --- a/apps/plugins/snake.c +++ b/apps/plugins/snake.c @@ -496,8 +496,11 @@ static void snake_game_init(void) { board[11][7]=1; } -static int snake_menu_cb(int action, const struct menu_item_ex *this_item) +static int snake_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; if(action == ACTION_REQUEST_MENUITEM && !ingame && ((intptr_t)this_item)==0) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index c743634279..b830edf857 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -1060,8 +1060,11 @@ void solitaire_init(void); enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; static bool _ingame; -static int solitaire_menu_cb(int action, const struct menu_item_ex *this_item) +static int solitaire_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int i = (intptr_t)this_item; if( action == ACTION_REQUEST_MENUITEM ) { diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 91bf7757de..ede67291b0 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -1929,8 +1929,11 @@ static bool spacerocks_help(void) #define PLUGIN_OTHER 10 static bool ingame; -static int spacerocks_menu_cb(int action, const struct menu_item_ex *this_item) +static int spacerocks_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; if (action == ACTION_REQUEST_MENUITEM && !ingame && ((intptr_t)this_item)==0) return ACTION_EXIT_MENUITEM; diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index f86992f240..b923e23986 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c @@ -1154,8 +1154,11 @@ static bool save_game(void) } /* the main menu */ -static int xobox_menu_cb(int action, const struct menu_item_ex *this_item) +static int xobox_menu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; intptr_t item = (intptr_t)this_item; if(action == ACTION_REQUEST_MENUITEM && !_ingame && (item == 0 || item == 6)) diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c index 22fc92f7e2..1416a40577 100644 --- a/apps/plugins/xworld/sys.c +++ b/apps/plugins/xworld/sys.c @@ -311,8 +311,11 @@ static void sys_reset_settings(struct System* sys) static struct System* mainmenu_sysptr; -static int mainmenu_cb(int action, const struct menu_item_ex *this_item) +static int mainmenu_cb(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { + (void)this_list; int idx = ((intptr_t)this_item); if(action == ACTION_REQUEST_MENUITEM && !mainmenu_sysptr->loaded && (idx == 0 || idx == 8 || idx == 10)) return ACTION_EXIT_MENUITEM; -- cgit v1.2.3