forked from len0rd/rockbox
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
This commit is contained in:
parent
4663d94b4e
commit
c39f95465b
39 changed files with 343 additions and 110 deletions
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue