Merge pull request #7491 from natinusala/ozone

[WIP] Ozone menu driver
This commit is contained in:
Twinaphex 2018-10-27 01:10:22 +02:00 committed by GitHub
commit eb734e4f37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 3118 additions and 24 deletions

View File

@ -30,7 +30,8 @@
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceFolder}/libretro-common/include"
"${workspaceFolder}/libretro-common/include",
"${workspaceRoot}/libretro-common/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
@ -51,7 +52,8 @@
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
"${workspaceRoot}"
"${workspaceRoot}",
"${workspaceFolder}/libretro-common/include"
],
"defines": [
"_DEBUG",

View File

@ -22,7 +22,11 @@
"ios": "c",
"list": "c",
"input_driver.h": "c",
"video_driver.h": "c"
"video_driver.h": "c",
"menu_driver.h": "c",
"file_path.h": "c",
"unordered_map": "c",
"unordered_set": "c"
},
"C_Cpp.dimInactiveRegions": false,
}

View File

@ -677,12 +677,17 @@ ifeq ($(HW_CONTEXT_MENU_DRIVERS), 1)
ifeq ($(HAVE_STRIPES),)
HAVE_STRIPES = 1
endif
ifeq ($(HAVE_OZONE),)
HAVE_OZONE = 1
endif
else
HAVE_ZARCH ?= 0
HAVE_MATERIALUI ?= 0
#HAVE_NUKLEAR ?= 0
HAVE_XMB ?= 0
HAVE_STRIPES ?= 0
HAVE_OZONE ?= 0
endif
ifeq ($(HAVE_RGUI), 1)
@ -714,6 +719,12 @@ ifeq ($(HAVE_XMB), 1)
HAVE_MENU_COMMON = 1
endif
ifeq ($(HAVE_OZONE), 1)
OBJ += menu/drivers/ozone.o
DEFINES += -DHAVE_OZONE
HAVE_MENU_COMMON = 1
endif
ifeq ($(HAVE_STRIPES), 1)
OBJ += menu/drivers/stripes.o
DEFINES += -DHAVE_STRIPES

View File

@ -58,6 +58,7 @@ ifeq ($(HAVE_OPENGL), 1)
HAVE_ZARCH = 0
HAVE_XMB = 1
HAVE_OZONE = 0
HAVE_STRIPES = 0
HAVE_OVERLAY = 1
@ -67,6 +68,7 @@ else
HAVE_ZARCH = 0
HAVE_MATERIALUI = 0
HAVE_XMB = 0
HAVE_OZONE = 0
HAVE_STRIPES = 0
endif

View File

@ -1743,7 +1743,10 @@ found:
{
settings_t *settings = config_get_ptr();
if (!string_is_equal(settings->arrays.menu_driver, "xmb") ||
if (!(
string_is_equal(settings->arrays.menu_driver, "xmb") ||
!string_is_equal(settings->arrays.menu_driver, "ozone")
) ||
!settings->bools.cheevos_badges_enable)
CORO_RET();
}

View File

@ -3229,7 +3229,10 @@ found:
{
settings_t *settings = config_get_ptr();
if (!string_is_equal(settings->arrays.menu_driver, "xmb") ||
if (!(
string_is_equal(settings->arrays.menu_driver, "xmb") ||
!string_is_equal(settings->arrays.menu_driver, "ozone")
) ||
!settings->bools.cheevos_badges_enable)
CORO_RET();
}

View File

@ -288,6 +288,7 @@ enum menu_driver_enum
MENU_XMB,
MENU_STRIPES,
MENU_NUKLEAR,
MENU_OZONE,
MENU_NULL
};
@ -534,6 +535,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_OZONE) && defined(HAVE_LIBNX)
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_OZONE;
#elif defined(HAVE_XMB) && !defined(_XBOX)
static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_XMB;
#elif defined(HAVE_RGUI)
@ -1028,6 +1031,8 @@ const char *config_get_default_menu(void)
return "rgui";
case MENU_XUI:
return "xui";
case MENU_OZONE:
return "ozone";
case MENU_MATERIALUI:
return "glui";
case MENU_XMB:

View File

@ -1264,6 +1264,9 @@ MENU
#ifdef HAVE_XMB
#include "../menu/drivers/xmb.c"
#endif
#ifdef HAVE_OZONE
#include "../menu/drivers/ozone.c"
#endif
#ifdef HAVE_STRIPES
#include "../menu/drivers/stripes.c"

View File

@ -183,14 +183,6 @@ typedef struct materialui_handle
} materialui_handle_t;
static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha)
{
rgba[0] = rgba[4] = rgba[8] = rgba[12] = ((hex >> 16) & 0xFF) * (1.0f / 255.0f); /* r */
rgba[1] = rgba[5] = rgba[9] = rgba[13] = ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f); /* g */
rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */
rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha;
}
static const char *materialui_texture_path(unsigned id)
{
switch (id)

3038
menu/drivers/ozone.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,7 @@ struct tween
uintptr_t tag;
easing_cb easing;
tween_cb cb;
void *userdata;
};
struct menu_animation
@ -326,6 +327,7 @@ bool menu_animation_push(menu_animation_ctx_entry_t *entry)
t.subject = entry->subject;
t.tag = entry->tag;
t.cb = entry->cb;
t.userdata = entry->userdata;
t.easing = NULL;
switch (entry->easing_enum)
@ -519,7 +521,7 @@ bool menu_animation_update(float delta_time)
anim.need_defrag = true;
if (tween->cb)
tween->cb();
tween->cb(tween->userdata);
}
if (tween->running_since < tween->duration)

