Merge pull request #7007 from libretro/stripes

[WIP] Stripes menu
This commit is contained in:
Twinaphex 2018-07-22 20:14:50 +02:00 committed by GitHub
commit c2d3727c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 4559 additions and 40 deletions

View File

@ -741,11 +741,16 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
ifeq ($(HAVE_XMB),)
HAVE_XMB = 1
endif
ifeq ($(HAVE_STRIPES),)
HAVE_STRIPES = 1
endif
else
HAVE_ZARCH ?= 0
HAVE_MATERIALUI ?= 0
#HAVE_NUKLEAR ?= 0
HAVE_XMB ?= 0
HAVE_STRIPES ?= 0
endif
ifeq ($(HAVE_RGUI), 1)
@ -777,6 +782,12 @@ ifeq ($(HAVE_XMB), 1)
HAVE_MENU_COMMON = 1
endif
ifeq ($(HAVE_STRIPES), 1)
OBJ += menu/drivers/stripes.o
DEFINES += -DHAVE_STRIPES
HAVE_MENU_COMMON = 1
endif
ifeq ($(HAVE_LAKKA), 1)
DEFINES += -DHAVE_LAKKA
endif

View File

@ -284,6 +284,7 @@ enum menu_driver_enum
MENU_XUI,
MENU_MATERIALUI,
MENU_XMB,
MENU_STRIPES,
MENU_NUKLEAR,
MENU_NULL
};
@ -528,6 +529,8 @@ static enum location_driver_enum LOCATION_DEFAULT_DRIVER = LOCATION_NULL;
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XUI;
#elif defined(HAVE_MATERIALUI) && defined(RARCH_MOBILE)
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_MATERIALUI;
#elif defined(HAVE_STRIPES) && !defined(_XBOX)
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XMB;
#elif defined(HAVE_XMB) && !defined(_XBOX)
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XMB;
#elif defined(HAVE_RGUI)
@ -1026,6 +1029,8 @@ const char *config_get_default_menu(void)
return "glui";
case MENU_XMB:
return "xmb";
case MENU_STRIPES:
return "stripes";
case MENU_NUKLEAR:
return "nuklear";
case MENU_NULL:

View File

