mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Merge pull request #1060 from lakkatv/lakka
(Lakka) Fix two submenu bugs
This commit is contained in:
commit
28c212c792
@ -163,51 +163,43 @@ static void lakka_switch_subitems(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lakka_reset_submenu(void)
|
static void lakka_reset_submenu(int i, int j)
|
||||||
|
{
|
||||||
|
menu_category_t *category = (menu_category_t*)&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) ?
|
||||||
|
i_active_zoom : i_passive_zoom;
|
||||||
|
subitem->y = k == 0 ?
|
||||||
|
vspacing * active_item_factor :
|
||||||
|
vspacing * (k + under_item_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool lakka_on_active_rom(void)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
|
||||||
menu_category_t *active_category = (menu_category_t*)
|
menu_category_t *active_category = (menu_category_t*)
|
||||||
&categories[menu_active_category];
|
&categories[menu_active_category];
|
||||||
|
|
||||||
bool do_reset = (!(
|
return !(g_extern.main_is_init
|
||||||
g_extern.main_is_init
|
|
||||||
&& !g_extern.libretro_dummy
|
&& !g_extern.libretro_dummy
|
||||||
&& (!strcmp(g_extern.fullpath,
|
&& (!strcmp(g_extern.fullpath,
|
||||||
active_category->items[
|
active_category->items[
|
||||||
active_category->active_item].rom))));
|
active_category->active_item].rom)));
|
||||||
|
|
||||||
if (!do_reset)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Keeps active submenu state (do we really want that?) */
|
|
||||||
active_category->items[active_category->active_item].active_subitem = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < num_categories; i++)
|
|
||||||
{
|
|
||||||
menu_category_t *category = (menu_category_t*)&categories[i];
|
|
||||||
|
|
||||||
if (!category)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lakka_open_submenu(void)
|
static void lakka_open_submenu(void)
|
||||||
@ -218,8 +210,11 @@ static void lakka_open_submenu(void)
|
|||||||
&all_categories_x, &inOutQuad, NULL);
|
&all_categories_x, &inOutQuad, NULL);
|
||||||
add_tween(LAKKA_DELAY, 1.0, &arrow_alpha, &inOutQuad, NULL);
|
add_tween(LAKKA_DELAY, 1.0, &arrow_alpha, &inOutQuad, NULL);
|
||||||
|
|
||||||
/* Reset contextual menu style */
|
menu_category_t *active_category = (menu_category_t*)
|
||||||
lakka_reset_submenu();
|
&categories[menu_active_category];
|
||||||
|
|
||||||
|
if (menu_active_category > 0 && lakka_on_active_rom())
|
||||||
|
lakka_reset_submenu(menu_active_category, active_category->active_item);
|
||||||
|
|
||||||
for (i = 0; i < num_categories; i++)
|
for (i = 0; i < num_categories; i++)
|
||||||
{
|
{
|
||||||
|
@ -513,8 +513,7 @@ static void lakka_draw_items(int i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* performance improvement */
|
/* performance improvement */
|
||||||
if (i == menu_active_category
|
if (i == menu_active_category && j == category->active_item)
|
||||||
&& j == category->active_item && depth == 1)
|
|
||||||
lakka_draw_subitems(i, j);
|
lakka_draw_subitems(i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -704,8 +703,8 @@ void lakka_init_settings(void)
|
|||||||
|
|
||||||
strlcpy(subitem->name, setting->short_description,
|
strlcpy(subitem->name, setting->short_description,
|
||||||
sizeof(subitem->name));
|
sizeof(subitem->name));
|
||||||
subitem->alpha = kk ? 1.0 : 0.5;
|
subitem->alpha = 0.0;
|
||||||
subitem->zoom = kk ? i_active_zoom : i_passive_zoom;
|
subitem->zoom = kk ? i_passive_zoom : i_active_zoom;
|
||||||
subitem->y = kk ? vspacing * (kk + under_item_offset)
|
subitem->y = kk ? vspacing * (kk + under_item_offset)
|
||||||
: vspacing * active_item_factor;
|
: vspacing * active_item_factor;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user