mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 10:40:39 +00:00
Create wrappers for accessing menu->begin
This commit is contained in:
parent
d3d4819ef9
commit
d66db000c6
@ -503,7 +503,7 @@ static void menu_action_setting_disp_set_label_menu_disk_index(
|
||||
current = control->get_image_index();
|
||||
|
||||
if (current >= images)
|
||||
strlcpy(s, "No Disk", len);
|
||||
strlcpy(s, menu_hash_to_str(MENU_VALUE_NO_DISK), len);
|
||||
else
|
||||
snprintf(s, len, "%u", current + 1);
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
|
||||
glui->list_block.carr.coords.vertices = 0;
|
||||
|
||||
for (i = menu->begin; i < end; i++)
|
||||
for (i = menu_entries_get_start(); i < end; i++)
|
||||
{
|
||||
bool entry_selected;
|
||||
char entry_path[PATH_MAX_LENGTH];
|
||||
@ -667,14 +667,14 @@ static void glui_navigation_set(bool scroll)
|
||||
end = menu_entries_get_end();
|
||||
|
||||
if (nav->selection_ptr < num_lines / 2 || end <= num_lines)
|
||||
menu->begin = 0;
|
||||
menu_entries_set_start(0);
|
||||
else if (nav->selection_ptr < (end - num_lines / 2))
|
||||
menu->begin = nav->selection_ptr - num_lines / 2;
|
||||
menu_entries_set_start(nav->selection_ptr - num_lines / 2);
|
||||
else
|
||||
menu->begin = end - num_lines;
|
||||
menu_entries_set_start(end - num_lines);
|
||||
|
||||
if (menu->begin > 5)
|
||||
menu->begin -= 5;
|
||||
if (menu_entries_get_start() > 5)
|
||||
menu_entries_set_start(menu_entries_get_start() - 5);
|
||||
}
|
||||
|
||||
menu_animation_push(disp->animation, 10, scroll_pos,
|
||||
@ -687,7 +687,7 @@ static void glui_navigation_clear(bool pending_push)
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
menu->begin = 0;
|
||||
menu_entries_set_start(0);
|
||||
menu->scroll_y = 0;
|
||||
}
|
||||
|
||||
|
@ -383,12 +383,12 @@ static void rgui_render(void)
|
||||
|
||||
if (settings->menu.pointer.enable)
|
||||
{
|
||||
menu_input->pointer.ptr = menu_input->pointer.y / 11 - 2 + menu->begin;
|
||||
menu_input->pointer.ptr = menu_input->pointer.y / 11 - 2 + menu_entries_get_start();
|
||||
|
||||
if (menu_input->pointer.dragging)
|
||||
{
|
||||
menu->scroll_y += menu_input->pointer.dy;
|
||||
menu->begin = -menu->scroll_y / 11 + 2;
|
||||
menu_entries_set_start(-menu->scroll_y / 11 + 2);
|
||||
if (menu->scroll_y > 0)
|
||||
menu->scroll_y = 0;
|
||||
}
|
||||
@ -397,25 +397,25 @@ static void rgui_render(void)
|
||||
if (settings->menu.mouse.enable)
|
||||
{
|
||||
if (menu_input->mouse.scrolldown
|
||||
&& menu->begin < menu_entries_get_end() - RGUI_TERM_HEIGHT)
|
||||
menu->begin++;
|
||||
&& (menu_entries_get_start() < menu_entries_get_end() - RGUI_TERM_HEIGHT))
|
||||
menu_entries_set_start(menu_entries_get_start() + 1);
|
||||
|
||||
if (menu_input->mouse.scrollup && menu->begin > 0)
|
||||
menu->begin--;
|
||||
if (menu_input->mouse.scrollup && (menu_entries_get_start() > 0))
|
||||
menu_entries_set_start(menu_entries_get_start() - 1);
|
||||
|
||||
menu_input->mouse.ptr = menu_input->mouse.y / 11 - 2 + menu->begin;
|
||||
menu_input->mouse.ptr = menu_input->mouse.y / 11 - 2 + menu_entries_get_start();
|
||||
}
|
||||
|
||||
/* Do not scroll if all items are visible. */
|
||||
if (menu_entries_get_end() <= RGUI_TERM_HEIGHT)
|
||||
menu->begin = 0;
|
||||
menu_entries_set_start(0);;
|
||||
|
||||
bottom = menu_entries_get_end() - RGUI_TERM_HEIGHT;
|
||||
if (menu->begin > bottom)
|
||||
menu->begin = bottom;
|
||||
if (menu_entries_get_start() > bottom)
|
||||
menu_entries_set_start(bottom);
|
||||
|
||||
end = (menu->begin + RGUI_TERM_HEIGHT <= menu_entries_get_end()) ?
|
||||
menu->begin + RGUI_TERM_HEIGHT : menu_entries_get_end();
|
||||
end = ((menu_entries_get_start() + RGUI_TERM_HEIGHT) <= (menu_entries_get_end())) ?
|
||||
menu_entries_get_start() + RGUI_TERM_HEIGHT : menu_entries_get_end();
|
||||
|
||||
rgui_render_background();
|
||||
|
||||
@ -551,9 +551,10 @@ static void *rgui_init(void)
|
||||
frame_buf->width = 320;
|
||||
frame_buf->height = 240;
|
||||
menu->display.header_height = FONT_HEIGHT_STRIDE * 2;
|
||||
menu->begin = 0;
|
||||
frame_buf->pitch = frame_buf->width * sizeof(uint16_t);
|
||||
|
||||
menu_entries_set_start(0);
|
||||
|
||||
ret = rguidisp_init_font(menu);
|
||||
|
||||
if (!ret)
|
||||
@ -622,7 +623,7 @@ static void rgui_navigation_clear(bool pending_push)
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
menu->begin = 0;
|
||||
menu_entries_set_start(0);
|
||||
menu->scroll_y = 0;
|
||||
}
|
||||
|
||||
@ -641,12 +642,12 @@ static void rgui_navigation_set(bool scroll)
|
||||
return;
|
||||
|
||||
if (nav->selection_ptr < RGUI_TERM_HEIGHT/2)
|
||||
menu->begin = 0;
|
||||
menu_entries_set_start(0);
|
||||
else if (nav->selection_ptr >= RGUI_TERM_HEIGHT/2
|
||||
&& nav->selection_ptr < (end - RGUI_TERM_HEIGHT/2))
|
||||
menu->begin = nav->selection_ptr - RGUI_TERM_HEIGHT/2;
|
||||
menu_entries_set_start(nav->selection_ptr - RGUI_TERM_HEIGHT/2);
|
||||
else if (nav->selection_ptr >= (end - RGUI_TERM_HEIGHT/2))
|
||||
menu->begin = end - RGUI_TERM_HEIGHT;
|
||||
menu_entries_set_start(end - RGUI_TERM_HEIGHT);
|
||||
}
|
||||
|
||||
static void rgui_navigation_set_last(void)
|
||||
|
@ -1028,7 +1028,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
matrix_4x4_scale(&mscal, 1 /* scale_factor */, 1 /* scale_factor */, 1);
|
||||
matrix_4x4_multiply(&mymat, &mscal, &mymat);
|
||||
|
||||
i = menu->begin;
|
||||
i = menu_entries_get_start();
|
||||
|
||||
if (list == xmb->selection_buf_old)
|
||||
i = 0;
|
||||
@ -1248,7 +1248,8 @@ static void xmb_render(void)
|
||||
current = nav->selection_ptr;
|
||||
end = menu_list_get_size(menu_list);
|
||||
|
||||
menu->begin = 0;
|
||||
menu_entries_set_start(0);
|
||||
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
float item_y1 = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
|
||||
@ -1256,7 +1257,7 @@ static void xmb_render(void)
|
||||
|
||||
if (item_y2 < 0)
|
||||
{
|
||||
menu->begin++;
|
||||
menu_entries_set_start(menu_entries_get_start() + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1276,8 +1277,8 @@ static void xmb_render(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (menu->begin > 5)
|
||||
menu->begin -= 5;
|
||||
if (menu_entries_get_start() > 5)
|
||||
menu_entries_set_start(menu_entries_get_start() - 5);
|
||||
|
||||
anim->is_active = false;
|
||||
anim->label.is_updated = false;
|
||||
|
@ -22,6 +22,17 @@
|
||||
|
||||
#include "../general.h"
|
||||
|
||||
/* Sets the starting index of the menu entry list. */
|
||||
void menu_entries_set_start(size_t i)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
menu->begin = i;
|
||||
}
|
||||
|
||||
/* Returns the starting index of the menu entry list. */
|
||||
size_t menu_entries_get_start(void)
|
||||
{
|
||||
|
@ -118,6 +118,8 @@ int menu_entry_select(uint32_t i);
|
||||
int menu_entry_action(menu_entry_t *entry,
|
||||
unsigned i, enum menu_action action);
|
||||
|
||||
void menu_entries_set_start(size_t i);
|
||||
|
||||
size_t menu_entries_get_start(void);
|
||||
|
||||
size_t menu_entries_get_end(void);
|
||||
|
@ -178,6 +178,8 @@ extern "C" {
|
||||
#define MENU_LABEL_VIDEO_SHADER_NUM_PASSES 0x79b2992fU
|
||||
#define MENU_LABEL_CHEAT_NUM_PASSES 0x1910eb87U
|
||||
|
||||
#define MENU_VALUE_NO_DISK 0x7d54e5cdU
|
||||
|
||||
#define MENU_VALUE_MD5 0x0b888fabU
|
||||
#define MENU_VALUE_SHA1 0x7c9de632U
|
||||
#define MENU_VALUE_CRC 0x0b88671dU
|
||||
|
Loading…
Reference in New Issue
Block a user