@ -130,6 +130,10 @@ bool fill_pathname_application_data(char *s, size_t len)
const char* xmb_theme_ident(void);
#endif
#ifdef HAVE_STRIPES
const char* stripes_theme_ident(void);
#endif
void fill_pathname_application_special(char *s,
size_t len, enum application_special_type type)
{

View File

@ -1240,6 +1240,10 @@ MENU
#include "../menu/drivers/xmb.c"
#endif
#ifdef HAVE_STRIPES
#include "../menu/drivers/stripes.c"
#endif
#ifdef HAVE_MATERIALUI
#include "../menu/drivers/materialui.c"
#endif

4468
menu/drivers/stripes.c Executable file

File diff suppressed because it is too large Load Diff

View File

@ -3968,42 +3968,6 @@ static void xmb_ribbon_set_vertex(float *ribbon_verts,
ribbon_verts[idx++] = ((float)row) / (XMB_RIBBON_ROWS-1) * 2.0f - 1.0f;
}
static void xmb_init_ribbon(xmb_handle_t * xmb)
{
video_coords_t coords;
unsigned r, c, col;
unsigned i = 0;
video_coord_array_t *ca = menu_display_get_coords_array();
unsigned vertices_total = XMB_RIBBON_VERTICES;
float *dummy = (float*)calloc(4 * vertices_total, sizeof(float));
float *ribbon_verts = (float*)calloc(2 * vertices_total, sizeof(float));
/* Set up vertices */
for (r = 0; r < XMB_RIBBON_ROWS - 1; r++)
{
for (c = 0; c < XMB_RIBBON_COLS; c++)
{
col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c;
xmb_ribbon_set_vertex(ribbon_verts, i, r, col);
xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col);
i += 4;
}
}
coords.color = dummy;
coords.vertex = ribbon_verts;
coords.tex_coord = dummy;
coords.lut_tex_coord = dummy;
coords.vertices = vertices_total;
video_coord_array_append(ca, &coords, coords.vertices);
free(dummy);
free(ribbon_verts);
}
static void *xmb_init(void **userdata, bool video_is_threaded)
{
unsigned width, height;
@ -4113,8 +4077,6 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
if (xmb->horizontal_list)
xmb_init_horizontal_list(xmb);
xmb_init_ribbon(xmb);
return menu;
error:

View File

@ -85,6 +85,9 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
#if defined(HAVE_XMB)
&menu_ctx_xmb,
#endif
#if defined(HAVE_STRIPES)
&menu_ctx_stripes,
#endif
#if defined(HAVE_RGUI)
&menu_ctx_rgui,
#endif
@ -743,6 +746,56 @@ void menu_display_draw_quad(
menu_disp->blend_end(video_info);
}
void menu_display_draw_polygon(
video_frame_info_t *video_info,
int x1, int y1,
int x2, int y2,
int x3, int y3,
int x4, int y4,
unsigned width, unsigned height,
float *color)
{
menu_display_ctx_draw_t draw;
struct video_coords coords;
float vertex[8];
vertex[0] = x1 / (float)width;
vertex[1] = y1 / (float)height;
vertex[2] = x2 / (float)width;
vertex[3] = y2 / (float)height;
vertex[4] = x3 / (float)width;
vertex[5] = y3 / (float)height;
vertex[6] = x4 / (float)width;
vertex[7] = y4 / (float)height;
coords.vertices = 4;
coords.vertex = &vertex[0];
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = color;
if (menu_disp && menu_disp->blend_begin)
menu_disp->blend_begin(video_info);
draw.x = 0;
draw.y = 0;
draw.width = width;
draw.height = height;
draw.coords = &coords;
draw.matrix_data = NULL;
draw.texture = menu_display_white_texture;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
draw.scale_factor = 1.0f;
draw.rotation = 0.0f;
menu_display_draw(&draw, video_info);
if (menu_disp && menu_disp->blend_end)
menu_disp->blend_end(video_info);
}
void menu_display_draw_texture(
video_frame_info_t *video_info,
int x, int y, unsigned w, unsigned h,

View File

@ -726,6 +726,14 @@ void menu_display_draw_quad(
int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height,
float *color);
void menu_display_draw_polygon(
video_frame_info_t *video_info,
int x1, int y1,
int x2, int y2,
int x3, int y3,
int x4, int y4,
unsigned width, unsigned height,
float *color);
void menu_display_draw_texture(
video_frame_info_t *video_info,
int x, int y, unsigned w, unsigned h,
@ -817,6 +825,7 @@ extern menu_ctx_driver_t menu_ctx_rgui;
extern menu_ctx_driver_t menu_ctx_mui;
extern menu_ctx_driver_t menu_ctx_nuklear;
extern menu_ctx_driver_t menu_ctx_xmb;
extern menu_ctx_driver_t menu_ctx_stripes;
extern menu_ctx_driver_t menu_ctx_zarch;
extern menu_ctx_driver_t menu_ctx_null;

View File

@ -541,7 +541,7 @@
"-DHAVE_MATERIALUI",
"-DHAVE_HID",
"-DHAVE_XMB",
"-DHAVE_SEGA",
"-DHAVE_STRIPES",
"-DHAVE_SHADERPIPELINE",
"-DHAVE_MMAP",
"-DHAVE_LIBRETRODB",
@ -604,7 +604,7 @@
"-DHAVE_MATERIALUI",
"-DHAVE_HID",
"-DHAVE_XMB",
"-DHAVE_SEGA",
"-DHAVE_STRIPES",
"-DHAVE_SHADERPIPELINE",
"-DHAVE_MMAP",
"-DHAVE_LIBRETRODB",

View File

@ -510,6 +510,7 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH"
if [ "$HAVE_RGUI" = 'no' ]; then
HAVE_MATERIALUI=no
HAVE_XMB=no
HAVE_STRIPES=no
HAVE_ZARCH=no
die : 'Notice: RGUI not available, MaterialUI, XMB and ZARCH will also be disabled.'
elif [ "$HAVE_OPENGL" = 'no' ] && [ "$HAVE_OPENGLES" = 'no' ] && [ "$HAVE_VULKAN" = 'no' ]; then
@ -522,6 +523,7 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH"
else
HAVE_MATERIALUI=no
HAVE_XMB=no
HAVE_STRIPES=no
HAVE_ZARCH=no
die : 'Notice: Hardware rendering context not available, XMB, MaterialUI and ZARCH will also be disabled.'
fi

View File

@ -10,6 +10,7 @@ HAVE_LIBRETRODB=yes # Libretrodb support
HAVE_RGUI=yes # RGUI menu
HAVE_MATERIALUI=auto # MaterialUI menu
HAVE_XMB=auto # XMB menu
HAVE_STRIPES=auto # Stripes menu
HAVE_ZARCH=no # Zarch menu
HAVE_NUKLEAR=no # Nuklear menu
HAVE_RUNAHEAD=yes # Runahead support