De-ioctl menu display interface.

Holy crap ...
This commit is contained in:
Hans-Kristian Arntzen 2016-05-08 12:33:28 +02:00
parent 464a4add66
commit 951c3e4085
14 changed files with 624 additions and 690 deletions

View File

@ -1151,9 +1151,7 @@ bool event_cmd_ctl(enum event_command cmd, void *data)
input_driver_ctl(RARCH_INPUT_CTL_POLL, NULL);
#ifdef HAVE_MENU
menu_display_ctl(
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
menu_display_set_framebuffer_dirty_flag();
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
event_cmd_ctl(EVENT_CMD_VIDEO_SET_BLOCKING_STATE, NULL);
#endif

View File

@ -768,10 +768,9 @@ static int generic_action_ok(const char *path,
break;
case ACTION_OK_LOAD_CONFIG_FILE:
{
bool msg_force = true;
flush_char = NULL;
flush_type = MENU_SETTINGS;
menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
menu_display_set_msg_force(true);
if (rarch_ctl(RARCH_CTL_REPLACE_CONFIG, action_path))
{

View File

@ -180,7 +180,7 @@ static void mui_draw_icon(
struct gfx_coords coords;
math_matrix_4x4 mymat;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
rotate_draw.matrix = &mymat;
rotate_draw.rotation = rotation;
@ -189,7 +189,7 @@ static void mui_draw_icon(
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
menu_display_ctl(MENU_DISPLAY_CTL_ROTATE_Z, &rotate_draw);
menu_display_rotate_z(&rotate_draw);
coords.vertices = 4;
coords.vertex = NULL;
@ -207,12 +207,10 @@ static void mui_draw_icon(
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw(&draw);
menu_display_blend_end();
}
static void mui_draw_tab(mui_handle_t *mui,
unsigned i,
unsigned width, unsigned height,
@ -256,7 +254,7 @@ static void mui_draw_text(float x, float y, unsigned width, unsigned height,
int font_size;
struct font_params params;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
font_size = menu_display_get_font_size();
params.x = x / width;
params.y = 1.0f - (y + font_size / 3) / height;
@ -285,7 +283,7 @@ static void mui_render_quad(mui_handle_t *mui,
coords.lut_tex_coord = NULL;
coords.color = coord_color;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
draw.x = x;
draw.y = (int)height - y - (int)h;
@ -297,17 +295,15 @@ static void mui_render_quad(mui_handle_t *mui,
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw(&draw);
menu_display_blend_end();
}
static void mui_draw_tab_begin(mui_handle_t *mui,
unsigned width, unsigned height,
float *white_bg, float *grey_bg)
{
float scale_factor;
menu_display_ctl(MENU_DISPLAY_CTL_GET_DPI, &scale_factor);
float scale_factor = menu_display_get_dpi();
mui->tabs_height = scale_factor / 3;
@ -350,7 +346,7 @@ static void mui_draw_scrollbar(mui_handle_t *mui,
if (!mui)
return;
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
header_height = menu_display_get_header_height();
content_height = menu_entries_get_end() * mui->line_height;
total_height = height - header_height - mui->tabs_height;
@ -404,7 +400,7 @@ static void mui_render_messagebox(const char *message)
video_driver_get_size(&width, &height);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
font_size = menu_display_get_font_size();
x = width / 2;
y = height / 2 - list->size * font_size / 2;
@ -445,9 +441,9 @@ static void mui_render(void *data)
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE, &delta.ideal);
menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &width);
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &height);
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
menu_display_set_width(width);
menu_display_set_height(height);
header_height = menu_display_get_header_height();
if (settings->menu.pointer.enable)
{
@ -624,10 +620,10 @@ static void mui_render_menu_list(mui_handle_t *mui,
size_t end = menu_entries_get_end();
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
if (!menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
if (!menu_display_get_update_pending())
return;
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
header_height = menu_display_get_header_height();
mui->list_block.carr.coords.vertices = 0;
@ -711,13 +707,15 @@ static int mui_get_core_title(char *s, size_t len)
static void mui_draw_bg(menu_display_ctx_draw_t *draw)
{
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
draw->x = 0;
draw->y = 0;
draw->pipeline.id = 0;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, draw);
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw_bg(draw);
menu_display_draw(draw);
menu_display_blend_end();
}
static void mui_frame(void *data)
@ -789,8 +787,7 @@ static void mui_frame(void *data)
const uint32_t activetab_color = 0x0096f2ff;
const uint32_t passivetab_color = 0x9e9e9eff;
bool background_rendered = false;
bool libretro_running = menu_display_ctl(
MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL);
bool libretro_running = menu_display_libretro_running();
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
@ -802,8 +799,8 @@ static void mui_frame(void *data)
video_driver_get_size(&width, &height);
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
menu_display_set_viewport();
header_height = menu_display_get_header_height();
if (libretro_running)
{
@ -818,8 +815,7 @@ static void mui_frame(void *data)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL)
&& draw.texture)
if (!menu_display_libretro_running() && draw.texture)
draw.color = &white_bg[0];
mui_draw_bg(&draw);
@ -833,7 +829,7 @@ static void mui_frame(void *data)
clearcolor.b = 1.0f;
clearcolor.a = 0.75f;
menu_display_ctl(MENU_DISPLAY_CTL_CLEAR_COLOR, &clearcolor);
menu_display_clear_color(&clearcolor);
if (mui->textures.bg)
{
@ -852,8 +848,7 @@ static void mui_frame(void *data)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL)
&& draw.texture)
if (!menu_display_libretro_running() && draw.texture)
draw.color = &white_bg[0];
mui_draw_bg(&draw);
@ -880,12 +875,12 @@ static void mui_frame(void *data)
width, height,
&lightblue_bg[0]);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BIND_BLOCK, &mui->list_block);
menu_display_font_bind_block(&mui->list_block);
mui_render_menu_list(mui, width, height,
normal_color, hover_color, &pure_white[0]);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK, NULL);
menu_display_font_flush_block();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
/* header */
@ -997,8 +992,8 @@ static void mui_frame(void *data)
width,
height);
menu_display_ctl(MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
menu_display_restore_clear_color();
menu_display_unset_viewport();
}
static void mui_font(void)
@ -1008,7 +1003,7 @@ static void mui_font(void)
menu_display_ctx_font_t font_info;
settings_t *settings = config_get_ptr();
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
font_size = menu_display_get_font_size();
fill_pathname_join(mediapath, settings->directory.assets,
"glui", sizeof(mediapath));
@ -1018,7 +1013,7 @@ static void mui_font(void)
font_info.path = fontpath;
font_info.size = font_size;
if (!menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_INIT, &font_info))
if (!menu_display_font_main_init(&font_info))
RARCH_WARN("Failed to load font.");
}
@ -1037,7 +1032,7 @@ static void mui_layout(mui_handle_t *mui)
*
* On desktops, we just care about readability, with every widget
* size proportional to the display width. */
menu_display_ctl(MENU_DISPLAY_CTL_GET_DPI, &scale_factor);
scale_factor = menu_display_get_dpi();
new_header_height = scale_factor / 3;
new_font_size = scale_factor / 9;
@ -1049,17 +1044,15 @@ static void mui_layout(mui_handle_t *mui)
mui->margin = scale_factor / 9;
mui->icon_size = scale_factor / 3;
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT,
&new_header_height);
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_SIZE,
&new_font_size);
menu_display_set_header_height(new_header_height);
menu_display_set_font_size(new_font_size);
/* we assume the average glyph aspect ratio is close to 3:4 */
mui->glyph_width = new_font_size * 3/4;
mui_font();
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &fb_buf);
fb_buf = menu_display_get_font_buffer();
if (fb_buf) /* calculate a more realistic ticker_limit */
{
@ -1080,7 +1073,7 @@ static void *mui_init(void **userdata)
if (!menu)
goto error;
if (!menu_display_ctl(MENU_DISPLAY_CTL_INIT_FIRST_DRIVER, NULL))
if (!menu_display_init_first_driver())
goto error;
mui = (mui_handle_t*)calloc(1, sizeof(mui_handle_t));
@ -1134,7 +1127,7 @@ static void mui_context_destroy(void *data)
for (i = 0; i < MUI_TEXTURE_LAST; i++)
video_driver_texture_unload(&mui->textures.list[i]);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_DEINIT, NULL);
menu_display_font_main_deinit();
mui_context_bg_destroy(mui);
}
@ -1498,7 +1491,7 @@ static int mui_pointer_tap(void *userdata,
video_driver_get_size(&width, &height);
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
header_height = menu_display_get_header_height();
if (y < header_height)
{

View File

@ -289,7 +289,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
if ( action != MENU_ACTION_NOOP
|| menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
|| menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
|| menu_display_get_update_pending())
{
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
}

View File

@ -202,19 +202,15 @@ static void blit_line(int x, int y,
const char *message, uint16_t color)
{
unsigned i, j;
size_t pitch = 0;
menu_display_ctl(MENU_DISPLAY_CTL_FB_PITCH, &pitch);
size_t pitch = menu_display_get_framebuffer_pitch();
if (!rgui_framebuf_data)
return;
while (*message)
{
uint8_t *font_fb = NULL;
uint32_t symbol = string_walk(&message);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_FB, &font_fb);
const uint8_t *font_fb = menu_display_get_font_framebuffer();
uint32_t symbol = string_walk(&message);
for (j = 0; j < FONT_HEIGHT; j++)
{
@ -244,7 +240,7 @@ static bool init_font(menu_handle_t *menu, const uint8_t *font_bmp_buf)
if (!font)
return false;
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_DATA_INIT, &fb_font_inited);
menu_display_set_font_data_init(fb_font_inited);
for (i = 0; i < 256; i++)
{
@ -254,7 +250,7 @@ static bool init_font(menu_handle_t *menu, const uint8_t *font_bmp_buf)
font_bmp_buf + 54 + 3 * (256 * (255 - 16 * y) + 16 * x));
}
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_FB, &font);
menu_display_set_font_framebuffer(font);
return true;
}
@ -273,7 +269,7 @@ static bool rguidisp_init_font(menu_handle_t *menu)
if (!font_bin_buf)
return false;
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_FB, &font_bin_buf);
menu_display_set_font_framebuffer(font_bin_buf);
return true;
}
@ -285,9 +281,9 @@ static void rgui_render_background(void)
uint16_t *src = NULL;
uint16_t *dst = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
menu_display_ctl(MENU_DISPLAY_CTL_FB_PITCH, &fb_pitch);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
fb_pitch = menu_display_get_framebuffer_pitch();
pitch_in_pixels = fb_pitch >> 1;
size = fb_pitch * 4;
@ -343,9 +339,9 @@ static void rgui_render_messagebox(const char *message)
width = 0;
glyphs_width = 0;
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
menu_display_ctl(MENU_DISPLAY_CTL_FB_PITCH, &fb_pitch);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
fb_pitch = menu_display_get_framebuffer_pitch();
for (i = 0; i < list->size; i++)
{
@ -403,9 +399,9 @@ static void rgui_blit_cursor(void)
int16_t x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
int16_t y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
menu_display_ctl(MENU_DISPLAY_CTL_FB_PITCH, &fb_pitch);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
fb_pitch = menu_display_get_framebuffer_pitch();
rgui_color_rect(fb_pitch, fb_width, fb_height, x, y - 5, 1, 11, 0xFFFF);
rgui_color_rect(fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF);
@ -438,7 +434,7 @@ static void rgui_render(void *data)
if (!rgui->force_redraw)
{
menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);
msg_force = menu_display_get_msg_force();
if (menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
&& menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && !msg_force)
@ -447,13 +443,13 @@ static void rgui_render(void *data)
if (runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
return;
if (!menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
if (!menu_display_get_update_pending())
return;
}
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
menu_display_ctl(MENU_DISPLAY_CTL_FB_PITCH, &fb_pitch);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
fb_pitch = menu_display_get_framebuffer_pitch();
/* if the framebuffer changed size, recache the background */
if (rgui->last_width != fb_width || rgui->last_height != fb_height)
@ -463,12 +459,11 @@ static void rgui_render(void *data)
rgui->last_height = fb_height;
}
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
menu_display_set_framebuffer_dirty_flag();
menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
rgui->force_redraw = false;
if (settings->menu.pointer.enable)
{
unsigned new_val;
@ -574,7 +569,7 @@ static void rgui_render(void *data)
datetime.len = sizeof(timedate);
datetime.time_mode = 3;
menu_display_ctl(MENU_DISPLAY_CTL_TIMEDATE, &datetime);
menu_display_timedate(&datetime);
blit_line(
RGUI_TERM_WIDTH(fb_width) * FONT_WIDTH_STRIDE - RGUI_TERM_START_X(fb_width),
@ -705,10 +700,10 @@ static void *rgui_init(void **userdata)
fb_pitch = fb_width * sizeof(uint16_t);
new_font_height = FONT_HEIGHT_STRIDE * 2;
menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &fb_height);
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT, &new_font_height);
menu_display_ctl(MENU_DISPLAY_CTL_SET_FB_PITCH, &fb_pitch);
menu_display_set_width(fb_width);
menu_display_set_height(fb_height);
menu_display_set_header_height(new_font_height);
menu_display_set_framebuffer_pitch(fb_pitch);
start = 0;
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start);
@ -736,31 +731,30 @@ error:
static void rgui_free(void *data)
{
uint8_t *font_fb;
const uint8_t *font_fb;
bool fb_font_inited = false;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_DATA_INIT, &fb_font_inited);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_FB, &font_fb);
fb_font_inited = menu_display_get_font_data_init();
font_fb = menu_display_get_font_framebuffer();
if (fb_font_inited)
free(font_fb);
free((void*)font_fb);
fb_font_inited = false;
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_DATA_INIT, &fb_font_inited);
menu_display_set_font_data_init(fb_font_inited);
}
static void rgui_set_texture(void)
{
unsigned fb_width, fb_height;
if (!menu_display_ctl(MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG, NULL))
if (!menu_display_get_framebuffer_dirty_flag())
return;
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG, NULL);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
menu_display_unset_framebuffer_dirty_flag();
video_driver_set_texture_frame(rgui_framebuf_data,
false, fb_width, fb_height, 1.0f);
@ -789,8 +783,8 @@ static void rgui_navigation_set(void *data, bool scroll)
if (!scroll)
return;
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
if (selection < RGUI_TERM_HEIGHT(fb_width, fb_height) /2)
{
@ -859,7 +853,7 @@ static int rgui_pointer_tap(void *data,
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
header_height = menu_display_get_header_height();
if (y < header_height)
{

View File

@ -511,14 +511,14 @@ static void xmb_draw_icon(
draw.x = x + 2;
draw.y = height - y - 2;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_draw(&draw);
}
coords.color = (const float*)color;
draw.x = x;
draw.y = height - y;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_draw(&draw);
}
static void xmb_draw_thumbnail(xmb_handle_t *xmb, float *color,
@ -542,7 +542,7 @@ static void xmb_draw_thumbnail(xmb_handle_t *xmb, float *color,
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
menu_display_ctl(MENU_DISPLAY_CTL_ROTATE_Z, &rotate_draw);
menu_display_rotate_z(&rotate_draw);
coords.vertices = 4;
coords.vertex = NULL;
@ -568,14 +568,14 @@ static void xmb_draw_thumbnail(xmb_handle_t *xmb, float *color,
draw.x = x + 2;
draw.y = height - y - 2;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_draw(&draw);
}
coords.color = (const float*)color;
draw.x = x;
draw.y = height - y;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_draw(&draw);
}
static void xmb_draw_text(xmb_handle_t *xmb,
@ -650,7 +650,7 @@ static void xmb_render_messagebox_internal(
if (list->elems == 0)
goto end;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
font_size = menu_display_get_font_size();
x = width / 2 - strlen(list->elems[0].data) * font_size / 4;
y = height / 2 - list->size * font_size / 2;
@ -1659,14 +1659,14 @@ static void xmb_draw_items(xmb_handle_t *xmb,
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
menu_display_ctl(MENU_DISPLAY_CTL_ROTATE_Z, &rotate_draw);
menu_display_rotate_z(&rotate_draw);
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
if (list == xmb->selection_buf_old)
i = 0;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
for (; i < end; i++)
{
@ -1826,7 +1826,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
menu_display_ctl(MENU_DISPLAY_CTL_ROTATE_Z, &rotate_draw);
menu_display_rotate_z(&rotate_draw);
xmb_draw_icon(
xmb->icon.size,
@ -1859,7 +1859,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
1, &color[0]);
}
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_blend_end();
}
static void xmb_render(void *data)
@ -1933,7 +1933,8 @@ static void xmb_draw_bg(
{
menu_display_ctx_draw_t draw;
settings_t *settings = config_get_ptr();
bool running = menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL);
bool running = menu_display_libretro_running();
draw.x = 0;
draw.y = 0;
@ -1947,8 +1948,8 @@ static void xmb_draw_bg(
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
menu_display_blend_begin();
menu_display_set_viewport();
if (settings->menu.shader_pipeline > 0)
{
@ -1959,25 +1960,24 @@ static void xmb_draw_bg(
else
menu_display_set_alpha(draw.color, coord_white[3]);
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_GRADIENT, &draw);
menu_display_draw_gradient(&draw);
draw.pipeline.id = VIDEO_SHADER_MENU_SEC;
if (settings->menu.shader_pipeline == 2)
draw.pipeline.id = VIDEO_SHADER_MENU;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_PIPELINE, &draw);
menu_display_draw_pipeline(&draw);
}
else
{
if (!running && draw.texture)
draw.color = &coord_white[0];
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
menu_display_draw_bg(&draw);
}
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw(&draw);
menu_display_blend_end();
}
static void xmb_draw_dark_layer(
@ -2012,9 +2012,9 @@ static void xmb_draw_dark_layer(
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_blend_begin();
menu_display_draw(&draw);
menu_display_blend_end();
}
static void xmb_frame(void *data)
@ -2040,7 +2040,7 @@ static void xmb_frame(void *data)
video_driver_get_size(&width, &height);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BIND_BLOCK, &xmb->raster_block);
menu_display_font_bind_block(&xmb->raster_block);
xmb->raster_block.carr.coords.vertices = 0;
@ -2091,8 +2091,8 @@ static void xmb_frame(void *data)
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
menu_display_ctl(MENU_DISPLAY_CTL_ROTATE_Z, &rotate_draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_rotate_z(&rotate_draw);
menu_display_blend_begin();
if (strcmp(xmb_thumbnails_ident(), "OFF") && xmb->thumbnail)
xmb_draw_thumbnail(xmb, &coord_white[0], width, height);
@ -2122,7 +2122,7 @@ static void xmb_frame(void *data)
datetime.len = sizeof(timedate);
datetime.time_mode = 4;
menu_display_ctl(MENU_DISPLAY_CTL_TIMEDATE, &datetime);
menu_display_timedate(&datetime);
xmb_draw_text(xmb, timedate,
width - xmb->margins.title.left - xmb->icon.size / 4,
@ -2149,7 +2149,7 @@ static void xmb_frame(void *data)
0,
1, &coord_white[0]);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
/* Horizontal tab icons */
for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
@ -2181,7 +2181,7 @@ static void xmb_frame(void *data)
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
menu_display_ctl(MENU_DISPLAY_CTL_ROTATE_Z, &rotate_draw);
menu_display_rotate_z(&rotate_draw);
xmb_draw_icon(
xmb->icon.size,
@ -2198,7 +2198,7 @@ static void xmb_frame(void *data)
}
}
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_blend_end();
/* Vertical icons */
xmb_draw_items(xmb,
@ -2227,7 +2227,7 @@ static void xmb_frame(void *data)
width,
height);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK, NULL);
menu_display_font_flush_block();
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);
@ -2269,7 +2269,7 @@ static void xmb_frame(void *data)
width,
height);
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
menu_display_unset_viewport();
}
@ -2281,7 +2281,7 @@ static void xmb_font(xmb_handle_t *xmb)
menu_display_ctx_font_t font_info;
settings_t *settings = config_get_ptr();
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
font_size = menu_display_get_font_size();
fill_pathname_join(
mediapath,
@ -2298,7 +2298,7 @@ static void xmb_font(xmb_handle_t *xmb)
font_info.path = fontpath;
font_info.size = font_size;
if (!menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_INIT, &font_info))
if (!menu_display_font_main_init(&font_info))
RARCH_WARN("Failed to load font.");
}
@ -2345,8 +2345,8 @@ static void xmb_layout(xmb_handle_t *xmb)
xmb->margins.setting.left = 600.0 * scale_factor;
xmb->icon.size = 128.0 * scale_factor;
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_SIZE, &new_font_size);
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT, &new_header_height);
menu_display_set_font_size(new_font_size);
menu_display_set_header_height(new_header_height);
current = selection;
end = menu_entries_get_end();
@ -2418,7 +2418,7 @@ static void xmb_init_ribbon(xmb_handle_t * xmb)
gfx_coord_array_t *ca = NULL;
memset(&dummy[0], 0, 4 * XMB_RIBBON_VERTICES * sizeof(float));
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
ca = menu_display_get_coords_array();
/* Set up vertices */
i = 0;
@ -2451,7 +2451,7 @@ static void *xmb_init(void **userdata)
if (!menu)
goto error;
if (!menu_display_ctl(MENU_DISPLAY_CTL_INIT_FIRST_DRIVER, NULL))
if (!menu_display_init_first_driver())
goto error;
video_driver_get_size(&width, &height);
@ -2487,8 +2487,8 @@ static void *xmb_init(void **userdata)
* for XMB, we should refactor this dependency
* away. */
menu_display_ctl(MENU_DISPLAY_CTL_SET_WIDTH, &width);
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEIGHT, &height);
menu_display_set_width(width);
menu_display_set_height(height);
menu_display_allocate_white_texture();
@ -3017,7 +3017,7 @@ static void xmb_context_destroy(void *data)
xmb_context_destroy_horizontal_list(xmb);
xmb_context_bg_destroy(xmb);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_DEINIT, NULL);
menu_display_font_main_deinit();
}
static void xmb_toggle(void *userdata, bool menu_on)
@ -3204,7 +3204,7 @@ static int xmb_pointer_tap(void *userdata,
bool scroll = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
header_height = menu_display_get_header_height();
if (y < header_height)
{

View File

@ -174,7 +174,7 @@ static void zarch_zui_font(void)
menu_display_ctx_font_t font_info;
settings_t *settings = config_get_ptr();
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
font_size = menu_display_get_font_size();
fill_pathname_join(
mediapath,
@ -187,7 +187,7 @@ static void zarch_zui_font(void)
font_info.path = fontpath;
font_info.size = font_size;
if (!menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_INIT, &font_info))
if (!menu_display_font_main_init(&font_info))
RARCH_WARN("Failed to load font.");
}
@ -874,15 +874,15 @@ static void zarch_frame(void *data)
zui_t *zui = (zui_t*)data;
gfx_coord_array_t *ca = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
ca = menu_display_get_coords_array();
if (!zui)
return;
video_driver_get_size(&zui->width, &zui->height);
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &zui->fb_buf);
menu_display_set_viewport();
zui->fb_buf = menu_display_get_font_buffer();
for (i = 0; i < 16; i++)
{
@ -904,11 +904,11 @@ static void zarch_frame(void *data)
zui->mouse.wheel = menu_input_mouse_state(MENU_MOUSE_WHEEL_DOWN) -
menu_input_mouse_state(MENU_MOUSE_WHEEL_UP);
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_RESET, NULL);
menu_display_coords_array_reset();
zui->tmp_block.carr.coords.vertices = 0;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BIND_BLOCK, &zui->tmp_block);
menu_display_font_bind_block(&zui->tmp_block);
menu_display_push_quad(zui->width, zui->height, zui_bg_screen,
0, 0, zui->width, zui->height);
@ -944,7 +944,7 @@ static void zarch_frame(void *data)
else if (zui->item.active == 0)
zui->item.active = -1;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
draw.x = 0;
draw.y = 0;
@ -956,15 +956,14 @@ static void zarch_frame(void *data)
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLES;
draw.pipeline.id = 0;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw(&draw);
menu_display_blend_end();
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
coord_draw.ptr = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_TEX_COORDS_GET, &coord_draw);
menu_display_get_tex_coords(&coord_draw);
draw.width = zui->width;
draw.height = zui->height;
@ -975,21 +974,20 @@ static void zarch_frame(void *data)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL)
&& draw.texture)
if (!menu_display_libretro_running() && draw.texture)
draw.color = &coord_color2[0];
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
draw.x = 0;
draw.y = 0;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw_bg(&draw);
menu_display_draw(&draw);
menu_display_blend_end();
zui->rendering = false;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
menu_display_font_flush_block();
menu_display_unset_viewport();
}
static void *zarch_init(void **userdata)
@ -1003,7 +1001,7 @@ static void *zarch_init(void **userdata)
if (!menu)
goto error;
if (!menu_display_ctl(MENU_DISPLAY_CTL_INIT_FIRST_DRIVER, NULL))
if (!menu_display_init_first_driver())
goto error;
zui = (zui_t*)calloc(1, sizeof(zui_t));
@ -1020,10 +1018,10 @@ static void *zarch_init(void **userdata)
}
unused = 1000;
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT, &unused);
menu_display_set_header_height(unused);
unused = 28;
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_SIZE, &unused);
menu_display_set_font_size(unused);
(void)unused;
@ -1067,7 +1065,7 @@ static void zarch_context_bg_destroy(void *data)
static void zarch_context_destroy(void *data)
{
menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_DEINIT, NULL);
menu_display_font_main_deinit();
zarch_context_bg_destroy(data);
}
@ -1111,7 +1109,7 @@ static void zarch_context_reset(void *data)
if (settings->video.font_enable)
font_info.path = settings->path.font;
if (!menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_INIT, &font_info))
if (!menu_display_font_main_init(&font_info))
RARCH_WARN("Failed to load font.");
zarch_context_bg_destroy(zui);
@ -1121,7 +1119,7 @@ static void zarch_context_reset(void *data)
menu_display_allocate_white_texture();
menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_SIZE, &zui->font_size);
menu_display_set_font_size(zui->font_size);
zarch_zui_font();
}

