mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(menu_navigation.c) Refactor code
This commit is contained in:
parent
a7950486be
commit
51114f5a6a
@ -31,6 +31,7 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||||
menu_list_t *menu_list = menu_list_get_ptr();
|
menu_list_t *menu_list = menu_list_get_ptr();
|
||||||
|
size_t selection = nav->selection_ptr;
|
||||||
|
|
||||||
(void)menu_list;
|
(void)menu_list;
|
||||||
(void)settings;
|
(void)settings;
|
||||||
@ -54,7 +55,6 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
return true;
|
return true;
|
||||||
case MENU_NAVIGATION_CTL_INCREMENT:
|
case MENU_NAVIGATION_CTL_INCREMENT:
|
||||||
{
|
{
|
||||||
size_t selection = nav->selection_ptr;
|
|
||||||
unsigned *scroll_speed = (unsigned*)data;
|
unsigned *scroll_speed = (unsigned*)data;
|
||||||
|
|
||||||
if (!scroll_speed)
|
if (!scroll_speed)
|
||||||
@ -92,7 +92,6 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
{
|
{
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
bool scroll = true;
|
bool scroll = true;
|
||||||
size_t selection = nav->selection_ptr;
|
|
||||||
unsigned *scroll_speed = (unsigned*)data;
|
unsigned *scroll_speed = (unsigned*)data;
|
||||||
|
|
||||||
if (!scroll_speed)
|
if (!scroll_speed)
|
||||||
@ -126,9 +125,13 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case MENU_NAVIGATION_CTL_SET_LAST:
|
case MENU_NAVIGATION_CTL_SET_LAST:
|
||||||
nav->selection_ptr = menu_list_get_size(menu_list) - 1;
|
{
|
||||||
if (driver->navigation_set_last)
|
size_t new_selection = menu_list_get_size(menu_list) - 1;
|
||||||
driver->navigation_set_last();
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &new_selection);
|
||||||
|
|
||||||
|
if (driver->navigation_set_last)
|
||||||
|
driver->navigation_set_last();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case MENU_NAVIGATION_CTL_ASCEND_ALPHABET:
|
case MENU_NAVIGATION_CTL_ASCEND_ALPHABET:
|
||||||
{
|
{
|
||||||
@ -171,7 +174,7 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
size_t *sel = (size_t*)data;
|
size_t *sel = (size_t*)data;
|
||||||
if (!nav || !sel)
|
if (!nav || !sel)
|
||||||
return false;
|
return false;
|
||||||
*sel = nav->selection_ptr;
|
*sel = selection;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case MENU_NAVIGATION_CTL_SET_SELECTION:
|
case MENU_NAVIGATION_CTL_SET_SELECTION:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user