View File

@ -26,7 +26,7 @@
RETRO_BEGIN_DECLS
typedef float (*easing_cb) (float, float, float, float);
typedef void (*tween_cb) (void);
typedef void (*tween_cb) (void*);
enum menu_animation_ctl_state
{
@ -106,6 +106,7 @@ typedef struct menu_animation_ctx_entry
float target_value;
float *subject;
tween_cb cb;
void *userdata;
} menu_animation_ctx_entry_t;
typedef struct menu_animation_ctx_ticker

View File

@ -78,6 +78,9 @@ typedef struct menu_ctx_load_image
/* Menu drivers */
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
#if defined(HAVE_OZONE)
&menu_ctx_ozone,
#endif
#if defined(HAVE_XUI)
&menu_ctx_xui,
#endif
@ -445,7 +448,6 @@ font_data_t *menu_display_font(
bool is_threaded)
{
char fontpath[PATH_MAX_LENGTH];
font_data_t *font_data = NULL;
if (!menu_disp)
return NULL;
@ -455,6 +457,16 @@ font_data_t *menu_display_font(
fill_pathname_application_special(
fontpath, sizeof(fontpath), type);
return menu_display_font_file(fontpath, font_size, is_threaded);
}
font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded)
{
if (!menu_disp)
return NULL;
font_data_t *font_data = NULL;
if (!menu_disp->font_init_first((void**)&font_data,
video_driver_get_ptr(false),
fontpath, font_size, is_threaded))
@ -2626,3 +2638,11 @@ void menu_navigation_set_selection(size_t val)
{
menu_driver_selection_ptr = val;
}
void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha)
{
rgba[0] = rgba[4] = rgba[8] = rgba[12] = ((hex >> 16) & 0xFF) * (1.0f / 255.0f); /* r */
rgba[1] = rgba[5] = rgba[9] = rgba[13] = ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f); /* g */
rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */
rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha;
}

View File

@ -812,6 +812,8 @@ font_data_t *menu_display_font(
float font_size,
bool video_is_threaded);
font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded);
void menu_display_reset_textures_list(
const char *texture_path,
const char *iconpath,
@ -826,6 +828,8 @@ bool menu_display_driver_exists(const char *s);
void menu_driver_destroy(void);
void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha);
extern uintptr_t menu_display_white_texture;
extern menu_display_ctx_driver_t menu_display_ctx_gl;
@ -846,6 +850,7 @@ extern menu_display_ctx_driver_t menu_display_ctx_switch;
extern menu_display_ctx_driver_t menu_display_ctx_sixel;
extern menu_display_ctx_driver_t menu_display_ctx_null;
extern menu_ctx_driver_t menu_ctx_ozone;
extern menu_ctx_driver_t menu_ctx_xui;
extern menu_ctx_driver_t menu_ctx_rgui;
extern menu_ctx_driver_t menu_ctx_mui;

View File

@ -3530,7 +3530,7 @@ static bool setting_append_list(
parent_group);
}
if (string_is_not_equal(settings->arrays.menu_driver, "xmb"))
if (string_is_not_equal(settings->arrays.menu_driver, "xmb") && string_is_not_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_ACTION(
list, list_info,
@ -7616,7 +7616,7 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_BOOL(
list, list_info,
@ -8055,8 +8055,8 @@ static bool setting_append_list(
SD_FLAG_NONE);
#endif
#ifdef HAVE_XMB
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_BOOL(
list, list_info,
@ -8302,7 +8302,7 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_ADVANCED);
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_UINT(
list, list_info,
@ -9040,7 +9040,7 @@ static bool setting_append_list(
SD_FLAG_NONE
);
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
if (string_is_equal(settings->arrays.menu_driver, "xmb") || string_is_equal(settings->arrays.menu_driver, "ozone"))
CONFIG_BOOL(
list, list_info,
&settings->bools.cheevos_badges_enable,

View File

@ -518,7 +518,8 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH"
HAVE_XMB=no
HAVE_STRIPES=no
HAVE_ZARCH=no
die : 'Notice: RGUI not available, MaterialUI, XMB and ZARCH will also be disabled.'
HAVE_OZONE=no
die : 'Notice: RGUI not available, MaterialUI, XMB, Ozone and ZARCH will also be disabled.'
elif [ "$HAVE_OPENGL" = 'no' ] && [ "$HAVE_OPENGLES" = 'no' ] && [ "$HAVE_VULKAN" = 'no' ]; then
if [ "$OS" = 'Win32' ]; then
HAVE_SHADERPIPELINE=no
@ -531,7 +532,8 @@ if [ "$HAVE_MATERIALUI" != 'no' ] || [ "$HAVE_XMB" != 'no' ] || [ "$HAVE_ZARCH"
HAVE_XMB=no
HAVE_STRIPES=no
HAVE_ZARCH=no
die : 'Notice: Hardware rendering context not available, XMB, MaterialUI and ZARCH will also be disabled.'
HAVE_OZONE=no
die : 'Notice: Hardware rendering context not available, XMB, MaterialUI, Ozone and ZARCH will also be disabled.'
fi
fi
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_OZONE=no # Ozone menu
HAVE_STRIPES=no # Stripes menu
HAVE_ZARCH=no # Zarch menu
HAVE_NUKLEAR=no # Nuklear menu