Get rid of duplicate code - move function to menu_driver.c and have
both XMB and Ozone use it
This commit is contained in:
parent
5f7d14966c
commit
a147cb09d9
|
@ -3400,62 +3400,6 @@ static bool ozone_is_load_content_playlist(void *userdata)
|
||||||
return entry.type == FILE_TYPE_RPL_ENTRY;
|
return entry.type == FILE_TYPE_RPL_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ozone_update_fullscreen_thumbnail_label(ozone_handle_t *ozone)
|
|
||||||
{
|
|
||||||
menu_entry_t selected_entry;
|
|
||||||
const char *thumbnail_label = NULL;
|
|
||||||
|
|
||||||
char tmpstr[64];
|
|
||||||
tmpstr[0] = '\0';
|
|
||||||
|
|
||||||
/* > Get menu entry */
|
|
||||||
MENU_ENTRY_INIT(selected_entry);
|
|
||||||
selected_entry.path_enabled = false;
|
|
||||||
selected_entry.value_enabled = false;
|
|
||||||
selected_entry.sublabel_enabled = false;
|
|
||||||
menu_entry_get(&selected_entry, 0, (size_t)ozone->selection, NULL, true);
|
|
||||||
|
|
||||||
/* > Get entry label */
|
|
||||||
if (!string_is_empty(selected_entry.rich_label))
|
|
||||||
thumbnail_label = selected_entry.rich_label;
|
|
||||||
/* > State slot label */
|
|
||||||
else if (ozone->is_quick_menu && (
|
|
||||||
string_is_equal(selected_entry.label, "state_slot") ||
|
|
||||||
string_is_equal(selected_entry.label, "loadstate") ||
|
|
||||||
string_is_equal(selected_entry.label, "savestate")
|
|
||||||
))
|
|
||||||
{
|
|
||||||
snprintf(tmpstr, sizeof(tmpstr), "%s %d",
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATE_SLOT),
|
|
||||||
config_get_ptr()->ints.state_slot);
|
|
||||||
thumbnail_label = tmpstr;
|
|
||||||
}
|
|
||||||
else if (string_to_unsigned(selected_entry.label) == MENU_ENUM_LABEL_STATE_SLOT)
|
|
||||||
{
|
|
||||||
snprintf(tmpstr, sizeof(tmpstr), "%s %d",
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATE_SLOT),
|
|
||||||
string_to_unsigned(selected_entry.path));
|
|
||||||
thumbnail_label = tmpstr;
|
|
||||||
}
|
|
||||||
/* > Quick Menu playlist label */
|
|
||||||
else if (ozone->is_quick_menu)
|
|
||||||
{
|
|
||||||
const struct playlist_entry *entry = NULL;
|
|
||||||
playlist_get_index(playlist_get_cached(), ozone->playlist_index, &entry);
|
|
||||||
if (entry)
|
|
||||||
thumbnail_label = entry->label;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
thumbnail_label = selected_entry.path;
|
|
||||||
|
|
||||||
/* > Sanity check */
|
|
||||||
if (!string_is_empty(thumbnail_label))
|
|
||||||
strlcpy(
|
|
||||||
ozone->fullscreen_thumbnail_label,
|
|
||||||
thumbnail_label,
|
|
||||||
sizeof(ozone->fullscreen_thumbnail_label));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ozone_update_savestate_thumbnail_path(void *data, unsigned i)
|
static void ozone_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
@ -3533,7 +3477,11 @@ static void ozone_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||||
|
|
||||||
ozone->want_thumbnail_bar = true;
|
ozone->want_thumbnail_bar = true;
|
||||||
ozone->fullscreen_thumbnails_available = true;
|
ozone->fullscreen_thumbnails_available = true;
|
||||||
ozone_update_fullscreen_thumbnail_label(ozone);
|
menu_update_fullscreen_thumbnail_label(
|
||||||
|
ozone->fullscreen_thumbnail_label,
|
||||||
|
sizeof(ozone->fullscreen_thumbnail_label),
|
||||||
|
ozone->is_quick_menu,
|
||||||
|
ozone->playlist_index);
|
||||||
}
|
}
|
||||||
else if (!ozone->is_state_slot)
|
else if (!ozone->is_state_slot)
|
||||||
{
|
{
|
||||||
|
@ -6657,8 +6605,12 @@ static void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
|
||||||
/* Cache selected entry label
|
/* Cache selected entry label
|
||||||
* (used as title when fullscreen thumbnails
|
* (used as title when fullscreen thumbnails
|
||||||
* are shown) */
|
* are shown) */
|
||||||
ozone->fullscreen_thumbnail_label[0] = '\0';
|
if (menu_update_fullscreen_thumbnail_label(
|
||||||
ozone_update_fullscreen_thumbnail_label(ozone);
|
ozone->fullscreen_thumbnail_label,
|
||||||
|
sizeof(ozone->fullscreen_thumbnail_label),
|
||||||
|
ozone->is_quick_menu,
|
||||||
|
ozone->playlist_index) == 0)
|
||||||
|
ozone->fullscreen_thumbnail_label[0] = '\0';
|
||||||
|
|
||||||
/* Configure fade in animation */
|
/* Configure fade in animation */
|
||||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||||
|
|
|
@ -1161,62 +1161,6 @@ static bool xmb_is_running_quick_menu(void)
|
||||||
string_is_equal(entry.label, "state_slot");
|
string_is_equal(entry.label, "state_slot");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_update_fullscreen_thumbnail_label(xmb_handle_t *xmb)
|
|
||||||
{
|
|
||||||
menu_entry_t selected_entry;
|
|
||||||
const char *thumbnail_label = NULL;
|
|
||||||
|
|
||||||
char tmpstr[64];
|
|
||||||
tmpstr[0] = '\0';
|
|
||||||
|
|
||||||
/* > Get menu entry */
|
|
||||||
MENU_ENTRY_INIT(selected_entry);
|
|
||||||
selected_entry.path_enabled = false;
|
|
||||||
selected_entry.value_enabled = false;
|
|
||||||
selected_entry.sublabel_enabled = false;
|
|
||||||
menu_entry_get(&selected_entry, 0, menu_navigation_get_selection(), NULL, true);
|
|
||||||
|
|
||||||
/* > Get entry label */
|
|
||||||
if (!string_is_empty(selected_entry.rich_label))
|
|
||||||
thumbnail_label = selected_entry.rich_label;
|
|
||||||
/* > State slot label */
|
|
||||||
else if (xmb->is_quick_menu && (
|
|
||||||
string_is_equal(selected_entry.label, "state_slot") ||
|
|
||||||
string_is_equal(selected_entry.label, "loadstate") ||
|
|
||||||
string_is_equal(selected_entry.label, "savestate")
|
|
||||||
))
|
|
||||||
{
|
|
||||||
snprintf(tmpstr, sizeof(tmpstr), "%s %d",
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATE_SLOT),
|
|
||||||
config_get_ptr()->ints.state_slot);
|
|
||||||
thumbnail_label = tmpstr;
|
|
||||||
}
|
|
||||||
else if (string_to_unsigned(selected_entry.label) == MENU_ENUM_LABEL_STATE_SLOT)
|
|
||||||
{
|
|
||||||
snprintf(tmpstr, sizeof(tmpstr), "%s %d",
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATE_SLOT),
|
|
||||||
string_to_unsigned(selected_entry.path));
|
|
||||||
thumbnail_label = tmpstr;
|
|
||||||
}
|
|
||||||
/* > Quick Menu playlist label */
|
|
||||||
else if (xmb->is_quick_menu)
|
|
||||||
{
|
|
||||||
const struct playlist_entry *entry = NULL;
|
|
||||||
playlist_get_index(playlist_get_cached(), xmb->playlist_index, &entry);
|
|
||||||
if (entry)
|
|
||||||
thumbnail_label = entry->label;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
thumbnail_label = selected_entry.path;
|
|
||||||
|
|
||||||
/* > Sanity check */
|
|
||||||
if (!string_is_empty(thumbnail_label))
|
|
||||||
strlcpy(
|
|
||||||
xmb->fullscreen_thumbnail_label,
|
|
||||||
thumbnail_label,
|
|
||||||
sizeof(xmb->fullscreen_thumbnail_label));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
|
static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
@ -1293,7 +1237,11 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||||
sizeof(xmb->savestate_thumbnail_file_path));
|
sizeof(xmb->savestate_thumbnail_file_path));
|
||||||
|
|
||||||
xmb->fullscreen_thumbnails_available = true;
|
xmb->fullscreen_thumbnails_available = true;
|
||||||
xmb_update_fullscreen_thumbnail_label(xmb);
|
menu_update_fullscreen_thumbnail_label(
|
||||||
|
xmb->fullscreen_thumbnail_label,
|
||||||
|
sizeof(xmb->fullscreen_thumbnail_label),
|
||||||
|
xmb->is_quick_menu,
|
||||||
|
xmb->playlist_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4168,8 +4116,12 @@ static void xmb_show_fullscreen_thumbnails(
|
||||||
/* Cache selected entry label
|
/* Cache selected entry label
|
||||||
* (used as title when fullscreen thumbnails
|
* (used as title when fullscreen thumbnails
|
||||||
* are shown) */
|
* are shown) */
|
||||||
xmb->fullscreen_thumbnail_label[0] = '\0';
|
if (menu_update_fullscreen_thumbnail_label(
|
||||||
xmb_update_fullscreen_thumbnail_label(xmb);
|
xmb->fullscreen_thumbnail_label,
|
||||||
|
sizeof(xmb->fullscreen_thumbnail_label),
|
||||||
|
xmb->is_quick_menu,
|
||||||
|
xmb->playlist_index) == 0)
|
||||||
|
xmb->fullscreen_thumbnail_label[0] = '\0';
|
||||||
|
|
||||||
/* Configure fade in animation */
|
/* Configure fade in animation */
|
||||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||||
|
|
|
@ -8217,3 +8217,59 @@ bool menu_input_dialog_start(menu_input_ctx_line_t *line)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t menu_update_fullscreen_thumbnail_label(
|
||||||
|
char *s, size_t len,
|
||||||
|
bool is_quick_menu, size_t playlist_index)
|
||||||
|
{
|
||||||
|
menu_entry_t selected_entry;
|
||||||
|
const char *thumbnail_label = NULL;
|
||||||
|
|
||||||
|
char tmpstr[64];
|
||||||
|
tmpstr[0] = '\0';
|
||||||
|
|
||||||
|
/* > Get menu entry */
|
||||||
|
MENU_ENTRY_INIT(selected_entry);
|
||||||
|
selected_entry.path_enabled = false;
|
||||||
|
selected_entry.value_enabled = false;
|
||||||
|
selected_entry.sublabel_enabled = false;
|
||||||
|
menu_entry_get(&selected_entry, 0, menu_navigation_get_selection(), NULL, true);
|
||||||
|
|
||||||
|
/* > Get entry label */
|
||||||
|
if (!string_is_empty(selected_entry.rich_label))
|
||||||
|
thumbnail_label = selected_entry.rich_label;
|
||||||
|
/* > State slot label */
|
||||||
|
else if (is_quick_menu && (
|
||||||
|
string_is_equal(selected_entry.label, "state_slot") ||
|
||||||
|
string_is_equal(selected_entry.label, "loadstate") ||
|
||||||
|
string_is_equal(selected_entry.label, "savestate")
|
||||||
|
))
|
||||||
|
{
|
||||||
|
snprintf(tmpstr, sizeof(tmpstr), "%s %d",
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATE_SLOT),
|
||||||
|
config_get_ptr()->ints.state_slot);
|
||||||
|
thumbnail_label = tmpstr;
|
||||||
|
}
|
||||||
|
else if (string_to_unsigned(selected_entry.label) == MENU_ENUM_LABEL_STATE_SLOT)
|
||||||
|
{
|
||||||
|
snprintf(tmpstr, sizeof(tmpstr), "%s %d",
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATE_SLOT),
|
||||||
|
string_to_unsigned(selected_entry.path));
|
||||||
|
thumbnail_label = tmpstr;
|
||||||
|
}
|
||||||
|
/* > Quick Menu playlist label */
|
||||||
|
else if (is_quick_menu)
|
||||||
|
{
|
||||||
|
const struct playlist_entry *entry = NULL;
|
||||||
|
playlist_get_index(playlist_get_cached(), playlist_index, &entry);
|
||||||
|
if (entry)
|
||||||
|
thumbnail_label = entry->label;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
thumbnail_label = selected_entry.path;
|
||||||
|
|
||||||
|
/* > Sanity check */
|
||||||
|
if (!string_is_empty(thumbnail_label))
|
||||||
|
return strlcpy(s, thumbnail_label, len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -1004,6 +1004,10 @@ bool menu_driver_iterate(
|
||||||
enum menu_action action,
|
enum menu_action action,
|
||||||
retro_time_t current_time);
|
retro_time_t current_time);
|
||||||
|
|
||||||
|
size_t menu_update_fullscreen_thumbnail_label(
|
||||||
|
char *s, size_t len,
|
||||||
|
bool is_quick_menu, size_t playlist_index);
|
||||||
|
|
||||||
extern const menu_ctx_driver_t *menu_ctx_drivers[];
|
extern const menu_ctx_driver_t *menu_ctx_drivers[];
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
Loading…
Reference in New Issue