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:
William Wilgus 2020-07-19 13:42:04 -04:00 committed by William Wilgus
parent 4663d94b4e
commit c39f95465b
39 changed files with 343 additions and 110 deletions

View file

@ -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);