diff --git a/Makefile.common b/Makefile.common
index b864e189b6..1e5726056c 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -288,27 +288,25 @@ ifeq ($(HAVE_NEON),1)
endif
ifeq ($(HAVE_RGUI), 1)
- OBJ += menu/drivers_display/rgui.o
+ OBJ += menu/drivers/rgui.o
DEFINES += -DHAVE_MENU -DHAVE_RGUI
HAVE_MENU_COMMON = 1
ifeq ($(HAVE_GLUI), 1)
- OBJ += menu/drivers_display/glui.o
+ OBJ += menu/drivers/glui.o
DEFINES += -DHAVE_GLUI
endif
ifeq ($(HAVE_XMB), 1)
- OBJ += menu/drivers_display/xmb.o
+ OBJ += menu/drivers/xmb.o
DEFINES += -DHAVE_XMB
endif
ifeq ($(HAVE_LAKKA), 1)
- OBJ += menu/drivers_backend/menu_lakka_backend.o \
- menu/drivers_display/lakka.o
+ OBJ += menu/drivers/lakka.o
DEFINES += -DHAVE_LAKKA
endif
endif
ifeq ($(HAVE_MENU_COMMON), 1)
- OBJ += menu/drivers_backend/menu_common_backend.o \
- menu/menu_input.o \
+ OBJ += menu/menu_input.o \
menu/menu.o \
menu/menu_common_list.o \
menu/menu_navigation.o \
diff --git a/griffin/griffin.c b/griffin/griffin.c
index c3e0b6d464..b24fdd66dd 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -694,41 +694,38 @@ MENU
#include "../menu/menu_navigation.c"
#include "../menu/menu_animation.c"
#include "../menu/menu_database.c"
-
-#include "../menu/drivers_backend/menu_common_backend.c"
#endif
#ifdef HAVE_RMENU
-#include "../menu/drivers_display/rmenu.c"
+#include "../menu/drivers/rmenu.c"
#endif
#ifdef HAVE_RGUI
-#include "../menu/drivers_display/rgui.c"
+#include "../menu/drivers/rgui.c"
#endif
#ifdef HAVE_RMENU_XUI
-#include "../menu/drivers_display/rmenu_xui.cpp"
+#include "../menu/drivers/rmenu_xui.cpp"
#endif
#ifdef HAVE_OPENGL
#ifdef HAVE_LAKKA
-#include "../menu/drivers_backend/menu_lakka_backend.c"
-#include "../menu/drivers_display/lakka.c"
+#include "../menu/drivers/lakka.c"
#endif
#ifdef HAVE_XMB
-#include "../menu/drivers_display/xmb.c"
+#include "../menu/drivers/xmb.c"
#endif
#ifdef HAVE_GLUI
-#include "../menu/drivers_display/glui.c"
+#include "../menu/drivers/glui.c"
#endif
#endif
#ifdef IOS
-#include "../menu/drivers_display/ios.c"
+#include "../menu/drivers/ios.c"
#endif
#ifdef HAVE_COMMAND
diff --git a/menu/drivers_display/glui.c b/menu/drivers/glui.c
similarity index 96%
rename from menu/drivers_display/glui.c
rename to menu/drivers/glui.c
index bc52fb69a0..d50494be66 100644
--- a/menu/drivers_display/glui.c
+++ b/menu/drivers/glui.c
@@ -14,6 +14,7 @@
* If not, see .
*/
+#include
#include
#include
#include
@@ -25,6 +26,7 @@
#include "../../gfx/gl_common.h"
#include "../../gfx/video_thread_wrapper.h"
#include
+#include "../menu_input.h"
#include "shared.h"
@@ -39,6 +41,24 @@ typedef struct glui_handle
GLuint bg;
} glui_handle_t;
+static int glui_entry_iterate(unsigned action)
+{
+ const char *label = NULL;
+ menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
+ menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
+ driver.menu->selection_ptr);
+
+ menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (cbs && cbs->action_iterate)
+ return cbs->action_iterate(label, action);
+
+ return -1;
+}
+
static void glui_blit_line(float x, float y, const char *message, bool green)
{
struct font_params params = {0};
@@ -653,6 +673,6 @@ menu_ctx_driver_t menu_ctx_glui = {
NULL,
glui_init_core_info,
glui_update_core_info,
- &menu_ctx_backend_common,
+ glui_entry_iterate,
"glui",
};
diff --git a/menu/drivers_display/ios.c b/menu/drivers/ios.c
similarity index 76%
rename from menu/drivers_display/ios.c
rename to menu/drivers/ios.c
index 23533a9346..2ce053b3be 100644
--- a/menu/drivers_display/ios.c
+++ b/menu/drivers/ios.c
@@ -13,12 +13,50 @@
* If not, see .
*/
+#include
+#include
+#include
+#include
#include
#include
#include "../menu_driver.h"
#include "../menu.h"
#include "../../general.h"
#include "ios.h"
+#include "../menu_input.h"
+
+#ifdef 1
+static int ios_entry_iterate(unsigned action)
+{
+ ios_handle_t *ios = NULL;
+ if (!driver.menu)
+ return 0;
+
+ ios = (ios_handle_t*)driver.menu->userdata;
+ if (ios->switch_to_ios)
+ ios->switch_to_ios();
+
+ return 0;
+}
+#else
+static int ios_entry_iterate(unsigned action)
+{
+ const char *label = NULL;
+ menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
+ menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
+ driver.menu->selection_ptr);
+
+ menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (cbs && cbs->action_iterate)
+ return cbs->action_iterate(label, action);
+
+ return -1;
+}
+#endif
static void *ios_init(void)
{
@@ -49,18 +87,6 @@ static void ios_free(void *data)
return;
}
-static int menu_ios_iterate(unsigned action)
-{
- ios_handle_t *ios = NULL;
- if (!driver.menu)
- return 0;
-
- ios = (ios_handle_t*)driver.menu->userdata;
- if (ios->switch_to_ios)
- ios->switch_to_ios();
-
- return 0;
-}
static void ios_update_core_info(void *data)
{
@@ -68,12 +94,6 @@ static void ios_update_core_info(void *data)
menu_update_libretro_info(&g_extern.menu.info);
}
-menu_ctx_driver_backend_t menu_ctx_backend_ios = {
- menu_ios_iterate,
-
- "menu_ios",
-};
-
menu_ctx_driver_t menu_ctx_ios = {
NULL, // set_texture
NULL, // render_messagebox
@@ -101,6 +121,6 @@ menu_ctx_driver_t menu_ctx_ios = {
NULL, // list_set_selection
NULL, // init_core_info
ios_update_core_info, // ios_update_core_info
- &menu_ctx_backend_ios, // backend
+ ios_entry_iterate,
"ios",
};
diff --git a/menu/drivers_display/ios.h b/menu/drivers/ios.h
similarity index 100%
rename from menu/drivers_display/ios.h
rename to menu/drivers/ios.h
diff --git a/menu/drivers_display/lakka.c b/menu/drivers/lakka.c
similarity index 72%
rename from menu/drivers_display/lakka.c
rename to menu/drivers/lakka.c
index 68b061fd95..f236f1014e 100644
--- a/menu/drivers_display/lakka.c
+++ b/menu/drivers/lakka.c
@@ -22,19 +22,24 @@
#include
#include
-#include "../menu.h"
#include "../../general.h"
#include
#include
#include "../../gfx/gl_common.h"
#include "../../gfx/video_thread_wrapper.h"
#include
-#include "shared.h"
#include "../../settings_data.h"
#include "lakka.h"
+
+#include "../menu.h"
#include "../menu_animation.h"
+#include "../menu_action.h"
+
+#include "shared.h"
+
+#include "../../retroarch.h"
static const GLfloat lakka_vertex[] = {
0, 0,
@@ -50,6 +55,489 @@ static const GLfloat lakka_tex_coord[] = {
1, 0,
};
+/* Move the categories left or right depending
+ * on the menu_active_category variable. */
+
+static void lakka_switch_categories(lakka_handle_t *lakka)
+{
+ int i, j;
+
+ /* Translation */
+ add_tween(LAKKA_DELAY,
+ -lakka->menu_active_category * lakka->hspacing,
+ &lakka->all_categories_x, &inOutQuad, NULL);
+
+ /* Alpha tweening */
+ for (i = 0; i < lakka->num_categories; i++)
+ {
+ float ca, cz;
+ menu_category_t *category = (menu_category_t*)&lakka->categories[i];
+
+ if (!category)
+ continue;
+
+ ca = (i == lakka->menu_active_category)
+ ? lakka->c_active_alpha : lakka->c_passive_alpha;
+ cz = (i == lakka->menu_active_category)
+ ? lakka->c_active_zoom : lakka->c_passive_zoom;
+ add_tween(LAKKA_DELAY, ca, &category->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, cz, &category->zoom, &inOutQuad, NULL);
+
+ for (j = 0; j < category->num_items; j++)
+ {
+ float ia = 0;
+
+ if (i == lakka->menu_active_category)
+ {
+ ia = lakka->i_passive_alpha;
+ if (j == category->active_item)
+ ia = lakka->i_active_alpha;
+ }
+
+ add_tween(LAKKA_DELAY, ia,
+ &category->items[j].alpha,&inOutQuad, NULL);
+ }
+ }
+}
+
+static void lakka_switch_items(lakka_handle_t *lakka)
+{
+ int j;
+ menu_category_t *active_category = (menu_category_t*)
+ &lakka->categories[lakka->menu_active_category];
+
+ for (j = 0; j < active_category->num_items; j++)
+ {
+ float iy;
+ float ia = lakka->i_passive_alpha;
+ float iz = lakka->i_passive_zoom;
+ menu_item_t *active_item = (menu_item_t*)&active_category->items[j];
+
+ if (!active_item)
+ continue;
+
+ iy = (j < active_category->active_item) ? lakka->vspacing *
+ (j - active_category->active_item + lakka->above_item_offset) :
+ lakka->vspacing * (j - active_category->active_item + lakka->under_item_offset);
+
+ if (j == active_category->active_item)
+ {
+ ia = lakka->i_active_alpha;
+ iz = lakka->i_active_zoom;
+ iy = lakka->vspacing * lakka->active_item_factor;
+ }
+
+ add_tween(LAKKA_DELAY, ia, &active_item->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, iz, &active_item->zoom, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, iy, &active_item->y, &inOutQuad, NULL);
+ }
+}
+
+static void lakka_switch_subitems(lakka_handle_t *lakka)
+{
+ int k;
+ menu_category_t *active_category = (menu_category_t*)
+ &lakka->categories[lakka->menu_active_category];
+ menu_item_t *item = (menu_item_t*)
+ &active_category->items[active_category->active_item];
+
+ for (k = 0; k < item->num_subitems; k++)
+ {
+ menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
+
+ if (!subitem)
+ continue;
+
+ if (k < item->active_subitem)
+ {
+ /* Above items */
+ add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
+ &subitem->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->vspacing * (k - item->active_subitem +
+ lakka->above_subitem_offset), &subitem->y, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->i_passive_zoom,
+ &subitem->zoom, &inOutQuad, NULL);
+ }
+ else if (k == item->active_subitem)
+ {
+ /* Active item */
+ add_tween(LAKKA_DELAY, lakka->i_active_alpha,
+ &subitem->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->vspacing * lakka->active_item_factor,
+ &subitem->y, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->i_active_zoom,
+ &subitem->zoom, &inOutQuad, NULL);
+ }
+ else if (k > item->active_subitem)
+ {
+ /* Under items */
+ add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
+ &subitem->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->vspacing * (k - item->active_subitem +
+ lakka->under_item_offset), &subitem->y, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->i_passive_zoom,
+ &subitem->zoom, &inOutQuad, NULL);
+ }
+ }
+}
+
+static void lakka_reset_submenu(lakka_handle_t *lakka, int i, int j)
+{
+ menu_category_t *category = (menu_category_t*)&lakka->categories[i];
+
+ if (!category)
+ return;
+
+ category->items[category->active_item].active_subitem = 0;
+
+ int k;
+ for (k = 0; k < category->items[j].num_subitems; k++)
+ {
+ menu_subitem_t *subitem = (menu_subitem_t*)
+ &category->items[j].subitems[k];
+
+ if (!subitem)
+ continue;
+
+ subitem->alpha = 0;
+ subitem->zoom = (k == category->items[j].active_subitem) ?
+ lakka->i_active_zoom : lakka->i_passive_zoom;
+ subitem->y = k == 0 ?
+ lakka->vspacing * lakka->active_item_factor :
+ lakka->vspacing * (k + lakka->under_item_offset);
+ }
+}
+
+static bool lakka_on_active_rom(lakka_handle_t *lakka)
+{
+ menu_category_t *active_category = (menu_category_t*)
+ &lakka->categories[lakka->menu_active_category];
+
+ return !(g_extern.main_is_init
+ && !g_extern.libretro_dummy
+ && (!strcmp(g_extern.fullpath,
+ active_category->items[
+ active_category->active_item].rom)));
+}
+
+static void lakka_open_submenu(lakka_handle_t *lakka)
+{
+ int i, j, k;
+
+ add_tween(LAKKA_DELAY, -lakka->hspacing * (lakka->menu_active_category+1),
+ &lakka->all_categories_x, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->i_active_alpha,
+ &lakka->arrow_alpha, &inOutQuad, NULL);
+
+ menu_category_t *active_category = (menu_category_t*)
+ &lakka->categories[lakka->menu_active_category];
+
+ if (lakka->menu_active_category > 0 && lakka_on_active_rom(lakka))
+ lakka_reset_submenu(lakka, lakka->menu_active_category,
+ active_category->active_item);
+
+ for (i = 0; i < lakka->num_categories; i++)
+ {
+ menu_category_t *category = (menu_category_t*)&lakka->categories[i];
+
+ if (!category)
+ continue;
+
+ float ca = (i == lakka->menu_active_category)
+ ? lakka->c_active_alpha : 0;
+ add_tween(LAKKA_DELAY, ca, &category->alpha, &inOutQuad, NULL);
+
+ if (i != lakka->menu_active_category)
+ continue;
+
+ for (j = 0; j < category->num_items; j++)
+ {
+ if (j == category->active_item)
+ {
+ for (k = 0; k < category->items[j].num_subitems; k++)
+ {
+ menu_subitem_t *subitem = (menu_subitem_t*)
+ &category->items[j].subitems[k];
+
+ if (k == category->items[j].active_subitem)
+ {
+ add_tween(LAKKA_DELAY, lakka->i_active_alpha,
+ &subitem->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->i_active_zoom,
+ &subitem->zoom, &inOutQuad, NULL);
+ }
+ else
+ {
+ add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
+ &subitem->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, lakka->i_passive_zoom,
+ &subitem->zoom, &inOutQuad, NULL);
+ }
+ }
+ }
+ else
+ add_tween(LAKKA_DELAY, 0,
+ &category->items[j].alpha, &inOutQuad, NULL);
+ }
+ }
+}
+
+static void lakka_close_submenu(lakka_handle_t *lakka)
+{
+ int i, j, k;
+
+ add_tween(LAKKA_DELAY, -lakka->hspacing * lakka->menu_active_category,
+ &lakka->all_categories_x, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, 0.0, &lakka->arrow_alpha, &inOutQuad, NULL);
+
+ for (i = 0; i < lakka->num_categories; i++)
+ {
+ float ca, cz;
+ menu_category_t *category = (menu_category_t*)&lakka->categories[i];
+ bool is_active_category = (i == lakka->menu_active_category);
+
+ if (!category)
+ continue;
+
+ ca = is_active_category ? lakka->c_active_alpha : lakka->c_passive_alpha;
+ cz = is_active_category ? lakka->c_active_zoom : lakka->c_passive_zoom;
+
+ add_tween(LAKKA_DELAY, ca,
+ &category->alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, cz,
+ &category->zoom, &inOutQuad, NULL);
+
+ if (i == lakka->menu_active_category)
+ {
+ for (j = 0; j < category->num_items; j++)
+ {
+ if (j == category->active_item)
+ {
+ add_tween(LAKKA_DELAY, lakka->i_active_alpha,
+ &category->items[j].alpha, &inOutQuad, NULL);
+
+ for (k = 0; k < category->items[j].num_subitems; k++)
+ add_tween(LAKKA_DELAY, 0,
+ &category->items[j].subitems[k].alpha,
+ &inOutQuad, NULL);
+ }
+ else
+ add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
+ &category->items[j].alpha, &inOutQuad, NULL);
+ }
+ }
+ else
+ {
+
+ for (j = 0; j < category->num_items; j++)
+ add_tween(LAKKA_DELAY, 0,
+ &category->items[j].alpha, &inOutQuad, NULL);
+ }
+ }
+}
+
+static int lakka_entry_iterate(unsigned action)
+{
+ menu_category_t *active_category = NULL;
+ menu_item_t *active_item = NULL;
+ menu_subitem_t * active_subitem = NULL;
+ lakka_handle_t *lakka = NULL;
+
+ if (!driver.menu)
+ return 0;
+
+ lakka = (lakka_handle_t*)driver.menu->userdata;
+
+ if (!lakka)
+ return 0;
+
+ active_category = (menu_category_t*)&lakka->categories[lakka->menu_active_category];
+
+ if (active_category)
+ active_item = (menu_item_t*)
+ &active_category->items[active_category->active_item];
+
+ if (active_item)
+ active_subitem = (menu_subitem_t*)
+ &active_item->subitems[active_item->active_subitem];
+
+ if (!active_category || !active_item)
+ return 0;
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (action && (action == MENU_ACTION_OK
+ || action == MENU_ACTION_LEFT
+ || action == MENU_ACTION_RIGHT)
+ && (lakka->depth == 1) && (lakka->menu_active_category == 0)
+ && active_subitem->setting)
+ {
+ rarch_setting_t *setting = (rarch_setting_t*)
+ active_subitem->setting;
+
+ menu_action_handle_setting(setting, 0, action);
+ }
+
+ switch (action)
+ {
+ case MENU_ACTION_TOGGLE:
+ if (g_extern.main_is_init && !g_extern.libretro_dummy)
+ {
+ lakka->global_alpha = 0.0;
+ lakka->global_scale = 2.0;
+ }
+ break;
+
+ case MENU_ACTION_LEFT:
+ if ((lakka->depth == 0) && (lakka->menu_active_category > 0))
+ {
+ lakka->menu_active_category--;
+ lakka_switch_categories(lakka);
+ }
+ else if ((lakka->depth == 1) && (lakka->menu_active_category > 0)
+ && (active_item->active_subitem == 1
+ || active_item->active_subitem == 2)
+ && g_settings.state_slot > -1)
+ {
+ g_settings.state_slot--;
+ }
+ break;
+
+ case MENU_ACTION_RIGHT:
+ if (lakka->depth == 0 &&
+ (lakka->menu_active_category < lakka->num_categories-1))
+ {
+ lakka->menu_active_category++;
+ lakka_switch_categories(lakka);
+ }
+ else if (lakka->depth == 1 && lakka->menu_active_category > 0
+ && (active_item->active_subitem == 1
+ || active_item->active_subitem == 2)
+ && g_settings.state_slot < 255)
+ {
+ g_settings.state_slot++;
+ }
+ break;
+
+ case MENU_ACTION_DOWN:
+ if (lakka->depth == 0
+ && (active_category->active_item <
+ (active_category->num_items - 1)))
+ {
+ active_category->active_item++;
+ lakka_switch_items(lakka);
+ }
+
+ /* If we are on subitems level, and we do not
+ * exceed the number of subitems, and we
+ * are in settings or content is launched. */
+ if (lakka->depth == 1
+ && (active_item->active_subitem <
+ (active_item->num_subitems -1))
+ && (lakka->menu_active_category == 0
+ || ((active_item->active_subitem <
+ (active_item->num_subitems - 1))
+ &&
+ (g_extern.main_is_init && !g_extern.libretro_dummy)
+ && (!strcmp(g_extern.fullpath, active_item->rom)))))
+ {
+ active_item->active_subitem++;
+ lakka_switch_subitems(lakka);
+ }
+ break;
+
+ case MENU_ACTION_UP:
+ if (lakka->depth == 0 && active_category->active_item > 0)
+ {
+ active_category->active_item--;
+ lakka_switch_items(lakka);
+ }
+ if (lakka->depth == 1 && active_item->active_subitem > 0)
+ {
+ active_item->active_subitem--;
+ lakka_switch_subitems(lakka);
+ }
+ break;
+
+ case MENU_ACTION_OK:
+ if (lakka->depth == 1 && lakka->menu_active_category > 0)
+ {
+ switch (active_item->active_subitem)
+ {
+ case 0:
+ if (g_extern.main_is_init && !g_extern.libretro_dummy
+ && (!strcmp(g_extern.fullpath, active_item->rom)))
+ rarch_main_command(RARCH_CMD_RESUME);
+ else
+ {
+ strlcpy(g_extern.fullpath,
+ active_item->rom, sizeof(g_extern.fullpath));
+ strlcpy(g_settings.libretro,
+ active_category->libretro,
+ sizeof(g_settings.libretro));
+
+#ifdef HAVE_DYNAMIC
+ rarch_main_command(RARCH_CMD_LOAD_CORE);
+ rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
+#endif
+ }
+ return -1;
+ break;
+ case 1:
+ rarch_main_command(RARCH_CMD_SAVE_STATE);
+ return -1;
+ break;
+ case 2:
+ rarch_main_command(RARCH_CMD_LOAD_STATE);
+ return -1;
+ break;
+ case 3:
+ rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);
+ break;
+ case 4:
+ rarch_main_command(RARCH_CMD_RESET);
+ return -1;
+ break;
+ }
+ }
+ else if (lakka->depth == 0 && active_item->num_subitems)
+ {
+ lakka_open_submenu(lakka);
+ lakka->depth = 1;
+ }
+ else if (lakka->depth == 0 &&
+ (lakka->menu_active_category == 0 &&
+ (active_category->active_item ==
+ (active_category->num_items - 1))))
+ {
+ add_tween(LAKKA_DELAY, 1.0, &lakka->global_alpha, &inOutQuad, NULL);
+ add_tween(LAKKA_DELAY, 1.0, &lakka->global_scale, &inOutQuad, NULL);
+ rarch_main_command(RARCH_CMD_QUIT_RETROARCH);
+ return -1;
+ }
+ break;
+
+ case MENU_ACTION_CANCEL:
+ if (lakka->depth == 1)
+ {
+ lakka_close_submenu(lakka);
+ lakka->depth = 0;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (driver.menu_ctx && driver.menu_ctx->iterate)
+ driver.menu_ctx->iterate(driver.menu, action);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
+ driver.menu_ctx->render();
+
+ return 0;
+}
+
static char *str_replace (const char *string,
const char *substr, const char *replacement)
{
@@ -1360,6 +1848,6 @@ menu_ctx_driver_t menu_ctx_lakka = {
NULL,
lakka_init_core_info,
lakka_update_core_info,
- &menu_ctx_backend_lakka,
+ lakka_entry_iterate,
"lakka",
};
diff --git a/menu/drivers_display/lakka.h b/menu/drivers/lakka.h
similarity index 100%
rename from menu/drivers_display/lakka.h
rename to menu/drivers/lakka.h
diff --git a/menu/drivers_display/rgui.c b/menu/drivers/rgui.c
similarity index 96%
rename from menu/drivers_display/rgui.c
rename to menu/drivers/rgui.c
index ee11dec495..fb835726f8 100644
--- a/menu/drivers_display/rgui.c
+++ b/menu/drivers/rgui.c
@@ -22,6 +22,7 @@
#include
#include "../menu.h"
+#include "../menu_input.h"
#include "../../retroarch.h"
#include
#include
@@ -42,6 +43,24 @@ typedef struct rgui_handle
#define RGUI_TERM_WIDTH (((driver.menu->width - RGUI_TERM_START_X - RGUI_TERM_START_X) / (FONT_WIDTH_STRIDE)))
#define RGUI_TERM_HEIGHT (((driver.menu->height - RGUI_TERM_START_Y - RGUI_TERM_START_X) / (FONT_HEIGHT_STRIDE)) - 1)
+static int rgui_entry_iterate(unsigned action)
+{
+ const char *label = NULL;
+ menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
+ menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
+ driver.menu->selection_ptr);
+
+ menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (cbs && cbs->action_iterate)
+ return cbs->action_iterate(label, action);
+
+ return -1;
+}
+
static void rgui_copy_glyph(uint8_t *glyph, const uint8_t *buf)
{
int y, x;
@@ -651,6 +670,6 @@ menu_ctx_driver_t menu_ctx_rgui = {
NULL,
NULL,
rgui_update_core_info,
- &menu_ctx_backend_common,
+ rgui_entry_iterate,
"rgui",
};
diff --git a/menu/drivers_display/rmenu.c b/menu/drivers/rmenu.c
similarity index 94%
rename from menu/drivers_display/rmenu.c
rename to menu/drivers/rmenu.c
index 4ab7398c93..997ef9c846 100644
--- a/menu/drivers_display/rmenu.c
+++ b/menu/drivers/rmenu.c
@@ -22,6 +22,7 @@
#include
#include "../menu_driver.h"
+#include "../menu_input.h"
#include "../menu.h"
#include "../../general.h"
#include "../../config.def.h"
@@ -63,6 +64,24 @@ struct texture_image *menu_texture;
static bool render_normal = true;
static bool menu_texture_inited =false;
+static int rmenu_entry_iterate(unsigned action)
+{
+ const char *label = NULL;
+ menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
+ menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
+ driver.menu->selection_ptr);
+
+ menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (cbs && cbs->action_iterate)
+ return cbs->action_iterate(label, action);
+
+ return -1;
+}
+
static void rmenu_render_background(void)
{
}
@@ -362,6 +381,6 @@ menu_ctx_driver_t menu_ctx_rmenu = {
NULL,
NULL,
rmenu_update_core_info,
- &menu_ctx_backend_common,
+ rmenu_entry_iterate,
"rmenu",
};
diff --git a/menu/drivers_display/rmenu_xui.cpp b/menu/drivers/rmenu_xui.cpp
similarity index 96%
rename from menu/drivers_display/rmenu_xui.cpp
rename to menu/drivers/rmenu_xui.cpp
index 09866ca152..a42fc79e4a 100644
--- a/menu/drivers_display/rmenu_xui.cpp
+++ b/menu/drivers/rmenu_xui.cpp
@@ -16,6 +16,10 @@
*/
#include
+#include
+#include
+#include
+#include
#include
#include
#include
@@ -23,6 +27,7 @@
#include "../menu_driver.h"
#include "../menu.h"
#include "../menu_list.h"
+#include "../menu_input.h"
#include "../../gfx/video_context_driver.h"
@@ -53,6 +58,24 @@ HXUIOBJ root_menu;
HXUIOBJ current_menu;
static msg_queue_t *xui_msg_queue;
+static int rmenu_xui_entry_iterate(unsigned action)
+{
+ const char *label = NULL;
+ menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
+ menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
+ driver.menu->selection_ptr);
+
+ menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (cbs && cbs->action_iterate)
+ return cbs->action_iterate(label, action);
+
+ return -1;
+}
+
class CRetroArch : public CXuiModule
{
protected:
@@ -683,6 +706,6 @@ menu_ctx_driver_t menu_ctx_rmenu_xui = {
rmenu_xui_list_set_selection,
NULL,
rmenu_xui_update_core_info,
- &menu_ctx_backend_common,
+ rmenu_xui_entry_iterate,
"rmenu_xui",
};
diff --git a/menu/drivers_display/shared.h b/menu/drivers/shared.h
similarity index 98%
rename from menu/drivers_display/shared.h
rename to menu/drivers/shared.h
index 8f4c8ad48c..9ffec03f6a 100644
--- a/menu/drivers_display/shared.h
+++ b/menu/drivers/shared.h
@@ -19,7 +19,7 @@
#include "../../settings_data.h"
#include
-static void get_title(const char *label, const char *dir,
+static INLINE void get_title(const char *label, const char *dir,
unsigned menu_type, char *title, size_t sizeof_title)
{
if (!strcmp(label, "core_list"))
@@ -169,7 +169,7 @@ static void get_title(const char *label, const char *dir,
}
}
-static void disp_timedate_set_label(char *label, size_t label_size,
+static INLINE void disp_timedate_set_label(char *label, size_t label_size,
unsigned time_mode)
{
time_t time_;
@@ -192,7 +192,7 @@ static void disp_timedate_set_label(char *label, size_t label_size,
}
}
-static void disp_set_label(file_list_t* list,
+static INLINE void disp_set_label(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *type_str, size_t type_str_size,
diff --git a/menu/drivers_display/xmb.c b/menu/drivers/xmb.c
similarity index 98%
rename from menu/drivers_display/xmb.c
rename to menu/drivers/xmb.c
index 8df18ff40d..5e5a52c3c3 100644
--- a/menu/drivers_display/xmb.c
+++ b/menu/drivers/xmb.c
@@ -21,6 +21,7 @@
#include
#include "../menu.h"
+#include "../menu_input.h"
#include
#include "../../gfx/gl_common.h"
#include "../../gfx/video_thread_wrapper.h"
@@ -137,6 +138,24 @@ static const GLfloat rmb_tex_coord[] = {
1, 0,
};
+static int xmb_entry_iterate(unsigned action)
+{
+ const char *label = NULL;
+ menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
+ menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
+ driver.menu->selection_ptr);
+
+ menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
+
+ if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
+ driver.menu_ctx->set_texture(driver.menu);
+
+ if (cbs && cbs->action_iterate)
+ return cbs->action_iterate(label, action);
+
+ return -1;
+}
+
static char *xmb_str_replace (const char *string,
const char *substr, const char *replacement)
{
@@ -1545,6 +1564,6 @@ menu_ctx_driver_t menu_ctx_xmb = {
xmb_list_set_selection,
xmb_init_core_info,
xmb_update_core_info,
- &menu_ctx_backend_common,
+ xmb_entry_iterate,
"xmb",
};
diff --git a/menu/drivers_backend/menu_common_backend.c b/menu/drivers_backend/menu_common_backend.c
deleted file mode 100644
index 536791d715..0000000000
--- a/menu/drivers_backend/menu_common_backend.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2015 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-#include
-#include
-#include
-#include
-#include "../menu_input.h"
-
-static int menu_common_iterate(unsigned action)
-{
- const char *label = NULL;
- menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
- menu_list_get_actiondata_at_offset(driver.menu->menu_list->selection_buf,
- driver.menu->selection_ptr);
-
- menu_list_get_last_stack(driver.menu->menu_list, NULL, &label, NULL);
-
- if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
- driver.menu_ctx->set_texture(driver.menu);
-
- if (cbs && cbs->action_iterate)
- return cbs->action_iterate(label, action);
-
- return -1;
-}
-
-menu_ctx_driver_backend_t menu_ctx_backend_common = {
- menu_common_iterate,
-
- "menu_common",
-};
diff --git a/menu/drivers_backend/menu_lakka_backend.c b/menu/drivers_backend/menu_lakka_backend.c
deleted file mode 100644
index 7b1d4847f0..0000000000
--- a/menu/drivers_backend/menu_lakka_backend.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2015 - Daniel De Matteis
- * Copyright (C) 2014-2015 - Jean-André Santoni
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include "../menu_action.h"
-#include "../menu_navigation.h"
-
-#include "../../driver.h"
-#include "../../file_ext.h"
-#include "../../input/input_common.h"
-#include "../../config.def.h"
-#include "../../input/keyboard_line.h"
-
-#include "../../settings_data.h"
-#include "../../retroarch.h"
-
-#include "../drivers_display/lakka.h"
-#include "../menu_animation.h"
-
-#ifdef HAVE_CONFIG_H
-#include "../../config.h"
-#endif
-
-/* Move the categories left or right depending
- * on the menu_active_category variable. */
-
-static void lakka_switch_categories(lakka_handle_t *lakka)
-{
- int i, j;
-
- /* Translation */
- add_tween(LAKKA_DELAY,
- -lakka->menu_active_category * lakka->hspacing,
- &lakka->all_categories_x, &inOutQuad, NULL);
-
- /* Alpha tweening */
- for (i = 0; i < lakka->num_categories; i++)
- {
- float ca, cz;
- menu_category_t *category = (menu_category_t*)&lakka->categories[i];
-
- if (!category)
- continue;
-
- ca = (i == lakka->menu_active_category)
- ? lakka->c_active_alpha : lakka->c_passive_alpha;
- cz = (i == lakka->menu_active_category)
- ? lakka->c_active_zoom : lakka->c_passive_zoom;
- add_tween(LAKKA_DELAY, ca, &category->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, cz, &category->zoom, &inOutQuad, NULL);
-
- for (j = 0; j < category->num_items; j++)
- {
- float ia = 0;
-
- if (i == lakka->menu_active_category)
- {
- ia = lakka->i_passive_alpha;
- if (j == category->active_item)
- ia = lakka->i_active_alpha;
- }
-
- add_tween(LAKKA_DELAY, ia,
- &category->items[j].alpha,&inOutQuad, NULL);
- }
- }
-}
-
-static void lakka_switch_items(lakka_handle_t *lakka)
-{
- int j;
- menu_category_t *active_category = (menu_category_t*)
- &lakka->categories[lakka->menu_active_category];
-
- for (j = 0; j < active_category->num_items; j++)
- {
- float iy;
- float ia = lakka->i_passive_alpha;
- float iz = lakka->i_passive_zoom;
- menu_item_t *active_item = (menu_item_t*)&active_category->items[j];
-
- if (!active_item)
- continue;
-
- iy = (j < active_category->active_item) ? lakka->vspacing *
- (j - active_category->active_item + lakka->above_item_offset) :
- lakka->vspacing * (j - active_category->active_item + lakka->under_item_offset);
-
- if (j == active_category->active_item)
- {
- ia = lakka->i_active_alpha;
- iz = lakka->i_active_zoom;
- iy = lakka->vspacing * lakka->active_item_factor;
- }
-
- add_tween(LAKKA_DELAY, ia, &active_item->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, iz, &active_item->zoom, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, iy, &active_item->y, &inOutQuad, NULL);
- }
-}
-
-static void lakka_switch_subitems(lakka_handle_t *lakka)
-{
- int k;
- menu_category_t *active_category = (menu_category_t*)
- &lakka->categories[lakka->menu_active_category];
- menu_item_t *item = (menu_item_t*)
- &active_category->items[active_category->active_item];
-
- for (k = 0; k < item->num_subitems; k++)
- {
- menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
-
- if (!subitem)
- continue;
-
- if (k < item->active_subitem)
- {
- /* Above items */
- add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
- &subitem->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->vspacing * (k - item->active_subitem +
- lakka->above_subitem_offset), &subitem->y, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->i_passive_zoom,
- &subitem->zoom, &inOutQuad, NULL);
- }
- else if (k == item->active_subitem)
- {
- /* Active item */
- add_tween(LAKKA_DELAY, lakka->i_active_alpha,
- &subitem->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->vspacing * lakka->active_item_factor,
- &subitem->y, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->i_active_zoom,
- &subitem->zoom, &inOutQuad, NULL);
- }
- else if (k > item->active_subitem)
- {
- /* Under items */
- add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
- &subitem->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->vspacing * (k - item->active_subitem +
- lakka->under_item_offset), &subitem->y, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->i_passive_zoom,
- &subitem->zoom, &inOutQuad, NULL);
- }
- }
-}
-
-static void lakka_reset_submenu(lakka_handle_t *lakka, int i, int j)
-{
- menu_category_t *category = (menu_category_t*)&lakka->categories[i];
-
- if (!category)
- return;
-
- category->items[category->active_item].active_subitem = 0;
-
- int k;
- for (k = 0; k < category->items[j].num_subitems; k++)
- {
- menu_subitem_t *subitem = (menu_subitem_t*)
- &category->items[j].subitems[k];
-
- if (!subitem)
- continue;
-
- subitem->alpha = 0;
- subitem->zoom = (k == category->items[j].active_subitem) ?
- lakka->i_active_zoom : lakka->i_passive_zoom;
- subitem->y = k == 0 ?
- lakka->vspacing * lakka->active_item_factor :
- lakka->vspacing * (k + lakka->under_item_offset);
- }
-}
-
-static bool lakka_on_active_rom(lakka_handle_t *lakka)
-{
- menu_category_t *active_category = (menu_category_t*)
- &lakka->categories[lakka->menu_active_category];
-
- return !(g_extern.main_is_init
- && !g_extern.libretro_dummy
- && (!strcmp(g_extern.fullpath,
- active_category->items[
- active_category->active_item].rom)));
-}
-
-static void lakka_open_submenu(lakka_handle_t *lakka)
-{
- int i, j, k;
-
- add_tween(LAKKA_DELAY, -lakka->hspacing * (lakka->menu_active_category+1),
- &lakka->all_categories_x, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->i_active_alpha,
- &lakka->arrow_alpha, &inOutQuad, NULL);
-
- menu_category_t *active_category = (menu_category_t*)
- &lakka->categories[lakka->menu_active_category];
-
- if (lakka->menu_active_category > 0 && lakka_on_active_rom(lakka))
- lakka_reset_submenu(lakka, lakka->menu_active_category,
- active_category->active_item);
-
- for (i = 0; i < lakka->num_categories; i++)
- {
- menu_category_t *category = (menu_category_t*)&lakka->categories[i];
-
- if (!category)
- continue;
-
- float ca = (i == lakka->menu_active_category)
- ? lakka->c_active_alpha : 0;
- add_tween(LAKKA_DELAY, ca, &category->alpha, &inOutQuad, NULL);
-
- if (i != lakka->menu_active_category)
- continue;
-
- for (j = 0; j < category->num_items; j++)
- {
- if (j == category->active_item)
- {
- for (k = 0; k < category->items[j].num_subitems; k++)
- {
- menu_subitem_t *subitem = (menu_subitem_t*)
- &category->items[j].subitems[k];
-
- if (k == category->items[j].active_subitem)
- {
- add_tween(LAKKA_DELAY, lakka->i_active_alpha,
- &subitem->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->i_active_zoom,
- &subitem->zoom, &inOutQuad, NULL);
- }
- else
- {
- add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
- &subitem->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, lakka->i_passive_zoom,
- &subitem->zoom, &inOutQuad, NULL);
- }
- }
- }
- else
- add_tween(LAKKA_DELAY, 0,
- &category->items[j].alpha, &inOutQuad, NULL);
- }
- }
-}
-
-static void lakka_close_submenu(lakka_handle_t *lakka)
-{
- int i, j, k;
-
- add_tween(LAKKA_DELAY, -lakka->hspacing * lakka->menu_active_category,
- &lakka->all_categories_x, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, 0.0, &lakka->arrow_alpha, &inOutQuad, NULL);
-
- for (i = 0; i < lakka->num_categories; i++)
- {
- float ca, cz;
- menu_category_t *category = (menu_category_t*)&lakka->categories[i];
- bool is_active_category = (i == lakka->menu_active_category);
-
- if (!category)
- continue;
-
- ca = is_active_category ? lakka->c_active_alpha : lakka->c_passive_alpha;
- cz = is_active_category ? lakka->c_active_zoom : lakka->c_passive_zoom;
-
- add_tween(LAKKA_DELAY, ca,
- &category->alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, cz,
- &category->zoom, &inOutQuad, NULL);
-
- if (i == lakka->menu_active_category)
- {
- for (j = 0; j < category->num_items; j++)
- {
- if (j == category->active_item)
- {
- add_tween(LAKKA_DELAY, lakka->i_active_alpha,
- &category->items[j].alpha, &inOutQuad, NULL);
-
- for (k = 0; k < category->items[j].num_subitems; k++)
- add_tween(LAKKA_DELAY, 0,
- &category->items[j].subitems[k].alpha,
- &inOutQuad, NULL);
- }
- else
- add_tween(LAKKA_DELAY, lakka->i_passive_alpha,
- &category->items[j].alpha, &inOutQuad, NULL);
- }
- }
- else
- {
-
- for (j = 0; j < category->num_items; j++)
- add_tween(LAKKA_DELAY, 0,
- &category->items[j].alpha, &inOutQuad, NULL);
- }
- }
-}
-
-static int menu_lakka_iterate(unsigned action)
-{
- menu_category_t *active_category = NULL;
- menu_item_t *active_item = NULL;
- menu_subitem_t * active_subitem = NULL;
- lakka_handle_t *lakka = NULL;
-
- if (!driver.menu)
- return 0;
-
- lakka = (lakka_handle_t*)driver.menu->userdata;
-
- if (!lakka)
- return 0;
-
- active_category = (menu_category_t*)&lakka->categories[lakka->menu_active_category];
-
- if (active_category)
- active_item = (menu_item_t*)
- &active_category->items[active_category->active_item];
-
- if (active_item)
- active_subitem = (menu_subitem_t*)
- &active_item->subitems[active_item->active_subitem];
-
- if (!active_category || !active_item)
- return 0;
-
- if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
- driver.menu_ctx->set_texture(driver.menu);
-
- if (action && (action == MENU_ACTION_OK
- || action == MENU_ACTION_LEFT
- || action == MENU_ACTION_RIGHT)
- && (lakka->depth == 1) && (lakka->menu_active_category == 0)
- && active_subitem->setting)
- {
- rarch_setting_t *setting = (rarch_setting_t*)
- active_subitem->setting;
-
- menu_action_handle_setting(setting, 0, action);
- }
-
- switch (action)
- {
- case MENU_ACTION_TOGGLE:
- if (g_extern.main_is_init && !g_extern.libretro_dummy)
- {
- lakka->global_alpha = 0.0;
- lakka->global_scale = 2.0;
- }
- break;
-
- case MENU_ACTION_LEFT:
- if ((lakka->depth == 0) && (lakka->menu_active_category > 0))
- {
- lakka->menu_active_category--;
- lakka_switch_categories(lakka);
- }
- else if ((lakka->depth == 1) && (lakka->menu_active_category > 0)
- && (active_item->active_subitem == 1
- || active_item->active_subitem == 2)
- && g_settings.state_slot > -1)
- {
- g_settings.state_slot--;
- }
- break;
-
- case MENU_ACTION_RIGHT:
- if (lakka->depth == 0 &&
- (lakka->menu_active_category < lakka->num_categories-1))
- {
- lakka->menu_active_category++;
- lakka_switch_categories(lakka);
- }
- else if (lakka->depth == 1 && lakka->menu_active_category > 0
- && (active_item->active_subitem == 1
- || active_item->active_subitem == 2)
- && g_settings.state_slot < 255)
- {
- g_settings.state_slot++;
- }
- break;
-
- case MENU_ACTION_DOWN:
- if (lakka->depth == 0
- && (active_category->active_item <
- (active_category->num_items - 1)))
- {
- active_category->active_item++;
- lakka_switch_items(lakka);
- }
-
- /* If we are on subitems level, and we do not
- * exceed the number of subitems, and we
- * are in settings or content is launched. */
- if (lakka->depth == 1
- && (active_item->active_subitem <
- (active_item->num_subitems -1))
- && (lakka->menu_active_category == 0
- || ((active_item->active_subitem <
- (active_item->num_subitems - 1))
- &&
- (g_extern.main_is_init && !g_extern.libretro_dummy)
- && (!strcmp(g_extern.fullpath, active_item->rom)))))
- {
- active_item->active_subitem++;
- lakka_switch_subitems(lakka);
- }
- break;
-
- case MENU_ACTION_UP:
- if (lakka->depth == 0 && active_category->active_item > 0)
- {
- active_category->active_item--;
- lakka_switch_items(lakka);
- }
- if (lakka->depth == 1 && active_item->active_subitem > 0)
- {
- active_item->active_subitem--;
- lakka_switch_subitems(lakka);
- }
- break;
-
- case MENU_ACTION_OK:
- if (lakka->depth == 1 && lakka->menu_active_category > 0)
- {
- switch (active_item->active_subitem)
- {
- case 0:
- if (g_extern.main_is_init && !g_extern.libretro_dummy
- && (!strcmp(g_extern.fullpath, active_item->rom)))
- rarch_main_command(RARCH_CMD_RESUME);
- else
- {
- strlcpy(g_extern.fullpath,
- active_item->rom, sizeof(g_extern.fullpath));
- strlcpy(g_settings.libretro,
- active_category->libretro,
- sizeof(g_settings.libretro));
-
-#ifdef HAVE_DYNAMIC
- rarch_main_command(RARCH_CMD_LOAD_CORE);
- rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
-#endif
- }
- return -1;
- break;
- case 1:
- rarch_main_command(RARCH_CMD_SAVE_STATE);
- return -1;
- break;
- case 2:
- rarch_main_command(RARCH_CMD_LOAD_STATE);
- return -1;
- break;
- case 3:
- rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);
- break;
- case 4:
- rarch_main_command(RARCH_CMD_RESET);
- return -1;
- break;
- }
- }
- else if (lakka->depth == 0 && active_item->num_subitems)
- {
- lakka_open_submenu(lakka);
- lakka->depth = 1;
- }
- else if (lakka->depth == 0 &&
- (lakka->menu_active_category == 0 &&
- (active_category->active_item ==
- (active_category->num_items - 1))))
- {
- add_tween(LAKKA_DELAY, 1.0, &lakka->global_alpha, &inOutQuad, NULL);
- add_tween(LAKKA_DELAY, 1.0, &lakka->global_scale, &inOutQuad, NULL);
- rarch_main_command(RARCH_CMD_QUIT_RETROARCH);
- return -1;
- }
- break;
-
- case MENU_ACTION_CANCEL:
- if (lakka->depth == 1)
- {
- lakka_close_submenu(lakka);
- lakka->depth = 0;
- }
- break;
- default:
- break;
- }
-
- if (driver.menu_ctx && driver.menu_ctx->iterate)
- driver.menu_ctx->iterate(driver.menu, action);
-
- if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
- driver.menu_ctx->render();
-
- return 0;
-}
-
-menu_ctx_driver_backend_t menu_ctx_backend_lakka = {
- menu_lakka_iterate,
- "menu_lakka",
-};
diff --git a/menu/menu.c b/menu/menu.c
index 10285b4d00..f0821c749e 100644
--- a/menu/menu.c
+++ b/menu/menu.c
@@ -127,9 +127,8 @@ bool menu_load_content(void)
if (driver.menu)
driver.menu->msg_force = true;
- if (driver.menu_ctx && driver.menu_ctx->backend &&
- driver.menu_ctx->backend->iterate)
- driver.menu_ctx->backend->iterate(MENU_ACTION_NOOP);
+ if (driver.menu_ctx && driver.menu_ctx->entry_iterate)
+ driver.menu_ctx->entry_iterate(MENU_ACTION_NOOP);
draw_frame();
@@ -472,9 +471,8 @@ int menu_iterate(retro_input_t input,
*/
action = menu_input_frame(trigger_input);
- if (driver.menu_ctx && driver.menu_ctx->backend
- && driver.menu_ctx->backend->iterate)
- ret = driver.menu_ctx->backend->iterate(action);
+ if (driver.menu_ctx && driver.menu_ctx->entry_iterate)
+ ret = driver.menu_ctx->entry_iterate(action);
if (g_extern.is_menu)
draw_frame();
diff --git a/menu/menu_driver.h b/menu/menu_driver.h
index 988e9f0e48..88cb64f36a 100644
--- a/menu/menu_driver.h
+++ b/menu/menu_driver.h
@@ -159,15 +159,6 @@ typedef struct menu_file_list_cbs
int (*action_up_or_down)(unsigned type, const char *label, unsigned action);
} menu_file_list_cbs_t;
-typedef struct menu_ctx_driver_backend
-{
- int (*iterate)(unsigned);
- const char *ident;
-} menu_ctx_driver_backend_t;
-
-extern menu_ctx_driver_backend_t menu_ctx_backend_common;
-extern menu_ctx_driver_backend_t menu_ctx_backend_lakka;
-
typedef struct menu_ctx_driver
{
void (*set_texture)(void*);
@@ -197,8 +188,7 @@ typedef struct menu_ctx_driver
void (*list_set_selection)(void *);
void (*init_core_info)(void *);
void (*update_core_info)(void *);
-
- const menu_ctx_driver_backend_t *backend;
+ int (*entry_iterate)(unsigned);
const char *ident;
} menu_ctx_driver_t;