View File

@ -160,7 +160,7 @@ static void menu_display_gl_draw_pipeline(void *data)
static float t = 0;
gfx_coord_array_t *ca = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
ca = menu_display_get_coords_array();
draw->x = 0;
draw->y = 0;

View File

@ -102,7 +102,7 @@ static void menu_display_vk_draw_pipeline(void *data)
if (!vk || !draw)
return;
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
ca = menu_display_get_coords_array();
draw->x = 0;
draw->y = 0;
draw->coords = (struct gfx_coords*)&ca->coords;

View File

@ -89,12 +89,11 @@ static bool menu_content_load(void)
content_ctx_info_t content_info;
char name[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH];
bool msg_force = true;
char *fullpath = NULL;
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
/* redraw menu frame */
menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
menu_display_set_msg_force(true);
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
if (*fullpath)

View File

@ -92,11 +92,9 @@ static bool menu_display_check_compatibility(
return false;
}
static void menu_display_timedate(void *data)
void menu_display_timedate(menu_display_ctx_datetime_t *datetime)
{
time_t time_;
menu_display_ctx_datetime_t *datetime =
(menu_display_ctx_datetime_t *)data;
if (!datetime)
return;
@ -128,459 +126,419 @@ static void menu_display_timedate(void *data)
}
}
static gfx_coord_array_t menu_disp_ca;
static unsigned menu_display_framebuf_width = 0;
static unsigned menu_display_framebuf_height = 0;
static size_t menu_display_framebuf_pitch = 0;
static int menu_display_font_size = 0;
static unsigned menu_display_header_height = 0;
static bool menu_display_msg_force = false;
static bool menu_display_font_alloc_framebuf = false;
static bool menu_display_framebuf_dirty = false;
static const uint8_t *menu_display_font_framebuf = NULL;
static void *menu_display_font_buf = NULL;
static msg_queue_t *menu_display_msg_queue = NULL;
static menu_display_ctx_driver_t *menu_disp = NULL;
bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
void menu_display_blend_begin(void)
{
unsigned width, height;
static gfx_coord_array_t menu_disp_ca;
static unsigned menu_display_framebuf_width = 0;
static unsigned menu_display_framebuf_height = 0;
static size_t menu_display_framebuf_pitch = 0;
static int menu_display_font_size = 0;
static unsigned menu_display_header_height = 0;
static bool menu_display_msg_force = false;
static bool menu_display_font_alloc_framebuf = false;
static bool menu_display_framebuf_dirty = false;
static const uint8_t *menu_display_font_framebuf = NULL;
static void *menu_display_font_buf = NULL;
static msg_queue_t *menu_display_msg_queue = NULL;
static menu_display_ctx_driver_t *menu_disp = NULL;
settings_t *settings = config_get_ptr();
if (!menu_disp || !menu_disp->blend_begin)
return;
menu_disp->blend_begin();
}
switch (state)
void menu_display_blend_end(void)
{
if (!menu_disp || !menu_disp->blend_end)
return;
menu_disp->blend_end();
}
void menu_display_font_main_deinit(void)
{
if (menu_display_font_buf)
font_driver_free(menu_display_font_buf);
menu_display_font_buf = NULL;
menu_display_font_size = 0;
}
bool menu_display_font_main_init(menu_display_ctx_font_t *font)
{
menu_display_font_main_deinit();
if (!font || !menu_disp)
return false;
if (!menu_disp->font_init_first)
return false;
if (!menu_disp->font_init_first(&menu_display_font_buf,
video_driver_get_ptr(false),
font->path, font->size))
return false;
menu_display_font_size = font->size;
return true;
}
void menu_display_font_bind_block(void *block)
{
font_driver_bind_block(menu_display_font_buf, block);
}
bool menu_display_font_flush_block(void)
{
if (!menu_display_font_buf)
return false;
font_driver_flush(menu_display_font_buf);
font_driver_bind_block(menu_display_font_buf, NULL);
return true;
}
void menu_display_framebuffer_deinit(void)
{
menu_display_framebuf_width = 0;
menu_display_framebuf_height = 0;
menu_display_framebuf_pitch = 0;
}
void menu_display_deinit(void)
{
if (menu_display_msg_queue)
msg_queue_free(menu_display_msg_queue);
gfx_coord_array_free(&menu_disp_ca);
menu_display_msg_queue = NULL;
menu_display_msg_force = false;
menu_display_header_height = 0;
menu_disp = NULL;
menu_animation_ctl(MENU_ANIMATION_CTL_DEINIT, NULL);
menu_display_framebuffer_deinit();
}
bool menu_display_init(void)
{
retro_assert(menu_display_msg_queue = msg_queue_new(8));
menu_disp_ca.allocated = 0;
return true;
}
void menu_display_coords_array_reset(void)
{
menu_disp_ca.coords.vertices = 0;
}
gfx_coord_array_t *menu_display_get_coords_array(void)
{
return &menu_disp_ca;
}
void *menu_display_get_font_buffer(void)
{
return menu_display_font_buf;
}
void menu_display_set_font_buffer(void *buffer)
{
menu_display_font_buf = buffer;
}
const uint8_t *menu_display_get_font_framebuffer(void)
{
return menu_display_font_framebuf;
}
void menu_display_set_font_framebuffer(const uint8_t *buffer)
{
menu_display_font_framebuf = buffer;
}
bool menu_display_libretro_running(void)
{
settings_t *settings = config_get_ptr();
if (!settings->menu.pause_libretro)
{
case MENU_DISPLAY_CTL_BLEND_BEGIN:
if (!menu_disp || !menu_disp->blend_begin)
return false;
menu_disp->blend_begin();
break;
case MENU_DISPLAY_CTL_BLEND_END:
if (!menu_disp || !menu_disp->blend_end)
return false;
menu_disp->blend_end();
break;
case MENU_DISPLAY_CTL_FONT_MAIN_DEINIT:
if (menu_display_font_buf)
font_driver_free(menu_display_font_buf);
menu_display_font_buf = NULL;
menu_display_font_size = 0;
break;
case MENU_DISPLAY_CTL_FONT_MAIN_INIT:
{
menu_display_ctx_font_t *font = (menu_display_ctx_font_t*)data;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_MAIN_DEINIT, NULL);
if (!font || !menu_disp)
return false;
if (!menu_disp->font_init_first)
return false;
if (!menu_disp->font_init_first(&menu_display_font_buf,
video_driver_get_ptr(false),
font->path, font->size))
return false;
menu_display_font_size = font->size;
}
break;
case MENU_DISPLAY_CTL_FONT_BIND_BLOCK:
font_driver_bind_block(menu_display_font_buf, data);
break;
case MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK:
if (!menu_display_font_buf)
return false;
font_driver_flush(menu_display_font_buf);
font_driver_bind_block(menu_display_font_buf, NULL);
break;
case MENU_DISPLAY_CTL_FRAMEBUF_DEINIT:
menu_display_framebuf_width = 0;
menu_display_framebuf_height = 0;
menu_display_framebuf_pitch = 0;
break;
case MENU_DISPLAY_CTL_DEINIT:
if (menu_display_msg_queue)
msg_queue_free(menu_display_msg_queue);
gfx_coord_array_free(&menu_disp_ca);
menu_display_msg_queue = NULL;
menu_display_msg_force = false;
menu_display_header_height = 0;
menu_disp = NULL;
menu_animation_ctl(MENU_ANIMATION_CTL_DEINIT, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_FRAMEBUF_DEINIT, NULL);
break;
case MENU_DISPLAY_CTL_INIT:
retro_assert(menu_display_msg_queue = msg_queue_new(8));
menu_disp_ca.allocated = 0;
break;
case MENU_DISPLAY_CTL_COORDS_ARRAY_RESET:
menu_disp_ca.coords.vertices = 0;
break;
case MENU_DISPLAY_CTL_COORDS_ARRAY_GET:
{
void **ptr = (void**)data;
if (!ptr)
return false;
*ptr = &menu_disp_ca;
}
break;
case MENU_DISPLAY_CTL_SET_STUB_DRAW_FRAME:
break;
case MENU_DISPLAY_CTL_UNSET_STUB_DRAW_FRAME:
break;
case MENU_DISPLAY_CTL_FONT_BUF:
{
void **ptr = (void**)data;
if (!ptr)
return false;
*ptr = menu_display_font_buf;
}
break;
case MENU_DISPLAY_CTL_SET_FONT_BUF:
{
void **ptr = (void**)data;
if (!ptr)
return false;
menu_display_font_buf = *ptr;
}
break;
case MENU_DISPLAY_CTL_FONT_FB:
{
uint8_t **ptr = (uint8_t**)data;
if (!ptr)
return false;
*ptr = (uint8_t*)menu_display_font_framebuf;
}
break;
case MENU_DISPLAY_CTL_SET_FONT_FB:
{
uint8_t **ptr = (uint8_t**)data;
if (!ptr)
return false;
menu_display_font_framebuf = *ptr;
}
break;
case MENU_DISPLAY_CTL_LIBRETRO_RUNNING:
if (!settings->menu.pause_libretro)
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
return true;
return false;
case MENU_DISPLAY_CTL_LIBRETRO:
video_driver_set_texture_enable(true, false);
if (menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL))
{
bool libretro_input_is_blocked =
input_driver_ctl(
RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED, NULL);
if (!libretro_input_is_blocked)
input_driver_ctl(
RARCH_INPUT_CTL_SET_LIBRETRO_INPUT_BLOCKED, NULL);
core_run();
input_driver_ctl(
RARCH_INPUT_CTL_UNSET_LIBRETRO_INPUT_BLOCKED, NULL);
return true;
}
return video_driver_ctl(RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER, NULL);
case MENU_DISPLAY_CTL_SET_WIDTH:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
menu_display_framebuf_width = *ptr;
}
break;
case MENU_DISPLAY_CTL_WIDTH:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
*ptr = menu_display_framebuf_width;
}
break;
case MENU_DISPLAY_CTL_HEIGHT:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
*ptr = menu_display_framebuf_height;
}
break;
case MENU_DISPLAY_CTL_HEADER_HEIGHT:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
*ptr = menu_display_header_height;
}
break;
case MENU_DISPLAY_CTL_SET_HEADER_HEIGHT:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
menu_display_header_height = *ptr;
}
break;
case MENU_DISPLAY_CTL_FONT_SIZE:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
*ptr = menu_display_font_size;
}
break;
case MENU_DISPLAY_CTL_SET_FONT_SIZE:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
menu_display_font_size = *ptr;
}
break;
case MENU_DISPLAY_CTL_SET_HEIGHT:
{
unsigned *ptr = (unsigned*)data;
if (!ptr)
return false;
menu_display_framebuf_height = *ptr;
}
break;
case MENU_DISPLAY_CTL_FB_PITCH:
{
size_t *ptr = (size_t*)data;
if (!ptr)
return false;
*ptr = menu_display_framebuf_pitch;
}
break;
case MENU_DISPLAY_CTL_SET_FB_PITCH:
{
size_t *ptr = (size_t*)data;
if (!ptr)
return false;
menu_display_framebuf_pitch = *ptr;
}
break;
case MENU_DISPLAY_CTL_MSG_FORCE:
{
bool *ptr = (bool*)data;
if (!ptr)
return false;
*ptr = menu_display_msg_force;
}
break;
case MENU_DISPLAY_CTL_SET_MSG_FORCE:
{
bool *ptr = (bool*)data;
if (!ptr)
return false;
menu_display_msg_force = *ptr;
}
break;
case MENU_DISPLAY_CTL_FONT_DATA_INIT:
{
bool *ptr = (bool*)data;
if (!ptr)
return false;
*ptr = menu_display_font_alloc_framebuf;
}
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
return true;
case MENU_DISPLAY_CTL_SET_FONT_DATA_INIT:
{
bool *ptr = (bool*)data;
if (!ptr)
return false;
menu_display_font_alloc_framebuf = *ptr;
}
break;
case MENU_DISPLAY_CTL_UPDATE_PENDING:
{
if (menu_animation_ctl(MENU_ANIMATION_CTL_IS_ACTIVE, NULL))
return true;
if (menu_display_ctl(
MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG, NULL))
return true;
}
return false;
case MENU_DISPLAY_CTL_SET_VIEWPORT:
video_driver_get_size(&width, &height);
video_driver_set_viewport(width,
height, true, false);
break;
case MENU_DISPLAY_CTL_UNSET_VIEWPORT:
video_driver_get_size(&width, &height);
video_driver_set_viewport(width,
height, false, true);
break;
case MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG:
return menu_display_framebuf_dirty;
case MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG:
menu_display_framebuf_dirty = true;
break;
case MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG:
menu_display_framebuf_dirty = false;
break;
case MENU_DISPLAY_CTL_GET_DPI:
{
gfx_ctx_metrics_t metrics;
float *dpi = (float*)data;
*dpi = menu_dpi_override_value;
}
return false;
}
if (!settings)
return true;
bool menu_display_libretro(void)
{
video_driver_set_texture_enable(true, false);
metrics.type = DISPLAY_METRIC_DPI;
metrics.value = dpi;
if (menu_display_libretro_running())
{
bool libretro_input_is_blocked =
input_driver_ctl(
RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED, NULL);
if (settings->menu.dpi.override_enable)
*dpi = settings->menu.dpi.override_value;
else if (!gfx_ctx_ctl(GFX_CTL_GET_METRICS, &metrics) || !*dpi)
*dpi = menu_dpi_override_value;
}
break;
case MENU_DISPLAY_CTL_INIT_FIRST_DRIVER:
{
unsigned i;
if (!libretro_input_is_blocked)
input_driver_ctl(
RARCH_INPUT_CTL_SET_LIBRETRO_INPUT_BLOCKED, NULL);
for (i = 0; menu_display_ctx_drivers[i]; i++)
{
if (!menu_display_check_compatibility(
menu_display_ctx_drivers[i]->type))
continue;
core_run();
RARCH_LOG("Found menu display driver: \"%s\".\n",
menu_display_ctx_drivers[i]->ident);
menu_disp = menu_display_ctx_drivers[i];
return true;
}
}
return false;
case MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR:
if (!menu_disp || !menu_disp->restore_clear_color)
return false;
menu_disp->restore_clear_color();
break;
case MENU_DISPLAY_CTL_CLEAR_COLOR:
if (!menu_disp || !menu_disp->clear_color)
return false;
menu_disp->clear_color((menu_display_ctx_clearcolor_t*)data);
break;
case MENU_DISPLAY_CTL_DRAW:
{
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
if (!menu_disp || !draw || !menu_disp->draw)
return false;
/* TODO - edge case */
if (draw->height <= 0)
draw->height = 1;
menu_disp->draw(draw);
}
break;
case MENU_DISPLAY_CTL_DRAW_PIPELINE:
{
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
if (!menu_disp || !draw || !menu_disp->draw_pipeline)
return false;
menu_disp->draw_pipeline(draw);
}
break;
case MENU_DISPLAY_CTL_DRAW_BG:
{
struct gfx_coords coords;
const float *new_vertex = NULL;
const float *new_tex_coord = NULL;
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
if (!menu_disp || !draw)
return false;
new_vertex = draw->vertex;
new_tex_coord = draw->tex_coord;
if (!new_vertex)
new_vertex = menu_disp->get_default_vertices();
if (!new_tex_coord)
new_tex_coord = menu_disp->get_default_tex_coords();
coords.vertices = draw->vertex_count;
coords.vertex = new_vertex;
coords.tex_coord = new_tex_coord;
coords.lut_tex_coord = new_tex_coord;
coords.color = (const float*)draw->color;
draw->coords = &coords;
if (!draw->texture)
draw->texture = menu_display_white_texture;
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
}
break;
case MENU_DISPLAY_CTL_DRAW_GRADIENT:
{
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
draw->texture = 0;
draw->x = 0;
draw->y = 0;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, draw);
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, draw);
}
break;
case MENU_DISPLAY_CTL_ROTATE_Z:
{
math_matrix_4x4 matrix_rotated, matrix_scaled;
math_matrix_4x4 *b = NULL;
menu_display_ctx_rotate_draw_t *draw =
(menu_display_ctx_rotate_draw_t*)data;
if (!draw || !menu_disp || !menu_disp->get_default_mvp)
return false;
b = (math_matrix_4x4*)menu_disp->get_default_mvp();
matrix_4x4_rotate_z(&matrix_rotated, draw->rotation);
matrix_4x4_multiply(draw->matrix, &matrix_rotated, b);
if (!draw->scale_enable)
return false;
matrix_4x4_scale(&matrix_scaled,
draw->scale_x, draw->scale_y, draw->scale_z);
matrix_4x4_multiply(draw->matrix, &matrix_scaled, draw->matrix);
}
break;
case MENU_DISPLAY_CTL_TEX_COORDS_GET:
{
menu_display_ctx_coord_draw_t *draw =
(menu_display_ctx_coord_draw_t*)data;
if (!draw)
return false;
if (!menu_disp || !menu_disp->get_default_tex_coords)
return false;
draw->ptr = menu_disp->get_default_tex_coords();
}
break;
case MENU_DISPLAY_CTL_TIMEDATE:
menu_display_timedate(data);
break;
case MENU_DISPLAY_CTL_NONE:
default:
break;
input_driver_ctl(
RARCH_INPUT_CTL_UNSET_LIBRETRO_INPUT_BLOCKED, NULL);
return true;
}
return video_driver_ctl(RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER, NULL);
}
void menu_display_set_width(unsigned width)
{
menu_display_framebuf_width = width;
}
unsigned menu_display_get_width(void)
{
return menu_display_framebuf_width;
}
void menu_display_set_height(unsigned height)
{
menu_display_framebuf_height = height;
}
unsigned menu_display_get_height(void)
{
return menu_display_framebuf_height;
}
void menu_display_set_header_height(unsigned height)
{
menu_display_header_height = height;
}
unsigned menu_display_get_header_height(void)
{
return menu_display_header_height;
}
unsigned menu_display_get_font_size(void)
{
return menu_display_font_size;
}
void menu_display_set_font_size(unsigned size)
{
menu_display_font_size = size;
}
size_t menu_display_get_framebuffer_pitch(void)
{
return menu_display_framebuf_pitch;
}
void menu_display_set_framebuffer_pitch(size_t pitch)
{
menu_display_framebuf_pitch = pitch;
}
bool menu_display_get_msg_force(void)
{
return menu_display_msg_force;
}
void menu_display_set_msg_force(bool state)
{
menu_display_msg_force = state;
}
bool menu_display_get_font_data_init(void)
{
return menu_display_font_alloc_framebuf;
}
void menu_display_set_font_data_init(bool state)
{
menu_display_font_alloc_framebuf = state;
}
bool menu_display_get_update_pending(void)
{
if (menu_animation_ctl(MENU_ANIMATION_CTL_IS_ACTIVE, NULL))
return true;
if (menu_display_get_framebuffer_dirty_flag())
return true;
return false;
}
void menu_display_set_viewport(void)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, true, false);
}
void menu_display_unset_viewport(void)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, false, true);
}
bool menu_display_get_framebuffer_dirty_flag(void)
{
return menu_display_framebuf_dirty;
}
void menu_display_set_framebuffer_dirty_flag(void)
{
menu_display_framebuf_dirty = true;
}
void menu_display_unset_framebuffer_dirty_flag(void)
{
menu_display_framebuf_dirty = false;
}
float menu_display_get_dpi(void)
{
settings_t *settings = config_get_ptr();
gfx_ctx_metrics_t metrics;
float dpi = menu_dpi_override_value;
if (!settings)
return true;
metrics.type = DISPLAY_METRIC_DPI;
metrics.value = &dpi;
if (settings->menu.dpi.override_enable)
return settings->menu.dpi.override_value;
else if (!gfx_ctx_ctl(GFX_CTL_GET_METRICS, &metrics) || !dpi)
return menu_dpi_override_value;
return dpi;
}
bool menu_display_init_first_driver(void)
{
unsigned i;
for (i = 0; menu_display_ctx_drivers[i]; i++)
{
if (!menu_display_check_compatibility(
menu_display_ctx_drivers[i]->type))
continue;
RARCH_LOG("Found menu display driver: \"%s\".\n",
menu_display_ctx_drivers[i]->ident);
menu_disp = menu_display_ctx_drivers[i];
return true;
}
return false;
}
bool menu_display_restore_clear_color(void)
{
if (!menu_disp || !menu_disp->restore_clear_color)
return false;
menu_disp->restore_clear_color();
return true;
}
void menu_display_clear_color(menu_display_ctx_clearcolor_t *color)
{
if (!menu_disp || !menu_disp->clear_color)
return;
menu_disp->clear_color(color);
}
void menu_display_draw(menu_display_ctx_draw_t *draw)
{
if (!menu_disp || !draw || !menu_disp->draw)
return;
/* TODO - edge case */
if (draw->height <= 0)
draw->height = 1;
menu_disp->draw(draw);
}
void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw)
{
if (!menu_disp || !draw || !menu_disp->draw_pipeline)
return;
menu_disp->draw_pipeline(draw);
}
void menu_display_draw_bg(menu_display_ctx_draw_t *draw)
{
struct gfx_coords coords;
const float *new_vertex = NULL;
const float *new_tex_coord = NULL;
if (!menu_disp || !draw)
return;
new_vertex = draw->vertex;
new_tex_coord = draw->tex_coord;
if (!new_vertex)
new_vertex = menu_disp->get_default_vertices();
if (!new_tex_coord)
new_tex_coord = menu_disp->get_default_tex_coords();
coords.vertices = draw->vertex_count;
coords.vertex = new_vertex;
coords.tex_coord = new_tex_coord;
coords.lut_tex_coord = new_tex_coord;
coords.color = (const float*)draw->color;
draw->coords = &coords;
if (!draw->texture)
draw->texture = menu_display_white_texture;
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
}
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw)
{
draw->texture = 0;
draw->x = 0;
draw->y = 0;
menu_display_draw_bg(draw);
menu_display_draw(draw);
}
void menu_display_rotate_z(menu_display_ctx_rotate_draw_t *draw)
{
math_matrix_4x4 matrix_rotated, matrix_scaled;
math_matrix_4x4 *b = NULL;
if (!draw || !menu_disp || !menu_disp->get_default_mvp)
return;
b = (math_matrix_4x4*)menu_disp->get_default_mvp();
matrix_4x4_rotate_z(&matrix_rotated, draw->rotation);
matrix_4x4_multiply(draw->matrix, &matrix_rotated, b);
if (!draw->scale_enable)
return;
matrix_4x4_scale(&matrix_scaled,
draw->scale_x, draw->scale_y, draw->scale_z);
matrix_4x4_multiply(draw->matrix, &matrix_scaled, draw->matrix);
}
bool menu_display_get_tex_coords(menu_display_ctx_coord_draw_t *draw)
{
if (!draw)
return false;
if (!menu_disp || !menu_disp->get_default_tex_coords)
return false;
draw->ptr = menu_disp->get_default_tex_coords();
return true;
}
@ -621,7 +579,7 @@ void menu_display_draw_cursor(
bool cursor_visible = settings->video.fullscreen ||
!video_driver_ctl(RARCH_DISPLAY_CTL_HAS_WINDOWED, NULL);
if ( !settings->menu.mouse.enable)
if (!settings->menu.mouse.enable)
return;
if (!cursor_visible)
return;
@ -632,7 +590,7 @@ void menu_display_draw_cursor(
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_blend_begin();
draw.x = x - (cursor_size / 2);
draw.y = (int)height - y - (cursor_size / 2);
@ -643,8 +601,8 @@ void menu_display_draw_cursor(
draw.texture = texture;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw(&draw);
menu_display_blend_end();
}
static INLINE float menu_display_scalef(float val,
@ -668,7 +626,7 @@ void menu_display_push_quad(
float vertex[8];
gfx_coord_array_t *ca = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_COORDS_ARRAY_GET, &ca);
ca = menu_display_get_coords_array();
vertex[0] = x1 / (float)width;
vertex[1] = y1 / (float)height;
@ -681,7 +639,7 @@ void menu_display_push_quad(
coord_draw.ptr = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_TEX_COORDS_GET, &coord_draw);
menu_display_get_tex_coords(&coord_draw);
coords.color = colors;
coords.vertex = vertex;
@ -794,8 +752,7 @@ void menu_display_draw_text(const char *msg,
params->x = params->x;
params->y = params->y;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &fb_buf);
fb_buf = menu_display_get_font_buffer();
video_driver_set_osd_msg(msg, params, fb_buf);
}

View File

@ -29,61 +29,6 @@
extern "C" {
#endif
enum menu_display_ctl_state
{
MENU_DISPLAY_CTL_NONE = 0,
MENU_DISPLAY_CTL_SET_VIEWPORT,
MENU_DISPLAY_CTL_UNSET_VIEWPORT,
MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG,
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG,
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG,
MENU_DISPLAY_CTL_GET_DPI,
MENU_DISPLAY_CTL_UPDATE_PENDING,
MENU_DISPLAY_CTL_WIDTH,
MENU_DISPLAY_CTL_HEIGHT,
MENU_DISPLAY_CTL_HEADER_HEIGHT,
MENU_DISPLAY_CTL_SET_HEADER_HEIGHT,
MENU_DISPLAY_CTL_SET_WIDTH,
MENU_DISPLAY_CTL_SET_HEIGHT,
MENU_DISPLAY_CTL_FB_PITCH,
MENU_DISPLAY_CTL_SET_FB_PITCH,
MENU_DISPLAY_CTL_LIBRETRO,
MENU_DISPLAY_CTL_LIBRETRO_RUNNING,
MENU_DISPLAY_CTL_SET_STUB_DRAW_FRAME,
MENU_DISPLAY_CTL_UNSET_STUB_DRAW_FRAME,
MENU_DISPLAY_CTL_FRAMEBUF_DEINIT,
MENU_DISPLAY_CTL_DEINIT,
MENU_DISPLAY_CTL_INIT,
MENU_DISPLAY_CTL_INIT_FIRST_DRIVER,
MENU_DISPLAY_CTL_FONT_DATA_INIT,
MENU_DISPLAY_CTL_SET_FONT_DATA_INIT,
MENU_DISPLAY_CTL_FONT_SIZE,
MENU_DISPLAY_CTL_SET_FONT_SIZE,
MENU_DISPLAY_CTL_MSG_FORCE,
MENU_DISPLAY_CTL_SET_MSG_FORCE,
MENU_DISPLAY_CTL_FONT_BUF,
MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK,
MENU_DISPLAY_CTL_SET_FONT_BUF,
MENU_DISPLAY_CTL_FONT_FB,
MENU_DISPLAY_CTL_SET_FONT_FB,
MENU_DISPLAY_CTL_FONT_MAIN_DEINIT,
MENU_DISPLAY_CTL_FONT_MAIN_INIT,
MENU_DISPLAY_CTL_FONT_BIND_BLOCK,
MENU_DISPLAY_CTL_BLEND_BEGIN,
MENU_DISPLAY_CTL_BLEND_END,
MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR,
MENU_DISPLAY_CTL_CLEAR_COLOR,
MENU_DISPLAY_CTL_DRAW,
MENU_DISPLAY_CTL_DRAW_BG,
MENU_DISPLAY_CTL_DRAW_GRADIENT,
MENU_DISPLAY_CTL_DRAW_PIPELINE,
MENU_DISPLAY_CTL_ROTATE_Z,
MENU_DISPLAY_CTL_TEX_COORDS_GET,
MENU_DISPLAY_CTL_TIMEDATE,
MENU_DISPLAY_CTL_COORDS_ARRAY_RESET,
MENU_DISPLAY_CTL_COORDS_ARRAY_GET
};
enum menu_display_prim_type
{
MENU_DISPLAY_PRIM_NONE = 0,
@ -177,7 +122,62 @@ typedef struct menu_display_ctx_font
typedef uintptr_t menu_texture_item;
bool menu_display_ctl(enum menu_display_ctl_state state, void *data);
void menu_display_blend_begin(void);
void menu_display_blend_end(void);
void menu_display_font_main_deinit(void);
bool menu_display_font_main_init(menu_display_ctx_font_t *font);
void menu_display_font_bind_block(void *block);
bool menu_display_font_flush_block(void);
void menu_display_framebuffer_deinit(void);
void menu_display_deinit(void);
bool menu_display_init(void);
void menu_display_coords_array_reset(void);
gfx_coord_array_t *menu_display_get_coords_array(void);
void *menu_display_get_font_buffer(void);
void menu_display_set_font_buffer(void *buffer);
const uint8_t *menu_display_get_font_framebuffer(void);
void menu_display_set_font_framebuffer(const uint8_t *buffer);
bool menu_display_libretro_running(void);
bool menu_display_libretro(void);
void menu_display_set_width(unsigned width);
unsigned menu_display_get_width(void);
void menu_display_set_height(unsigned height);
unsigned menu_display_get_height(void);
void menu_display_set_header_height(unsigned height);
unsigned menu_display_get_header_height(void);
unsigned menu_display_get_font_size(void);
void menu_display_set_font_size(unsigned size);
size_t menu_display_get_framebuffer_pitch(void);
void menu_display_set_framebuffer_pitch(size_t pitch);
bool menu_display_get_msg_force(void);
void menu_display_set_msg_force(bool state);
bool menu_display_get_font_data_init(void);
void menu_display_set_font_data_init(bool state);
bool menu_display_get_update_pending(void);
void menu_display_set_viewport(void);
void menu_display_unset_viewport(void);
bool menu_display_get_framebuffer_dirty_flag(void);
void menu_display_set_framebuffer_dirty_flag(void);
void menu_display_unset_framebuffer_dirty_flag(void);
float menu_display_get_dpi(void);
bool menu_display_init_first_driver(void);
bool menu_display_restore_clear_color(void);
void menu_display_clear_color(menu_display_ctx_clearcolor_t *color);
void menu_display_draw(menu_display_ctx_draw_t *draw);
void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw);
void menu_display_draw_bg(menu_display_ctx_draw_t *draw);
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw);
void menu_display_rotate_z(menu_display_ctx_rotate_draw_t *draw);
bool menu_display_get_tex_coords(menu_display_ctx_coord_draw_t *draw);
void menu_display_timedate(menu_display_ctx_datetime_t *datetime);
void menu_display_handle_wallpaper_upload(void *task_data,
void *user_data, const char *err);

View File

@ -185,7 +185,7 @@ static bool menu_init(menu_handle_t *menu_data)
menu_driver_ctl(RARCH_MENU_CTL_SHADER_MANAGER_INIT, NULL);
if (!menu_display_ctl(MENU_DISPLAY_CTL_INIT, NULL))
if (!menu_display_init())
return false;
return true;
@ -445,7 +445,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
BIT64_SET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER);
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_FRAMEBUFFER))
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
menu_display_set_framebuffer_dirty_flag();
if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX)
&& !string_is_empty(menu_driver_data->menu_state.msg))
@ -468,7 +468,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)
&& !runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO, NULL);
menu_display_libretro();
menu_driver_ctl(RARCH_MENU_CTL_SET_TEXTURE, NULL);
@ -562,7 +562,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_userdata = NULL;
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_DEINIT, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_DEINIT, NULL);
menu_display_deinit();
menu_entries_ctl(MENU_ENTRIES_CTL_DEINIT, NULL);
event_cmd_ctl(EVENT_CMD_HISTORY_DEINIT, NULL);
@ -836,11 +836,9 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, NULL))
{
bool msg_force = true;
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU, NULL);
menu_entries_flush_stack(NULL, MENU_SETTINGS);
menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force);
menu_display_set_msg_force(true);
generic_action_ok_displaylist_push("",
"", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS);

View File

@ -825,8 +825,8 @@ static int menu_input_pointer(unsigned *action)
const struct retro_keybind *binds[MAX_USERS] = {NULL};
menu_input_t *menu_input = menu_input_get_ptr();
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
menu_display_ctl(MENU_DISPLAY_CTL_HEIGHT, &fb_height);
fb_width = menu_display_get_width();
fb_height = menu_display_get_height();
pointer_device = menu_driver_ctl(RARCH_MENU_CTL_IS_SET_TEXTURE, NULL) ?
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
@ -940,7 +940,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse,
menu_input_t *menu_input = menu_input_get_ptr();
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
header_height = menu_display_get_header_height();
BIT64_SET(*input_mouse, MENU_MOUSE_ACTION_BUTTON_L);
@ -1068,7 +1068,6 @@ static int menu_input_pointer_post_iterate(
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
{
unsigned header_height;
size_t selection;
static bool pointer_oldpressed[2];
static bool pointer_oldback = false;
@ -1088,7 +1087,6 @@ static int menu_input_pointer_post_iterate(
return -1;
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
return -1;
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
#ifdef HAVE_OVERLAY
check_overlay = check_overlay ||