mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
commit
7ee79593a4
@ -26,6 +26,7 @@
|
|||||||
#include "../../../general.h"
|
#include "../../../general.h"
|
||||||
#include "../../../gfx/gfx_common.h"
|
#include "../../../gfx/gfx_common.h"
|
||||||
#include "../../../gfx/gl_common.h"
|
#include "../../../gfx/gl_common.h"
|
||||||
|
#include "../../../gfx/video_thread_wrapper.h"
|
||||||
#include "../../../config.def.h"
|
#include "../../../config.def.h"
|
||||||
#include "../../../file.h"
|
#include "../../../file.h"
|
||||||
#include "../../../dynamic.h"
|
#include "../../../dynamic.h"
|
||||||
@ -76,16 +77,39 @@ static void glui_blit_line(float x, float y, const char *message, bool green)
|
|||||||
|
|
||||||
static void glui_render_background(void)
|
static void glui_render_background(void)
|
||||||
{
|
{
|
||||||
|
float alpha = 0.9f;
|
||||||
gl_t *gl = NULL;
|
gl_t *gl = NULL;
|
||||||
glui_handle_t *glui = NULL;
|
glui_handle_t *glui = NULL;
|
||||||
|
|
||||||
GLfloat black_color[] = {
|
if (!driver.menu)
|
||||||
0.0f, 0.0f, 0.0f, 0.8f,
|
return;
|
||||||
0.0f, 0.0f, 0.0f, 0.8f,
|
|
||||||
0.0f, 0.0f, 0.0f, 0.8f,
|
glui = (glui_handle_t*)driver.menu->userdata;
|
||||||
0.0f, 0.0f, 0.0f, 0.8f,
|
|
||||||
|
if (!glui)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GLfloat color[] = {
|
||||||
|
1.0f, 1.0f, 1.0f, alpha,
|
||||||
|
1.0f, 1.0f, 1.0f, alpha,
|
||||||
|
1.0f, 1.0f, 1.0f, alpha,
|
||||||
|
1.0f, 1.0f, 1.0f, alpha,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GLfloat black_color[] = {
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
};
|
||||||
|
|
||||||
|
gl = (gl_t*)driver_video_resolve(NULL);
|
||||||
|
|
||||||
|
if (!gl)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glViewport(0, 0, gl->win_width, gl->win_height);
|
||||||
|
|
||||||
static const GLfloat vertex[] = {
|
static const GLfloat vertex[] = {
|
||||||
0, 0,
|
0, 0,
|
||||||
1, 0,
|
1, 0,
|
||||||
@ -100,36 +124,31 @@ static void glui_render_background(void)
|
|||||||
1, 0,
|
1, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
gl = (gl_t*)driver_video_resolve(NULL);
|
struct gl_coords coords;
|
||||||
|
coords.vertices = 4;
|
||||||
|
coords.vertex = vertex;
|
||||||
|
coords.tex_coord = tex_coord;
|
||||||
|
coords.lut_tex_coord = tex_coord;
|
||||||
|
|
||||||
if (!gl)
|
if ((g_settings.menu.pause_libretro
|
||||||
return;
|
|| !g_extern.main_is_init || g_extern.libretro_dummy)
|
||||||
|
&& glui->bg)
|
||||||
glui = (glui_handle_t*)driver.menu->userdata;
|
{
|
||||||
|
coords.color = color;
|
||||||
if (!glui)
|
|
||||||
return;
|
|
||||||
|
|
||||||
glViewport(0, 0, gl->win_width, gl->win_height);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
gl->coords.vertex = vertex;
|
|
||||||
gl->coords.tex_coord = tex_coord;
|
|
||||||
gl->coords.color = glui->bg
|
|
||||||
? gl->white_color_ptr : black_color;
|
|
||||||
glBindTexture(GL_TEXTURE_2D, glui->bg);
|
glBindTexture(GL_TEXTURE_2D, glui->bg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coords.color = black_color;
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (gl->shader && gl->shader->use)
|
gl->shader->set_coords(&coords);
|
||||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
|
||||||
|
|
||||||
gl->coords.vertices = 4;
|
|
||||||
gl->shader->set_coords(&gl->coords);
|
|
||||||
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
|
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
gl->coords.color = gl->white_color_ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void glui_get_message(const char *message)
|
static void glui_get_message(const char *message)
|
||||||
@ -403,8 +422,11 @@ static void glui_free(void *data)
|
|||||||
g_extern.core_info = NULL;
|
g_extern.core_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint glui_png_texture_load(const char * file_name)
|
static GLuint glui_png_texture_load_(const char * file_name)
|
||||||
{
|
{
|
||||||
|
if (! path_file_exists(file_name))
|
||||||
|
return 0;
|
||||||
|
|
||||||
struct texture_image ti = {0};
|
struct texture_image ti = {0};
|
||||||
texture_image_load(&ti, file_name);
|
texture_image_load(&ti, file_name);
|
||||||
|
|
||||||
@ -421,6 +443,30 @@ static GLuint glui_png_texture_load(const char * file_name)
|
|||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
static int glui_png_texture_load_wrap(void * file_name)
|
||||||
|
{
|
||||||
|
return glui_png_texture_load_(file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static GLuint glui_png_texture_load(const char* file_name)
|
||||||
|
{
|
||||||
|
if (g_settings.video.threaded
|
||||||
|
&& !g_extern.system.hw_render_callback.context_type)
|
||||||
|
{
|
||||||
|
thread_video_t *thr = (thread_video_t*)driver.video_data;
|
||||||
|
thr->cmd_data.custom_command.method = glui_png_texture_load_wrap;
|
||||||
|
thr->cmd_data.custom_command.data = (void*)file_name;
|
||||||
|
thr->send_cmd_func(thr, CMD_CUSTOM_COMMAND);
|
||||||
|
thr->wait_reply_func(thr, CMD_CUSTOM_COMMAND);
|
||||||
|
|
||||||
|
return thr->cmd_data.custom_command.return_value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return glui_png_texture_load_(file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void glui_context_reset(void *data)
|
static void glui_context_reset(void *data)
|
||||||
{
|
{
|
||||||
@ -448,6 +494,8 @@ static void glui_context_reset(void *data)
|
|||||||
|
|
||||||
if (path_file_exists(bgpath))
|
if (path_file_exists(bgpath))
|
||||||
glui->bg = glui_png_texture_load(bgpath);
|
glui->bg = glui_png_texture_load(bgpath);
|
||||||
|
|
||||||
|
printf("%d\n", glui->bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_ctx_driver_t menu_ctx_glui = {
|
menu_ctx_driver_t menu_ctx_glui = {
|
||||||
|
@ -178,8 +178,19 @@ void lakka_draw_background(void)
|
|||||||
coords.vertex = lakka_vertex;
|
coords.vertex = lakka_vertex;
|
||||||
coords.tex_coord = lakka_tex_coord;
|
coords.tex_coord = lakka_tex_coord;
|
||||||
coords.lut_tex_coord = lakka_tex_coord;
|
coords.lut_tex_coord = lakka_tex_coord;
|
||||||
coords.color = lakka->textures[TEXTURE_BG].id ? color : black_color;
|
|
||||||
|
if ((g_settings.menu.pause_libretro
|
||||||
|
|| !g_extern.main_is_init || g_extern.libretro_dummy)
|
||||||
|
&& lakka->textures[TEXTURE_BG].id)
|
||||||
|
{
|
||||||
|
coords.color = color;
|
||||||
glBindTexture(GL_TEXTURE_2D, lakka->textures[TEXTURE_BG].id);
|
glBindTexture(GL_TEXTURE_2D, lakka->textures[TEXTURE_BG].id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coords.color = black_color;
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
gl->shader->set_coords(&coords);
|
gl->shader->set_coords(&coords);
|
||||||
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
|
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
|
||||||
@ -603,7 +614,6 @@ static int lakka_png_texture_load_wrap(void * file_name)
|
|||||||
return lakka_png_texture_load_(file_name);
|
return lakka_png_texture_load_(file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GLuint lakka_png_texture_load(const char* file_name)
|
static GLuint lakka_png_texture_load(const char* file_name)
|
||||||
{
|
{
|
||||||
if (g_settings.video.threaded
|
if (g_settings.video.threaded
|
||||||
|
@ -75,7 +75,6 @@ typedef struct xmb_handle
|
|||||||
{
|
{
|
||||||
int depth;
|
int depth;
|
||||||
int old_depth;
|
int old_depth;
|
||||||
GLuint bg;
|
|
||||||
char icon_dir[4];
|
char icon_dir[4];
|
||||||
char box_message[PATH_MAX];
|
char box_message[PATH_MAX];
|
||||||
char title[PATH_MAX];
|
char title[PATH_MAX];
|
||||||
@ -96,6 +95,15 @@ typedef struct xmb_handle
|
|||||||
float above_item_offset;
|
float above_item_offset;
|
||||||
float active_item_factor;
|
float active_item_factor;
|
||||||
float under_item_offset;
|
float under_item_offset;
|
||||||
|
float above_subitem_offset;
|
||||||
|
float c_active_zoom;
|
||||||
|
float c_active_alpha;
|
||||||
|
float i_active_zoom;
|
||||||
|
float i_active_alpha;
|
||||||
|
float c_passive_zoom;
|
||||||
|
float c_passive_alpha;
|
||||||
|
float i_passive_zoom;
|
||||||
|
float i_passive_alpha;
|
||||||
} xmb_handle_t;
|
} xmb_handle_t;
|
||||||
|
|
||||||
static const GLfloat rmb_vertex[] = {
|
static const GLfloat rmb_vertex[] = {
|
||||||
@ -271,8 +279,19 @@ static void xmb_render_background(void)
|
|||||||
coords.vertex = vertex;
|
coords.vertex = vertex;
|
||||||
coords.tex_coord = tex_coord;
|
coords.tex_coord = tex_coord;
|
||||||
coords.lut_tex_coord = tex_coord;
|
coords.lut_tex_coord = tex_coord;
|
||||||
coords.color = xmb->textures[XMB_TEXTURE_BG].id ? color : black_color;
|
|
||||||
|
if ((g_settings.menu.pause_libretro
|
||||||
|
|| !g_extern.main_is_init || g_extern.libretro_dummy)
|
||||||
|
&& xmb->textures[XMB_TEXTURE_BG].id)
|
||||||
|
{
|
||||||
|
coords.color = color;
|
||||||
glBindTexture(GL_TEXTURE_2D, xmb->textures[XMB_TEXTURE_BG].id);
|
glBindTexture(GL_TEXTURE_2D, xmb->textures[XMB_TEXTURE_BG].id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coords.color = black_color;
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
gl->shader->set_coords(&coords);
|
gl->shader->set_coords(&coords);
|
||||||
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
|
gl->shader->set_mvp(gl, &gl->mvp_no_rot);
|
||||||
@ -340,8 +359,8 @@ static void xmb_selection_pointer_changed(void)
|
|||||||
for (i = 0; i < end; i++)
|
for (i = 0; i < end; i++)
|
||||||
{
|
{
|
||||||
float iy;
|
float iy;
|
||||||
float ia = 0.5;
|
float ia = xmb->i_passive_alpha;
|
||||||
float iz = 0.5;
|
float iz = xmb->i_passive_zoom;
|
||||||
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(
|
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(
|
||||||
driver.menu->selection_buf, i);
|
driver.menu->selection_buf, i);
|
||||||
|
|
||||||
@ -354,8 +373,8 @@ static void xmb_selection_pointer_changed(void)
|
|||||||
|
|
||||||
if (i == current)
|
if (i == current)
|
||||||
{
|
{
|
||||||
ia = 1.0;
|
ia = xmb->i_active_alpha;
|
||||||
iz = 1.0;
|
iz = xmb->i_active_zoom;
|
||||||
iy = xmb->vspacing * xmb->active_item_factor;
|
iy = xmb->vspacing * xmb->active_item_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +431,8 @@ static void xmb_frame(void)
|
|||||||
|
|
||||||
get_title(label, dir, menu_type, xmb->title, sizeof(xmb->title));
|
get_title(label, dir, menu_type, xmb->title, sizeof(xmb->title));
|
||||||
|
|
||||||
xmb_draw_text(xmb->title, 30, 40, 1, 1);
|
xmb_draw_text(
|
||||||
|
xmb->title, xmb->title_margin_left, xmb->title_margin_top, 1, 1);
|
||||||
|
|
||||||
const char *core_name = g_extern.menu.info.library_name;
|
const char *core_name = g_extern.menu.info.library_name;
|
||||||
if (!core_name)
|
if (!core_name)
|
||||||
@ -428,7 +448,8 @@ static void xmb_frame(void)
|
|||||||
|
|
||||||
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
||||||
core_name, core_version);
|
core_name, core_version);
|
||||||
xmb_draw_text(title_msg, 30, gl->win_height - 30, 1, 1);
|
xmb_draw_text(title_msg, xmb->title_margin_left,
|
||||||
|
gl->win_height - xmb->title_margin_top, 1, 1);
|
||||||
|
|
||||||
end = file_list_get_size(driver.menu->selection_buf);
|
end = file_list_get_size(driver.menu->selection_buf);
|
||||||
|
|
||||||
@ -552,6 +573,84 @@ static void *xmb_init(void)
|
|||||||
if (!xmb)
|
if (!xmb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
xmb->x = 0;
|
||||||
|
xmb->alpha = 1.0f;
|
||||||
|
xmb->depth = 1;
|
||||||
|
xmb->old_depth = 1;
|
||||||
|
|
||||||
|
xmb->c_active_zoom = 1.0;
|
||||||
|
xmb->c_passive_zoom = 0.5;
|
||||||
|
xmb->i_active_zoom = 1.0;
|
||||||
|
xmb->i_passive_zoom = 0.5;
|
||||||
|
|
||||||
|
xmb->c_active_alpha = 1.0;
|
||||||
|
xmb->c_passive_alpha = 0.5;
|
||||||
|
xmb->i_active_alpha = 1.0;
|
||||||
|
xmb->i_passive_alpha = 0.5;
|
||||||
|
|
||||||
|
xmb->above_subitem_offset = 1.5;
|
||||||
|
xmb->above_item_offset = -1.0;
|
||||||
|
xmb->active_item_factor = 2.75;
|
||||||
|
xmb->under_item_offset = 4.0;
|
||||||
|
|
||||||
|
if (gl->win_width >= 3840)
|
||||||
|
{
|
||||||
|
xmb->icon_size = 256;
|
||||||
|
xmb->hspacing = 400;
|
||||||
|
xmb->vspacing = 128;
|
||||||
|
xmb->margin_left = 672.0;
|
||||||
|
xmb->margin_top = 512;
|
||||||
|
xmb->title_margin_left = 20.0;
|
||||||
|
xmb->title_margin_top = 50.0;
|
||||||
|
xmb->label_margin_left = 192;
|
||||||
|
xmb->label_margin_top = 15;
|
||||||
|
xmb->setting_margin_left = 1200;
|
||||||
|
strcpy(xmb->icon_dir, "256");
|
||||||
|
}
|
||||||
|
else if (gl->win_width >= 2560)
|
||||||
|
{
|
||||||
|
xmb->icon_size = 192;
|
||||||
|
xmb->hspacing = 300;
|
||||||
|
xmb->vspacing = 96;
|
||||||
|
xmb->margin_left = 448.0;
|
||||||
|
xmb->margin_top = 384;
|
||||||
|
xmb->title_margin_left = 15.0;
|
||||||
|
xmb->title_margin_top = 40.0;
|
||||||
|
xmb->label_margin_left = 144;
|
||||||
|
xmb->label_margin_top = 11.0;
|
||||||
|
xmb->setting_margin_left = 800;
|
||||||
|
strcpy(xmb->icon_dir, "192");
|
||||||
|
}
|
||||||
|
else if (gl->win_width >= 1920)
|
||||||
|
{
|
||||||
|
xmb->icon_size = 128;
|
||||||
|
xmb->hspacing = 200.0;
|
||||||
|
xmb->vspacing = 64.0;
|
||||||
|
xmb->margin_left = 336.0;
|
||||||
|
xmb->margin_top = 256;
|
||||||
|
xmb->title_margin_left = 15.0;
|
||||||
|
xmb->title_margin_top = 35.0;
|
||||||
|
xmb->label_margin_left = 85;
|
||||||
|
xmb->label_margin_top = 8.0;
|
||||||
|
xmb->setting_margin_left = 600;
|
||||||
|
strcpy(xmb->icon_dir, "128");
|
||||||
|
}
|
||||||
|
else if (gl->win_width <= 640)
|
||||||
|
{
|
||||||
|
xmb->icon_size = 64;
|
||||||
|
xmb->hspacing = 100.0;
|
||||||
|
xmb->vspacing = 32.0;
|
||||||
|
xmb->margin_left = 60.0;
|
||||||
|
xmb->margin_top = 128.0;
|
||||||
|
xmb->title_margin_left = 10.0;
|
||||||
|
xmb->title_margin_top = 24.0;
|
||||||
|
xmb->label_margin_left = 48;
|
||||||
|
xmb->label_margin_top = 6.0;
|
||||||
|
xmb->setting_margin_left = 250;
|
||||||
|
strcpy(xmb->icon_dir, "64");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
xmb->icon_size = 96;
|
xmb->icon_size = 96;
|
||||||
xmb->hspacing = 150.0;
|
xmb->hspacing = 150.0;
|
||||||
xmb->vspacing = 48.0;
|
xmb->vspacing = 48.0;
|
||||||
@ -562,20 +661,11 @@ static void *xmb_init(void)
|
|||||||
xmb->label_margin_left = 64;
|
xmb->label_margin_left = 64;
|
||||||
xmb->label_margin_top = 6.0;
|
xmb->label_margin_top = 6.0;
|
||||||
xmb->setting_margin_left = 400;
|
xmb->setting_margin_left = 400;
|
||||||
xmb->above_item_offset = -1.0;
|
strcpy(xmb->icon_dir, "96");
|
||||||
xmb->active_item_factor = 2.75;
|
}
|
||||||
xmb->under_item_offset = 4.0;
|
|
||||||
xmb->x = 0;
|
|
||||||
xmb->alpha = 1.0f;
|
|
||||||
xmb->depth = 1;
|
|
||||||
xmb->old_depth = 1;
|
|
||||||
xmb->bg = 0;
|
|
||||||
|
|
||||||
strlcpy(xmb->icon_dir, "96", sizeof(xmb->icon_dir));
|
|
||||||
|
|
||||||
xmb_init_core_info(menu);
|
xmb_init_core_info(menu);
|
||||||
|
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,9 +761,6 @@ static void xmb_context_reset(void *data)
|
|||||||
|
|
||||||
fill_pathname_join(bgpath, bgpath, "bg.png", sizeof(bgpath));
|
fill_pathname_join(bgpath, bgpath, "bg.png", sizeof(bgpath));
|
||||||
|
|
||||||
if (path_file_exists(bgpath))
|
|
||||||
xmb->bg = xmb_png_texture_load(bgpath);
|
|
||||||
|
|
||||||
fill_pathname_join(mediapath, g_settings.assets_directory,
|
fill_pathname_join(mediapath, g_settings.assets_directory,
|
||||||
"lakka", sizeof(mediapath));
|
"lakka", sizeof(mediapath));
|
||||||
fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
|
fill_pathname_join(themepath, mediapath, XMB_THEME, sizeof(themepath));
|
||||||
@ -791,8 +878,8 @@ static void xmb_list_insert(void *data,
|
|||||||
iy = xmb->vspacing * xmb->active_item_factor;
|
iy = xmb->vspacing * xmb->active_item_factor;
|
||||||
|
|
||||||
|
|
||||||
node->alpha = (i == driver.menu->selection_ptr) ? 1.0 : 0.5;
|
node->alpha = (i == current) ? xmb->i_active_alpha : xmb->i_passive_alpha;
|
||||||
node->zoom = (i == driver.menu->selection_ptr) ? 1.0 : 0.5;
|
node->zoom = (i == current) ? xmb->i_active_zoom : xmb->i_passive_zoom;
|
||||||
node->y = iy;
|
node->y = iy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user