Skip to content

Commit

Permalink
Reworked xmb driver to allow tab hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost Coder committed Aug 17, 2016
1 parent 51b44bc commit 069a9cb
Show file tree
Hide file tree
Showing 10 changed files with 836 additions and 77 deletions.
6 changes: 6 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ endif
ifeq ($(HAVE_XMB), 1)
OBJ += menu/drivers/xmb.o
DEFINES += -DHAVE_XMB
ifeq ($(HAVE_XMB_REQUIRESETTINGS), 1)
DEFINES += -DHAVE_XMB_REQUIRESETTINGS
endif
endif
ifeq ($(HAVE_KIOSK), 1)
DEFINES += -DHAVE_KIOSK
endif
endif

Expand Down
45 changes: 45 additions & 0 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,21 @@ static void config_set_defaults(void)
settings->menu.xmb.shadows_enable = xmb_shadows_enable;
settings->menu.xmb.shader_pipeline = menu_shader_pipeline;
settings->menu.xmb.font[0] = '\0';
#ifdef HAVE_KIOSK
settings->menu.xmb.node_position_main = XMB_NODE_POSITION_NORMAL;
#endif
settings->menu.xmb.node_position_settings = XMB_NODE_POSITION_NORMAL;
#ifdef HAVE_IMAGEVIEWER
settings->menu.xmb.node_position_images = XMB_NODE_POSITION_NORMAL;
#endif
#ifdef HAVE_FFMPEG
settings->menu.xmb.node_position_music = XMB_NODE_POSITION_NORMAL;
settings->menu.xmb.node_position_video = XMB_NODE_POSITION_NORMAL;
#endif
settings->menu.xmb.node_position_history = XMB_NODE_POSITION_NORMAL;
#ifdef HAVE_LIBRETRODB
settings->menu.xmb.node_position_add = XMB_NODE_POSITION_NORMAL;
#endif
#endif
#ifdef HAVE_MATERIALUI
settings->menu.materialui.menu_color_theme = MATERIALUI_THEME_BLUE;
Expand Down Expand Up @@ -1440,6 +1455,21 @@ static bool config_load_file(const char *path, bool set_defaults)
{ "xmb_theme", &settings->menu.xmb.theme},
#ifdef HAVE_XMB
{ "xmb_menu_color_theme", &settings->menu.xmb.menu_color_theme},
#ifdef HAVE_KIOSK
{ "xmb_node_position_main", &settings->menu.xmb.node_position_main},
#endif
{ "xmb_node_position_settings", &settings->menu.xmb.node_position_settings},
#ifdef HAVE_IMAGEVIEWER
{ "xmb_node_position_images", &settings->menu.xmb.node_position_images},
#endif
#ifdef HAVE_FFMPEG
{ "xmb_node_position_music", &settings->menu.xmb.node_position_music},
{ "xmb_node_position_video", &settings->menu.xmb.node_position_video},
#endif
{ "xmb_node_position_history", &settings->menu.xmb.node_position_history},
#ifdef HAVE_LIBRETRODB
{ "xmb_node_position_add", &settings->menu.xmb.node_position_add},
#endif
#endif
{ "materialui_menu_color_theme", &settings->menu.materialui.menu_color_theme},
{ "menu_shader_pipeline", &settings->menu.xmb.shader_pipeline},
Expand Down Expand Up @@ -2944,6 +2974,21 @@ bool config_save_file(const char *path)
{ "xmb_theme", settings->menu.xmb.theme},
#ifdef HAVE_XMB
{ "xmb_menu_color_theme", settings->menu.xmb.menu_color_theme},
#ifdef HAVE_KIOSK
{ "xmb_node_position_main", settings->menu.xmb.node_position_main},
#endif
{ "xmb_node_position_settings", settings->menu.xmb.node_position_settings},
#ifdef HAVE_IMAGEVIEWER
{ "xmb_node_position_images", settings->menu.xmb.node_position_images},
#endif
#ifdef HAVE_FFMPEG
{ "xmb_node_position_music", settings->menu.xmb.node_position_music},
{ "xmb_node_position_video", settings->menu.xmb.node_position_video},
#endif
{ "xmb_node_position_history", settings->menu.xmb.node_position_history},
#ifdef HAVE_LIBRETRODB
{ "xmb_node_position_add", settings->menu.xmb.node_position_add},
#endif
#endif
{ "materialui_menu_color_theme", settings->menu.materialui.menu_color_theme},
{ "menu_shader_pipeline", settings->menu.xmb.shader_pipeline},
Expand Down
17 changes: 17 additions & 0 deletions configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,23 @@ typedef struct settings
unsigned alpha_factor;
unsigned theme;
unsigned menu_color_theme;
#ifdef HAVE_XMB
#ifdef HAVE_KIOSK
unsigned node_position_main;
#endif
unsigned node_position_settings;
#ifdef HAVE_IMAGEVIEWER
unsigned node_position_images;
#endif
#ifdef HAVE_FFMPEG
unsigned node_position_music;
unsigned node_position_video;
#endif
unsigned node_position_history;
#ifdef HAVE_LIBRETRODB
unsigned node_position_add;
#endif
#endif
bool shadows_enable;
} xmb;

