2014-05-08 01:12:51 +07:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
2014-05-09 17:55:39 +02:00
|
|
|
* Copyright (C) 2014 - Jean-André Santoni
|
2014-05-08 01:12:51 +07:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <ctype.h>
|
2014-09-12 05:54:58 +02:00
|
|
|
#include "../menu_action.h"
|
2014-05-08 01:12:51 +07:00
|
|
|
#include "../menu_navigation.h"
|
|
|
|
|
|
|
|
#include "../../../gfx/gfx_common.h"
|
|
|
|
#include "../../../driver.h"
|
|
|
|
#include "../../../file_ext.h"
|
|
|
|
#include "../../../input/input_common.h"
|
|
|
|
#include "../../../config.def.h"
|
|
|
|
#include "../../../input/keyboard_line.h"
|
|
|
|
|
2014-09-09 00:08:25 +02:00
|
|
|
#include "../../../settings_data.h"
|
|
|
|
|
2014-05-09 17:29:41 +02:00
|
|
|
#include "../disp/lakka.h"
|
|
|
|
|
2014-05-08 01:12:51 +07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../../../config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
/* Move the categories left or right depending
|
|
|
|
* on the menu_active_category variable. */
|
|
|
|
|
2014-06-04 22:29:00 +02:00
|
|
|
static void lakka_switch_categories(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
/* Translation */
|
|
|
|
add_tween(LAKKA_DELAY,
|
|
|
|
-menu_active_category * hspacing,
|
|
|
|
&all_categories_x, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
/* Alpha tweening */
|
2014-06-04 22:29:00 +02:00
|
|
|
for (i = 0; i < num_categories; i++)
|
|
|
|
{
|
|
|
|
float ca, cz;
|
|
|
|
menu_category_t *category = (menu_category_t*)&categories[i];
|
|
|
|
|
2014-06-05 21:18:15 +02:00
|
|
|
if (!category)
|
|
|
|
continue;
|
|
|
|
|
2014-06-04 22:29:00 +02:00
|
|
|
ca = (i == menu_active_category) ? 1.0 : 0.5;
|
2014-08-08 23:29:36 +02:00
|
|
|
cz = (i == menu_active_category) ? c_active_zoom : c_passive_zoom;
|
2014-09-10 04:53:07 +02:00
|
|
|
add_tween(LAKKA_DELAY, ca, &category->alpha, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, cz, &category->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (j = 0; j < category->num_items; j++)
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
float ia = 0;
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
if (i == menu_active_category)
|
|
|
|
{
|
|
|
|
ia = 0.5;
|
|
|
|
if (j == category->active_item)
|
|
|
|
ia = 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_tween(LAKKA_DELAY, ia,
|
|
|
|
&category->items[j].alpha,&inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lakka_switch_items(void)
|
|
|
|
{
|
|
|
|
int j;
|
2014-09-12 06:29:39 +02:00
|
|
|
menu_category_t *active_category = (menu_category_t*)
|
|
|
|
&categories[menu_active_category];
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (j = 0; j < active_category->num_items; j++)
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
float iy;
|
|
|
|
float ia = 0.5;
|
|
|
|
float iz = i_passive_zoom;
|
2014-06-04 22:29:00 +02:00
|
|
|
menu_item_t *active_item = (menu_item_t*)&active_category->items[j];
|
|
|
|
|
2014-06-05 21:18:15 +02:00
|
|
|
if (!active_item)
|
|
|
|
continue;
|
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
iy = (j < active_category->active_item) ? vspacing *
|
|
|
|
(j - active_category->active_item + above_item_offset) :
|
|
|
|
vspacing * (j - active_category->active_item + under_item_offset);
|
|
|
|
|
|
|
|
if (j == active_category->active_item)
|
|
|
|
{
|
|
|
|
ia = 1.0;
|
|
|
|
iz = i_active_zoom;
|
|
|
|
iy = vspacing * active_item_factor;
|
|
|
|
}
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-10 04:53:07 +02:00
|
|
|
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);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lakka_switch_subitems(void)
|
|
|
|
{
|
|
|
|
int k;
|
2014-09-12 06:29:39 +02:00
|
|
|
menu_category_t *active_category = (menu_category_t*)
|
|
|
|
&categories[menu_active_category];
|
|
|
|
menu_item_t *item = (menu_item_t*)
|
|
|
|
&active_category->items[active_category->active_item];
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (k = 0; k < item->num_subitems; k++)
|
|
|
|
{
|
|
|
|
menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];
|
|
|
|
|
2014-06-05 21:18:15 +02:00
|
|
|
if (!subitem)
|
|
|
|
continue;
|
|
|
|
|
2014-06-04 22:29:00 +02:00
|
|
|
if (k < item->active_subitem)
|
|
|
|
{
|
2014-09-10 04:53:07 +02:00
|
|
|
/* Above items */
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0.5,
|
|
|
|
&subitem->alpha, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, vspacing*(k - item->active_subitem +
|
|
|
|
above_subitem_offset), &subitem->y, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, i_passive_zoom,
|
|
|
|
&subitem->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
else if (k == item->active_subitem)
|
|
|
|
{
|
2014-09-10 04:53:07 +02:00
|
|
|
/* Active item */
|
|
|
|
add_tween(LAKKA_DELAY, 1.0, &subitem->alpha, &inOutQuad, NULL);
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, vspacing*active_item_factor,
|
|
|
|
&subitem->y, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, i_active_zoom,
|
|
|
|
&subitem->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
else if (k > item->active_subitem)
|
|
|
|
{
|
2014-09-10 04:53:07 +02:00
|
|
|
/* Under items */
|
|
|
|
add_tween(LAKKA_DELAY, 0.5, &subitem->alpha, &inOutQuad, NULL);
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, vspacing*(k - item->active_subitem +
|
|
|
|
under_item_offset), &subitem->y, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, i_passive_zoom,
|
|
|
|
&subitem->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lakka_reset_submenu(void)
|
|
|
|
{
|
|
|
|
int i, j, k;
|
2014-09-12 06:29:39 +02:00
|
|
|
menu_category_t *active_category = (menu_category_t*)
|
|
|
|
&categories[menu_active_category];
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
bool do_reset = (!(
|
2014-06-04 22:29:00 +02:00
|
|
|
g_extern.main_is_init
|
|
|
|
&& !g_extern.libretro_dummy
|
2014-09-12 06:29:39 +02:00
|
|
|
&& (!strcmp(g_extern.fullpath,
|
|
|
|
active_category->items[
|
|
|
|
active_category->active_item].rom))));
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
if (!do_reset)
|
|
|
|
return;
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
/* Keeps active submenu state (do we really want that?) */
|
|
|
|
active_category->items[active_category->active_item].active_subitem = 0;
|
2014-06-05 21:18:15 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
for (i = 0; i < num_categories; i++)
|
|
|
|
{
|
|
|
|
menu_category_t *category = (menu_category_t*)&categories[i];
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
if (!category)
|
|
|
|
continue;
|
2014-06-05 21:18:15 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
for (j = 0; j < category->num_items; j++)
|
|
|
|
{
|
|
|
|
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) ?
|
|
|
|
i_active_zoom : i_passive_zoom;
|
|
|
|
subitem->y = k == 0 ?
|
|
|
|
vspacing * active_item_factor :
|
|
|
|
vspacing * (k + under_item_offset);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lakka_open_submenu(void)
|
|
|
|
{
|
|
|
|
int i, j, k;
|
2014-09-10 04:53:07 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, -hspacing * (menu_active_category+1),
|
|
|
|
&all_categories_x, &inOutQuad, NULL);
|
2014-09-10 04:53:07 +02:00
|
|
|
add_tween(LAKKA_DELAY, 1.0, &arrow_alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
/* Reset contextual menu style */
|
2014-06-04 22:29:00 +02:00
|
|
|
lakka_reset_submenu();
|
|
|
|
|
|
|
|
for (i = 0; i < num_categories; i++)
|
|
|
|
{
|
|
|
|
menu_category_t *category = (menu_category_t*)&categories[i];
|
|
|
|
|
2014-06-05 21:18:15 +02:00
|
|
|
if (!category)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (i != menu_active_category)
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0,
|
|
|
|
&category->alpha, &inOutQuad, NULL);
|
2014-06-05 21:18:15 +02:00
|
|
|
else
|
2014-06-04 22:29:00 +02:00
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 1.0,
|
|
|
|
&category->alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (j = 0; j < category->num_items; j++)
|
|
|
|
{
|
|
|
|
if (j == category->active_item)
|
|
|
|
{
|
|
|
|
for (k = 0; k < category->items[j].num_subitems; k++)
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
menu_subitem_t *subitem = (menu_subitem_t*)
|
|
|
|
&category->items[j].subitems[k];
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
if (k == category->items[j].active_subitem)
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 1.0,
|
|
|
|
&subitem->alpha, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, i_active_zoom,
|
|
|
|
&subitem->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0.5,
|
|
|
|
&subitem->alpha, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, i_passive_zoom,
|
|
|
|
&subitem->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0,
|
|
|
|
&category->items[j].alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lakka_close_submenu(void)
|
|
|
|
{
|
|
|
|
int i, j, k;
|
2014-09-10 04:53:07 +02:00
|
|
|
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, -hspacing * menu_active_category,
|
|
|
|
&all_categories_x, &inOutQuad, NULL);
|
2014-09-10 04:53:07 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0.0, &arrow_alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (i = 0; i < num_categories; i++)
|
|
|
|
{
|
|
|
|
menu_category_t *category = (menu_category_t*)&categories[i];
|
|
|
|
|
2014-06-05 21:18:15 +02:00
|
|
|
if (!category)
|
|
|
|
continue;
|
|
|
|
|
2014-06-04 22:29:00 +02:00
|
|
|
if (i == menu_active_category)
|
|
|
|
{
|
2014-09-10 04:53:07 +02:00
|
|
|
add_tween(LAKKA_DELAY, 1.0, &category->alpha, &inOutQuad, NULL);
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, c_active_zoom,
|
|
|
|
&category->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (j = 0; j < category->num_items; j++)
|
|
|
|
{
|
|
|
|
if (j == category->active_item)
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 1.0,
|
|
|
|
&category->items[j].alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (k = 0; k < category->items[j].num_subitems; k++)
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0,
|
|
|
|
&category->items[j].subitems[k].alpha,
|
|
|
|
&inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
else
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0.5,
|
|
|
|
&category->items[j].alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0.5,
|
|
|
|
&category->alpha, &inOutQuad, NULL);
|
|
|
|
add_tween(LAKKA_DELAY, c_passive_zoom,
|
|
|
|
&category->zoom, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
|
|
|
|
for (j = 0; j < category->num_items; j++)
|
2014-09-12 06:29:39 +02:00
|
|
|
add_tween(LAKKA_DELAY, 0,
|
|
|
|
&category->items[j].alpha, &inOutQuad, NULL);
|
2014-06-04 22:29:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-30 20:23:20 +02:00
|
|
|
static int menu_lakka_iterate(unsigned action)
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
menu_category_t *active_category = NULL;
|
|
|
|
menu_item_t *active_item = NULL;
|
|
|
|
menu_subitem_t * active_subitem = NULL;
|
2014-05-30 20:23:20 +02:00
|
|
|
|
2014-05-31 22:34:45 +02:00
|
|
|
if (!driver.menu)
|
2014-05-30 20:23:20 +02:00
|
|
|
{
|
|
|
|
RARCH_ERR("Cannot iterate menu, menu handle is not initialized.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2014-05-27 02:26:15 +02:00
|
|
|
|
2014-05-27 03:48:08 +02:00
|
|
|
active_category = (menu_category_t*)&categories[menu_active_category];
|
|
|
|
|
|
|
|
if (active_category)
|
2014-09-12 06:29:39 +02:00
|
|
|
active_item = (menu_item_t*)
|
|
|
|
&active_category->items[active_category->active_item];
|
2014-05-27 03:48:08 +02:00
|
|
|
|
2014-09-11 22:07:41 +02:00
|
|
|
if (active_item)
|
2014-09-12 06:29:39 +02:00
|
|
|
active_subitem = (menu_subitem_t*)
|
|
|
|
&active_item->subitems[active_item->active_subitem];
|
2014-09-11 22:07:41 +02:00
|
|
|
|
2014-05-27 03:48:08 +02:00
|
|
|
if (!active_category || !active_item)
|
2014-05-27 02:26:15 +02:00
|
|
|
return 0;
|
2014-05-08 01:12:51 +07:00
|
|
|
|
2014-05-09 17:36:38 +02:00
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
|
2014-06-01 00:48:54 +02:00
|
|
|
driver.menu_ctx->set_texture(driver.menu);
|
2014-05-08 01:12:51 +07:00
|
|
|
|
2014-09-11 22:07:41 +02:00
|
|
|
if (action && depth == 1 && menu_active_category == 0
|
|
|
|
&& active_subitem->setting)
|
|
|
|
{
|
2014-09-12 05:57:27 +02:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
|
|
|
case MENU_ACTION_RIGHT:
|
|
|
|
case MENU_ACTION_OK:
|
|
|
|
case MENU_ACTION_START:
|
2014-09-12 06:46:43 +02:00
|
|
|
{
|
|
|
|
rarch_setting_t *setting = (rarch_setting_t*)
|
|
|
|
active_subitem->setting;
|
|
|
|
|
|
|
|
if (setting->type == ST_BOOL)
|
|
|
|
menu_action_setting_boolean(setting, action);
|
|
|
|
else if (setting->type == ST_UINT)
|
|
|
|
menu_action_setting_unsigned_integer(setting, 0, action);
|
|
|
|
else if (setting->type == ST_FLOAT)
|
|
|
|
menu_action_setting_fraction(setting, action);
|
|
|
|
else if (setting->type == ST_STRING)
|
|
|
|
menu_action_setting_driver(setting, action);
|
|
|
|
}
|
2014-09-12 05:57:27 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-09-11 22:07:41 +02:00
|
|
|
}
|
|
|
|
|
2014-05-09 17:36:38 +02:00
|
|
|
switch (action)
|
|
|
|
{
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_LEFT:
|
2014-05-09 17:36:38 +02:00
|
|
|
if (depth == 0 && menu_active_category > 0)
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-09 17:36:38 +02:00
|
|
|
menu_active_category--;
|
|
|
|
lakka_switch_categories();
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
2014-09-11 00:09:53 +02:00
|
|
|
else if (depth == 1 && menu_active_category > 0
|
|
|
|
&& (active_item->active_subitem == 1
|
|
|
|
|| active_item->active_subitem == 2)
|
|
|
|
&& g_settings.state_slot > -1)
|
|
|
|
{
|
|
|
|
g_settings.state_slot--;
|
|
|
|
}
|
2014-05-08 01:12:51 +07:00
|
|
|
break;
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_RIGHT:
|
2014-05-09 17:36:38 +02:00
|
|
|
if (depth == 0 && menu_active_category < num_categories-1)
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-09 17:36:38 +02:00
|
|
|
menu_active_category++;
|
|
|
|
lakka_switch_categories();
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
2014-09-11 00:09:53 +02:00
|
|
|
else if (depth == 1 && menu_active_category > 0
|
|
|
|
&& (active_item->active_subitem == 1
|
|
|
|
|| active_item->active_subitem == 2)
|
|
|
|
&& g_settings.state_slot < 255)
|
|
|
|
{
|
|
|
|
g_settings.state_slot++;
|
|
|
|
}
|
2014-05-08 01:12:51 +07:00
|
|
|
break;
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_DOWN:
|
2014-09-12 06:29:39 +02:00
|
|
|
if (depth == 0
|
|
|
|
&& (active_category->active_item <
|
|
|
|
(active_category->num_items - 1)))
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-27 02:26:15 +02:00
|
|
|
active_category->active_item++;
|
2014-05-09 17:36:38 +02:00
|
|
|
lakka_switch_items();
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
2014-09-12 06:29:39 +02:00
|
|
|
|
|
|
|
/* 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 (depth == 1
|
|
|
|
&& (active_item->active_subitem <
|
|
|
|
(active_item->num_subitems -1))
|
|
|
|
&& (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)))))
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-27 03:25:41 +02:00
|
|
|
active_item->active_subitem++;
|
2014-05-09 17:36:38 +02:00
|
|
|
lakka_switch_subitems();
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_UP:
|
2014-05-27 02:26:15 +02:00
|
|
|
if (depth == 0 && active_category->active_item > 0)
|
2014-05-09 17:36:38 +02:00
|
|
|
{
|
2014-05-27 02:26:15 +02:00
|
|
|
active_category->active_item--;
|
2014-05-09 17:36:38 +02:00
|
|
|
lakka_switch_items();
|
|
|
|
}
|
2014-05-27 03:25:41 +02:00
|
|
|
if (depth == 1 && active_item->active_subitem > 0)
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-27 03:25:41 +02:00
|
|
|
active_item->active_subitem--;
|
2014-05-09 17:36:38 +02:00
|
|
|
lakka_switch_subitems();
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_OK:
|
2014-09-11 22:07:41 +02:00
|
|
|
if (depth == 1 && menu_active_category > 0)
|
2014-05-09 17:55:39 +02:00
|
|
|
{
|
2014-05-27 03:25:41 +02:00
|
|
|
switch (active_item->active_subitem)
|
2014-05-09 17:55:39 +02:00
|
|
|
{
|
2014-05-09 17:36:38 +02:00
|
|
|
case 0:
|
2014-06-03 11:54:48 +02:00
|
|
|
global_alpha = 0.0;
|
2014-05-27 03:25:41 +02:00
|
|
|
if (g_extern.main_is_init && !g_extern.libretro_dummy
|
2014-09-12 06:29:39 +02:00
|
|
|
&& (!strcmp(g_extern.fullpath, active_item->rom)))
|
2014-09-03 16:58:20 +02:00
|
|
|
{
|
|
|
|
rarch_main_command(RARCH_CMD_RESUME);
|
|
|
|
}
|
2014-05-09 17:36:38 +02:00
|
|
|
else
|
|
|
|
{
|
2014-09-12 06:29:39 +02:00
|
|
|
strlcpy(g_extern.fullpath,
|
|
|
|
active_item->rom, sizeof(g_extern.fullpath));
|
|
|
|
strlcpy(g_settings.libretro,
|
|
|
|
active_category->libretro,
|
|
|
|
sizeof(g_settings.libretro));
|
2014-05-10 00:07:15 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_DYNAMIC
|
2014-07-22 03:34:28 +02:00
|
|
|
rarch_main_command(RARCH_CMD_LOAD_CORE);
|
2014-09-03 18:36:46 +02:00
|
|
|
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
|
2014-05-10 00:07:15 +02:00
|
|
|
#endif
|
2014-05-09 17:36:38 +02:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
case 1:
|
2014-06-03 11:54:48 +02:00
|
|
|
global_alpha = 0.0;
|
2014-07-22 02:14:52 +02:00
|
|
|
rarch_main_command(RARCH_CMD_SAVE_STATE);
|
2014-05-09 17:36:38 +02:00
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
case 2:
|
2014-06-03 11:54:48 +02:00
|
|
|
global_alpha = 0.0;
|
2014-07-22 02:14:52 +02:00
|
|
|
rarch_main_command(RARCH_CMD_LOAD_STATE);
|
2014-05-09 17:36:38 +02:00
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
case 3:
|
2014-07-22 03:17:47 +02:00
|
|
|
rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);
|
2014-05-09 17:36:38 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2014-06-03 11:54:48 +02:00
|
|
|
global_alpha = 0.0;
|
2014-07-22 02:14:52 +02:00
|
|
|
rarch_main_command(RARCH_CMD_RESET);
|
2014-05-09 17:36:38 +02:00
|
|
|
return -1;
|
|
|
|
break;
|
|
|
|
}
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
2014-06-02 16:34:17 +02:00
|
|
|
else if (depth == 0 && active_item->num_subitems)
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-09 17:36:38 +02:00
|
|
|
lakka_open_submenu();
|
|
|
|
depth = 1;
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
2014-09-12 06:29:39 +02:00
|
|
|
else if (depth == 0 &&
|
|
|
|
(menu_active_category == 0 &&
|
|
|
|
(active_category->active_item ==
|
|
|
|
(active_category->num_items - 1))))
|
2014-06-02 16:34:17 +02:00
|
|
|
{
|
2014-09-10 04:53:07 +02:00
|
|
|
add_tween(LAKKA_DELAY, 1.0, &global_alpha, &inOutQuad, NULL);
|
2014-09-03 18:36:46 +02:00
|
|
|
rarch_main_set_state(RARCH_ACTION_STATE_RUNNING_FINISHED);
|
2014-08-27 22:18:17 +02:00
|
|
|
return -1;
|
2014-06-02 16:34:17 +02:00
|
|
|
}
|
2014-05-09 17:36:38 +02:00
|
|
|
break;
|
2014-05-08 01:12:51 +07:00
|
|
|
|
2014-06-10 01:42:26 +02:00
|
|
|
case MENU_ACTION_CANCEL:
|
2014-05-09 17:36:38 +02:00
|
|
|
if (depth == 1)
|
2014-05-08 01:12:51 +07:00
|
|
|
{
|
2014-05-09 17:36:38 +02:00
|
|
|
lakka_close_submenu();
|
|
|
|
depth = 0;
|
2014-05-08 01:12:51 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-09 17:36:38 +02:00
|
|
|
if (driver.menu_ctx && driver.menu_ctx->iterate)
|
2014-05-31 22:34:45 +02:00
|
|
|
driver.menu_ctx->iterate(driver.menu, action);
|
2014-05-08 01:12:51 +07:00
|
|
|
|
|
|
|
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
|
2014-05-30 21:51:12 +02:00
|
|
|
driver.menu_ctx->render();
|
2014-05-08 01:12:51 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-11 07:06:20 +02:00
|
|
|
menu_ctx_driver_backend_t menu_ctx_backend_lakka = {
|
2014-05-09 17:36:38 +02:00
|
|
|
menu_lakka_iterate,
|
2014-09-01 19:37:00 +02:00
|
|
|
//#ifndef HAVE_SHADER_MANAGER
|
2014-05-09 17:36:38 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2014-09-01 19:37:00 +02:00
|
|
|
//#endif
|
2014-05-22 03:12:56 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2014-05-08 01:12:51 +07:00
|
|
|
"menu_lakka",
|
|
|
|
};
|