From 657b02033efae785f9bc9bd7a62b74a0b057b7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 00:06:05 +0700 Subject: [PATCH 01/25] (GLUI) Free textures in context_destroy --- menu/drivers/glui.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 1b1eca2be6..2bb9fdb2ec 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -866,16 +866,21 @@ static void glui_context_bg_destroy(glui_handle_t *glui) static void glui_context_destroy(void) { - gl_t *gl = (gl_t*)video_driver_get_ptr(NULL); + unsigned i; glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); - driver_t *driver = driver_get_ptr(); - if (!menu || !menu->userdata || !gl || !driver) + if (!menu || !menu->userdata) return; glui = (glui_handle_t*)menu->userdata; + if (!glui) + return; + + for (i = 0; i < GLUI_TEXTURE_LAST; i++) + video_texture_unload((uintptr_t*)&glui->textures.list[i].id); + menu_display_free_main_font(); glui_context_bg_destroy(glui); From a599ac4c98558190a7c378a9c1f40316bf2973a8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 28 Oct 2015 18:21:08 +0100 Subject: [PATCH 02/25] Added Android2.mk --- pkg/android/phoenix/jni/Android2.mk | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 pkg/android/phoenix/jni/Android2.mk diff --git a/pkg/android/phoenix/jni/Android2.mk b/pkg/android/phoenix/jni/Android2.mk new file mode 100644 index 0000000000..5b69a4fbbf --- /dev/null +++ b/pkg/android/phoenix/jni/Android2.mk @@ -0,0 +1,85 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE := retroarch-jni +RARCH_DIR := ../../../.. +LOCAL_CFLAGS += -std=gnu99 -Wall -DRARCH_DUMMY_LOG -DHAVE_ZLIB -DHAVE_MMAP -DRARCH_INTERNAL +LOCAL_LDLIBS := -llog -lz +LOCAL_SRC_FILES := apk-extract/apk-extract.c \ + $(RARCH_DIR)/libretro-common/file/file_extract.c \ + $(RARCH_DIR)/libretro-common/file/file_path.c \ + $(RARCH_DIR)/file_ops.c \ + $(RARCH_DIR)/libretro-common/string/string_list.c \ + $(RARCH_DIR)/libretro-common/compat/compat_strl.c \ + $(RARCH_DIR)/libretro-common/file/retro_file.c \ + $(RARCH_DIR)/libretro-common/file/retro_stat.c + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(RARCH_DIR)/libretro-common/include/ + +include $(BUILD_SHARED_LIBRARY) + +HAVE_NEON := 1 +HAVE_LOGGER := 0 + +include $(CLEAR_VARS) +ifeq ($(TARGET_ARCH),arm) + LOCAL_CFLAGS += -DANDROID_ARM -marm + LOCAL_ARM_MODE := arm +endif + +ifeq ($(TARGET_ARCH),x86) + LOCAL_CFLAGS += -DANDROID_X86 -DHAVE_SSSE3 +endif + +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + +ifeq ($(HAVE_NEON),1) + LOCAL_CFLAGS += -D__ARM_NEON__ + LOCAL_SRC_FILES += $(RARCH_DIR)/audio/audio_utils_neon.S.neon + LOCAL_SRC_FILES += $(RARCH_DIR)/audio/drivers_resampler/sinc_neon.S.neon + LOCAL_SRC_FILES += $(RARCH_DIR)/audio/drivers_resampler/cc_resampler_neon.S.neon +endif +LOCAL_CFLAGS += -DSINC_LOWER_QUALITY + +LOCAL_CFLAGS += -DANDROID_ARM_V7 +endif + +ifeq ($(TARGET_ARCH),mips) + LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ +endif + +LOCAL_MODULE := retroarch-activity + +LOCAL_SRC_FILES += $(RARCH_DIR)/griffin/griffin.c + +ifeq ($(HAVE_LOGGER), 1) + LOCAL_CFLAGS += -DHAVE_LOGGER +endif +LOGGER_LDLIBS := -llog + +ifeq ($(GLES),3) + GLES_LIB := -lGLESv3 + LOCAL_CFLAGS += -DHAVE_OPENGLES3 +else + GLES_LIB := -lGLESv2 +endif + + +LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DHAVE_RPNG -DINLINE=inline -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_GLUI -DHAVE_XMB -std=gnu99 -DHAVE_LIBRETRODB -DHAVE_STB_FONT +LOCAL_CFLAGS += -DHAVE_7ZIP +LOCAL_CFLAGS += -DDEBUG_ANDROID + +ifeq ($(NDK_DEBUG),1) +LOCAL_CFLAGS += -O0 -g +else +LOCAL_CFLAGS += -O2 -DNDEBUG +endif + +LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL $(GLES_LIB) $(LOGGER_LDLIBS) -ldl +LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(RARCH_DIR)/libretro-common/include/ + +LOCAL_CFLAGS += -DHAVE_SL +LOCAL_LDLIBS += -lOpenSLES -lz + +include $(BUILD_SHARED_LIBRARY) + From 434f8383d8ce0a279d9af7e24d129cc2c4aa49bb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 28 Oct 2015 18:24:51 +0100 Subject: [PATCH 03/25] menu_display_draw_frame - put in potential edge case fix --- menu/menu_display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/menu/menu_display.c b/menu/menu_display.c index e88dac2154..ad409159e7 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -514,6 +514,10 @@ void menu_display_draw_frame( const shader_backend_t *shader = (const shader_backend_t*)shader_data; driver_t *driver = driver_get_ptr(); + /* TODO - edge case */ + if (height <= 0) + height = 1; + glViewport(x, y, width, height); glBindTexture(GL_TEXTURE_2D, texture); From 4a391e8af2f9372710a1c374b3fe8f44cbb97abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 00:59:06 +0700 Subject: [PATCH 04/25] (GLUI) Tabs, first step: allow switching between two tabs --- menu/drivers/glui.c | 113 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index a4a275388e..374e09cf6c 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -46,6 +46,14 @@ enum GLUI_TEXTURE_LAST }; +enum +{ + GLUI_SYSTEM_TAB_MAIN = 0, + GLUI_SYSTEM_TAB_SETTINGS +}; + +#define GLUI_SYSTEM_TAB_END GLUI_SYSTEM_TAB_SETTINGS + struct glui_texture_item { GRuint id; @@ -71,6 +79,19 @@ typedef struct glui_handle GRuint white; } textures; + struct + { + struct + { + unsigned idx; + unsigned idx_old; + } active; + + float x_pos; + size_t selection_ptr_old; + size_t selection_ptr; + } categories; + gfx_font_raster_block_t list_block; } glui_handle_t; @@ -1032,6 +1053,94 @@ static int glui_environ(menu_environ_cb_t type, void *data) return -1; } +static void glui_list_cache(menu_list_type_t type, unsigned action) +{ + size_t stack_size, list_size; + glui_handle_t *glui = NULL; + menu_handle_t *menu = menu_driver_get_ptr(); + file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); + file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + + if (!menu) + return; + + glui = (glui_handle_t*)menu->userdata; + + if (!glui) + return; + + list_size = GLUI_SYSTEM_TAB_END; + + switch (type) + { + case MENU_LIST_PLAIN: + break; + case MENU_LIST_HORIZONTAL: + glui->categories.selection_ptr_old = glui->categories.selection_ptr; + + switch (action) + { + case MENU_ACTION_LEFT: + if (glui->categories.selection_ptr == 0) + { + glui->categories.selection_ptr = list_size; + glui->categories.active.idx = list_size - 1; + } + else + glui->categories.selection_ptr--; + break; + default: + if (glui->categories.selection_ptr == list_size) + { + glui->categories.selection_ptr = 0; + glui->categories.active.idx = 1; + } + else + glui->categories.selection_ptr++; + break; + } + + stack_size = menu_stack->size; + + if (menu_stack->list[stack_size - 1].label) + free(menu_stack->list[stack_size - 1].label); + menu_stack->list[stack_size - 1].label = NULL; + + switch (glui->categories.selection_ptr) + { + case GLUI_SYSTEM_TAB_MAIN: + menu_stack->list[stack_size - 1].label = + strdup(menu_hash_to_str(MENU_VALUE_MAIN_MENU)); + menu_stack->list[stack_size - 1].type = + MENU_SETTINGS; + break; + case GLUI_SYSTEM_TAB_SETTINGS: + menu_stack->list[stack_size - 1].label = + strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB)); + menu_stack->list[stack_size - 1].type = + MENU_SETTINGS_TAB; + break; + } + break; + } +} + +static size_t glui_list_get_size(void *data, menu_list_type_t type) +{ + size_t list_size = 0; + menu_handle_t *menu = (menu_handle_t*)data; + glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL; + + switch (type) + { + case MENU_LIST_PLAIN: + list_size = menu_entries_get_stack_size(0); + break; + } + + return list_size; +} + menu_ctx_driver_t menu_ctx_glui = { NULL, glui_get_message, @@ -1055,10 +1164,10 @@ menu_ctx_driver_t menu_ctx_glui = { NULL, NULL, NULL, + glui_list_cache, NULL, NULL, - NULL, - NULL, + glui_list_get_size, NULL, glui_list_set_selection, NULL, From 01f0cb43f7d8b55988f7b4b9e8f56d682cfe0cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 02:05:38 +0700 Subject: [PATCH 05/25] (GLUI) Display tabs in the header --- menu/drivers/glui.c | 50 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 374e09cf6c..63392f0df3 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -61,6 +61,7 @@ struct glui_texture_item typedef struct glui_handle { + unsigned tabs_height; unsigned line_height; unsigned icon_size; unsigned margin; @@ -254,7 +255,7 @@ static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRflo glui = (glui_handle_t*)menu->userdata; content_height = menu_entries_get_end() * glui->line_height; - total_height = height - header_height; + total_height = height - header_height - glui->tabs_height; scrollbar_height = total_height / (content_height / total_height) - (header_height / 6); y = total_height * menu->scroll_y / content_height; @@ -266,7 +267,7 @@ static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRflo glui_render_quad(gl, width - scrollbar_width - (header_height / 12), - header_height + y + (header_height / 12), + header_height + glui->tabs_height + y + (header_height / 12), scrollbar_width, scrollbar_height, width, height, @@ -391,12 +392,12 @@ static void glui_render(void) menu->scroll_y = 0; bottom = menu_entries_get_end() * glui->line_height - - height + header_height; + - height + header_height + glui->tabs_height; if (menu->scroll_y > bottom) menu->scroll_y = bottom; if (menu_entries_get_end() * glui->line_height - < height - header_height) + < height - header_height - glui->tabs_height) menu->scroll_y = 0; if (menu_entries_get_end() < height / glui->line_height) @@ -532,7 +533,7 @@ static void glui_render_menu_list(glui_handle_t *glui, gl_t *gl, if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) continue; - y = header_height - menu->scroll_y + (glui->line_height * i); + y = header_height + glui->tabs_height - menu->scroll_y + (glui->line_height * i); if (y > (int)height || ((y + (int)glui->line_height) < 0)) continue; @@ -624,7 +625,7 @@ static void glui_frame(void) 0, 0, 0, 0.2, 0, 0, 0, 0.2, }; - unsigned width, height, ticker_limit; + unsigned width, height, ticker_limit, i, tab_width; char msg[PATH_MAX_LENGTH]; char title[PATH_MAX_LENGTH]; char title_buf[PATH_MAX_LENGTH]; @@ -640,6 +641,8 @@ static void glui_frame(void) const uint32_t normal_color = 0x212121ff; const uint32_t hover_color = 0x212121ff; const uint32_t title_color = 0xffffffff; + const uint32_t activetab_color = 0xffffffff; + const uint32_t passivetab_color = 0xffffff88; if (!menu || !menu->userdata) return; @@ -676,7 +679,7 @@ static void glui_frame(void) /* highlighted entry */ glui_render_quad(gl, 0, - header_height - menu->scroll_y + glui->line_height * + header_height + glui->tabs_height - menu->scroll_y + glui->line_height * selection, width, glui->line_height, width, height, &lightblue_bg[0]); @@ -697,6 +700,30 @@ static void glui_frame(void) /* shadow underneath header */ glui_render_quad(gl, 0, header_height, width, + glui->tabs_height, + width, height, + &blue_bg[0]); + + for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++) + { + uint32_t tab_color = passivetab_color; + if (i == glui->categories.selection_ptr) + tab_color = activetab_color; + + glui_blit_line(width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5), + header_height - header_height/8, + width, height, "TAB", tab_color, TEXT_ALIGN_CENTER); + } + + tab_width = width / (GLUI_SYSTEM_TAB_END+1); + glui_render_quad(gl, glui->categories.selection_ptr * tab_width, + header_height + glui->tabs_height - (header_height/16), + tab_width, + header_height/16, + width, height, + &pure_white[0]); + + glui_render_quad(gl, 0, header_height + glui->tabs_height, width, header_height/12, width, height, &shadow_bg[0]); @@ -801,6 +828,7 @@ static void glui_layout(menu_handle_t *menu, glui_handle_t *glui) new_header_height = scale_factor / 3; new_font_size = scale_factor / 9; + glui->tabs_height = scale_factor / 4; glui->line_height = scale_factor / 3; glui->margin = scale_factor / 9; glui->icon_size = scale_factor / 3; @@ -1131,12 +1159,12 @@ static size_t glui_list_get_size(void *data, menu_list_type_t type) menu_handle_t *menu = (menu_handle_t*)data; glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL; - switch (type) + /*switch (type) { - case MENU_LIST_PLAIN: + case MENU_LIST_PLAIN:*/ list_size = menu_entries_get_stack_size(0); - break; - } + /*break; + }*/ return list_size; } From 37312fe9222c0ab2bcf65de8176b916459514e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 02:11:26 +0700 Subject: [PATCH 06/25] (GLUI) Display playlists in the second tab --- menu/drivers/glui.c | 10 +++++----- menu/intl/menu_hash_us.c | 2 ++ menu/menu.h | 1 + menu/menu_displaylist.c | 5 +++++ menu/menu_hash.h | 1 + 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 63392f0df3..1ead6d37ee 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -49,10 +49,10 @@ enum enum { GLUI_SYSTEM_TAB_MAIN = 0, - GLUI_SYSTEM_TAB_SETTINGS + GLUI_SYSTEM_TAB_PLAYLISTS }; -#define GLUI_SYSTEM_TAB_END GLUI_SYSTEM_TAB_SETTINGS +#define GLUI_SYSTEM_TAB_END GLUI_SYSTEM_TAB_PLAYLISTS struct glui_texture_item { @@ -1142,11 +1142,11 @@ static void glui_list_cache(menu_list_type_t type, unsigned action) menu_stack->list[stack_size - 1].type = MENU_SETTINGS; break; - case GLUI_SYSTEM_TAB_SETTINGS: + case GLUI_SYSTEM_TAB_PLAYLISTS: menu_stack->list[stack_size - 1].label = - strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB)); + strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB)); menu_stack->list[stack_size - 1].type = - MENU_SETTINGS_TAB; + MENU_PLAYLISTS_TAB; break; } break; diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index fa7d6e6c3f..c8ca204e3e 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -780,6 +780,8 @@ const char *menu_hash_to_str_us(uint32_t hash) return "History tab"; case MENU_VALUE_ADD_TAB: return "Add tab"; + case MENU_VALUE_PLAYLISTS_TAB: + return "Playlists tab"; case MENU_LABEL_VALUE_NO_SETTINGS_FOUND: return "No settings found."; case MENU_LABEL_VALUE_NO_PERFORMANCE_COUNTERS: diff --git a/menu/menu.h b/menu/menu.h index 27dd77c56a..d9623b8c7a 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -104,6 +104,7 @@ typedef enum MENU_SETTINGS_TAB, MENU_HISTORY_TAB, MENU_ADD_TAB, + MENU_PLAYLISTS_TAB, MENU_SETTING_DRIVER, MENU_SETTING_ACTION, MENU_SETTING_ACTION_RUN, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b00f22c98b..e1d7e243b1 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3110,6 +3110,11 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list) return -1; menu_displaylist_push_list_process(&info); return 0; + case MENU_VALUE_PLAYLISTS_TAB: + if (menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS) != 0) + return -1; + menu_displaylist_push_list_process(&info); + return 0; case MENU_VALUE_HORIZONTAL_MENU: if (menu_displaylist_push_list(&info, DISPLAYLIST_HORIZONTAL) != 0) return -1; diff --git a/menu/menu_hash.h b/menu/menu_hash.h index d6fcfd29fb..994de737af 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -572,6 +572,7 @@ extern "C" { #define MENU_VALUE_SETTINGS_TAB 0x6548d16dU #define MENU_VALUE_HISTORY_TAB 0xea9b0ceeU #define MENU_VALUE_ADD_TAB 0x7fb20225U +#define MENU_VALUE_PLAYLISTS_TAB 0x092d3161U #define MENU_VALUE_MAIN_MENU 0x1625971fU #define MENU_LABEL_VALUE_SETTINGS 0x8aca3ff6U #define MENU_VALUE_INPUT_SETTINGS 0xddd30846U From d779ffcf131f24d548516b00c8cf196215aecb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 02:34:52 +0700 Subject: [PATCH 07/25] (GLUI) Show appropriate tab names --- menu/drivers/glui.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 1ead6d37ee..912508e053 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -710,9 +710,20 @@ static void glui_frame(void) if (i == glui->categories.selection_ptr) tab_color = activetab_color; + char tab_label[PATH_MAX_LENGTH]; + switch (i) + { + case GLUI_SYSTEM_TAB_MAIN: + strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(tab_label)); + break; + case GLUI_SYSTEM_TAB_PLAYLISTS: + strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB), sizeof(tab_label)); + break; + } + glui_blit_line(width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5), header_height - header_height/8, - width, height, "TAB", tab_color, TEXT_ALIGN_CENTER); + width, height, tab_label, tab_color, TEXT_ALIGN_CENTER); } tab_width = width / (GLUI_SYSTEM_TAB_END+1); From 27553e2363b84576925ea41bba8b970ae72cb63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 02:54:26 +0700 Subject: [PATCH 08/25] (GLUI) Use uppercase for tab names --- menu/drivers/glui.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 912508e053..22f194d8a9 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -721,6 +722,7 @@ static void glui_frame(void) break; } + strlcpy(tab_label, string_to_upper(tab_label), sizeof(tab_label)); glui_blit_line(width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5), header_height - header_height/8, width, height, tab_label, tab_color, TEXT_ALIGN_CENTER); From ed1d8583f4cc155c0a035ff52fe8e5aeb8498109 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 28 Oct 2015 21:30:30 +0100 Subject: [PATCH 09/25] (GLUI) Playlist tab works now --- menu/drivers/glui.c | 2 ++ menu/menu_displaylist.c | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 22f194d8a9..eb521c3dd4 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -1156,6 +1156,8 @@ static void glui_list_cache(menu_list_type_t type, unsigned action) MENU_SETTINGS; break; case GLUI_SYSTEM_TAB_PLAYLISTS: + menu_stack->list[stack_size - 1].label = + strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB)); menu_stack->list[stack_size - 1].label = strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB)); menu_stack->list[stack_size - 1].type = diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e1d7e243b1..c8ed578e39 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3027,6 +3027,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) case DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL: { bool horizontal = (type == DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL); + if (menu_displaylist_parse_generic(info, horizontal) == 0) { info->need_refresh = true; @@ -3074,6 +3075,7 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list) uint32_t hash_label = 0; unsigned type = 0; menu_displaylist_info_t info = {0}; + settings_t *settings = config_get_ptr(); menu_entries_get_last_stack(&path, &label, &type, NULL); @@ -3111,8 +3113,28 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list) menu_displaylist_push_list_process(&info); return 0; case MENU_VALUE_PLAYLISTS_TAB: - if (menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS) != 0) - return -1; + info.type = 42; + strlcpy(info.exts, "lpl", sizeof(info.exts)); + strlcpy(info.label, menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST), + sizeof(info.label)); + + if (settings->playlist_directory[0] != '\0') + { + strlcpy(info.path, settings->playlist_directory, + sizeof(info.path)); + if (menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL) != 0) + return -1; + } + else + { + menu_entries_clear(info.list); + menu_entries_push(info.list, + menu_hash_to_str(MENU_LABEL_VALUE_NO_PLAYLIST_ENTRIES_AVAILABLE), + menu_hash_to_str(MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE), + MENU_INFO_MESSAGE, 0, 0); + info.need_refresh = true; + info.need_push = true; + } menu_displaylist_push_list_process(&info); return 0; case MENU_VALUE_HORIZONTAL_MENU: From 6f137587d13a67efeaf38176ad081d0be6ea8da2 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Wed, 28 Oct 2015 21:25:27 -0200 Subject: [PATCH 10/25] initialize the network in net_http_new_socket --- libretro-common/net/net_http.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index bcfb6a35b2..a3dc3ce3d1 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -74,6 +74,9 @@ static int net_http_new_socket(const char *domain, int port) #endif struct addrinfo hints, *addr = NULL; char portstr[16] = {0}; + + /* Initialize the network. */ + network_init(); snprintf(portstr, sizeof(portstr), "%i", port); From 89d5eaa7c8d3c2a3c664ad2d5e654e5c35d5b4bf Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 29 Oct 2015 01:38:43 +0100 Subject: [PATCH 11/25] (GLSL) Add precision hack for GLES --- gfx/drivers_shader/shader_glsl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index adc0dfe911..f05ff44cf7 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -158,6 +158,9 @@ static const char *stock_fragment_legacy = "}"; static const char *stock_vertex_modern_blend = + "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n" "attribute vec2 TexCoord;\n" "attribute vec2 VertexCoord;\n" "attribute vec4 Color;\n" From b6bb679e68760b7e7b88f789c9bff71afab8ef21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 13:32:44 +0700 Subject: [PATCH 12/25] (GLUI) Fix left action on the playlist tab --- menu/cbs/menu_cbs_left.c | 1 + 1 file changed, 1 insertion(+) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 56782304cf..2fc99f833d 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -496,6 +496,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, case MENU_VALUE_MAIN_MENU: case MENU_VALUE_HISTORY_TAB: case MENU_VALUE_ADD_TAB: + case MENU_VALUE_PLAYLISTS_TAB: BIND_ACTION_LEFT(cbs, action_left_mainmenu); break; default: From c0916c11af93858d75f94c2cbf43490541f60f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 17:23:04 +0700 Subject: [PATCH 13/25] (GLUI) Add a settings tab --- menu/drivers/glui.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index eb521c3dd4..7908a9d7ba 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -50,10 +50,11 @@ enum enum { GLUI_SYSTEM_TAB_MAIN = 0, - GLUI_SYSTEM_TAB_PLAYLISTS + GLUI_SYSTEM_TAB_PLAYLISTS, + GLUI_SYSTEM_TAB_SETTINGS }; -#define GLUI_SYSTEM_TAB_END GLUI_SYSTEM_TAB_PLAYLISTS +#define GLUI_SYSTEM_TAB_END GLUI_SYSTEM_TAB_SETTINGS struct glui_texture_item { @@ -720,6 +721,9 @@ static void glui_frame(void) case GLUI_SYSTEM_TAB_PLAYLISTS: strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB), sizeof(tab_label)); break; + case GLUI_SYSTEM_TAB_SETTINGS: + strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_SETTINGS_TAB), sizeof(tab_label)); + break; } strlcpy(tab_label, string_to_upper(tab_label), sizeof(tab_label)); @@ -1163,6 +1167,12 @@ static void glui_list_cache(menu_list_type_t type, unsigned action) menu_stack->list[stack_size - 1].type = MENU_PLAYLISTS_TAB; break; + case GLUI_SYSTEM_TAB_SETTINGS: + menu_stack->list[stack_size - 1].label = + strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB)); + menu_stack->list[stack_size - 1].type = + MENU_SETTINGS; + break; } break; } From 07ef7f23abdb9979a8f7049a23c7c402f0a5590b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 17:31:13 +0700 Subject: [PATCH 14/25] (GLUI) Move tabs to the bottom --- menu/drivers/glui.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 7908a9d7ba..33c6a52ee9 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -269,7 +269,7 @@ static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRflo glui_render_quad(gl, width - scrollbar_width - (header_height / 12), - header_height + glui->tabs_height + y + (header_height / 12), + header_height + y + (header_height / 12), scrollbar_width, scrollbar_height, width, height, @@ -535,7 +535,7 @@ static void glui_render_menu_list(glui_handle_t *glui, gl_t *gl, if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) continue; - y = header_height + glui->tabs_height - menu->scroll_y + (glui->line_height * i); + y = header_height - menu->scroll_y + (glui->line_height * i); if (y > (int)height || ((y + (int)glui->line_height) < 0)) continue; @@ -681,7 +681,7 @@ static void glui_frame(void) /* highlighted entry */ glui_render_quad(gl, 0, - header_height + glui->tabs_height - menu->scroll_y + glui->line_height * + header_height - menu->scroll_y + glui->line_height * selection, width, glui->line_height, width, height, &lightblue_bg[0]); @@ -700,8 +700,8 @@ static void glui_frame(void) width, height, &blue_bg[0]); - /* shadow underneath header */ - glui_render_quad(gl, 0, header_height, width, + /* tabs background */ + glui_render_quad(gl, 0, height - glui->tabs_height, width, glui->tabs_height, width, height, &blue_bg[0]); @@ -728,19 +728,19 @@ static void glui_frame(void) strlcpy(tab_label, string_to_upper(tab_label), sizeof(tab_label)); glui_blit_line(width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5), - header_height - header_height/8, + height - glui->tabs_height - header_height/8, width, height, tab_label, tab_color, TEXT_ALIGN_CENTER); } tab_width = width / (GLUI_SYSTEM_TAB_END+1); glui_render_quad(gl, glui->categories.selection_ptr * tab_width, - header_height + glui->tabs_height - (header_height/16), + height - (header_height/16), tab_width, header_height/16, width, height, &pure_white[0]); - glui_render_quad(gl, 0, header_height + glui->tabs_height, width, + glui_render_quad(gl, 0, header_height, width, header_height/12, width, height, &shadow_bg[0]); From 1eda4a094ff0a9748cba6221fa173df407ed572b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 17:40:06 +0700 Subject: [PATCH 15/25] (GLUI) Use a white theme for the tabs --- menu/drivers/glui.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 33c6a52ee9..9865746202 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -643,8 +643,8 @@ static void glui_frame(void) const uint32_t normal_color = 0x212121ff; const uint32_t hover_color = 0x212121ff; const uint32_t title_color = 0xffffffff; - const uint32_t activetab_color = 0xffffffff; - const uint32_t passivetab_color = 0xffffff88; + const uint32_t activetab_color = 0x0096f2ff; + const uint32_t passivetab_color = 0x9e9e9eff; if (!menu || !menu->userdata) return; @@ -704,7 +704,13 @@ static void glui_frame(void) glui_render_quad(gl, 0, height - glui->tabs_height, width, glui->tabs_height, width, height, - &blue_bg[0]); + &white_bg[0]); + + /* tabs separator */ + glui_render_quad(gl, 0, height - glui->tabs_height, width, + 1, + width, height, + &grey_bg[0]); for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++) { @@ -738,7 +744,7 @@ static void glui_frame(void) tab_width, header_height/16, width, height, - &pure_white[0]); + &blue_bg[0]); glui_render_quad(gl, 0, header_height, width, header_height/12, From 2b1bbadc3b0ae10d2bb6d74724de2e03bf595cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 18:24:37 +0700 Subject: [PATCH 16/25] (XMB) Use icons for tabs instead of labels --- menu/drivers/glui.c | 52 +++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 9865746202..ccffa27f07 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -44,6 +44,12 @@ enum GLUI_TEXTURE_BACK, GLUI_TEXTURE_SWITCH_ON, GLUI_TEXTURE_SWITCH_OFF, + GLUI_TEXTURE_TAB_MAIN_ACTIVE, + GLUI_TEXTURE_TAB_PLAYLISTS_ACTIVE, + GLUI_TEXTURE_TAB_SETTINGS_ACTIVE, + GLUI_TEXTURE_TAB_MAIN_PASSIVE, + GLUI_TEXTURE_TAB_PLAYLISTS_PASSIVE, + GLUI_TEXTURE_TAB_SETTINGS_PASSIVE, GLUI_TEXTURE_LAST }; @@ -135,6 +141,24 @@ static void glui_context_reset_textures(glui_handle_t *glui, const char *iconpat case GLUI_TEXTURE_SWITCH_OFF: fill_pathname_join(path, iconpath, "off.png", sizeof(path)); break; + case GLUI_TEXTURE_TAB_MAIN_ACTIVE: + fill_pathname_join(path, iconpath, "main_tab_active.png", sizeof(path)); + break; + case GLUI_TEXTURE_TAB_PLAYLISTS_ACTIVE: + fill_pathname_join(path, iconpath, "playlists_tab_active.png", sizeof(path)); + break; + case GLUI_TEXTURE_TAB_SETTINGS_ACTIVE: + fill_pathname_join(path, iconpath, "settings_tab_active.png", sizeof(path)); + break; + case GLUI_TEXTURE_TAB_MAIN_PASSIVE: + fill_pathname_join(path, iconpath, "main_tab_passive.png", sizeof(path)); + break; + case GLUI_TEXTURE_TAB_PLAYLISTS_PASSIVE: + fill_pathname_join(path, iconpath, "playlists_tab_passive.png", sizeof(path)); + break; + case GLUI_TEXTURE_TAB_SETTINGS_PASSIVE: + fill_pathname_join(path, iconpath, "settings_tab_passive.png", sizeof(path)); + break; } if (path[0] == '\0' || !path_file_exists(path)) @@ -714,28 +738,30 @@ static void glui_frame(void) for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++) { - uint32_t tab_color = passivetab_color; - if (i == glui->categories.selection_ptr) - tab_color = activetab_color; - - char tab_label[PATH_MAX_LENGTH]; + unsigned tab_icon = GLUI_TEXTURE_TAB_MAIN_PASSIVE; switch (i) { case GLUI_SYSTEM_TAB_MAIN: - strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(tab_label)); + tab_icon = (i == glui->categories.selection_ptr) + ? GLUI_TEXTURE_TAB_MAIN_ACTIVE + : GLUI_TEXTURE_TAB_MAIN_PASSIVE; break; case GLUI_SYSTEM_TAB_PLAYLISTS: - strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB), sizeof(tab_label)); + tab_icon = (i == glui->categories.selection_ptr) + ? GLUI_TEXTURE_TAB_PLAYLISTS_ACTIVE + : GLUI_TEXTURE_TAB_PLAYLISTS_PASSIVE; break; case GLUI_SYSTEM_TAB_SETTINGS: - strlcpy(tab_label, menu_hash_to_str(MENU_VALUE_SETTINGS_TAB), sizeof(tab_label)); + tab_icon = (i == glui->categories.selection_ptr) + ? GLUI_TEXTURE_TAB_SETTINGS_ACTIVE + : GLUI_TEXTURE_TAB_SETTINGS_PASSIVE; break; } - strlcpy(tab_label, string_to_upper(tab_label), sizeof(tab_label)); - glui_blit_line(width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5), - height - glui->tabs_height - header_height/8, - width, height, tab_label, tab_color, TEXT_ALIGN_CENTER); + glui_draw_icon(gl, glui, glui->textures.list[tab_icon].id, + width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5) - glui->icon_size/2, + height - glui->tabs_height, + width, height, 0, 1, &pure_white[0]); } tab_width = width / (GLUI_SYSTEM_TAB_END+1); @@ -851,7 +877,7 @@ static void glui_layout(menu_handle_t *menu, glui_handle_t *glui) new_header_height = scale_factor / 3; new_font_size = scale_factor / 9; - glui->tabs_height = scale_factor / 4; + glui->tabs_height = scale_factor / 3; glui->line_height = scale_factor / 3; glui->margin = scale_factor / 9; glui->icon_size = scale_factor / 3; From 0fa2e553b291c6f423cb6316e3d40ee893fa835f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 18:27:40 +0700 Subject: [PATCH 17/25] (XMB) Use pure white color when displaying an icon with GL --- menu/drivers/glui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index ccffa27f07..f6bea2af88 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -783,7 +783,7 @@ static void glui_frame(void) { title_margin = glui->icon_size; glui_draw_icon(gl, glui, glui->textures.list[GLUI_TEXTURE_BACK].id, - 0, 0, width, height, 0, 1, &white_bg[0]); + 0, 0, width, height, 0, 1, &pure_white[0]); } ticker_limit = (width - glui->margin*2) / glui->glyph_width; From cdfb274ac22f2ba8c42c611454802dfab4927b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 29 Oct 2015 18:36:57 +0700 Subject: [PATCH 18/25] (GLUI) Hide tabs if we're not on the root level of the navigation --- menu/drivers/glui.c | 125 ++++++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 58 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index f6bea2af88..c0601cabf1 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -599,6 +599,22 @@ static void glui_draw_cursor(gl_t *gl, glui_handle_t *glui, MENU_DISPLAY_PRIM_TRIANGLESTRIP); } +static size_t glui_list_get_size(void *data, menu_list_type_t type) +{ + size_t list_size = 0; + menu_handle_t *menu = (menu_handle_t*)data; + glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL; + + /*switch (type) + { + case MENU_LIST_PLAIN:*/ + list_size = menu_entries_get_stack_size(0); + /*break; + }*/ + + return list_size; +} + static void glui_frame(void) { unsigned header_height; @@ -724,53 +740,62 @@ static void glui_frame(void) width, height, &blue_bg[0]); - /* tabs background */ - glui_render_quad(gl, 0, height - glui->tabs_height, width, - glui->tabs_height, - width, height, - &white_bg[0]); - - /* tabs separator */ - glui_render_quad(gl, 0, height - glui->tabs_height, width, - 1, - width, height, - &grey_bg[0]); - - for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++) + /* display tabs if depth equal one, if not hide them */ + if (glui_list_get_size(menu, MENU_LIST_PLAIN) == 1) { - unsigned tab_icon = GLUI_TEXTURE_TAB_MAIN_PASSIVE; - switch (i) + /* tabs background */ + glui_render_quad(gl, 0, height - glui->tabs_height, width, + glui->tabs_height, + width, height, + &white_bg[0]); + + /* tabs separator */ + glui_render_quad(gl, 0, height - glui->tabs_height, width, + 1, + width, height, + &grey_bg[0]); + + for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++) { - case GLUI_SYSTEM_TAB_MAIN: - tab_icon = (i == glui->categories.selection_ptr) - ? GLUI_TEXTURE_TAB_MAIN_ACTIVE - : GLUI_TEXTURE_TAB_MAIN_PASSIVE; - break; - case GLUI_SYSTEM_TAB_PLAYLISTS: - tab_icon = (i == glui->categories.selection_ptr) - ? GLUI_TEXTURE_TAB_PLAYLISTS_ACTIVE - : GLUI_TEXTURE_TAB_PLAYLISTS_PASSIVE; - break; - case GLUI_SYSTEM_TAB_SETTINGS: - tab_icon = (i == glui->categories.selection_ptr) - ? GLUI_TEXTURE_TAB_SETTINGS_ACTIVE - : GLUI_TEXTURE_TAB_SETTINGS_PASSIVE; - break; + unsigned tab_icon = GLUI_TEXTURE_TAB_MAIN_PASSIVE; + switch (i) + { + case GLUI_SYSTEM_TAB_MAIN: + tab_icon = (i == glui->categories.selection_ptr) + ? GLUI_TEXTURE_TAB_MAIN_ACTIVE + : GLUI_TEXTURE_TAB_MAIN_PASSIVE; + break; + case GLUI_SYSTEM_TAB_PLAYLISTS: + tab_icon = (i == glui->categories.selection_ptr) + ? GLUI_TEXTURE_TAB_PLAYLISTS_ACTIVE + : GLUI_TEXTURE_TAB_PLAYLISTS_PASSIVE; + break; + case GLUI_SYSTEM_TAB_SETTINGS: + tab_icon = (i == glui->categories.selection_ptr) + ? GLUI_TEXTURE_TAB_SETTINGS_ACTIVE + : GLUI_TEXTURE_TAB_SETTINGS_PASSIVE; + break; + } + + glui_draw_icon(gl, glui, glui->textures.list[tab_icon].id, + width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5) - glui->icon_size/2, + height - glui->tabs_height, + width, height, 0, 1, &pure_white[0]); } - glui_draw_icon(gl, glui, glui->textures.list[tab_icon].id, - width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5) - glui->icon_size/2, - height - glui->tabs_height, - width, height, 0, 1, &pure_white[0]); + /* active tab marker */ + tab_width = width / (GLUI_SYSTEM_TAB_END+1); + glui_render_quad(gl, glui->categories.selection_ptr * tab_width, + height - (header_height/16), + tab_width, + header_height/16, + width, height, + &blue_bg[0]); + } + else + { + glui->tabs_height = 0; } - - tab_width = width / (GLUI_SYSTEM_TAB_END+1); - glui_render_quad(gl, glui->categories.selection_ptr * tab_width, - height - (header_height/16), - tab_width, - header_height/16, - width, height, - &blue_bg[0]); glui_render_quad(gl, 0, header_height, width, header_height/12, @@ -1210,22 +1235,6 @@ static void glui_list_cache(menu_list_type_t type, unsigned action) } } -static size_t glui_list_get_size(void *data, menu_list_type_t type) -{ - size_t list_size = 0; - menu_handle_t *menu = (menu_handle_t*)data; - glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL; - - /*switch (type) - { - case MENU_LIST_PLAIN:*/ - list_size = menu_entries_get_stack_size(0); - /*break; - }*/ - - return list_size; -} - menu_ctx_driver_t menu_ctx_glui = { NULL, glui_get_message, From 507fa8028eb1cd1f15317fb02fe016e894b647a8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 29 Oct 2015 13:05:01 +0100 Subject: [PATCH 19/25] Set tabs_height again if glui_list_get_size is 1 --- menu/drivers/glui.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index c0601cabf1..7e26ee5139 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -743,6 +743,11 @@ static void glui_frame(void) /* display tabs if depth equal one, if not hide them */ if (glui_list_get_size(menu, MENU_LIST_PLAIN) == 1) { + float scale_factor; + menu_display_ctl(MENU_DISPLAY_CTL_GET_DPI, &scale_factor); + + glui->tabs_height = scale_factor / 3; + /* tabs background */ glui_render_quad(gl, 0, height - glui->tabs_height, width, glui->tabs_height, From f38ba514ed077c472508a8f23018ab4c3cf5952e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 29 Oct 2015 13:32:58 +0100 Subject: [PATCH 20/25] Get rid of unused variables --- menu/drivers/glui.c | 6 +++--- menu/menu_setting.c | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 7e26ee5139..16507ff3a8 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -602,8 +602,6 @@ static void glui_draw_cursor(gl_t *gl, glui_handle_t *glui, static size_t glui_list_get_size(void *data, menu_list_type_t type) { size_t list_size = 0; - menu_handle_t *menu = (menu_handle_t*)data; - glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL; /*switch (type) { @@ -686,6 +684,9 @@ static void glui_frame(void) const uint32_t activetab_color = 0x0096f2ff; const uint32_t passivetab_color = 0x9e9e9eff; + (void)passivetab_color; + (void)activetab_color; + if (!menu || !menu->userdata) return; @@ -1166,7 +1167,6 @@ static void glui_list_cache(menu_list_type_t type, unsigned action) glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); - file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); if (!menu) return; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1f6f6a0b88..4112b3f15e 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -482,7 +482,6 @@ rarch_setting_t *menu_setting_find(const char *label) int menu_setting_set_flags(rarch_setting_t *setting) { - uint64_t flags = menu_setting_get_flags(setting); if (!setting) return 0; From dc01a392ead5865f3db6fd3e428fd6fbf67bfc15 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 29 Oct 2015 13:35:15 +0100 Subject: [PATCH 21/25] (GLUI) Implement glui_list_push --- menu/drivers/glui.c | 58 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 16507ff3a8..fb27d4f08b 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -1240,6 +1240,62 @@ static void glui_list_cache(menu_list_type_t type, unsigned action) } } +static int glui_list_push(menu_displaylist_info_t *info, unsigned type) +{ + int ret = -1; + menu_handle_t *menu = menu_driver_get_ptr(); + global_t *global = global_get_ptr(); + + switch (type) + { + case DISPLAYLIST_MAIN_MENU: + menu_entries_clear(info->list); + + if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY)) + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false); + +#if defined(HAVE_DYNAMIC) || defined(HAVE_LIBRETRO_MANAGEMENT) + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_CORE_LIST), PARSE_ACTION, false); +#endif + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_LIST), PARSE_ACTION, false); + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_HISTORY), PARSE_ACTION, false); +#if defined(HAVE_NETWORKING) +#if defined(HAVE_LIBRETRODB) + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_ADD_CONTENT_LIST), PARSE_ACTION, false); +#endif + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_ONLINE_UPDATER), PARSE_ACTION, false); +#endif + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_INFORMATION_LIST), PARSE_ACTION, false); +#ifndef HAVE_DYNAMIC + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_RESTART_RETROARCH), PARSE_ACTION, false); +#endif + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_CONFIGURATIONS), PARSE_ACTION, false); + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_SAVE_NEW_CONFIG), PARSE_ACTION, false); + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_HELP_LIST), PARSE_ACTION, false); +#if !defined(IOS) + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_QUIT_RETROARCH), PARSE_ACTION, false); +#endif + menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_SHUTDOWN), PARSE_ACTION, false); + info->need_push = true; + ret = 0; + break; + } + return ret; +} + menu_ctx_driver_t menu_ctx_glui = { NULL, glui_get_message, @@ -1264,7 +1320,7 @@ menu_ctx_driver_t menu_ctx_glui = { NULL, NULL, glui_list_cache, - NULL, + glui_list_push, NULL, glui_list_get_size, NULL, From d796ac592af1252f5855ce4051b35f844d460736 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 29 Oct 2015 14:48:55 +0100 Subject: [PATCH 22/25] Set type of 'No Items' and attempt to implement a left callback by default --- menu/cbs/menu_cbs_left.c | 9 +++++++++ menu/menu.h | 1 + menu/menu_displaylist.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 2fc99f833d..cd0d7c7892 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -458,6 +458,15 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, { switch (type) { + case MENU_SETTING_NO_ITEM: + switch (menu_label_hash) + { + case MENU_VALUE_HORIZONTAL_MENU: + case MENU_VALUE_MAIN_MENU: + BIND_ACTION_LEFT(cbs, action_left_mainmenu); + break; + } + break; case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX: BIND_ACTION_LEFT(cbs, disk_options_disk_idx_left); break; diff --git a/menu/menu.h b/menu/menu.h index d9623b8c7a..8d4def3215 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -105,6 +105,7 @@ typedef enum MENU_HISTORY_TAB, MENU_ADD_TAB, MENU_PLAYLISTS_TAB, + MENU_SETTING_NO_ITEM, MENU_SETTING_DRIVER, MENU_SETTING_ACTION, MENU_SETTING_ACTION_RUN, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c8ed578e39..3c4d84369f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1706,7 +1706,7 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t else menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_NO_ITEMS), - "", 0, 0, 0); + "", MENU_SETTING_NO_ITEM, 0, 0); return 0; } From d4f037f6d7346a17e3b6e579ead0fa51d146bb7a Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 29 Oct 2015 15:00:29 +0100 Subject: [PATCH 23/25] Add default left/right callbacks for 'No Items' --- menu/cbs/menu_cbs_left.c | 23 ++++++++++++++--------- menu/cbs/menu_cbs_right.c | 14 ++++++++++++++ menu/menu_displaylist.c | 6 +++--- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index cd0d7c7892..5dbc82d44b 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -458,15 +458,6 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, { switch (type) { - case MENU_SETTING_NO_ITEM: - switch (menu_label_hash) - { - case MENU_VALUE_HORIZONTAL_MENU: - case MENU_VALUE_MAIN_MENU: - BIND_ACTION_LEFT(cbs, action_left_mainmenu); - break; - } - break; case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX: BIND_ACTION_LEFT(cbs, disk_options_disk_idx_left); break; @@ -535,6 +526,20 @@ int menu_cbs_init_bind_left(menu_file_list_cbs_t *cbs, BIND_ACTION_LEFT(cbs, bind_left_generic); + if (type == MENU_SETTING_NO_ITEM) + { + switch (menu_label_hash) + { + case MENU_VALUE_HORIZONTAL_MENU: + case MENU_VALUE_MAIN_MENU: + case 153956705: /* TODO/FIXME - dehardcode */ + BIND_ACTION_LEFT(cbs, action_left_mainmenu); + return 0; + default: + break; + } + } + if (menu_cbs_init_bind_left_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0) return 0; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 3c112a6b19..5a4d1e445b 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -552,6 +552,20 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, return -1; BIND_ACTION_RIGHT(cbs, bind_right_generic); + + if (type == MENU_SETTING_NO_ITEM) + { + switch (menu_label_hash) + { + case MENU_VALUE_HORIZONTAL_MENU: + case MENU_VALUE_MAIN_MENU: + case 153956705: /* TODO/FIXME - dehardcode */ + BIND_ACTION_RIGHT(cbs, action_right_mainmenu); + return 0; + default: + break; + } + } if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label_hash, elem0) == 0) return 0; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 3c4d84369f..6c7f4a18fc 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1929,7 +1929,7 @@ static int menu_displaylist_parse_options(menu_displaylist_info_t *info) #else menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_NO_ITEMS), - "", 0, 0, 0); + "", MENU_SETTING_NO_ITEM, 0, 0); #endif return 0; @@ -2125,7 +2125,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool ho { menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_NO_ITEMS), - "", 0, 0, 0); + "", MENU_SETTING_NO_ITEM, 0, 0); } string_list_free(str_list); @@ -2402,7 +2402,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) #else menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_NO_ITEMS), - "", 0, 0, 0); + "", MENU_SETTING_NO_ITEM, 0, 0); ret = 0; #endif info->need_refresh = true; From c85414c7bed3cdb0dc4b28153bed9e0e9b83feaa Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 29 Oct 2015 23:23:56 +0100 Subject: [PATCH 24/25] (iOS) Force mipmapping off for textures on iOS --- gfx/drivers/gl_common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gfx/drivers/gl_common.c b/gfx/drivers/gl_common.c index 7b908cfaee..36d2ccfe81 100644 --- a/gfx/drivers/gl_common.c +++ b/gfx/drivers/gl_common.c @@ -64,6 +64,13 @@ void gl_load_texture_data(GLuint id, glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap); + +#ifdef IOS + if (filter_type == TEXTURE_FILTER_MIPMAP_LINEAR) + filter_type = TEXTURE_FILTER_LINEAR; + if (filter_type == TEXTURE_FILTER_MIPMAP_NEAREST) + filter_type = TEXTURE_FILTER_NEAREST; +#endif switch (filter_type) { From 0750fe50bb6b1a2d652328295dac818de265881c Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Thu, 29 Oct 2015 22:04:48 -0200 Subject: [PATCH 25/25] better network initialization in net_http_new_socket --- libretro-common/net/net_http.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index a3dc3ce3d1..e34185954d 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -76,7 +76,8 @@ static int net_http_new_socket(const char *domain, int port) char portstr[16] = {0}; /* Initialize the network. */ - network_init(); + if (!network_init()) + return -1; snprintf(portstr, sizeof(portstr), "%i", port);