Expand Down
52 changes: 52 additions & 0 deletions intl/msg_hash_us.c
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,30 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
return "xmb_theme";
case MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME:
return "xmb_menu_color_theme";
#ifdef HAVE_XMB
#ifdef HAVE_KIOSK
case MENU_ENUM_LABEL_XMB_NODE_POSITION_MAIN:
return "xmb_node_position_main";
#endif
case MENU_ENUM_LABEL_XMB_NODE_POSITION_SETTINGS:
return "xmb_node_position_settings";
#ifdef HAVE_IMAGEVIEWER
case MENU_ENUM_LABEL_XMB_NODE_POSITION_IMAGES:
return "xmb_node_position_images";
#endif
#ifdef HAVE_FFMPEG
case MENU_ENUM_LABEL_XMB_NODE_POSITION_MUSIC:
return "xmb_node_position_music";
case MENU_ENUM_LABEL_XMB_NODE_POSITION_VIDEO:
return "xmb_node_position_video";
#endif
case MENU_ENUM_LABEL_XMB_NODE_POSITION_HISTORY:
return "xmb_node_position_history";
#ifdef HAVE_LIBRETRODB
case MENU_ENUM_LABEL_XMB_NODE_POSITION_ADD:
return "xmb_node_position_add";
#endif
#endif
case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME:
return "materialui_menu_color_theme";
case MENU_ENUM_LABEL_MATERIALUI_MENU_HEADER_OPACITY:
Expand Down Expand Up @@ -2949,6 +2973,10 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
return "Volcanic Red";
case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_DARK:
return "Dark";
#ifdef HAVE_XMB
case MENU_ENUM_LABEL_VALUE_XMB_MENU_NODE_POSITION_REORDERED:
return "REORDERED";
#endif
case MENU_ENUM_LABEL_VALUE_CHEEVOS_UNLOCKED_ENTRY:
return "Unlocked";
case MENU_ENUM_LABEL_VALUE_CHEEVOS_LOCKED_ENTRY:
Expand Down Expand Up @@ -3711,6 +3739,30 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
return "Menu Icon Theme";
case MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME:
return "Menu Color Theme";
#ifdef HAVE_XMB
#ifdef HAVE_KIOSK
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_MAIN:
return "Show Main Menu";
#endif
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_SETTINGS:
return "Show Settings Menu";
#ifdef HAVE_IMAGEVIEWER
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_IMAGES:
return "Show Images Menu";
#endif
#ifdef HAVE_FFMPEG
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_MUSIC:
return "Show Music Menu";
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_VIDEO:
return "Show Video Menu";
#endif
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_HISTORY:
return "Show History Menu";
#ifdef HAVE_LIBRETRODB
case MENU_ENUM_LABEL_VALUE_XMB_NODE_POSITION_ADD:
return "Show Import Menu";
#endif
#endif
case MENU_ENUM_LABEL_VALUE_MATERIALUI_MENU_COLOR_THEME:
return "Menu Color Theme";
case MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE:
Expand Down
193 changes: 193 additions & 0 deletions menu/cbs/menu_cbs_get_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,165 @@ static void menu_action_setting_disp_set_label_xmb_menu_color_theme(
}
}

