(Zarch) Start implementing menu entries

This commit is contained in:
twinaphex 2015-10-24 06:36:13 +02:00
parent 17132d1a20
commit bc3f9953a0
2 changed files with 38 additions and 21 deletions

View File

@ -35,6 +35,7 @@
#include "../menu_animation.h" #include "../menu_animation.h"
#include "../menu_entry.h" #include "../menu_entry.h"
#include "../menu_display.h" #include "../menu_display.h"
#include "../menu_hash.h"
#include "../../runloop_data.h" #include "../../runloop_data.h"
#include "../../gfx/video_thread_wrapper.h" #include "../../gfx/video_thread_wrapper.h"
@ -589,30 +590,17 @@ static void render_lay_root(zui_t *zui)
if (zui_tab(zui, &tabbed, "Recent")) if (zui_tab(zui, &tabbed, "Recent"))
{ {
unsigned size = min(zui->height/30-2, content_playlist_size(g_defaults.history)); size_t end = menu_entries_get_end();
unsigned i = 0; unsigned size = min(zui->height/30-2, end);
unsigned i = menu_entries_get_start();
for (i = 0; i < size; ++i) for (; i < size; ++i)
{ {
const char *path = NULL; menu_entry_t entry;
const char *label = NULL; menu_entries_get(i, &entry);
const char *core_name = NULL;
const char *crc32 = NULL;
content_playlist_get_index(g_defaults.history, i, if (zui_list_item(zui, 0, tabbed.tabline_size + i * 54, entry.path))
&path, &label, NULL, &core_name, &crc32, NULL);
if (!label)
{ {
if (path)
label = path_basename(path);
else
label = core_name;
}
if (zui_list_item(zui, 0, tabbed.tabline_size + i * 54, label))
{
RARCH_LOG("Gets here, label: %s, path: %s.\n", core_name, path);
} }
} }
} }
@ -1164,9 +1152,35 @@ static int zarch_iterate(enum menu_action action)
return -1; return -1;
} }
return 0; return 0;
} }
static bool zarch_menu_init_list(void *data)
{
int ret;
menu_displaylist_info_t info = {0};
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr();
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr();
strlcpy(info.label, menu_hash_to_str(MENU_VALUE_HISTORY_TAB), sizeof(info.label));
menu_entries_push(menu_stack, info.path, info.label, info.type, info.flags, 0);
event_command(EVENT_CMD_HISTORY_INIT);
info.list = selection_buf;
menu_displaylist_push_list(&info, DISPLAYLIST_HISTORY);
info.need_push = true;
(void)ret;
menu_displaylist_push_list_process(&info);
return true;
}
menu_ctx_driver_t menu_ctx_zarch = { menu_ctx_driver_t menu_ctx_zarch = {
NULL, NULL,
zarch_get_message, zarch_get_message,
@ -1186,7 +1200,7 @@ menu_ctx_driver_t menu_ctx_zarch = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, zarch_menu_init_list,
NULL, NULL,
NULL, NULL,
NULL, NULL,

View File

@ -2649,6 +2649,9 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
char path_playlist[PATH_MAX_LENGTH]; char path_playlist[PATH_MAX_LENGTH];
content_playlist_t *playlist = g_defaults.history; content_playlist_t *playlist = g_defaults.history;
if (!playlist)
event_command(EVENT_CMD_HISTORY_INIT);
strlcpy(path_playlist, "history", sizeof(path_playlist)); strlcpy(path_playlist, "history", sizeof(path_playlist));
ret = menu_displaylist_parse_playlist(info, playlist, path_playlist, true); ret = menu_displaylist_parse_playlist(info, playlist, path_playlist, true);