#ifdef HAVE_XMB
#ifndef HAVE_KIOSK
static void menu_action_setting_disp_set_label_xmb_menu_node_position(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2, unsigned position)
{
strlcpy(s2, path, len2);
*w = 7;

switch (position)
{
case XMB_NODE_POSITION_HIDDEN:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_OFF),
len);
break;
case XMB_NODE_POSITION_NORMAL:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_ON),
len);
break;
default:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_XMB_MENU_NODE_POSITION_REORDERED),
len);
break;
}
}

static void menu_action_setting_disp_set_label_xmb_menu_node_position_settings(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();

if (!settings)
return;

menu_action_setting_disp_set_label_xmb_menu_node_position(list,
w, type, i, label, s, len, entry_label, path, s2, len2,
settings->menu.xmb.node_position_settings);
}

#ifdef HAVE_IMAGEVIEWER
static void menu_action_setting_disp_set_label_xmb_menu_node_position_images(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();

if (!settings)
return;

menu_action_setting_disp_set_label_xmb_menu_node_position(list,
w, type, i, label, s, len, entry_label, path, s2, len2,
settings->menu.xmb.node_position_images);
}
#endif

#ifdef HAVE_FFMPEG
static void menu_action_setting_disp_set_label_xmb_menu_node_position_music(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();

if (!settings)
return;

menu_action_setting_disp_set_label_xmb_menu_node_position(list,
w, type, i, label, s, len, entry_label, path, s2, len2,
settings->menu.xmb.node_position_music);
}

static void menu_action_setting_disp_set_label_xmb_menu_node_position_video(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();

if (!settings)
return;

menu_action_setting_disp_set_label_xmb_menu_node_position(list,
w, type, i, label, s, len, entry_label, path, s2, len2,
settings->menu.xmb.node_position_video);
}
#endif

static void menu_action_setting_disp_set_label_xmb_menu_node_position_history(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();

if (!settings)
return;

menu_action_setting_disp_set_label_xmb_menu_node_position(list,
w, type, i, label, s, len, entry_label, path, s2, len2,
settings->menu.xmb.node_position_history);
}

#ifdef HAVE_LIBRETRODB
static void menu_action_setting_disp_set_label_xmb_menu_node_position_add(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
settings_t *settings = config_get_ptr();

if (!settings)
return;

menu_action_setting_disp_set_label_xmb_menu_node_position(list,
w, type, i, label, s, len, entry_label, path, s2, len2,
settings->menu.xmb.node_position_add);
}
#endif
#endif
#endif

static void menu_action_setting_disp_set_label_materialui_menu_color_theme(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
Expand Down Expand Up @@ -1532,6 +1691,40 @@ static int menu_cbs_init_bind_get_string_representation_compare_label(
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_color_theme);
break;
#ifdef HAVE_XMB
#ifndef HAVE_KIOSK
case MENU_ENUM_LABEL_XMB_NODE_POSITION_SETTINGS:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_node_position_settings);
break;
#ifdef HAVE_IMAGEVIEWER
case MENU_ENUM_LABEL_XMB_NODE_POSITION_IMAGES:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_node_position_images);
break;
#endif
#ifdef HAVE_FFMPEG
case MENU_ENUM_LABEL_XMB_NODE_POSITION_MUSIC:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_node_position_music);
break;
case MENU_ENUM_LABEL_XMB_NODE_POSITION_VIDEO:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_node_position_video);
break;
#endif
case MENU_ENUM_LABEL_XMB_NODE_POSITION_HISTORY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_node_position_history);
break;
#ifdef HAVE_LIBRETRODB
case MENU_ENUM_LABEL_XMB_NODE_POSITION_ADD:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_xmb_menu_node_position_add);
break;
#endif
#endif
#endif
case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_materialui_menu_color_theme);
Expand Down
Loading

0 comments on commit 069a9cb

Please sign in to comment.