2014-10-08 23:21:22 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2016-05-05 15:00:43 +00:00
|
|
|
* Copyright (C) 2014-2015 - Jean-André Santoni
|
2014-10-08 23:21:22 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
2014-10-16 05:27:42 +00:00
|
|
|
#include <stdint.h>
|
2014-10-08 23:21:22 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
2015-06-05 16:22:15 +00:00
|
|
|
#include <file/file_path.h>
|
|
|
|
#include <compat/posix_string.h>
|
2015-11-08 00:30:07 +00:00
|
|
|
#include <compat/strl.h>
|
|
|
|
#include <formats/image.h>
|
2015-06-05 16:22:15 +00:00
|
|
|
#include <string/stdstring.h>
|
2016-03-20 13:53:54 +00:00
|
|
|
#include <lists/string_list.h>
|
2015-11-08 00:30:07 +00:00
|
|
|
#include <gfx/math/matrix_4x4.h>
|
2015-06-04 20:46:23 +00:00
|
|
|
|
2015-10-03 01:15:47 +00:00
|
|
|
#include "menu_generic.h"
|
|
|
|
|
2015-06-04 08:39:48 +00:00
|
|
|
#include "../menu_driver.h"
|
2015-05-10 09:23:00 +00:00
|
|
|
#include "../menu_entry.h"
|
2015-02-11 02:52:35 +00:00
|
|
|
#include "../menu_animation.h"
|
2015-04-24 20:17:08 +00:00
|
|
|
#include "../menu_display.h"
|
2015-06-17 17:55:24 +00:00
|
|
|
#include "../menu_hash.h"
|
2015-10-18 05:15:54 +00:00
|
|
|
#include "../menu_display.h"
|
2015-12-09 08:53:43 +00:00
|
|
|
#include "../menu_navigation.h"
|
2015-02-11 02:52:35 +00:00
|
|
|
|
2015-06-12 14:01:46 +00:00
|
|
|
#include "../menu_cbs.h"
|
2015-06-04 20:46:23 +00:00
|
|
|
|
2016-02-04 10:28:12 +00:00
|
|
|
#include "../../frontend/frontend_driver.h"
|
2015-11-23 11:03:38 +00:00
|
|
|
#include "../../verbosity.h"
|
2015-11-08 00:30:07 +00:00
|
|
|
#include "../../configuration.h"
|
2016-03-21 18:23:45 +00:00
|
|
|
#include "../../retroarch.h"
|
2016-01-24 00:51:05 +00:00
|
|
|
#include "../../system.h"
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2016-02-09 16:12:39 +00:00
|
|
|
#include "../../tasks/tasks_internal.h"
|
2015-04-13 16:59:39 +00:00
|
|
|
|
2016-04-22 22:24:44 +00:00
|
|
|
#define XMB_RIBBON_ROWS 64
|
|
|
|
#define XMB_RIBBON_COLS 64
|
2016-04-19 21:00:55 +00:00
|
|
|
#define XMB_RIBBON_VERTICES 2*XMB_RIBBON_COLS*XMB_RIBBON_ROWS-2*XMB_RIBBON_COLS
|
2016-04-16 19:09:54 +00:00
|
|
|
|
2014-10-09 00:41:08 +00:00
|
|
|
#ifndef XMB_DELAY
|
2015-03-06 15:00:46 +00:00
|
|
|
#define XMB_DELAY 10
|
2014-10-09 00:41:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
float alpha;
|
2014-10-20 18:00:39 +00:00
|
|
|
float label_alpha;
|
2014-10-09 00:41:08 +00:00
|
|
|
float zoom;
|
2014-10-20 18:00:39 +00:00
|
|
|
float x;
|
2014-10-09 00:41:08 +00:00
|
|
|
float y;
|
2015-11-08 00:30:07 +00:00
|
|
|
uintptr_t icon;
|
|
|
|
uintptr_t content_icon;
|
2014-10-09 00:41:08 +00:00
|
|
|
} xmb_node_t;
|
|
|
|
|
2014-10-09 02:34:16 +00:00
|
|
|
enum
|
|
|
|
{
|
2015-10-20 12:11:43 +00:00
|
|
|
XMB_TEXTURE_MAIN_MENU = 0,
|
|
|
|
XMB_TEXTURE_SETTINGS,
|
2015-10-22 18:05:51 +00:00
|
|
|
XMB_TEXTURE_HISTORY,
|
2014-10-09 20:59:05 +00:00
|
|
|
XMB_TEXTURE_SETTING,
|
|
|
|
XMB_TEXTURE_SUBSETTING,
|
|
|
|
XMB_TEXTURE_ARROW,
|
|
|
|
XMB_TEXTURE_RUN,
|
2015-06-25 04:14:22 +00:00
|
|
|
XMB_TEXTURE_CLOSE,
|
2014-10-09 20:59:05 +00:00
|
|
|
XMB_TEXTURE_RESUME,
|
|
|
|
XMB_TEXTURE_SAVESTATE,
|
|
|
|
XMB_TEXTURE_LOADSTATE,
|
2015-02-17 22:43:34 +00:00
|
|
|
XMB_TEXTURE_CORE_INFO,
|
|
|
|
XMB_TEXTURE_CORE_OPTIONS,
|
|
|
|
XMB_TEXTURE_INPUT_REMAPPING_OPTIONS,
|
|
|
|
XMB_TEXTURE_CHEAT_OPTIONS,
|
|
|
|
XMB_TEXTURE_DISK_OPTIONS,
|
2015-06-25 04:47:20 +00:00
|
|
|
XMB_TEXTURE_SHADER_OPTIONS,
|
2015-11-19 08:14:19 +00:00
|
|
|
XMB_TEXTURE_ACHIEVEMENT_LIST,
|
2014-10-09 20:59:05 +00:00
|
|
|
XMB_TEXTURE_SCREENSHOT,
|
|
|
|
XMB_TEXTURE_RELOAD,
|
2014-10-14 21:05:53 +00:00
|
|
|
XMB_TEXTURE_FILE,
|
|
|
|
XMB_TEXTURE_FOLDER,
|
|
|
|
XMB_TEXTURE_ZIP,
|
2015-06-30 16:07:22 +00:00
|
|
|
XMB_TEXTURE_MUSIC,
|
2015-07-01 12:53:34 +00:00
|
|
|
XMB_TEXTURE_IMAGE,
|
2015-07-04 00:14:26 +00:00
|
|
|
XMB_TEXTURE_MOVIE,
|
2014-10-18 14:26:02 +00:00
|
|
|
XMB_TEXTURE_CORE,
|
2015-02-02 23:27:18 +00:00
|
|
|
XMB_TEXTURE_RDB,
|
|
|
|
XMB_TEXTURE_CURSOR,
|
2014-10-22 00:41:28 +00:00
|
|
|
XMB_TEXTURE_SWITCH_ON,
|
|
|
|
XMB_TEXTURE_SWITCH_OFF,
|
2015-02-04 21:44:33 +00:00
|
|
|
XMB_TEXTURE_CLOCK,
|
2015-03-08 23:14:55 +00:00
|
|
|
XMB_TEXTURE_POINTER,
|
2015-10-24 17:37:59 +00:00
|
|
|
XMB_TEXTURE_ADD,
|
2014-10-09 20:59:05 +00:00
|
|
|
XMB_TEXTURE_LAST
|
2014-10-09 02:34:16 +00:00
|
|
|
};
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2015-10-22 02:52:57 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
XMB_SYSTEM_TAB_MAIN = 0,
|
2015-10-22 18:05:51 +00:00
|
|
|
XMB_SYSTEM_TAB_SETTINGS,
|
2015-10-24 17:37:59 +00:00
|
|
|
XMB_SYSTEM_TAB_HISTORY,
|
|
|
|
XMB_SYSTEM_TAB_ADD
|
2015-10-22 02:52:57 +00:00
|
|
|
};
|
|
|
|
|
2016-01-14 12:30:25 +00:00
|
|
|
#ifdef HAVE_LIBRETRODB
|
2015-10-24 17:37:59 +00:00
|
|
|
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_ADD
|
2016-01-14 12:30:25 +00:00
|
|
|
#else
|
|
|
|
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_HISTORY
|
|
|
|
#endif
|
2015-10-21 23:03:49 +00:00
|
|
|
|
2014-10-09 02:34:16 +00:00
|
|
|
typedef struct xmb_handle
|
|
|
|
{
|
2014-11-27 16:03:27 +00:00
|
|
|
file_list_t *menu_stack_old;
|
|
|
|
file_list_t *selection_buf_old;
|
2015-06-08 14:08:00 +00:00
|
|
|
file_list_t *horizontal_list;
|
2014-11-27 16:03:27 +00:00
|
|
|
size_t selection_ptr_old;
|
2014-10-10 20:42:56 +00:00
|
|
|
int depth;
|
2014-10-11 23:27:31 +00:00
|
|
|
int old_depth;
|
2015-01-07 19:42:36 +00:00
|
|
|
char box_message[PATH_MAX_LENGTH];
|
2014-10-11 23:27:31 +00:00
|
|
|
float x;
|
2014-10-10 20:42:56 +00:00
|
|
|
float alpha;
|
2016-04-07 18:42:53 +00:00
|
|
|
uintptr_t thumbnail;
|
|
|
|
float thumbnail_width;
|
|
|
|
float thumbnail_height;
|
2015-10-25 20:02:21 +00:00
|
|
|
char background_file_path[PATH_MAX_LENGTH];
|
2016-04-07 18:42:53 +00:00
|
|
|
char thumbnail_file_path[PATH_MAX_LENGTH];
|
2015-10-25 20:02:21 +00:00
|
|
|
|
2015-02-12 19:23:14 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float left;
|
|
|
|
float top;
|
2015-02-12 19:26:04 +00:00
|
|
|
|
2015-02-12 19:23:14 +00:00
|
|
|
} screen;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float left;
|
|
|
|
} setting;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float left;
|
|
|
|
float top;
|
|
|
|
float bottom;
|
|
|
|
} title;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float left;
|
|
|
|
float top;
|
|
|
|
} label;
|
|
|
|
} margins;
|
|
|
|
|
2016-05-08 21:05:11 +00:00
|
|
|
float above_subitem_offset;
|
|
|
|
float above_item_offset;
|
|
|
|
float active_item_factor;
|
|
|
|
float under_item_offset;
|
2016-05-08 21:09:52 +00:00
|
|
|
|
2016-05-08 20:57:02 +00:00
|
|
|
float shadow_offset;
|
|
|
|
|
2015-12-06 12:28:20 +00:00
|
|
|
char title_name[256];
|
2015-02-12 17:34:36 +00:00
|
|
|
|
2016-03-09 21:17:18 +00:00
|
|
|
struct
|
2015-02-12 18:27:13 +00:00
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float alpha;
|
|
|
|
} arrow;
|
|
|
|
|
2016-03-05 07:40:28 +00:00
|
|
|
menu_texture_item bg;
|
|
|
|
menu_texture_item list[XMB_TEXTURE_LAST];
|
2015-02-12 18:27:13 +00:00
|
|
|
} textures;
|
|
|
|
|
2015-02-12 17:31:46 +00:00
|
|
|
struct
|
|
|
|
{
|
2015-02-12 22:38:44 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
float horizontal;
|
|
|
|
float vertical;
|
|
|
|
} spacing;
|
|
|
|
|
2015-02-12 17:31:46 +00:00
|
|
|
char dir[4];
|
|
|
|
int size;
|
|
|
|
} icon;
|
|
|
|
|
2015-03-08 23:14:55 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
} cursor;
|
2015-02-12 17:23:47 +00:00
|
|
|
|
2015-02-12 17:18:38 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2015-03-16 16:40:05 +00:00
|
|
|
unsigned idx;
|
|
|
|
unsigned idx_old;
|
2016-05-08 21:19:34 +00:00
|
|
|
float alpha;
|
|
|
|
float zoom;
|
2015-02-12 17:18:38 +00:00
|
|
|
} active;
|
2015-02-12 18:23:11 +00:00
|
|
|
|
2016-05-08 21:19:34 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
float alpha;
|
|
|
|
float zoom;
|
|
|
|
} passive;
|
|
|
|
|
2015-02-12 18:23:11 +00:00
|
|
|
float x_pos;
|
|
|
|
size_t selection_ptr_old;
|
2015-06-15 17:00:52 +00:00
|
|
|
size_t selection_ptr;
|
2015-02-12 18:23:11 +00:00
|
|
|
} categories;
|
2015-02-12 17:18:38 +00:00
|
|
|
|
2016-05-08 21:22:22 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float alpha;
|
|
|
|
float zoom;
|
|
|
|
} active;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
float alpha;
|
|
|
|
float zoom;
|
|
|
|
} passive;
|
|
|
|
} items;
|
|
|
|
|
2015-10-20 12:11:43 +00:00
|
|
|
xmb_node_t main_menu_node;
|
|
|
|
xmb_node_t settings_tab_node;
|
2015-10-22 18:05:51 +00:00
|
|
|
xmb_node_t history_tab_node;
|
2015-10-24 17:37:59 +00:00
|
|
|
xmb_node_t add_tab_node;
|
2015-03-25 14:04:53 +00:00
|
|
|
|
2016-05-10 00:42:02 +00:00
|
|
|
video_font_raster_block_t raster_block;
|
2014-10-09 02:34:16 +00:00
|
|
|
} xmb_handle_t;
|
|
|
|
|
2016-04-22 08:20:08 +00:00
|
|
|
float gradient_dark_purple[16] = {
|
|
|
|
20/255.0, 13/255.0, 20/255.0, 1.0,
|
|
|
|
20/255.0, 13/255.0, 20/255.0, 1.0,
|
|
|
|
92/255.0, 44/255.0, 92/255.0, 1.0,
|
|
|
|
148/255.0, 90/255.0, 148/255.0, 1.0,
|
2016-04-22 06:47:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
float gradient_midnight_blue[16] = {
|
|
|
|
44/255.0, 62/255.0, 80/255.0, 1.0,
|
|
|
|
44/255.0, 62/255.0, 80/255.0, 1.0,
|
|
|
|
44/255.0, 62/255.0, 80/255.0, 1.0,
|
|
|
|
44/255.0, 62/255.0, 80/255.0, 1.0,
|
|
|
|
};
|
|
|
|
|
2016-04-22 08:20:08 +00:00
|
|
|
float gradient_golden[16] = {
|
|
|
|
174/255.0, 123/255.0, 44/255.0, 1.0,
|
|
|
|
205/255.0, 174/255.0, 84/255.0, 1.0,
|
|
|
|
58/255.0, 43/255.0, 24/255.0, 1.0,
|
|
|
|
58/255.0, 43/255.0, 24/255.0, 1.0,
|
2016-04-22 06:47:14 +00:00
|
|
|
};
|
|
|
|
|
2016-04-22 08:20:08 +00:00
|
|
|
float gradient_legacy_red[16] = {
|
|
|
|
171/255.0, 70/255.0, 59/255.0, 1.0,
|
|
|
|
171/255.0, 70/255.0, 59/255.0, 1.0,
|
|
|
|
190/255.0, 80/255.0, 69/255.0, 1.0,
|
|
|
|
190/255.0, 80/255.0, 69/255.0, 1.0,
|
|
|
|
};
|
|
|
|
|
|
|
|
float gradient_electric_blue[16] = {
|
|
|
|
1/255.0, 2/255.0, 67/255.0, 1.0,
|
|
|
|
1/255.0, 73/255.0, 183/255.0, 1.0,
|
|
|
|
1/255.0, 93/255.0, 194/255.0, 1.0,
|
|
|
|
3/255.0, 162/255.0, 254/255.0, 1.0,
|
|
|
|
};
|
|
|
|
|
|
|
|
float gradient_apple_green[16] = {
|
|
|
|
102/255.0, 134/255.0, 58/255.0, 1.0,
|
|
|
|
122/255.0, 131/255.0, 52/255.0, 1.0,
|
|
|
|
82/255.0, 101/255.0, 35/255.0, 1.0,
|
|
|
|
63/255.0, 95/255.0, 30/255.0, 1.0,
|
|
|
|
};
|
|
|
|
|
|
|
|
float gradient_undersea[16] = {
|
|
|
|
23/255.0, 18/255.0, 41/255.0, 1.0,
|
|
|
|
30/255.0, 72/255.0, 114/255.0, 1.0,
|
|
|
|
52/255.0, 88/255.0, 110/255.0, 1.0,
|
|
|
|
69/255.0, 125/255.0, 140/255.0, 1.0,
|
|
|
|
|
2016-04-22 06:47:14 +00:00
|
|
|
};
|
|
|
|
|
2016-04-22 11:16:31 +00:00
|
|
|
float gradient_volcanic_red[16] = {
|
|
|
|
1.0, 0.0, 0.1, 1.00,
|
|
|
|
1.0, 0.1, 0.0, 1.00,
|
|
|
|
0.1, 0.0, 0.1, 1.00,
|
|
|
|
0.1, 0.0, 0.1, 1.00,
|
|
|
|
};
|
|
|
|
|
2016-04-28 22:06:32 +00:00
|
|
|
float gradient_dark[16] = {
|
|
|
|
0.1, 0.1, 0.1, 1.00,
|
|
|
|
0.1, 0.1, 0.1, 1.00,
|
|
|
|
0.0, 0.0, 0.0, 1.00,
|
|
|
|
0.0, 0.0, 0.0, 1.00,
|
|
|
|
};
|
|
|
|
|
2016-03-22 01:59:13 +00:00
|
|
|
static const char *xmb_theme_ident(void)
|
2016-03-21 19:54:16 +00:00
|
|
|
{
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
switch (settings->menu.xmb_theme)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
return "flatui";
|
|
|
|
case 2:
|
2016-04-09 05:46:40 +00:00
|
|
|
return "retroactive";
|
|
|
|
case 3:
|
2016-05-08 20:45:38 +00:00
|
|
|
return "pixel";
|
|
|
|
case 4:
|
2016-03-21 19:54:16 +00:00
|
|
|
return "custom";
|
2016-04-19 05:24:37 +00:00
|
|
|
case 0:
|
2016-03-21 19:54:16 +00:00
|
|
|
default:
|
2016-03-21 20:18:25 +00:00
|
|
|
break;
|
2016-03-21 19:54:16 +00:00
|
|
|
}
|
2016-03-21 20:18:25 +00:00
|
|
|
|
|
|
|
return "monochrome";
|
2016-03-21 19:54:16 +00:00
|
|
|
}
|
|
|
|
|
2016-04-07 18:42:53 +00:00
|
|
|
static const char *xmb_thumbnails_ident(void)
|
|
|
|
{
|
|
|
|
settings_t *settings = config_get_ptr();
|
2016-04-16 03:07:08 +00:00
|
|
|
|
2016-04-07 18:42:53 +00:00
|
|
|
switch (settings->menu.thumbnails)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
return "Named_Snaps";
|
|
|
|
case 2:
|
|
|
|
return "Named_Titles";
|
|
|
|
case 3:
|
|
|
|
return "Named_Boxarts";
|
2016-04-16 03:07:08 +00:00
|
|
|
case 0:
|
2016-04-07 18:42:53 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "OFF";
|
|
|
|
}
|
|
|
|
|
2016-04-22 06:47:14 +00:00
|
|
|
static float *xmb_gradient_ident(void)
|
|
|
|
{
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
2016-05-01 02:46:16 +00:00
|
|
|
switch (settings->menu.background_gradient)
|
2016-04-22 06:47:14 +00:00
|
|
|
{
|
|
|
|
case 1:
|
2016-04-22 08:20:08 +00:00
|
|
|
return &gradient_dark_purple[0];
|
2016-04-22 06:47:14 +00:00
|
|
|
case 2:
|
|
|
|
return &gradient_midnight_blue[0];
|
|
|
|
case 3:
|
2016-04-22 08:20:08 +00:00
|
|
|
return &gradient_golden[0];
|
|
|
|
case 4:
|
|
|
|
return &gradient_electric_blue[0];
|
|
|
|
case 5:
|
|
|
|
return &gradient_apple_green[0];
|
|
|
|
case 6:
|
|
|
|
return &gradient_undersea[0];
|
2016-04-22 11:16:31 +00:00
|
|
|
case 7:
|
|
|
|
return &gradient_volcanic_red[0];
|
2016-04-28 22:06:32 +00:00
|
|
|
case 8:
|
|
|
|
return &gradient_dark[0];
|
2016-04-22 06:47:14 +00:00
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-04-22 08:20:08 +00:00
|
|
|
return &gradient_legacy_red[0];
|
2016-04-22 06:47:14 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
static void xmb_fill_default_background_path(xmb_handle_t *xmb,
|
|
|
|
char *path, size_t size)
|
2015-10-25 20:02:21 +00:00
|
|
|
{
|
|
|
|
char mediapath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char themepath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char iconpath[PATH_MAX_LENGTH] = {0};
|
|
|
|
settings_t *settings = config_get_ptr();
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2015-10-25 20:02:21 +00:00
|
|
|
strlcpy(xmb->icon.dir, "png", sizeof(xmb->icon.dir));
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2016-04-28 17:26:02 +00:00
|
|
|
fill_pathname_join(mediapath, settings->directory.assets,
|
2015-10-25 20:02:21 +00:00
|
|
|
"xmb", sizeof(mediapath));
|
2016-03-21 20:18:25 +00:00
|
|
|
fill_pathname_join(themepath, mediapath, xmb_theme_ident(), sizeof(themepath));
|
2015-10-25 20:02:21 +00:00
|
|
|
fill_pathname_join(iconpath, themepath, xmb->icon.dir, sizeof(iconpath));
|
|
|
|
fill_pathname_slash(iconpath, sizeof(iconpath));
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2015-10-25 20:02:21 +00:00
|
|
|
fill_pathname_join(path, iconpath, "bg.png", size);
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2016-04-28 18:49:13 +00:00
|
|
|
if (*settings->path.menu_wallpaper)
|
|
|
|
strlcpy(path, settings->path.menu_wallpaper, size);
|
2015-10-25 20:02:21 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 17:00:52 +00:00
|
|
|
static size_t xmb_list_get_selection(void *data)
|
|
|
|
{
|
2015-12-11 13:50:06 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-06-15 17:00:52 +00:00
|
|
|
|
2015-07-08 15:26:23 +00:00
|
|
|
if (!xmb)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return xmb->categories.selection_ptr;
|
2015-06-15 17:00:52 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 18:27:06 +00:00
|
|
|
static size_t xmb_list_get_size(void *data, enum menu_list_type type)
|
2015-06-07 12:29:43 +00:00
|
|
|
{
|
2015-12-10 14:23:43 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-07-08 15:26:23 +00:00
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_LIST_PLAIN:
|
2016-03-03 05:59:54 +00:00
|
|
|
return menu_entries_get_stack_size(0);
|
2015-07-08 15:26:23 +00:00
|
|
|
case MENU_LIST_HORIZONTAL:
|
|
|
|
if (xmb && xmb->horizontal_list)
|
2016-03-03 05:59:54 +00:00
|
|
|
return file_list_get_size(xmb->horizontal_list);
|
2015-07-08 15:26:23 +00:00
|
|
|
break;
|
2015-10-30 09:28:27 +00:00
|
|
|
case MENU_LIST_TABS:
|
2016-03-03 05:59:54 +00:00
|
|
|
return XMB_SYSTEM_TAB_END;
|
2015-07-08 15:26:23 +00:00
|
|
|
}
|
|
|
|
|
2016-03-03 05:59:54 +00:00
|
|
|
return 0;
|
2015-06-07 12:29:43 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 18:27:06 +00:00
|
|
|
static void *xmb_list_get_entry(void *data, enum menu_list_type type, unsigned i)
|
2015-06-08 15:02:14 +00:00
|
|
|
{
|
2015-10-17 16:17:59 +00:00
|
|
|
size_t list_size = 0;
|
2015-12-11 13:52:16 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-07-08 15:26:23 +00:00
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_LIST_PLAIN:
|
2016-04-21 02:17:45 +00:00
|
|
|
{
|
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
|
|
list_size = menu_entries_get_stack_size(0);
|
|
|
|
if (i < list_size)
|
|
|
|
return (void*)&menu_stack->list[i];
|
|
|
|
}
|
2015-07-08 15:26:23 +00:00
|
|
|
break;
|
|
|
|
case MENU_LIST_HORIZONTAL:
|
|
|
|
if (xmb && xmb->horizontal_list)
|
|
|
|
list_size = file_list_get_size(xmb->horizontal_list);
|
|
|
|
if (i < list_size)
|
2016-04-21 02:17:45 +00:00
|
|
|
return (void*)&xmb->horizontal_list->list[i];
|
2015-07-08 15:26:23 +00:00
|
|
|
break;
|
2015-10-30 09:28:27 +00:00
|
|
|
default:
|
|
|
|
break;
|
2015-07-08 15:26:23 +00:00
|
|
|
}
|
|
|
|
|
2016-04-21 02:17:45 +00:00
|
|
|
return NULL;
|
2015-06-08 15:02:14 +00:00
|
|
|
}
|
|
|
|
|
2015-02-11 04:33:53 +00:00
|
|
|
static float xmb_item_y(xmb_handle_t *xmb, int i, size_t current)
|
2015-02-09 21:54:14 +00:00
|
|
|
{
|
2015-02-12 22:38:44 +00:00
|
|
|
float iy = xmb->icon.spacing.vertical;
|
2015-02-09 21:54:14 +00:00
|
|
|
|
2015-03-16 16:40:05 +00:00
|
|
|
if (i < (int)current)
|
2015-02-09 21:54:14 +00:00
|
|
|
if (xmb->depth > 1)
|
2016-05-08 21:05:11 +00:00
|
|
|
iy *= (i - (int)current + xmb->above_subitem_offset);
|
2015-02-09 21:54:14 +00:00
|
|
|
else
|
2016-05-08 21:05:11 +00:00
|
|
|
iy *= (i - (int)current + xmb->above_item_offset);
|
2015-02-09 21:54:14 +00:00
|
|
|
else
|
2016-05-08 21:05:11 +00:00
|
|
|
iy *= (i - (int)current + xmb->under_item_offset);
|
2015-02-09 21:54:14 +00:00
|
|
|
|
2015-03-16 16:40:05 +00:00
|
|
|
if (i == (int)current)
|
2016-05-08 21:05:11 +00:00
|
|
|
iy = xmb->icon.spacing.vertical * xmb->active_item_factor;
|
2015-02-09 21:54:14 +00:00
|
|
|
|
|
|
|
return iy;
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:14:25 +00:00
|
|
|
static void xmb_draw_icon(
|
2016-04-21 07:18:03 +00:00
|
|
|
int icon_size,
|
2016-04-07 16:43:04 +00:00
|
|
|
math_matrix_4x4 *mymat,
|
2015-11-08 00:30:07 +00:00
|
|
|
uintptr_t texture,
|
2016-04-21 07:14:25 +00:00
|
|
|
float x,
|
|
|
|
float y,
|
|
|
|
unsigned width,
|
|
|
|
unsigned height,
|
|
|
|
float alpha,
|
|
|
|
float rotation,
|
|
|
|
float scale_factor,
|
2016-05-08 20:57:02 +00:00
|
|
|
float *color,
|
|
|
|
float shadow_offset)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2016-02-09 03:34:07 +00:00
|
|
|
menu_display_ctx_draw_t draw;
|
2016-05-10 00:32:49 +00:00
|
|
|
struct video_coords coords;
|
2016-04-07 17:24:55 +00:00
|
|
|
float shadow[16];
|
|
|
|
unsigned i;
|
2016-04-20 06:01:51 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2014-10-09 02:34:16 +00:00
|
|
|
|
2015-02-01 14:25:37 +00:00
|
|
|
if (
|
2016-05-24 19:53:08 +00:00
|
|
|
x < (-icon_size / 2.0f) ||
|
2015-05-19 22:26:50 +00:00
|
|
|
x > width ||
|
2016-05-24 19:53:08 +00:00
|
|
|
y < (icon_size / 2.0f) ||
|
2016-04-21 07:18:03 +00:00
|
|
|
y > height + icon_size)
|
2014-10-08 23:21:22 +00:00
|
|
|
return;
|
|
|
|
|
2015-02-02 19:48:26 +00:00
|
|
|
coords.vertices = 4;
|
2015-11-02 21:37:29 +00:00
|
|
|
coords.vertex = NULL;
|
2015-11-02 21:46:23 +00:00
|
|
|
coords.tex_coord = NULL;
|
|
|
|
coords.lut_tex_coord = NULL;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2016-04-21 07:18:03 +00:00
|
|
|
draw.width = icon_size;
|
|
|
|
draw.height = icon_size;
|
2016-04-21 07:14:25 +00:00
|
|
|
draw.coords = &coords;
|
|
|
|
draw.matrix_data = mymat;
|
|
|
|
draw.texture = texture;
|
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
2016-05-08 09:11:28 +00:00
|
|
|
draw.pipeline.id = 0;
|
2016-02-09 03:34:07 +00:00
|
|
|
|
2016-04-22 05:46:56 +00:00
|
|
|
if (settings->menu.xmb_shadows_enable)
|
2016-04-07 17:24:55 +00:00
|
|
|
{
|
|
|
|
for (i = 0; i < 16; i++)
|
2016-04-21 07:14:25 +00:00
|
|
|
shadow[i] = 0;
|
2016-04-21 02:34:02 +00:00
|
|
|
|
2016-04-22 22:24:44 +00:00
|
|
|
menu_display_set_alpha(shadow, color[3] * 0.35f);
|
2016-04-07 17:24:55 +00:00
|
|
|
|
2016-04-21 07:14:25 +00:00
|
|
|
coords.color = shadow;
|
2016-05-08 20:57:02 +00:00
|
|
|
draw.x = x + shadow_offset;
|
|
|
|
draw.y = height - y - shadow_offset;
|
2016-04-07 17:24:55 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw(&draw);
|
2016-04-07 17:24:55 +00:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:14:25 +00:00
|
|
|
coords.color = (const float*)color;
|
|
|
|
draw.x = x;
|
|
|
|
draw.y = height - y;
|
2016-04-07 17:24:55 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw(&draw);
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2016-04-07 18:42:53 +00:00
|
|
|
static void xmb_draw_thumbnail(xmb_handle_t *xmb, float *color,
|
2016-02-04 20:40:29 +00:00
|
|
|
unsigned width, unsigned height)
|
2015-06-18 19:16:45 +00:00
|
|
|
{
|
2016-04-25 15:55:18 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
unsigned i;
|
2016-02-09 03:43:15 +00:00
|
|
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
2016-02-09 03:34:07 +00:00
|
|
|
menu_display_ctx_draw_t draw;
|
2016-05-10 00:32:49 +00:00
|
|
|
struct video_coords coords;
|
2015-11-02 18:47:25 +00:00
|
|
|
math_matrix_4x4 mymat;
|
2016-04-25 15:55:18 +00:00
|
|
|
float shadow[16];
|
2016-04-07 18:42:53 +00:00
|
|
|
float y = xmb->margins.screen.top + xmb->icon.size + xmb->thumbnail_height;
|
2015-11-02 18:47:25 +00:00
|
|
|
float x = xmb->margins.screen.left + xmb->icon.spacing.horizontal +
|
2015-07-08 15:26:23 +00:00
|
|
|
xmb->icon.spacing.horizontal*4 - xmb->icon.size / 4;
|
2015-06-19 16:19:49 +00:00
|
|
|
|
2016-02-09 03:43:15 +00:00
|
|
|
rotate_draw.matrix = &mymat;
|
|
|
|
rotate_draw.rotation = 0;
|
|
|
|
rotate_draw.scale_x = 1;
|
|
|
|
rotate_draw.scale_y = 1;
|
|
|
|
rotate_draw.scale_z = 1;
|
|
|
|
rotate_draw.scale_enable = true;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_rotate_z(&rotate_draw);
|
2015-07-12 04:12:39 +00:00
|
|
|
|
2015-06-18 19:16:45 +00:00
|
|
|
coords.vertices = 4;
|
2015-11-02 21:37:29 +00:00
|
|
|
coords.vertex = NULL;
|
2015-11-02 21:46:23 +00:00
|
|
|
coords.tex_coord = NULL;
|
|
|
|
coords.lut_tex_coord = NULL;
|
2015-06-18 19:16:45 +00:00
|
|
|
|
2016-04-07 18:42:53 +00:00
|
|
|
draw.width = xmb->thumbnail_width;
|
|
|
|
draw.height = xmb->thumbnail_height;
|
2016-02-09 03:34:07 +00:00
|
|
|
draw.coords = &coords;
|
|
|
|
draw.matrix_data = &mymat;
|
2016-04-07 18:42:53 +00:00
|
|
|
draw.texture = xmb->thumbnail;
|
2016-02-09 03:34:07 +00:00
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
2016-05-08 09:11:28 +00:00
|
|
|
draw.pipeline.id = 0;
|
2016-02-09 03:34:07 +00:00
|
|
|
|
2016-04-25 15:55:18 +00:00
|
|
|
if (settings->menu.xmb_shadows_enable)
|
|
|
|
{
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
shadow[i] = 0;
|
|
|
|
|
|
|
|
menu_display_set_alpha(shadow, color[3] * 0.35f);
|
|
|
|
|
|
|
|
coords.color = shadow;
|
2016-05-08 20:57:02 +00:00
|
|
|
draw.x = x + xmb->shadow_offset;
|
|
|
|
draw.y = height - y - xmb->shadow_offset;
|
2016-04-25 15:55:18 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw(&draw);
|
2016-04-25 15:55:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
coords.color = (const float*)color;
|
|
|
|
draw.x = x;
|
|
|
|
draw.y = height - y;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw(&draw);
|
2015-06-18 19:16:45 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 12:48:41 +00:00
|
|
|
static void xmb_draw_text(xmb_handle_t *xmb,
|
2015-04-21 14:45:27 +00:00
|
|
|
const char *str, float x,
|
|
|
|
float y, float scale_factor, float alpha,
|
2015-09-06 19:57:12 +00:00
|
|
|
enum text_alignment text_align,
|
|
|
|
unsigned width, unsigned height)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2016-04-07 17:24:55 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-12-06 13:46:50 +00:00
|
|
|
struct font_params params;
|
2015-04-26 03:21:43 +00:00
|
|
|
uint8_t a8 = 0;
|
2014-10-09 02:34:16 +00:00
|
|
|
|
2014-10-10 20:42:56 +00:00
|
|
|
if (alpha > xmb->alpha)
|
|
|
|
alpha = xmb->alpha;
|
2015-02-01 14:25:37 +00:00
|
|
|
|
2014-10-09 02:34:16 +00:00
|
|
|
a8 = 255 * alpha;
|
2015-02-01 14:25:37 +00:00
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
if (a8 == 0)
|
|
|
|
return;
|
|
|
|
|
2015-05-19 22:26:50 +00:00
|
|
|
if (x < -xmb->icon.size || x > width + xmb->icon.size
|
|
|
|
|| y < -xmb->icon.size || y > height + xmb->icon.size)
|
2014-10-08 23:21:22 +00:00
|
|
|
return;
|
|
|
|
|
2016-04-20 16:25:52 +00:00
|
|
|
params.x = x / width;
|
2016-04-21 19:24:14 +00:00
|
|
|
params.y = 1.0f - y / height;
|
2015-02-02 19:48:26 +00:00
|
|
|
params.scale = scale_factor;
|
2015-12-06 13:46:50 +00:00
|
|
|
params.drop_mod = 0.0f;
|
|
|
|
params.drop_x = 0.0f;
|
|
|
|
params.drop_y = 0.0f;
|
2015-02-02 19:48:26 +00:00
|
|
|
params.color = FONT_COLOR_RGBA(255, 255, 255, a8);
|
2014-10-08 23:21:22 +00:00
|
|
|
params.full_screen = true;
|
2015-03-31 12:00:30 +00:00
|
|
|
params.text_align = text_align;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2016-04-22 05:46:56 +00:00
|
|
|
if (settings->menu.xmb_shadows_enable)
|
2016-04-07 17:24:55 +00:00
|
|
|
{
|
2016-05-08 20:57:02 +00:00
|
|
|
params.drop_x = xmb->shadow_offset;
|
|
|
|
params.drop_y = -xmb->shadow_offset;
|
2016-04-22 22:24:44 +00:00
|
|
|
params.drop_alpha = 0.35f;
|
2016-04-07 17:24:55 +00:00
|
|
|
}
|
|
|
|
|
2016-04-20 04:56:19 +00:00
|
|
|
menu_display_draw_text(str, width, height, ¶ms);
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 13:40:56 +00:00
|
|
|
static void xmb_messagebox(void *data, const char *message)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2015-12-10 13:40:56 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2014-10-10 14:23:12 +00:00
|
|
|
if (!xmb || !message || !*message)
|
2014-10-08 23:21:22 +00:00
|
|
|
return;
|
|
|
|
|
2014-10-09 02:34:16 +00:00
|
|
|
strlcpy(xmb->box_message, message, sizeof(xmb->box_message));
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
static void xmb_render_messagebox_internal(
|
|
|
|
xmb_handle_t *xmb, const char *message)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2015-09-26 21:37:25 +00:00
|
|
|
int x, y, font_size;
|
2014-10-09 02:34:16 +00:00
|
|
|
unsigned i;
|
2015-05-19 22:26:50 +00:00
|
|
|
unsigned width, height;
|
2015-01-10 22:45:14 +00:00
|
|
|
struct string_list *list = NULL;
|
2015-02-11 19:28:54 +00:00
|
|
|
|
2015-12-10 14:46:15 +00:00
|
|
|
if (!xmb)
|
2015-02-11 19:28:54 +00:00
|
|
|
return;
|
2015-02-13 18:00:34 +00:00
|
|
|
|
2015-05-19 22:29:46 +00:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-19 22:26:50 +00:00
|
|
|
|
2015-01-10 22:45:14 +00:00
|
|
|
list = string_split(message, "\n");
|
2014-10-08 23:21:22 +00:00
|
|
|
if (!list)
|
|
|
|
return;
|
2015-01-10 22:45:14 +00:00
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
if (list->elems == 0)
|
2015-02-11 05:27:28 +00:00
|
|
|
goto end;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
font_size = menu_display_get_font_size();
|
2015-09-26 21:37:25 +00:00
|
|
|
|
|
|
|
x = width / 2 - strlen(list->elems[0].data) * font_size / 4;
|
|
|
|
y = height / 2 - list->size * font_size / 2;
|
2014-10-09 02:34:16 +00:00
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
for (i = 0; i < list->size; i++)
|
|
|
|
{
|
|
|
|
const char *msg = list->elems[i].data;
|
2014-10-09 20:45:29 +00:00
|
|
|
|
|
|
|
if (msg)
|
2015-12-10 12:48:41 +00:00
|
|
|
xmb_draw_text(
|
|
|
|
xmb, msg,
|
2015-06-14 13:34:05 +00:00
|
|
|
x,
|
2015-09-26 21:37:25 +00:00
|
|
|
y + i * font_size,
|
2015-06-14 13:34:05 +00:00
|
|
|
1,
|
|
|
|
1,
|
2015-09-06 19:57:12 +00:00
|
|
|
TEXT_ALIGN_LEFT,
|
|
|
|
width,
|
|
|
|
height);
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2015-02-11 05:27:28 +00:00
|
|
|
end:
|
2014-10-08 23:21:22 +00:00
|
|
|
string_list_free(list);
|
|
|
|
}
|
|
|
|
|
2016-04-27 20:26:09 +00:00
|
|
|
static void xmb_update_thumbnail_path(void *data, unsigned i)
|
2015-06-18 02:32:56 +00:00
|
|
|
{
|
2016-04-27 21:03:49 +00:00
|
|
|
menu_entry_t entry;
|
|
|
|
char *tmp = NULL;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2016-04-27 20:26:09 +00:00
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2015-10-27 09:10:33 +00:00
|
|
|
menu_entry_get(&entry, 0, i, NULL, true);
|
2015-06-18 02:32:56 +00:00
|
|
|
|
2016-04-28 17:26:02 +00:00
|
|
|
fill_pathname_join(
|
|
|
|
xmb->thumbnail_file_path,
|
|
|
|
settings->directory.thumbnails,
|
|
|
|
xmb->title_name,
|
|
|
|
sizeof(xmb->thumbnail_file_path));
|
2016-04-07 18:42:53 +00:00
|
|
|
fill_pathname_join(xmb->thumbnail_file_path, xmb->thumbnail_file_path,
|
|
|
|
xmb_thumbnails_ident(), sizeof(xmb->thumbnail_file_path));
|
2016-04-15 19:10:30 +00:00
|
|
|
|
|
|
|
tmp = string_replace_substring(entry.path, "/", "-");
|
|
|
|
|
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
fill_pathname_join(xmb->thumbnail_file_path, xmb->thumbnail_file_path,
|
|
|
|
tmp, sizeof(xmb->thumbnail_file_path));
|
|
|
|
free(tmp);
|
|
|
|
}
|
2015-11-23 22:21:29 +00:00
|
|
|
|
2016-05-17 11:19:47 +00:00
|
|
|
#if 0
|
|
|
|
strlcat(xmb->thumbnail_file_path, ".jpg", sizeof(xmb->thumbnail_file_path));
|
|
|
|
#else
|
2016-04-07 18:42:53 +00:00
|
|
|
strlcat(xmb->thumbnail_file_path, ".png", sizeof(xmb->thumbnail_file_path));
|
2016-05-17 11:19:47 +00:00
|
|
|
#endif
|
2015-11-19 16:39:48 +00:00
|
|
|
}
|
2015-06-18 02:32:56 +00:00
|
|
|
|
2016-04-27 20:26:09 +00:00
|
|
|
static void xmb_update_thumbnail_image(void *data)
|
2015-11-19 16:39:48 +00:00
|
|
|
{
|
2016-04-27 20:26:09 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2016-04-07 18:42:53 +00:00
|
|
|
if (path_file_exists(xmb->thumbnail_file_path))
|
2016-05-27 16:14:47 +00:00
|
|
|
task_push_image_load(xmb->thumbnail_file_path, "cb_menu_thumbnail",
|
2016-05-22 20:29:12 +00:00
|
|
|
menu_display_handle_thumbnail_upload, NULL);
|
2016-05-05 15:00:43 +00:00
|
|
|
else if (xmb->depth == 1)
|
|
|
|
xmb->thumbnail = 0;
|
2015-06-18 02:32:56 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
static void xmb_selection_pointer_changed(
|
|
|
|
xmb_handle_t *xmb, bool allow_animations)
|
2014-10-09 00:41:08 +00:00
|
|
|
{
|
2016-02-25 12:23:39 +00:00
|
|
|
unsigned i, end, height, depth;
|
|
|
|
menu_animation_ctx_tag_t tag;
|
2015-12-12 13:39:35 +00:00
|
|
|
size_t selection, num = 0;
|
|
|
|
int threshold = 0;
|
2015-12-11 21:05:54 +00:00
|
|
|
menu_list_t *menu_list = NULL;
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-02-13 18:00:34 +00:00
|
|
|
|
2015-12-11 21:05:54 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_LIST_GET, &menu_list);
|
|
|
|
|
2014-10-10 13:52:12 +00:00
|
|
|
if (!xmb)
|
2014-10-09 02:34:16 +00:00
|
|
|
return;
|
2015-09-25 12:57:37 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
2014-10-09 00:41:08 +00:00
|
|
|
|
2015-06-23 14:38:51 +00:00
|
|
|
end = menu_entries_get_end();
|
2015-11-03 10:32:32 +00:00
|
|
|
threshold = xmb->icon.size*10;
|
2014-10-09 20:45:29 +00:00
|
|
|
|
2015-06-23 14:38:51 +00:00
|
|
|
video_driver_get_size(NULL, &height);
|
2015-06-23 14:04:57 +00:00
|
|
|
|
2016-02-25 12:23:39 +00:00
|
|
|
tag.id = (uintptr_t)menu_list;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag);
|
2015-12-12 13:39:35 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &num);
|
2015-06-23 14:04:57 +00:00
|
|
|
|
2014-10-09 20:33:23 +00:00
|
|
|
for (i = 0; i < end; i++)
|
2014-10-09 00:41:08 +00:00
|
|
|
{
|
2015-06-23 14:38:51 +00:00
|
|
|
float iy, real_iy;
|
2016-05-08 21:22:22 +00:00
|
|
|
float ia = xmb->items.passive.alpha;
|
|
|
|
float iz = xmb->items.passive.zoom;
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
|
|
|
menu_entries_get_userdata_at_offset(selection_buf, i);
|
2014-10-09 00:41:08 +00:00
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
2015-09-25 12:57:37 +00:00
|
|
|
iy = xmb_item_y(xmb, i, selection);
|
2015-06-23 14:38:51 +00:00
|
|
|
real_iy = iy + xmb->margins.screen.top;
|
2014-10-09 00:41:08 +00:00
|
|
|
|
2015-09-25 12:57:37 +00:00
|
|
|
if (i == selection)
|
2014-10-09 00:41:08 +00:00
|
|
|
{
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.active.alpha;
|
|
|
|
iz = xmb->items.active.zoom;
|
2016-05-05 15:00:43 +00:00
|
|
|
|
|
|
|
depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
|
2016-05-21 18:53:57 +00:00
|
|
|
if (!string_is_equal(xmb_thumbnails_ident(), "OFF") && depth == 1)
|
2016-05-05 15:00:43 +00:00
|
|
|
{
|
|
|
|
xmb_update_thumbnail_path(xmb, i);
|
|
|
|
xmb_update_thumbnail_image(xmb);
|
|
|
|
}
|
2014-10-09 00:41:08 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
if ( (!allow_animations)
|
2016-03-09 21:17:18 +00:00
|
|
|
|| (real_iy < -threshold
|
2016-02-04 20:40:29 +00:00
|
|
|
|| real_iy > height+threshold))
|
2015-06-23 14:38:51 +00:00
|
|
|
{
|
|
|
|
node->alpha = node->label_alpha = ia;
|
|
|
|
node->y = iy;
|
|
|
|
node->zoom = iz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
|
|
|
|
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = ia;
|
|
|
|
entry.subject = &node->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = tag.id;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.subject = &node->label_alpha;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = iz;
|
|
|
|
entry.subject = &node->zoom;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = iy;
|
|
|
|
entry.subject = &node->y;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-06-23 14:38:51 +00:00
|
|
|
}
|
2014-10-09 00:41:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-21 14:45:27 +00:00
|
|
|
static void xmb_list_open_old(xmb_handle_t *xmb,
|
|
|
|
file_list_t *list, int dir, size_t current)
|
2014-10-09 00:41:08 +00:00
|
|
|
{
|
2015-06-23 16:10:59 +00:00
|
|
|
unsigned i, height = 0;
|
2015-11-03 10:32:32 +00:00
|
|
|
int threshold = xmb->icon.size * 10;
|
2015-06-15 15:34:12 +00:00
|
|
|
size_t end = 0;
|
2014-10-11 23:27:31 +00:00
|
|
|
|
2015-06-07 13:07:38 +00:00
|
|
|
end = file_list_get_size(list);
|
|
|
|
|
2015-06-23 16:10:59 +00:00
|
|
|
video_driver_get_size(NULL, &height);
|
|
|
|
|
2015-06-07 13:07:38 +00:00
|
|
|
for (i = 0; i < end; i++)
|
2014-10-20 18:00:39 +00:00
|
|
|
{
|
2015-01-10 22:45:14 +00:00
|
|
|
float ia = 0;
|
2015-06-23 16:10:59 +00:00
|
|
|
float real_y;
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
|
|
|
menu_entries_get_userdata_at_offset(list, i);
|
2015-01-10 22:45:14 +00:00
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (i == current)
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.active.alpha;
|
2015-01-10 22:45:14 +00:00
|
|
|
if (dir == -1)
|
|
|
|
ia = 0;
|
2015-02-02 19:48:26 +00:00
|
|
|
|
2015-06-23 20:06:04 +00:00
|
|
|
real_y = node->y + xmb->margins.screen.top;
|
2015-06-23 16:10:59 +00:00
|
|
|
|
|
|
|
if (real_y < -threshold || real_y > height+threshold)
|
|
|
|
{
|
|
|
|
node->alpha = ia;
|
|
|
|
node->label_alpha = 0;
|
|
|
|
node->x = xmb->icon.size * dir * -2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
|
|
|
|
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = ia;
|
|
|
|
entry.subject = &node->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = 0;
|
|
|
|
entry.subject = &node->label_alpha;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = xmb->icon.size * dir * -2;
|
|
|
|
entry.subject = &node->x;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-06-23 16:10:59 +00:00
|
|
|
}
|
2014-10-20 18:00:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-10-11 23:27:31 +00:00
|
|
|
|
2015-04-21 14:45:27 +00:00
|
|
|
static void xmb_list_open_new(xmb_handle_t *xmb,
|
|
|
|
file_list_t *list, int dir, size_t current)
|
2014-10-20 18:00:39 +00:00
|
|
|
{
|
2015-06-23 15:22:57 +00:00
|
|
|
unsigned i, height;
|
2015-12-12 13:39:35 +00:00
|
|
|
size_t skip = 0;
|
2015-09-25 20:48:58 +00:00
|
|
|
int threshold = xmb->icon.size * 10;
|
2015-06-15 17:12:31 +00:00
|
|
|
size_t end = file_list_get_size(list);
|
2015-06-07 13:07:38 +00:00
|
|
|
|
2015-06-23 15:22:57 +00:00
|
|
|
video_driver_get_size(NULL, &height);
|
|
|
|
|
2015-06-07 13:07:38 +00:00
|
|
|
for (i = 0; i < end; i++)
|
2014-10-17 23:24:14 +00:00
|
|
|
{
|
2015-06-07 13:08:32 +00:00
|
|
|
float ia;
|
2015-06-23 15:22:57 +00:00
|
|
|
float real_y;
|
2015-04-21 14:45:27 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
2015-10-19 14:32:51 +00:00
|
|
|
menu_entries_get_userdata_at_offset(list, i);
|
2015-02-02 19:48:26 +00:00
|
|
|
|
2015-02-11 05:22:00 +00:00
|
|
|
if (!node)
|
2015-02-02 19:48:26 +00:00
|
|
|
continue;
|
2015-01-26 18:30:44 +00:00
|
|
|
|
2014-10-20 18:00:39 +00:00
|
|
|
if (dir == 1 || (dir == -1 && i != current))
|
|
|
|
node->alpha = 0;
|
2015-01-26 18:30:44 +00:00
|
|
|
|
|
|
|
if (dir == 1 || dir == -1)
|
|
|
|
node->label_alpha = 0;
|
|
|
|
|
2015-02-12 17:31:46 +00:00
|
|
|
node->x = xmb->icon.size * dir * 2;
|
2015-02-11 04:33:53 +00:00
|
|
|
node->y = xmb_item_y(xmb, i, current);
|
2016-05-08 21:19:34 +00:00
|
|
|
node->zoom = xmb->categories.passive.zoom;
|
2014-10-17 23:24:14 +00:00
|
|
|
|
2015-06-23 20:06:04 +00:00
|
|
|
real_y = node->y + xmb->margins.screen.top;
|
2015-06-23 15:22:57 +00:00
|
|
|
|
2014-10-17 23:24:14 +00:00
|
|
|
if (i == current)
|
2016-05-08 21:19:34 +00:00
|
|
|
node->zoom = xmb->categories.active.zoom;
|
2014-11-27 10:07:52 +00:00
|
|
|
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.passive.alpha;
|
2015-01-26 05:51:46 +00:00
|
|
|
if (i == current)
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.active.alpha;
|
2015-01-26 05:51:46 +00:00
|
|
|
|
2015-06-23 15:22:57 +00:00
|
|
|
if (real_y < -threshold || real_y > height+threshold)
|
|
|
|
{
|
|
|
|
node->alpha = node->label_alpha = ia;
|
|
|
|
node->x = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
|
|
|
|
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = ia;
|
|
|
|
entry.subject = &node->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.subject = &node->label_alpha;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = 0;
|
|
|
|
entry.subject = &node->x;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-06-23 15:22:57 +00:00
|
|
|
}
|
2014-10-17 23:24:14 +00:00
|
|
|
}
|
2014-10-19 23:51:00 +00:00
|
|
|
|
|
|
|
xmb->old_depth = xmb->depth;
|
2015-12-12 13:39:35 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &skip);
|
2014-10-09 00:41:08 +00:00
|
|
|
}
|
|
|
|
|
2015-06-08 14:27:30 +00:00
|
|
|
static xmb_node_t *xmb_node_allocate_userdata(xmb_handle_t *xmb, unsigned i)
|
2015-06-07 14:39:40 +00:00
|
|
|
{
|
2015-06-11 21:02:17 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)calloc(1, sizeof(xmb_node_t));
|
2015-01-26 05:51:46 +00:00
|
|
|
|
2015-06-07 14:41:20 +00:00
|
|
|
if (!node)
|
2014-11-17 09:17:24 +00:00
|
|
|
{
|
2015-01-26 05:51:46 +00:00
|
|
|
RARCH_ERR("XMB node could not be allocated.\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-11-17 09:17:24 +00:00
|
|
|
|
2016-05-08 21:19:34 +00:00
|
|
|
node->alpha = xmb->categories.passive.alpha;
|
|
|
|
node->zoom = xmb->categories.passive.zoom;
|
2014-11-17 09:17:24 +00:00
|
|
|
|
2015-10-24 17:37:59 +00:00
|
|
|
if ((i + XMB_SYSTEM_TAB_END) == xmb->categories.active.idx)
|
2015-01-26 05:51:46 +00:00
|
|
|
{
|
2016-05-08 21:19:34 +00:00
|
|
|
node->alpha = xmb->categories.active.alpha;
|
|
|
|
node->zoom = xmb->categories.active.zoom;
|
2014-11-17 09:17:24 +00:00
|
|
|
}
|
|
|
|
|
2015-06-11 21:21:25 +00:00
|
|
|
file_list_free_actiondata(xmb->horizontal_list, i);
|
2015-06-11 21:02:17 +00:00
|
|
|
file_list_set_actiondata(xmb->horizontal_list, i, node);
|
2015-06-07 14:41:20 +00:00
|
|
|
|
2014-11-13 20:05:16 +00:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2015-06-07 14:52:07 +00:00
|
|
|
static xmb_node_t* xmb_get_userdata_from_horizontal_list(
|
2015-06-08 14:27:30 +00:00
|
|
|
xmb_handle_t *xmb, unsigned i)
|
2015-03-12 14:32:50 +00:00
|
|
|
{
|
2016-02-04 20:40:29 +00:00
|
|
|
return (xmb_node_t*)
|
|
|
|
menu_entries_get_actiondata_at_offset(xmb->horizontal_list, i);
|
2015-03-12 14:32:50 +00:00
|
|
|
}
|
|
|
|
|
2015-02-13 18:00:34 +00:00
|
|
|
static void xmb_push_animations(xmb_node_t *node, float ia, float ix)
|
2015-02-12 16:22:24 +00:00
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
|
|
|
|
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = ia;
|
|
|
|
entry.subject = &node->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.subject = &node->label_alpha;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = ix;
|
|
|
|
entry.subject = &node->x;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-02-12 16:22:24 +00:00
|
|
|
}
|
|
|
|
|
2015-04-21 14:45:27 +00:00
|
|
|
static void xmb_list_switch_old(xmb_handle_t *xmb,
|
|
|
|
file_list_t *list, int dir, size_t current)
|
2014-11-14 20:56:21 +00:00
|
|
|
{
|
2015-03-16 16:40:05 +00:00
|
|
|
unsigned i;
|
2015-06-15 17:12:31 +00:00
|
|
|
size_t end = file_list_get_size(list);
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-02-12 16:22:24 +00:00
|
|
|
for (i = 0; i < end; i++)
|
2014-11-14 20:56:21 +00:00
|
|
|
{
|
2015-02-01 14:25:37 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
2015-10-19 14:32:51 +00:00
|
|
|
menu_entries_get_userdata_at_offset(list, i);
|
2015-02-12 16:22:24 +00:00
|
|
|
float ia = 0;
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-02-11 05:11:25 +00:00
|
|
|
if (!node)
|
2015-06-06 12:07:20 +00:00
|
|
|
continue;
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-02-13 18:00:34 +00:00
|
|
|
xmb_push_animations(node, ia, -xmb->icon.spacing.horizontal * dir);
|
2014-11-14 20:56:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-21 14:45:27 +00:00
|
|
|
static void xmb_list_switch_new(xmb_handle_t *xmb,
|
|
|
|
file_list_t *list, int dir, size_t current)
|
2014-11-14 20:56:21 +00:00
|
|
|
{
|
2015-03-16 16:40:05 +00:00
|
|
|
unsigned i;
|
2015-06-14 02:19:25 +00:00
|
|
|
size_t end = 0;
|
2015-06-04 10:17:23 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-02-13 18:00:34 +00:00
|
|
|
|
2015-06-04 10:17:23 +00:00
|
|
|
if (settings->menu.dynamic_wallpaper_enable)
|
|
|
|
{
|
2015-06-12 14:25:32 +00:00
|
|
|
char path[PATH_MAX_LENGTH] = {0};
|
2015-06-04 10:17:23 +00:00
|
|
|
char *tmp = string_replace_substring(xmb->title_name, "/", " ");
|
|
|
|
|
|
|
|
if (tmp)
|
|
|
|
{
|
2016-04-28 17:26:02 +00:00
|
|
|
fill_pathname_join(
|
|
|
|
path,
|
|
|
|
settings->directory.dynamic_wallpapers,
|
|
|
|
tmp,
|
|
|
|
sizeof(path));
|
2015-06-11 14:06:39 +00:00
|
|
|
path_remove_extension(path);
|
2015-06-04 10:17:23 +00:00
|
|
|
free(tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
strlcat(path, ".png", sizeof(path));
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2015-10-25 20:02:21 +00:00
|
|
|
if (!path_file_exists(path))
|
|
|
|
xmb_fill_default_background_path(xmb, path, sizeof(path));
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2016-01-20 03:54:17 +00:00
|
|
|
if(!string_is_equal(path, xmb->background_file_path))
|
2015-11-24 16:50:37 +00:00
|
|
|
{
|
|
|
|
if(path_file_exists(path))
|
|
|
|
{
|
2016-05-27 16:14:47 +00:00
|
|
|
task_push_image_load(path, "cb_menu_wallpaper",
|
2015-11-24 16:50:37 +00:00
|
|
|
menu_display_handle_wallpaper_upload, NULL);
|
2016-02-04 20:40:29 +00:00
|
|
|
strlcpy(xmb->background_file_path,
|
|
|
|
path, sizeof(xmb->background_file_path));
|
2015-10-25 20:02:21 +00:00
|
|
|
}
|
|
|
|
}
|
2015-06-04 10:17:23 +00:00
|
|
|
}
|
|
|
|
|
2015-02-13 18:00:34 +00:00
|
|
|
end = file_list_get_size(list);
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-02-12 16:22:24 +00:00
|
|
|
for (i = 0; i < end; i++)
|
2014-11-14 20:56:21 +00:00
|
|
|
{
|
2015-02-01 14:25:37 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
2015-10-19 14:32:51 +00:00
|
|
|
menu_entries_get_userdata_at_offset(list, i);
|
2016-05-08 21:22:22 +00:00
|
|
|
float ia = xmb->items.passive.alpha;
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-02-11 05:15:15 +00:00
|
|
|
if (!node)
|
2015-06-06 12:07:20 +00:00
|
|
|
continue;
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-02-12 22:38:44 +00:00
|
|
|
node->x = xmb->icon.spacing.horizontal * dir;
|
2015-02-02 19:48:26 +00:00
|
|
|
node->alpha = 0;
|
2014-11-14 22:39:24 +00:00
|
|
|
node->label_alpha = 0;
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-01-10 22:45:14 +00:00
|
|
|
if (i == current)
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.active.alpha;
|
2015-06-06 12:07:20 +00:00
|
|
|
|
2015-02-13 18:00:34 +00:00
|
|
|
xmb_push_animations(node, ia, 0);
|
2014-11-14 20:56:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-13 18:00:34 +00:00
|
|
|
static void xmb_set_title(xmb_handle_t *xmb)
|
2014-11-14 23:35:45 +00:00
|
|
|
{
|
2015-10-24 17:37:59 +00:00
|
|
|
if (xmb->categories.selection_ptr <= XMB_SYSTEM_TAB_END)
|
2014-11-14 23:35:45 +00:00
|
|
|
{
|
2015-10-24 17:37:59 +00:00
|
|
|
menu_entries_get_title(xmb->title_name, sizeof(xmb->title_name));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *path = NULL;
|
|
|
|
menu_entries_get_at_offset(
|
|
|
|
xmb->horizontal_list,
|
|
|
|
xmb->categories.selection_ptr - (XMB_SYSTEM_TAB_END + 1),
|
|
|
|
&path, NULL, NULL, NULL, NULL);
|
2014-11-14 23:35:45 +00:00
|
|
|
|
2015-10-24 17:37:59 +00:00
|
|
|
if (!path)
|
|
|
|
return;
|
2014-11-14 23:35:45 +00:00
|
|
|
|
2015-10-24 17:37:59 +00:00
|
|
|
strlcpy(xmb->title_name, path, sizeof(xmb->title_name));
|
2015-07-06 22:52:04 +00:00
|
|
|
|
2015-10-24 17:37:59 +00:00
|
|
|
path_remove_extension(xmb->title_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
|
|
|
|
{
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case XMB_SYSTEM_TAB_SETTINGS:
|
2016-04-20 06:01:51 +00:00
|
|
|
return &xmb->settings_tab_node;
|
2015-10-24 17:37:59 +00:00
|
|
|
case XMB_SYSTEM_TAB_HISTORY:
|
2016-04-20 06:01:51 +00:00
|
|
|
return &xmb->history_tab_node;
|
2015-10-24 17:37:59 +00:00
|
|
|
case XMB_SYSTEM_TAB_ADD:
|
2016-04-20 06:01:51 +00:00
|
|
|
return &xmb->add_tab_node;
|
2015-10-24 17:37:59 +00:00
|
|
|
default:
|
|
|
|
if (i > XMB_SYSTEM_TAB_END)
|
2016-04-20 06:01:51 +00:00
|
|
|
return xmb_get_userdata_from_horizontal_list(
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb, i - (XMB_SYSTEM_TAB_END + 1));
|
2014-11-14 23:35:45 +00:00
|
|
|
}
|
2015-10-24 17:37:59 +00:00
|
|
|
|
2016-04-20 06:01:51 +00:00
|
|
|
return &xmb->main_menu_node;
|
2014-11-14 23:35:45 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2014-11-14 20:56:21 +00:00
|
|
|
unsigned j;
|
2016-03-09 21:17:18 +00:00
|
|
|
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
|
2016-02-04 20:40:29 +00:00
|
|
|
+ XMB_SYSTEM_TAB_END;
|
2015-01-26 20:59:55 +00:00
|
|
|
|
2015-06-11 14:54:28 +00:00
|
|
|
for (j = 0; j <= list_size; j++)
|
2014-11-14 20:56:21 +00:00
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
2016-05-08 21:19:34 +00:00
|
|
|
float ia = xmb->categories.passive.alpha;
|
|
|
|
float iz = xmb->categories.passive.zoom;
|
2015-10-24 17:37:59 +00:00
|
|
|
xmb_node_t *node = xmb_get_node(xmb, j);
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-01-26 20:59:55 +00:00
|
|
|
if (!node)
|
|
|
|
continue;
|
2015-06-06 12:07:20 +00:00
|
|
|
|
2015-02-12 18:23:11 +00:00
|
|
|
if (j == xmb->categories.active.idx)
|
2015-02-02 19:40:29 +00:00
|
|
|
{
|
2016-05-08 21:19:34 +00:00
|
|
|
ia = xmb->categories.active.alpha;
|
|
|
|
iz = xmb->categories.active.zoom;
|
2015-02-02 19:40:29 +00:00
|
|
|
}
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = ia;
|
|
|
|
entry.subject = &node->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = iz;
|
|
|
|
entry.subject = &node->zoom;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-01-26 20:59:55 +00:00
|
|
|
}
|
2015-06-07 11:09:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void xmb_list_switch(xmb_handle_t *xmb)
|
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
2015-09-25 12:57:37 +00:00
|
|
|
size_t selection;
|
2015-06-07 11:09:35 +00:00
|
|
|
int dir = -1;
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-10-17 16:17:59 +00:00
|
|
|
|
2015-09-25 12:57:37 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
2015-06-07 11:09:35 +00:00
|
|
|
|
2015-06-15 17:00:52 +00:00
|
|
|
if (xmb->categories.selection_ptr > xmb->categories.selection_ptr_old)
|
2015-06-07 11:09:35 +00:00
|
|
|
dir = 1;
|
|
|
|
|
|
|
|
xmb->categories.active.idx += dir;
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_list_switch_horizontal_list(xmb);
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = xmb->icon.spacing.horizontal * -(float)xmb->categories.selection_ptr;
|
|
|
|
entry.subject = &xmb->categories.x_pos;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-02-02 19:40:29 +00:00
|
|
|
|
|
|
|
dir = -1;
|
2015-06-15 17:00:52 +00:00
|
|
|
if (xmb->categories.selection_ptr > xmb->categories.selection_ptr_old)
|
2015-02-02 19:40:29 +00:00
|
|
|
dir = 1;
|
|
|
|
|
2015-04-21 14:45:27 +00:00
|
|
|
xmb_list_switch_old(xmb, xmb->selection_buf_old,
|
|
|
|
dir, xmb->selection_ptr_old);
|
2015-10-17 16:17:59 +00:00
|
|
|
xmb_list_switch_new(xmb, selection_buf, dir, selection);
|
2015-06-15 17:00:52 +00:00
|
|
|
xmb->categories.active.idx_old = xmb->categories.selection_ptr;
|
2015-06-18 02:32:56 +00:00
|
|
|
|
2016-05-21 18:53:57 +00:00
|
|
|
if (!string_is_equal(xmb_thumbnails_ident(), "OFF"))
|
2015-11-19 16:39:48 +00:00
|
|
|
{
|
2016-04-07 18:42:53 +00:00
|
|
|
xmb_update_thumbnail_path(xmb, 0);
|
|
|
|
xmb_update_thumbnail_image(xmb);
|
2015-11-19 16:39:48 +00:00
|
|
|
}
|
2015-01-26 20:59:55 +00:00
|
|
|
}
|
2014-11-14 20:56:21 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
static void xmb_list_open_horizontal_list(xmb_handle_t *xmb)
|
2015-01-26 20:59:55 +00:00
|
|
|
{
|
|
|
|
unsigned j;
|
2016-03-09 21:17:18 +00:00
|
|
|
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
|
2016-02-04 20:40:29 +00:00
|
|
|
+ XMB_SYSTEM_TAB_END;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2015-06-10 12:35:07 +00:00
|
|
|
for (j = 0; j <= list_size; j++)
|
2014-11-11 17:15:00 +00:00
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
2015-03-22 07:09:00 +00:00
|
|
|
float ia = 0;
|
2015-10-24 17:37:59 +00:00
|
|
|
xmb_node_t *node = xmb_get_node(xmb, j);
|
2014-11-11 17:15:00 +00:00
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
2015-02-12 18:23:11 +00:00
|
|
|
if (j == xmb->categories.active.idx)
|
2016-05-08 21:19:34 +00:00
|
|
|
ia = xmb->categories.active.alpha;
|
2015-02-02 19:40:29 +00:00
|
|
|
else if (xmb->depth <= 1)
|
2016-05-08 21:19:34 +00:00
|
|
|
ia = xmb->categories.passive.alpha;
|
2015-02-02 19:40:29 +00:00
|
|
|
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = ia;
|
|
|
|
entry.subject = &node->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2014-11-11 17:15:00 +00:00
|
|
|
}
|
2015-06-07 11:09:35 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb)
|
2015-11-02 21:56:05 +00:00
|
|
|
{
|
|
|
|
unsigned i;
|
2015-12-10 14:23:43 +00:00
|
|
|
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
|
|
|
for (i = 0; i < list_size; i++)
|
|
|
|
{
|
2016-01-08 21:26:13 +00:00
|
|
|
const char *path = NULL;
|
2015-11-02 21:56:05 +00:00
|
|
|
xmb_node_t *node = xmb_get_userdata_from_horizontal_list(xmb, i);
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
2016-01-08 21:26:13 +00:00
|
|
|
file_list_get_at_offset(xmb->horizontal_list, i,
|
|
|
|
&path, NULL, NULL, NULL);
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2016-02-09 00:39:01 +00:00
|
|
|
if (!path || !strstr(path, ".lpl"))
|
2016-01-08 21:26:13 +00:00
|
|
|
continue;
|
|
|
|
|
2016-02-16 19:24:00 +00:00
|
|
|
video_driver_texture_unload(&node->icon);
|
|
|
|
video_driver_texture_unload(&node->content_icon);
|
2015-11-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
static void xmb_init_horizontal_list(xmb_handle_t *xmb)
|
2015-11-02 21:56:05 +00:00
|
|
|
{
|
|
|
|
menu_displaylist_info_t info = {0};
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
xmb->horizontal_list = (file_list_t*)calloc(1, sizeof(file_list_t));
|
|
|
|
|
|
|
|
if (!xmb->horizontal_list)
|
|
|
|
return;
|
|
|
|
|
|
|
|
info.list = xmb->horizontal_list;
|
|
|
|
info.menu_list = NULL;
|
|
|
|
info.type = 0;
|
|
|
|
info.type_default = MENU_FILE_PLAIN;
|
2016-02-06 20:33:45 +00:00
|
|
|
info.flags = SL_FLAG_ALLOW_EMPTY_LIST;
|
2015-11-02 21:56:05 +00:00
|
|
|
strlcpy(info.label,
|
2016-02-04 20:40:29 +00:00
|
|
|
menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST),
|
|
|
|
sizeof(info.label));
|
2016-04-28 17:26:02 +00:00
|
|
|
strlcpy(info.path,
|
|
|
|
settings->directory.playlist,
|
|
|
|
sizeof(info.path));
|
2015-11-02 21:56:05 +00:00
|
|
|
strlcpy(info.exts, "lpl", sizeof(info.exts));
|
|
|
|
|
2016-02-24 22:05:54 +00:00
|
|
|
if (menu_displaylist_ctl(DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL, &info))
|
2016-02-24 22:19:53 +00:00
|
|
|
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
|
2015-11-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
static void xmb_toggle_horizontal_list(xmb_handle_t *xmb)
|
2015-11-02 21:56:05 +00:00
|
|
|
{
|
|
|
|
unsigned i;
|
2016-03-09 21:17:18 +00:00
|
|
|
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
|
2016-02-04 20:40:29 +00:00
|
|
|
+ XMB_SYSTEM_TAB_END;
|
2015-11-02 21:56:05 +00:00
|
|
|
|
|
|
|
for (i = 0; i <= list_size; i++)
|
|
|
|
{
|
|
|
|
xmb_node_t *node = xmb_get_node(xmb, i);
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
node->alpha = 0;
|
2016-05-08 21:19:34 +00:00
|
|
|
node->zoom = xmb->categories.passive.zoom;
|
2015-11-02 21:56:05 +00:00
|
|
|
|
|
|
|
if (i == xmb->categories.active.idx)
|
|
|
|
{
|
2016-05-08 21:19:34 +00:00
|
|
|
node->alpha = xmb->categories.active.alpha;
|
|
|
|
node->zoom = xmb->categories.active.zoom;
|
2015-11-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
else if (xmb->depth <= 1)
|
2016-05-08 21:19:34 +00:00
|
|
|
node->alpha = xmb->categories.passive.alpha;
|
2015-11-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
static void xmb_context_reset_horizontal_list(
|
|
|
|
xmb_handle_t *xmb, const char *themepath)
|
2015-11-02 21:56:05 +00:00
|
|
|
{
|
|
|
|
unsigned i;
|
2015-11-07 03:36:27 +00:00
|
|
|
int depth; /* keep this integer */
|
2015-12-10 14:23:43 +00:00
|
|
|
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
|
|
|
xmb->categories.x_pos = xmb->icon.spacing.horizontal *
|
|
|
|
-(float)xmb->categories.selection_ptr;
|
|
|
|
|
2015-11-07 03:36:27 +00:00
|
|
|
depth = (xmb->depth > 1) ? 2 : 1;
|
|
|
|
xmb->x = xmb->icon.size * -(depth*2-2);
|
2015-11-03 22:17:21 +00:00
|
|
|
|
2015-11-02 21:56:05 +00:00
|
|
|
for (i = 0; i < list_size; i++)
|
|
|
|
{
|
|
|
|
char iconpath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char sysname[PATH_MAX_LENGTH] = {0};
|
|
|
|
char texturepath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char content_texturepath[PATH_MAX_LENGTH] = {0};
|
|
|
|
struct texture_image ti = {0};
|
|
|
|
const char *path = NULL;
|
2016-03-09 21:17:18 +00:00
|
|
|
xmb_node_t *node =
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_get_userdata_from_horizontal_list(xmb, i);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
node = xmb_node_allocate_userdata(xmb, i);
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
file_list_get_at_offset(xmb->horizontal_list, i,
|
|
|
|
&path, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
if (!path)
|
|
|
|
continue;
|
|
|
|
|
2016-01-08 08:33:53 +00:00
|
|
|
if (!strstr(path, ".lpl"))
|
|
|
|
continue;
|
|
|
|
|
2015-11-02 21:56:05 +00:00
|
|
|
strlcpy(sysname, path, sizeof(sysname));
|
|
|
|
path_remove_extension(sysname);
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
fill_pathname_join(iconpath, themepath, xmb->icon.dir,
|
|
|
|
sizeof(iconpath));
|
2015-11-02 21:56:05 +00:00
|
|
|
fill_pathname_slash(iconpath, sizeof(iconpath));
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
fill_pathname_join(texturepath, iconpath, sysname,
|
|
|
|
sizeof(texturepath));
|
2015-11-02 21:56:05 +00:00
|
|
|
strlcat(texturepath, ".png", sizeof(texturepath));
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
fill_pathname_join(content_texturepath, iconpath,
|
|
|
|
sysname, sizeof(content_texturepath));
|
|
|
|
strlcat(content_texturepath, "-content.png",
|
|
|
|
sizeof(content_texturepath));
|
2015-11-02 21:56:05 +00:00
|
|
|
|
2016-05-18 10:57:44 +00:00
|
|
|
image_texture_load(&ti, texturepath);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
2016-05-21 17:43:32 +00:00
|
|
|
video_driver_texture_unload(&node->icon);
|
2016-02-09 00:45:37 +00:00
|
|
|
video_driver_texture_load(&ti,
|
2016-02-16 19:24:00 +00:00
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR, &node->icon);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
2016-05-18 10:57:44 +00:00
|
|
|
image_texture_free(&ti);
|
2016-01-30 01:39:08 +00:00
|
|
|
|
2016-05-18 10:57:44 +00:00
|
|
|
image_texture_load(&ti, content_texturepath);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
2016-05-21 17:43:32 +00:00
|
|
|
video_driver_texture_unload(&node->content_icon);
|
2016-02-09 00:45:37 +00:00
|
|
|
video_driver_texture_load(&ti,
|
2016-02-16 19:24:00 +00:00
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR, &node->content_icon);
|
2015-11-02 21:56:05 +00:00
|
|
|
|
2016-05-18 10:57:44 +00:00
|
|
|
image_texture_free(&ti);
|
2015-11-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_toggle_horizontal_list(xmb);
|
2015-11-02 21:56:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
static void xmb_refresh_horizontal_list(xmb_handle_t *xmb)
|
2015-07-07 10:04:03 +00:00
|
|
|
{
|
|
|
|
char mediapath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char themepath[PATH_MAX_LENGTH] = {0};
|
2015-07-07 23:01:41 +00:00
|
|
|
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
2016-04-28 17:26:02 +00:00
|
|
|
fill_pathname_join(
|
|
|
|
mediapath,
|
|
|
|
settings->directory.assets,
|
|
|
|
"xmb",
|
|
|
|
sizeof(mediapath));
|
2016-03-21 20:18:25 +00:00
|
|
|
fill_pathname_join(themepath, mediapath, xmb_theme_ident(), sizeof(themepath));
|
2015-07-07 10:04:03 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_context_destroy_horizontal_list(xmb);
|
2015-07-07 10:04:03 +00:00
|
|
|
if (xmb->horizontal_list)
|
2016-05-24 03:07:54 +00:00
|
|
|
file_list_free(xmb->horizontal_list);
|
2015-07-07 10:04:03 +00:00
|
|
|
xmb->horizontal_list = NULL;
|
2015-07-07 23:01:41 +00:00
|
|
|
|
2015-12-07 15:55:13 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
2015-10-24 18:40:07 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_init_horizontal_list(xmb);
|
|
|
|
xmb_context_reset_horizontal_list(xmb, themepath);
|
2015-07-07 10:04:03 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 18:30:14 +00:00
|
|
|
static int xmb_environ(enum menu_environ_cb type, void *data, void *userdata)
|
2015-07-07 22:37:44 +00:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_ENVIRON_RESET_HORIZONTAL_LIST:
|
|
|
|
{
|
2015-12-10 15:23:32 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
|
2015-07-07 22:37:44 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
if (!xmb)
|
2015-07-07 23:01:41 +00:00
|
|
|
return -1;
|
2015-07-07 22:37:44 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_refresh_horizontal_list(xmb);
|
2015-07-07 22:37:44 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-07 11:09:35 +00:00
|
|
|
static void xmb_list_open(xmb_handle_t *xmb)
|
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
|
|
|
|
2015-09-25 14:25:33 +00:00
|
|
|
size_t selection;
|
2015-10-17 16:17:59 +00:00
|
|
|
int dir = 0;
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-06-07 11:09:35 +00:00
|
|
|
|
2015-09-25 14:25:33 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
2015-06-07 11:09:35 +00:00
|
|
|
|
2015-12-10 14:23:43 +00:00
|
|
|
xmb->depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
|
2015-06-07 11:09:35 +00:00
|
|
|
|
|
|
|
if (xmb->depth > xmb->old_depth)
|
|
|
|
dir = 1;
|
|
|
|
else if (xmb->depth < xmb->old_depth)
|
|
|
|
dir = -1;
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_list_open_horizontal_list(xmb);
|
2014-11-11 17:15:00 +00:00
|
|
|
|
2015-04-21 14:45:27 +00:00
|
|
|
xmb_list_open_old(xmb, xmb->selection_buf_old,
|
|
|
|
dir, xmb->selection_ptr_old);
|
2015-10-17 16:17:59 +00:00
|
|
|
xmb_list_open_new(xmb, selection_buf,
|
2015-09-25 14:25:33 +00:00
|
|
|
dir, selection);
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2016-02-25 14:44:30 +00:00
|
|
|
|
|
|
|
entry.duration = XMB_DELAY;
|
|
|
|
entry.target_value = xmb->icon.size * -(xmb->depth*2-2);
|
|
|
|
entry.subject = &xmb->x;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
|
2015-02-01 14:25:37 +00:00
|
|
|
switch (xmb->depth)
|
|
|
|
{
|
|
|
|
case 1:
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = 0;
|
|
|
|
entry.subject = &xmb->textures.arrow.alpha;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-02-01 14:25:37 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
|
|
|
|
|
|
|
entry.target_value = 1;
|
|
|
|
entry.subject = &xmb->textures.arrow.alpha;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-02-01 14:25:37 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2014-10-20 18:00:39 +00:00
|
|
|
xmb->old_depth = xmb->depth;
|
|
|
|
}
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2015-12-10 15:45:38 +00:00
|
|
|
static void xmb_populate_entries(void *data,
|
|
|
|
const char *path,
|
2015-09-21 19:32:31 +00:00
|
|
|
const char *label, unsigned k)
|
2015-01-26 20:59:55 +00:00
|
|
|
{
|
2015-12-10 15:45:38 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-01-26 20:59:55 +00:00
|
|
|
|
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2015-12-07 15:55:13 +00:00
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL))
|
2015-01-28 18:09:21 +00:00
|
|
|
{
|
2015-12-10 15:14:53 +00:00
|
|
|
xmb_selection_pointer_changed(xmb, false);
|
2015-12-07 15:55:13 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
|
2016-05-21 18:53:57 +00:00
|
|
|
if (!string_is_equal(xmb_thumbnails_ident(), "OFF"))
|
2016-04-07 18:42:53 +00:00
|
|
|
xmb_update_thumbnail_image(xmb);
|
2015-01-28 18:09:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-13 18:00:34 +00:00
|
|
|
xmb_set_title(xmb);
|
2015-01-26 20:59:55 +00:00
|
|
|
|
2015-06-15 17:00:52 +00:00
|
|
|
if (xmb->categories.selection_ptr != xmb->categories.active.idx_old)
|
2015-02-13 18:00:34 +00:00
|
|
|
xmb_list_switch(xmb);
|
2015-02-23 20:40:36 +00:00
|
|
|
else
|
|
|
|
xmb_list_open(xmb);
|
2015-01-26 20:59:55 +00:00
|
|
|
}
|
|
|
|
|
2015-11-08 00:30:07 +00:00
|
|
|
static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
|
2016-04-20 15:34:15 +00:00
|
|
|
xmb_node_t *core_node, xmb_node_t *node,
|
|
|
|
uint32_t hash, unsigned type, bool active)
|
2015-03-09 23:39:18 +00:00
|
|
|
{
|
2016-04-20 19:53:42 +00:00
|
|
|
switch (hash)
|
|
|
|
{
|
|
|
|
case MENU_LABEL_CORE_OPTIONS:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
|
|
|
|
case MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS];
|
|
|
|
case MENU_LABEL_CORE_CHEAT_OPTIONS:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS];
|
|
|
|
case MENU_LABEL_DISK_OPTIONS:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS];
|
|
|
|
case MENU_LABEL_SHADER_OPTIONS:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS];
|
|
|
|
case MENU_LABEL_ACHIEVEMENT_LIST:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_ACHIEVEMENT_LIST];
|
|
|
|
case MENU_LABEL_SAVESTATE:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_SAVESTATE];
|
|
|
|
case MENU_LABEL_LOADSTATE:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_LOADSTATE];
|
|
|
|
case MENU_LABEL_TAKE_SCREENSHOT:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_SCREENSHOT];
|
|
|
|
case MENU_LABEL_RESTART_CONTENT:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_RELOAD];
|
|
|
|
case MENU_LABEL_RESUME_CONTENT:
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_RESUME];
|
|
|
|
}
|
2016-04-20 15:34:15 +00:00
|
|
|
|
2015-03-09 23:39:18 +00:00
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case MENU_FILE_DIRECTORY:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_FOLDER];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_FILE_PLAIN:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_FILE];
|
2015-07-23 17:44:59 +00:00
|
|
|
case MENU_FILE_RPL_ENTRY:
|
2015-03-09 23:39:18 +00:00
|
|
|
if (core_node)
|
|
|
|
return core_node->content_icon;
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_FILE];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_FILE_CARCHIVE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_ZIP];
|
2015-06-30 16:07:22 +00:00
|
|
|
case MENU_FILE_MUSIC:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_MUSIC];
|
2015-07-01 12:53:34 +00:00
|
|
|
case MENU_FILE_IMAGEVIEWER:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_IMAGE];
|
2015-07-04 00:14:26 +00:00
|
|
|
case MENU_FILE_MOVIE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_MOVIE];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_FILE_CORE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CORE];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_FILE_RDB:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_RDB];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_FILE_CURSOR:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CURSOR];
|
2015-07-23 17:44:59 +00:00
|
|
|
case MENU_FILE_PLAYLIST_ENTRY:
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_RUN:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_RUN];
|
2015-06-25 04:14:22 +00:00
|
|
|
case MENU_SETTING_ACTION_CLOSE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CLOSE];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_SAVESTATE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_SAVESTATE];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_LOADSTATE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_LOADSTATE];
|
2015-07-23 17:44:59 +00:00
|
|
|
case MENU_FILE_RDB_ENTRY:
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_CORE_INFORMATION:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CORE_INFO];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_CORE_OPTIONS:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CORE_OPTIONS];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_CORE_INPUT_REMAPPING_OPTIONS:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_CORE_CHEAT_OPTIONS:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CHEAT_OPTIONS];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_DISK_OPTIONS];
|
2015-06-25 04:47:20 +00:00
|
|
|
case MENU_SETTING_ACTION_CORE_SHADER_OPTIONS:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_SHADER_OPTIONS];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_SCREENSHOT:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_SCREENSHOT];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION_RESET:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_RELOAD];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_ACTION:
|
|
|
|
if (xmb->depth == 3)
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_SUBSETTING];
|
|
|
|
return xmb->textures.list[XMB_TEXTURE_SETTING];
|
2015-03-09 23:39:18 +00:00
|
|
|
case MENU_SETTING_GROUP:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_SETTING];
|
2015-10-22 20:43:25 +00:00
|
|
|
case MENU_INFO_MESSAGE:
|
2016-03-02 21:17:05 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_CORE_INFO];
|
2015-03-09 23:39:18 +00:00
|
|
|
}
|
|
|
|
|
2016-04-20 19:53:42 +00:00
|
|
|
return xmb->textures.list[XMB_TEXTURE_SUBSETTING];
|
2015-03-09 23:39:18 +00:00
|
|
|
}
|
|
|
|
|
2015-11-02 19:02:06 +00:00
|
|
|
static void xmb_draw_items(xmb_handle_t *xmb,
|
2015-02-11 04:33:53 +00:00
|
|
|
file_list_t *list, file_list_t *stack,
|
2015-11-08 00:30:07 +00:00
|
|
|
size_t current, size_t cat_selection_ptr, float *color,
|
2015-09-06 21:10:00 +00:00
|
|
|
unsigned width, unsigned height)
|
2014-10-20 18:00:39 +00:00
|
|
|
{
|
2016-02-25 14:19:33 +00:00
|
|
|
menu_animation_ctx_ticker_t ticker;
|
2015-12-12 13:39:35 +00:00
|
|
|
size_t i;
|
|
|
|
unsigned ticker_limit;
|
2015-11-02 18:47:25 +00:00
|
|
|
math_matrix_4x4 mymat;
|
2016-02-09 03:43:15 +00:00
|
|
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
2016-02-25 14:19:33 +00:00
|
|
|
uint64_t *frame_count = NULL;
|
2015-06-13 03:04:57 +00:00
|
|
|
xmb_node_t *core_node = NULL;
|
|
|
|
size_t end = 0;
|
2016-05-08 12:00:51 +00:00
|
|
|
frame_count = video_driver_get_frame_count_ptr();
|
2015-11-20 14:08:27 +00:00
|
|
|
|
2015-12-10 12:48:41 +00:00
|
|
|
if (!list || !list->size)
|
2014-10-20 18:00:39 +00:00
|
|
|
return;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2015-10-21 23:03:49 +00:00
|
|
|
if (cat_selection_ptr > XMB_SYSTEM_TAB_END)
|
2016-02-04 20:40:29 +00:00
|
|
|
core_node = xmb_get_userdata_from_horizontal_list(
|
|
|
|
xmb, cat_selection_ptr - (XMB_SYSTEM_TAB_END + 1));
|
2014-11-27 10:07:52 +00:00
|
|
|
|
2015-02-12 16:08:57 +00:00
|
|
|
end = file_list_get_size(list);
|
|
|
|
|
2016-02-09 03:43:15 +00:00
|
|
|
rotate_draw.matrix = &mymat;
|
|
|
|
rotate_draw.rotation = 0;
|
|
|
|
rotate_draw.scale_x = 1;
|
|
|
|
rotate_draw.scale_y = 1;
|
|
|
|
rotate_draw.scale_z = 1;
|
|
|
|
rotate_draw.scale_enable = true;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_rotate_z(&rotate_draw);
|
2015-03-10 02:42:26 +00:00
|
|
|
|
2015-12-12 13:39:35 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
|
2015-06-15 22:51:20 +00:00
|
|
|
|
|
|
|
if (list == xmb->selection_buf_old)
|
|
|
|
i = 0;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_blend_begin();
|
2016-04-21 08:16:21 +00:00
|
|
|
|
2015-06-15 22:51:20 +00:00
|
|
|
for (; i < end; i++)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2015-12-06 13:46:50 +00:00
|
|
|
menu_entry_t entry;
|
2015-09-06 23:33:38 +00:00
|
|
|
float icon_x, icon_y;
|
2016-06-03 02:12:18 +00:00
|
|
|
char name[PATH_MAX_LENGTH] = {0};
|
|
|
|
char value[PATH_MAX_LENGTH] = {0};
|
2015-09-28 14:20:26 +00:00
|
|
|
const float half_size = xmb->icon.size / 2.0f;
|
2016-02-04 20:40:29 +00:00
|
|
|
uintptr_t texture_switch = 0;
|
|
|
|
uintptr_t icon = 0;
|
|
|
|
xmb_node_t * node = (xmb_node_t*)
|
|
|
|
menu_entries_get_userdata_at_offset(list, i);
|
2015-06-12 14:25:32 +00:00
|
|
|
uint32_t hash_label = 0;
|
|
|
|
uint32_t hash_value = 0;
|
|
|
|
bool do_draw_text = false;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2015-02-12 16:05:56 +00:00
|
|
|
if (!node)
|
|
|
|
continue;
|
2015-06-06 12:07:20 +00:00
|
|
|
|
2015-06-14 23:04:08 +00:00
|
|
|
icon_y = xmb->margins.screen.top + node->y + half_size;
|
2015-02-01 23:02:16 +00:00
|
|
|
|
2015-06-14 23:04:08 +00:00
|
|
|
if (icon_y < half_size)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (icon_y > height + xmb->icon.size)
|
|
|
|
break;
|
|
|
|
|
|
|
|
icon_x = node->x + xmb->margins.screen.left +
|
|
|
|
xmb->icon.spacing.horizontal - half_size;
|
|
|
|
|
|
|
|
if (icon_x < -half_size || icon_x > width)
|
2015-02-01 23:02:16 +00:00
|
|
|
continue;
|
|
|
|
|
2015-10-27 09:10:33 +00:00
|
|
|
menu_entry_get(&entry, 0, i, list, true);
|
2014-10-09 17:22:42 +00:00
|
|
|
|
2015-06-17 17:55:24 +00:00
|
|
|
hash_label = menu_hash_calculate(entry.label);
|
|
|
|
hash_value = menu_hash_calculate(entry.value);
|
2015-06-04 20:46:23 +00:00
|
|
|
|
2015-06-02 06:06:20 +00:00
|
|
|
if (entry.type == MENU_FILE_CONTENTLIST_ENTRY)
|
2015-06-22 17:39:56 +00:00
|
|
|
fill_short_pathname_representation(entry.path, entry.path,
|
|
|
|
sizeof(entry.path));
|
2015-06-01 13:21:43 +00:00
|
|
|
|
2016-04-20 15:34:15 +00:00
|
|
|
icon = xmb_icon_get_id(xmb, core_node, node, hash_label, entry.type, (i == current));
|
2015-02-18 09:31:01 +00:00
|
|
|
|
2016-01-20 03:54:17 +00:00
|
|
|
if (string_is_equal(entry.value, "disabled") ||
|
|
|
|
string_is_equal(entry.value, "off"))
|
2015-06-06 09:36:29 +00:00
|
|
|
{
|
2016-03-02 21:17:05 +00:00
|
|
|
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
|
|
|
|
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
|
2015-10-28 00:36:36 +00:00
|
|
|
else
|
2015-06-06 09:36:29 +00:00
|
|
|
do_draw_text = true;
|
2015-10-28 00:36:36 +00:00
|
|
|
}
|
2016-01-20 03:54:17 +00:00
|
|
|
else if (string_is_equal(entry.value, "enabled") ||
|
|
|
|
string_is_equal(entry.value, "on"))
|
2015-10-28 00:36:36 +00:00
|
|
|
{
|
2016-03-02 21:17:05 +00:00
|
|
|
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
|
|
|
|
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
|
2015-10-28 00:36:36 +00:00
|
|
|
else
|
|
|
|
do_draw_text = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (hash_value)
|
|
|
|
{
|
|
|
|
case MENU_VALUE_COMP:
|
|
|
|
case MENU_VALUE_MORE:
|
|
|
|
case MENU_VALUE_CORE:
|
|
|
|
case MENU_VALUE_RDB:
|
|
|
|
case MENU_VALUE_CURSOR:
|
|
|
|
case MENU_VALUE_FILE:
|
|
|
|
case MENU_VALUE_DIR:
|
|
|
|
case MENU_VALUE_MUSIC:
|
|
|
|
case MENU_VALUE_IMAGE:
|
|
|
|
case MENU_VALUE_MOVIE:
|
|
|
|
break;
|
|
|
|
case MENU_VALUE_ON:
|
2016-03-02 21:17:05 +00:00
|
|
|
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
|
|
|
|
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
|
2015-10-28 00:36:36 +00:00
|
|
|
else
|
|
|
|
do_draw_text = true;
|
|
|
|
break;
|
|
|
|
case MENU_VALUE_OFF:
|
2016-03-02 21:17:05 +00:00
|
|
|
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
|
|
|
|
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
|
2015-10-28 00:36:36 +00:00
|
|
|
else
|
|
|
|
do_draw_text = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
do_draw_text = true;
|
|
|
|
break;
|
|
|
|
}
|
2015-06-06 09:36:29 +00:00
|
|
|
}
|
|
|
|
|
2015-07-06 13:34:28 +00:00
|
|
|
ticker_limit = 35;
|
2015-12-26 06:37:44 +00:00
|
|
|
if (string_is_empty(entry.value))
|
2015-07-06 13:34:28 +00:00
|
|
|
{
|
2016-05-21 18:53:57 +00:00
|
|
|
if (!string_is_equal(xmb_thumbnails_ident(), "OFF") && xmb->thumbnail)
|
2015-07-06 13:34:28 +00:00
|
|
|
ticker_limit = 40;
|
|
|
|
else
|
|
|
|
ticker_limit = 70;
|
|
|
|
}
|
|
|
|
|
2016-02-25 14:19:33 +00:00
|
|
|
ticker.s = name;
|
|
|
|
ticker.len = ticker_limit;
|
|
|
|
ticker.idx = *frame_count / 20;
|
|
|
|
ticker.str = entry.path;
|
|
|
|
ticker.selected = (i == current);
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
|
2015-06-06 09:38:10 +00:00
|
|
|
|
2015-12-10 12:48:41 +00:00
|
|
|
xmb_draw_text(xmb, name,
|
2016-03-09 21:17:18 +00:00
|
|
|
node->x + xmb->margins.screen.left +
|
|
|
|
xmb->icon.spacing.horizontal + xmb->margins.label.left,
|
|
|
|
xmb->margins.screen.top + node->y + xmb->margins.label.top,
|
2015-09-06 19:57:12 +00:00
|
|
|
1, node->label_alpha, TEXT_ALIGN_LEFT,
|
|
|
|
width, height);
|
2015-06-06 09:38:10 +00:00
|
|
|
|
2016-02-25 14:19:33 +00:00
|
|
|
ticker.s = value;
|
|
|
|
ticker.len = 35;
|
|
|
|
ticker.idx = *frame_count / 20;
|
|
|
|
ticker.str = entry.value;
|
|
|
|
ticker.selected = (i == current);
|
2015-06-06 09:38:10 +00:00
|
|
|
|
2016-02-25 14:19:33 +00:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
|
2015-06-06 09:38:10 +00:00
|
|
|
|
2015-06-06 09:36:29 +00:00
|
|
|
if (do_draw_text)
|
2015-12-10 12:48:41 +00:00
|
|
|
xmb_draw_text(xmb, value,
|
2016-03-09 21:17:18 +00:00
|
|
|
node->x +
|
2016-02-04 20:40:29 +00:00
|
|
|
+ xmb->margins.screen.left
|
|
|
|
+ xmb->icon.spacing.horizontal
|
2016-03-09 21:17:18 +00:00
|
|
|
+ xmb->margins.label.left
|
|
|
|
+ xmb->margins.setting.left,
|
|
|
|
xmb->margins.screen.top + node->y + xmb->margins.label.top,
|
|
|
|
1,
|
2015-01-23 00:54:17 +00:00
|
|
|
node->label_alpha,
|
2015-09-06 19:57:12 +00:00
|
|
|
TEXT_ALIGN_LEFT,
|
|
|
|
width, height);
|
2014-10-22 00:41:28 +00:00
|
|
|
|
2015-03-08 21:02:33 +00:00
|
|
|
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha));
|
2015-03-08 21:02:33 +00:00
|
|
|
|
2015-09-06 21:24:51 +00:00
|
|
|
if (color[3] != 0)
|
2016-04-21 07:14:25 +00:00
|
|
|
{
|
|
|
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
|
|
|
math_matrix_4x4 mymat;
|
|
|
|
uintptr_t texture = icon;
|
|
|
|
float x = icon_x;
|
|
|
|
float y = icon_y;
|
|
|
|
float rotation = 0;
|
|
|
|
float scale_factor = node->zoom;
|
|
|
|
|
|
|
|
rotate_draw.matrix = &mymat;
|
|
|
|
rotate_draw.rotation = rotation;
|
|
|
|
rotate_draw.scale_x = scale_factor;
|
|
|
|
rotate_draw.scale_y = scale_factor;
|
|
|
|
rotate_draw.scale_z = 1;
|
|
|
|
rotate_draw.scale_enable = true;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_rotate_z(&rotate_draw);
|
2016-04-21 07:14:25 +00:00
|
|
|
|
2016-04-21 07:18:03 +00:00
|
|
|
xmb_draw_icon(
|
|
|
|
xmb->icon.size,
|
|
|
|
&mymat,
|
|
|
|
texture,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
1.0,
|
|
|
|
rotation,
|
|
|
|
scale_factor,
|
2016-05-08 20:57:02 +00:00
|
|
|
&color[0],
|
|
|
|
xmb->shadow_offset);
|
2016-04-21 07:14:25 +00:00
|
|
|
}
|
2015-04-27 02:21:39 +00:00
|
|
|
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha));
|
2015-09-06 21:24:51 +00:00
|
|
|
|
|
|
|
if (texture_switch != 0 && color[3] != 0)
|
2016-04-21 07:18:03 +00:00
|
|
|
xmb_draw_icon(
|
|
|
|
xmb->icon.size,
|
|
|
|
&mymat,
|
2015-04-27 02:21:39 +00:00
|
|
|
texture_switch,
|
2016-03-09 21:17:18 +00:00
|
|
|
node->x + xmb->margins.screen.left
|
2016-02-04 20:40:29 +00:00
|
|
|
+ xmb->icon.spacing.horizontal
|
2015-02-12 19:23:14 +00:00
|
|
|
+ xmb->icon.size / 2.0 + xmb->margins.setting.left,
|
|
|
|
xmb->margins.screen.top + node->y + xmb->icon.size / 2.0,
|
2015-09-06 19:05:33 +00:00
|
|
|
width, height,
|
2014-10-22 00:41:28 +00:00
|
|
|
node->alpha,
|
|
|
|
0,
|
2016-05-08 20:57:02 +00:00
|
|
|
1,
|
|
|
|
&color[0],
|
|
|
|
xmb->shadow_offset);
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
2016-04-21 08:16:21 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_blend_end();
|
2014-10-20 18:00:39 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 13:45:34 +00:00
|
|
|
static void xmb_render(void *data)
|
2015-03-08 18:15:24 +00:00
|
|
|
{
|
2016-04-20 15:37:31 +00:00
|
|
|
size_t i;
|
2016-02-25 15:05:30 +00:00
|
|
|
float delta_time;
|
|
|
|
menu_animation_ctx_delta_t delta;
|
2015-06-13 20:57:55 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-12-10 13:45:34 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2016-04-20 15:37:31 +00:00
|
|
|
unsigned end = menu_entries_get_size();
|
2015-03-08 22:36:12 +00:00
|
|
|
|
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2015-09-25 21:37:02 +00:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
2016-02-25 15:05:30 +00:00
|
|
|
|
|
|
|
delta.current = delta_time;
|
|
|
|
|
|
|
|
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE, &delta.ideal);
|
2015-03-08 18:50:12 +00:00
|
|
|
|
2015-06-23 16:27:45 +00:00
|
|
|
if (settings->menu.pointer.enable || settings->menu.mouse.enable)
|
2015-04-16 15:39:40 +00:00
|
|
|
{
|
2016-04-20 15:37:31 +00:00
|
|
|
size_t selection;
|
|
|
|
|
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
|
|
|
|
2015-06-23 16:27:45 +00:00
|
|
|
for (i = 0; i < end; i++)
|
2015-06-15 22:51:20 +00:00
|
|
|
{
|
2016-03-09 21:17:18 +00:00
|
|
|
float item_y1 = xmb->margins.screen.top
|
2016-02-04 20:40:29 +00:00
|
|
|
+ xmb_item_y(xmb, i, selection);
|
2015-09-24 15:21:50 +00:00
|
|
|
float item_y2 = item_y1 + xmb->icon.size;
|
|
|
|
int16_t pointer_y = menu_input_pointer_state(MENU_POINTER_Y_AXIS);
|
2016-03-09 21:17:18 +00:00
|
|
|
int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS)
|
2016-02-04 20:40:29 +00:00
|
|
|
+ (xmb->cursor.size/2);
|
2015-06-23 16:27:45 +00:00
|
|
|
|
|
|
|
if (settings->menu.pointer.enable)
|
|
|
|
{
|
2015-09-24 15:21:50 +00:00
|
|
|
if (pointer_y > item_y1 && pointer_y < item_y2)
|
2015-09-26 00:52:05 +00:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &i);
|
2015-06-23 16:27:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->menu.mouse.enable)
|
|
|
|
{
|
2015-09-24 15:34:44 +00:00
|
|
|
if (mouse_y > item_y1 && mouse_y < item_y2)
|
2015-09-26 00:52:05 +00:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_MOUSE_PTR, &i);
|
2015-06-23 16:27:45 +00:00
|
|
|
}
|
2015-04-16 15:39:40 +00:00
|
|
|
}
|
2015-03-08 22:36:12 +00:00
|
|
|
}
|
|
|
|
|
2015-12-12 13:39:35 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
|
|
|
|
|
|
|
|
if (i >= end)
|
|
|
|
{
|
|
|
|
i = 0;
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i);
|
|
|
|
}
|
2015-06-15 22:51:20 +00:00
|
|
|
|
2015-09-25 21:39:02 +00:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
|
2015-03-08 18:15:24 +00:00
|
|
|
}
|
|
|
|
|
2016-04-21 03:04:01 +00:00
|
|
|
static void xmb_draw_bg(
|
|
|
|
xmb_handle_t *xmb,
|
|
|
|
unsigned width,
|
|
|
|
unsigned height,
|
|
|
|
float alpha,
|
|
|
|
uintptr_t texture_id,
|
2016-04-22 10:11:56 +00:00
|
|
|
float *coord_black,
|
|
|
|
float *coord_white)
|
2016-04-16 15:57:51 +00:00
|
|
|
{
|
2016-04-21 03:04:01 +00:00
|
|
|
menu_display_ctx_draw_t draw;
|
2016-04-22 13:05:56 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2016-05-08 10:33:28 +00:00
|
|
|
|
|
|
|
bool running = menu_display_libretro_running();
|
2016-04-21 02:54:07 +00:00
|
|
|
|
2016-04-22 10:43:23 +00:00
|
|
|
draw.x = 0;
|
|
|
|
draw.y = 0;
|
2016-04-21 03:04:01 +00:00
|
|
|
draw.texture = texture_id;
|
|
|
|
draw.width = width;
|
|
|
|
draw.height = height;
|
2016-04-22 10:11:56 +00:00
|
|
|
draw.color = &coord_black[0];
|
2016-04-21 03:04:01 +00:00
|
|
|
draw.vertex = NULL;
|
|
|
|
draw.tex_coord = NULL;
|
|
|
|
draw.vertex_count = 4;
|
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
2016-05-08 09:11:28 +00:00
|
|
|
draw.pipeline.id = 0;
|
2016-04-21 03:04:01 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_blend_begin();
|
|
|
|
menu_display_set_viewport();
|
2016-04-22 05:32:32 +00:00
|
|
|
|
2016-06-06 22:00:28 +00:00
|
|
|
#ifdef HAVE_SHADERPIPELINE
|
2016-05-01 02:40:20 +00:00
|
|
|
if (settings->menu.shader_pipeline > 0)
|
2016-04-22 05:32:32 +00:00
|
|
|
{
|
2016-04-22 06:47:14 +00:00
|
|
|
draw.color = xmb_gradient_ident();
|
2016-04-22 13:05:56 +00:00
|
|
|
|
|
|
|
if (running)
|
|
|
|
menu_display_set_alpha(draw.color, coord_black[3]);
|
|
|
|
else
|
|
|
|
menu_display_set_alpha(draw.color, coord_white[3]);
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw_gradient(&draw);
|
2016-05-08 09:11:28 +00:00
|
|
|
|
2016-04-24 20:56:28 +00:00
|
|
|
draw.pipeline.id = VIDEO_SHADER_MENU_SEC;
|
2016-05-01 02:40:20 +00:00
|
|
|
if (settings->menu.shader_pipeline == 2)
|
2016-04-24 20:56:28 +00:00
|
|
|
draw.pipeline.id = VIDEO_SHADER_MENU;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw_pipeline(&draw);
|
2016-04-22 05:32:32 +00:00
|
|
|
}
|
|
|
|
else
|
2016-06-06 22:00:28 +00:00
|
|
|
#endif
|
2016-04-22 05:32:32 +00:00
|
|
|
{
|
2016-04-22 13:05:56 +00:00
|
|
|
if (!running && draw.texture)
|
|
|
|
draw.color = &coord_white[0];
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw_bg(&draw);
|
2016-04-22 05:32:32 +00:00
|
|
|
}
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_draw(&draw);
|
|
|
|
menu_display_blend_end();
|
2016-04-12 14:25:13 +00:00
|
|
|
}
|
|
|
|
|
2016-04-22 07:05:18 +00:00
|
|
|
static void xmb_draw_dark_layer(
|
|
|
|
xmb_handle_t *xmb,
|
|
|
|
unsigned width,
|
|
|
|
unsigned height)
|
|
|
|
{
|
2016-04-22 07:27:34 +00:00
|
|
|
menu_display_ctx_draw_t draw;
|
2016-05-10 00:32:49 +00:00
|
|
|
struct video_coords coords;
|
2016-04-22 07:05:18 +00:00
|
|
|
float black[16] = {
|
|
|
|
0, 0, 0, 1,
|
|
|
|
0, 0, 0, 1,
|
|
|
|
0, 0, 0, 1,
|
|
|
|
0, 0, 0, 1,
|
|
|
|
};
|
|
|
|
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(black, MIN(xmb->alpha, 0.75));
|
2016-04-22 07:05:18 +00:00
|
|
|
|
2016-04-22 07:27:34 +00:00
|
|
|
coords.vertices = 4;
|
|
|
|
coords.vertex = NULL;
|
|
|
|
coords.tex_coord = NULL;
|
|
|
|
coords.lut_tex_coord = NULL;
|
|
|
|
coords.color = &black[0];
|
|
|
|
|
|
|
|
draw.x = 0;
|
|
|
|
draw.y = 0;
|
|
|
|
draw.width = width;
|
|
|
|
draw.height = height;
|
|
|
|
draw.coords = &coords;
|
|
|
|
draw.matrix_data = NULL;
|
|
|
|
draw.texture = menu_display_white_texture;
|
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
2016-05-08 09:11:28 +00:00
|
|
|
draw.pipeline.id = 0;
|
2016-04-22 07:05:18 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_blend_begin();
|
|
|
|
menu_display_draw(&draw);
|
|
|
|
menu_display_blend_end();
|
2016-04-22 07:05:18 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:44:26 +00:00
|
|
|
static void xmb_frame(void *data)
|
2014-10-20 18:00:39 +00:00
|
|
|
{
|
2015-09-25 14:25:33 +00:00
|
|
|
size_t selection;
|
2015-11-02 18:47:25 +00:00
|
|
|
math_matrix_4x4 mymat;
|
2016-04-21 05:02:30 +00:00
|
|
|
unsigned i, width, height;
|
2016-04-22 10:11:56 +00:00
|
|
|
float item_color[16], coord_black[16], coord_white[16];
|
2016-02-09 03:43:15 +00:00
|
|
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
2016-06-03 02:12:18 +00:00
|
|
|
char msg[PATH_MAX_LENGTH] = {0};
|
|
|
|
char title_msg[256] = {0};
|
2016-04-21 03:04:01 +00:00
|
|
|
bool display_kb = false;
|
2015-06-12 14:25:32 +00:00
|
|
|
bool render_background = false;
|
2016-04-21 05:02:30 +00:00
|
|
|
file_list_t *selection_buf = NULL;
|
|
|
|
file_list_t *menu_stack = NULL;
|
2015-06-12 14:25:32 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2016-04-21 05:02:30 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2014-10-20 18:00:39 +00:00
|
|
|
|
2015-12-10 14:44:26 +00:00
|
|
|
if (!xmb)
|
2015-12-10 14:17:37 +00:00
|
|
|
return;
|
|
|
|
|
2015-06-14 19:23:31 +00:00
|
|
|
msg[0] = '\0';
|
|
|
|
title_msg[0] = '\0';
|
|
|
|
|
2015-05-19 22:29:46 +00:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-19 22:26:50 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_font_bind_block(&xmb->raster_block);
|
2015-03-27 14:20:10 +00:00
|
|
|
|
|
|
|
xmb->raster_block.carr.coords.vertices = 0;
|
2015-03-25 16:42:25 +00:00
|
|
|
|
2015-09-06 15:45:16 +00:00
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
2016-04-22 10:11:56 +00:00
|
|
|
coord_black[i] = 0;
|
|
|
|
coord_white[i] = 1.0f;
|
2015-09-06 20:24:14 +00:00
|
|
|
item_color[i] = 1.0f;
|
2015-09-06 15:45:16 +00:00
|
|
|
}
|
|
|
|
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(coord_black, MIN(
|
|
|
|
(float)settings->menu.xmb_alpha_factor/100, xmb->alpha));
|
2016-04-22 10:11:56 +00:00
|
|
|
menu_display_set_alpha(coord_white, xmb->alpha);
|
2015-09-06 21:15:03 +00:00
|
|
|
|
2016-04-21 03:04:01 +00:00
|
|
|
xmb_draw_bg(
|
|
|
|
xmb,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
xmb->alpha,
|
|
|
|
xmb->textures.bg,
|
2016-04-22 10:11:56 +00:00
|
|
|
coord_black,
|
|
|
|
coord_white);
|
2014-10-20 18:00:39 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
/* Title text */
|
2015-12-10 12:48:41 +00:00
|
|
|
xmb_draw_text(xmb,
|
2015-04-21 14:45:27 +00:00
|
|
|
xmb->title_name, xmb->margins.title.left,
|
2015-09-06 19:57:12 +00:00
|
|
|
xmb->margins.title.top, 1, 1, TEXT_ALIGN_LEFT,
|
|
|
|
width, height);
|
2014-11-14 23:35:45 +00:00
|
|
|
|
2016-05-08 00:51:42 +00:00
|
|
|
/* uncomment to print the messages on the XMB status line
|
|
|
|
if (string_is_empty(runloop_msg_queue_pull()))
|
|
|
|
{*/
|
|
|
|
if (menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
|
|
|
xmb_draw_text(xmb, title_msg, xmb->margins.title.left,
|
|
|
|
height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT,
|
|
|
|
width, height);
|
|
|
|
/* }
|
|
|
|
else
|
|
|
|
xmb_draw_text(xmb, runloop_msg_queue_pull(), xmb->margins.title.left,
|
|
|
|
height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT,
|
|
|
|
width, height);
|
|
|
|
*/
|
2014-10-20 18:00:39 +00:00
|
|
|
|
2016-02-09 03:43:15 +00:00
|
|
|
rotate_draw.matrix = &mymat;
|
|
|
|
rotate_draw.rotation = 0;
|
|
|
|
rotate_draw.scale_x = 1;
|
|
|
|
rotate_draw.scale_y = 1;
|
|
|
|
rotate_draw.scale_z = 1;
|
|
|
|
rotate_draw.scale_enable = true;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_rotate_z(&rotate_draw);
|
|
|
|
menu_display_blend_begin();
|
2015-03-08 20:55:02 +00:00
|
|
|
|
2016-05-21 18:53:57 +00:00
|
|
|
if (!string_is_equal(xmb_thumbnails_ident(), "OFF") && xmb->thumbnail)
|
2016-04-22 10:11:56 +00:00
|
|
|
xmb_draw_thumbnail(xmb, &coord_white[0], width, height);
|
2015-06-18 19:16:45 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
/* Clock image */
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f));
|
|
|
|
|
2016-04-22 10:11:56 +00:00
|
|
|
if (settings->menu.timedate_enable && coord_white[3] != 0)
|
2016-04-21 07:18:03 +00:00
|
|
|
xmb_draw_icon(
|
|
|
|
xmb->icon.size,
|
|
|
|
&mymat,
|
2016-03-02 21:17:05 +00:00
|
|
|
xmb->textures.list[XMB_TEXTURE_CLOCK],
|
2016-04-21 07:18:03 +00:00
|
|
|
width - xmb->icon.size,
|
|
|
|
xmb->icon.size,width,
|
|
|
|
height,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
1,
|
2016-05-08 20:57:02 +00:00
|
|
|
&coord_white[0],
|
|
|
|
xmb->shadow_offset);
|
2015-09-06 21:24:51 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
if (settings->menu.timedate_enable)
|
|
|
|
{
|
|
|
|
menu_display_ctx_datetime_t datetime;
|
2016-06-03 02:12:18 +00:00
|
|
|
char timedate[256] = {0};
|
2016-04-21 05:02:30 +00:00
|
|
|
|
|
|
|
datetime.s = timedate;
|
|
|
|
datetime.len = sizeof(timedate);
|
|
|
|
datetime.time_mode = 4;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_timedate(&datetime);
|
2016-04-21 05:02:30 +00:00
|
|
|
|
|
|
|
xmb_draw_text(xmb, timedate,
|
|
|
|
width - xmb->margins.title.left - xmb->icon.size / 4,
|
|
|
|
xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT,
|
|
|
|
width, height);
|
|
|
|
}
|
2015-09-06 21:24:51 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
/* Arrow image */
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(coord_white, MIN(xmb->textures.arrow.alpha, xmb->alpha));
|
|
|
|
|
2016-04-22 10:11:56 +00:00
|
|
|
if (coord_white[3] != 0)
|
2016-04-21 07:14:25 +00:00
|
|
|
xmb_draw_icon(
|
2016-04-21 07:18:03 +00:00
|
|
|
xmb->icon.size,
|
2015-09-06 21:24:51 +00:00
|
|
|
&mymat,
|
2016-03-02 21:17:05 +00:00
|
|
|
xmb->textures.list[XMB_TEXTURE_ARROW],
|
2016-03-09 21:17:18 +00:00
|
|
|
xmb->x + xmb->margins.screen.left +
|
2015-09-06 21:24:51 +00:00
|
|
|
xmb->icon.spacing.horizontal - xmb->icon.size / 2.0 + xmb->icon.size,
|
2016-03-09 21:17:18 +00:00
|
|
|
xmb->margins.screen.top +
|
|
|
|
xmb->icon.size / 2.0 + xmb->icon.spacing.vertical
|
2016-05-08 21:05:11 +00:00
|
|
|
* xmb->active_item_factor,
|
2015-09-06 21:24:51 +00:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
xmb->textures.arrow.alpha,
|
|
|
|
0,
|
2016-05-08 20:57:02 +00:00
|
|
|
1,
|
|
|
|
&coord_white[0],
|
|
|
|
xmb->shadow_offset);
|
2015-03-10 02:42:26 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_blend_begin();
|
2016-04-21 08:14:46 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
/* Horizontal tab icons */
|
2016-04-21 02:12:04 +00:00
|
|
|
for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
|
|
|
|
+ XMB_SYSTEM_TAB_END; i++)
|
|
|
|
{
|
|
|
|
xmb_node_t *node = xmb_get_node(xmb, i);
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(item_color, MIN(node->alpha, xmb->alpha));
|
2016-04-21 02:12:04 +00:00
|
|
|
|
|
|
|
if (item_color[3] != 0)
|
2016-04-21 07:14:25 +00:00
|
|
|
{
|
|
|
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
|
|
|
math_matrix_4x4 mymat;
|
|
|
|
uintptr_t texture = node->icon;
|
|
|
|
float x = xmb->x + xmb->categories.x_pos +
|
|
|
|
xmb->margins.screen.left +
|
|
|
|
xmb->icon.spacing.horizontal * (i + 1) - xmb->icon.size / 2.0;
|
|
|
|
float y = xmb->margins.screen.top + xmb->icon.size / 2.0;
|
|
|
|
float rotation = 0;
|
|
|
|
float scale_factor = node->zoom;
|
|
|
|
|
|
|
|
rotate_draw.matrix = &mymat;
|
|
|
|
rotate_draw.rotation = rotation;
|
|
|
|
rotate_draw.scale_x = scale_factor;
|
|
|
|
rotate_draw.scale_y = scale_factor;
|
|
|
|
rotate_draw.scale_z = 1;
|
|
|
|
rotate_draw.scale_enable = true;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_rotate_z(&rotate_draw);
|
2016-04-21 07:14:25 +00:00
|
|
|
|
2016-04-21 07:18:03 +00:00
|
|
|
xmb_draw_icon(
|
|
|
|
xmb->icon.size,
|
|
|
|
&mymat,
|
|
|
|
texture,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
1.0,
|
|
|
|
rotation,
|
|
|
|
scale_factor,
|
2016-05-08 20:57:02 +00:00
|
|
|
&item_color[0],
|
|
|
|
xmb->shadow_offset);
|
2016-04-21 07:14:25 +00:00
|
|
|
}
|
2016-04-21 02:12:04 +00:00
|
|
|
}
|
2014-11-11 15:28:40 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_blend_end();
|
2016-04-21 08:14:46 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
/* Vertical icons */
|
|
|
|
xmb_draw_items(xmb,
|
|
|
|
xmb->selection_buf_old,
|
|
|
|
xmb->menu_stack_old,
|
|
|
|
xmb->selection_ptr_old,
|
|
|
|
(xmb_list_get_size(xmb, MENU_LIST_PLAIN) > 1)
|
|
|
|
? xmb->categories.selection_ptr : xmb->categories.selection_ptr_old,
|
|
|
|
&item_color[0],
|
|
|
|
width,
|
|
|
|
height);
|
|
|
|
|
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
|
|
|
|
|
|
|
selection_buf = menu_entries_get_selection_buf_ptr(0);
|
|
|
|
menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
|
|
|
|
|
|
xmb_draw_items(
|
|
|
|
xmb,
|
|
|
|
selection_buf,
|
|
|
|
menu_stack,
|
|
|
|
selection,
|
|
|
|
xmb->categories.selection_ptr,
|
|
|
|
&item_color[0],
|
|
|
|
width,
|
|
|
|
height);
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_font_flush_block();
|
2015-09-24 18:08:11 +00:00
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);
|
|
|
|
|
2015-09-24 18:08:11 +00:00
|
|
|
if (display_kb)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2016-06-03 02:12:18 +00:00
|
|
|
const char *str = NULL;
|
|
|
|
const char *label = NULL;
|
2015-09-26 00:52:05 +00:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_BUFF_PTR, &str);
|
|
|
|
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL, &label);
|
2015-02-02 17:44:56 +00:00
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
if (!str)
|
|
|
|
str = "";
|
2015-09-24 18:08:11 +00:00
|
|
|
snprintf(msg, sizeof(msg), "%s\n%s", label, str);
|
2015-03-08 12:17:07 +00:00
|
|
|
render_background = true;
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2015-12-26 06:37:44 +00:00
|
|
|
if (!string_is_empty(xmb->box_message))
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2015-03-08 12:17:07 +00:00
|
|
|
strlcpy(msg, xmb->box_message,
|
|
|
|
sizeof(msg));
|
2014-10-09 02:34:16 +00:00
|
|
|
xmb->box_message[0] = '\0';
|
2015-03-08 12:17:07 +00:00
|
|
|
render_background = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (render_background)
|
|
|
|
{
|
2016-04-22 07:05:18 +00:00
|
|
|
xmb_draw_dark_layer(xmb, width, height);
|
2016-02-09 03:34:07 +00:00
|
|
|
|
2015-12-10 14:46:15 +00:00
|
|
|
xmb_render_messagebox_internal(xmb, msg);
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2016-04-21 05:02:30 +00:00
|
|
|
/* Cursor image */
|
2016-04-22 10:43:23 +00:00
|
|
|
menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f));
|
2016-04-21 03:08:36 +00:00
|
|
|
menu_display_draw_cursor(
|
2016-04-22 10:11:56 +00:00
|
|
|
&coord_white[0],
|
2016-04-21 03:08:36 +00:00
|
|
|
xmb->cursor.size,
|
|
|
|
xmb->textures.list[XMB_TEXTURE_POINTER],
|
|
|
|
menu_input_mouse_state(MENU_MOUSE_X_AXIS),
|
|
|
|
menu_input_mouse_state(MENU_MOUSE_Y_AXIS),
|
|
|
|
width,
|
|
|
|
height);
|
2015-03-08 22:36:12 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_unset_viewport();
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2015-06-07 09:51:06 +00:00
|
|
|
|
2016-02-08 06:11:56 +00:00
|
|
|
static void xmb_font(xmb_handle_t *xmb)
|
2015-06-20 09:31:10 +00:00
|
|
|
{
|
2016-02-09 00:24:35 +00:00
|
|
|
menu_display_ctx_font_t font_info;
|
2016-05-26 15:32:27 +00:00
|
|
|
char mediapath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char themepath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char fontpath[PATH_MAX_LENGTH] = {0};
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
int font_size = menu_display_get_font_size();
|
2015-06-20 09:31:10 +00:00
|
|
|
|
2016-04-28 17:26:02 +00:00
|
|
|
fill_pathname_join(
|
|
|
|
mediapath,
|
|
|
|
settings->directory.assets,
|
|
|
|
"xmb",
|
|
|
|
sizeof(mediapath));
|
2016-02-04 20:40:29 +00:00
|
|
|
fill_pathname_join(themepath,
|
2016-03-21 20:18:25 +00:00
|
|
|
mediapath, xmb_theme_ident(), sizeof(themepath));
|
2016-02-08 06:11:56 +00:00
|
|
|
if (string_is_empty(settings->menu.xmb_font))
|
|
|
|
fill_pathname_join(fontpath, themepath, "font.ttf", sizeof(fontpath));
|
|
|
|
else
|
|
|
|
strlcpy(fontpath, settings->menu.xmb_font,sizeof(fontpath));
|
2015-06-20 09:31:10 +00:00
|
|
|
|
2016-02-09 00:24:35 +00:00
|
|
|
font_info.path = fontpath;
|
|
|
|
font_info.size = font_size;
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
if (!menu_display_font_main_init(&font_info))
|
2015-06-20 09:31:10 +00:00
|
|
|
RARCH_WARN("Failed to load font.");
|
|
|
|
}
|
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
|
2015-06-20 09:31:10 +00:00
|
|
|
{
|
2016-05-08 22:12:40 +00:00
|
|
|
unsigned new_font_size, new_header_height;
|
2015-09-25 14:25:33 +00:00
|
|
|
float scale_factor;
|
2016-02-08 05:34:13 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-09-25 14:25:33 +00:00
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
scale_factor = (settings->menu.xmb_scale_factor * width) / (1920.0 * 100);
|
2016-03-24 00:23:04 +00:00
|
|
|
|
2016-05-08 21:05:11 +00:00
|
|
|
xmb->above_subitem_offset = 1.5;
|
|
|
|
xmb->above_item_offset = -1.0;
|
|
|
|
xmb->active_item_factor = 3.0;
|
|
|
|
xmb->under_item_offset = 5.0;
|
|
|
|
|
2016-05-08 21:19:34 +00:00
|
|
|
xmb->categories.active.zoom = 1.0;
|
|
|
|
xmb->categories.passive.zoom = 0.5;
|
2016-05-08 21:22:22 +00:00
|
|
|
xmb->items.active.zoom = 1.0;
|
|
|
|
xmb->items.passive.zoom = 0.5;
|
2016-05-08 21:16:23 +00:00
|
|
|
|
2016-05-08 21:19:34 +00:00
|
|
|
xmb->categories.active.alpha = 1.0;
|
|
|
|
xmb->categories.passive.alpha = 0.85;
|
2016-05-08 22:12:40 +00:00
|
|
|
xmb->items.active.alpha = 1.0;
|
|
|
|
xmb->items.passive.alpha = 0.85;
|
2016-05-08 21:09:52 +00:00
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
xmb->shadow_offset = 2.0;
|
2016-03-24 00:23:04 +00:00
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
new_font_size = 32.0 * scale_factor;
|
|
|
|
new_header_height = 128.0 * scale_factor;
|
|
|
|
xmb->margins.screen.top = (256+32) * scale_factor;
|
2015-06-20 09:31:10 +00:00
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
xmb->thumbnail_width = 460.0 * scale_factor;
|
|
|
|
xmb->cursor.size = 64.0;
|
2015-09-26 21:37:25 +00:00
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
xmb->icon.spacing.horizontal = 200.0 * scale_factor;
|
|
|
|
xmb->icon.spacing.vertical = 64.0 * scale_factor;
|
2016-03-24 00:23:04 +00:00
|
|
|
|
2016-05-08 22:12:40 +00:00
|
|
|
xmb->margins.screen.left = 336.0 * scale_factor;
|
|
|
|
xmb->margins.title.left = 60 * scale_factor;
|
|
|
|
xmb->margins.title.top = 60 * scale_factor + new_font_size / 3;
|
|
|
|
xmb->margins.title.bottom = 60 * scale_factor - new_font_size / 3;
|
|
|
|
xmb->margins.label.left = 85.0 * scale_factor;
|
|
|
|
xmb->margins.label.top = new_font_size / 3.0;
|
|
|
|
xmb->margins.setting.left = 600.0 * scale_factor;
|
|
|
|
xmb->icon.size = 128.0 * scale_factor;
|
2015-06-20 09:31:10 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_set_font_size(new_font_size);
|
|
|
|
menu_display_set_header_height(new_header_height);
|
2016-05-08 22:12:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void xmb_layout_psp(xmb_handle_t *xmb, int width)
|
|
|
|
{
|
|
|
|
unsigned new_font_size, new_header_height;
|
|
|
|
float scale_factor;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
scale_factor = ((settings->menu.xmb_scale_factor * width) / (1920.0 * 100)) * 1.5;
|
|
|
|
|
|
|
|
xmb->above_subitem_offset = 1.5;
|
|
|
|
xmb->above_item_offset = -1.0;
|
|
|
|
xmb->active_item_factor = 2.0;
|
|
|
|
xmb->under_item_offset = 3.0;
|
|
|
|
|
|
|
|
xmb->categories.active.zoom = 1.0;
|
|
|
|
xmb->categories.passive.zoom = 1.0;
|
|
|
|
xmb->items.active.zoom = 1.0;
|
|
|
|
xmb->items.passive.zoom = 1.0;
|
|
|
|
|
|
|
|
xmb->categories.active.alpha = 1.0;
|
|
|
|
xmb->categories.passive.alpha = 0.85;
|
|
|
|
xmb->items.active.alpha = 1.0;
|
|
|
|
xmb->items.passive.alpha = 0.85;
|
|
|
|
|
|
|
|
xmb->shadow_offset = 1.0;
|
|
|
|
|
|
|
|
new_font_size = 32.0 * scale_factor;
|
|
|
|
new_header_height = 128.0 * scale_factor;
|
|
|
|
xmb->margins.screen.top = (256+32) * scale_factor;
|
|
|
|
|
|
|
|
xmb->thumbnail_width = 460.0 * scale_factor;
|
|
|
|
xmb->cursor.size = 64.0;
|
|
|
|
|
|
|
|
xmb->icon.spacing.horizontal = 250.0 * scale_factor;
|
|
|
|
xmb->icon.spacing.vertical = 108.0 * scale_factor;
|
|
|
|
|
|
|
|
xmb->margins.screen.left = 136.0 * scale_factor;
|
|
|
|
xmb->margins.title.left = 60 * scale_factor;
|
|
|
|
xmb->margins.title.top = 60 * scale_factor + new_font_size / 3;
|
|
|
|
xmb->margins.title.bottom = 60 * scale_factor - new_font_size / 3;
|
|
|
|
xmb->margins.label.left = 85.0 * scale_factor;
|
|
|
|
xmb->margins.label.top = new_font_size / 3.0;
|
|
|
|
xmb->margins.setting.left = 600.0 * scale_factor;
|
|
|
|
xmb->icon.size = 128.0 * scale_factor;
|
|
|
|
|
|
|
|
menu_display_set_font_size(new_font_size);
|
|
|
|
menu_display_set_header_height(new_header_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xmb_layout(xmb_handle_t *xmb)
|
|
|
|
{
|
|
|
|
size_t selection;
|
|
|
|
unsigned width, height, i, current, end;
|
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
|
|
|
|
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
|
|
|
|
|
|
|
video_driver_get_size(&width, &height);
|
|
|
|
|
|
|
|
/* Mimic the layout of the PSP instead of the PS3 on tiny screens */
|
|
|
|
if (width > 320)
|
|
|
|
xmb_layout_ps3(xmb, width);
|
|
|
|
else
|
|
|
|
xmb_layout_psp(xmb, width);
|
2016-03-24 00:23:04 +00:00
|
|
|
|
2015-09-25 14:25:33 +00:00
|
|
|
current = selection;
|
2015-06-20 09:31:10 +00:00
|
|
|
end = menu_entries_get_end();
|
|
|
|
|
|
|
|
for (i = 0; i < end; i++)
|
|
|
|
{
|
2016-05-08 21:22:22 +00:00
|
|
|
float ia = xmb->items.passive.alpha;
|
|
|
|
float iz = xmb->items.passive.zoom;
|
2015-10-19 14:32:51 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)menu_entries_get_userdata_at_offset(
|
2015-10-17 16:17:59 +00:00
|
|
|
selection_buf, i);
|
2015-06-20 09:31:10 +00:00
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (i == current)
|
|
|
|
{
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.active.alpha;
|
|
|
|
iz = xmb->items.active.alpha;
|
2015-06-20 09:31:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
node->alpha = ia;
|
|
|
|
node->label_alpha = ia;
|
|
|
|
node->zoom = iz;
|
|
|
|
node->y = xmb_item_y(xmb, i, current);
|
|
|
|
}
|
2015-11-03 22:17:21 +00:00
|
|
|
|
|
|
|
if (xmb->depth <= 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
current = xmb->selection_ptr_old;
|
|
|
|
end = file_list_get_size(xmb->selection_buf_old);
|
|
|
|
|
|
|
|
for (i = 0; i < end; i++)
|
|
|
|
{
|
|
|
|
float ia = 0;
|
2016-05-08 21:22:22 +00:00
|
|
|
float iz = xmb->items.passive.zoom;
|
2015-11-03 22:17:21 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)menu_entries_get_userdata_at_offset(
|
|
|
|
xmb->selection_buf_old, i);
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (i == current)
|
|
|
|
{
|
2016-05-08 21:22:22 +00:00
|
|
|
ia = xmb->items.active.alpha;
|
|
|
|
iz = xmb->items.active.alpha;
|
2015-11-03 22:17:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
node->alpha = ia;
|
|
|
|
node->label_alpha = 0;
|
|
|
|
node->zoom = iz;
|
|
|
|
node->y = xmb_item_y(xmb, i, current);
|
|
|
|
node->x = xmb->icon.size * 1 * -2;
|
|
|
|
}
|
2015-06-20 09:31:10 +00:00
|
|
|
}
|
|
|
|
|
2016-04-19 21:00:55 +00:00
|
|
|
static void xmb_ribbon_set_vertex(float *ribbon_verts, unsigned idx, unsigned row, unsigned col)
|
|
|
|
{
|
2016-04-22 22:24:44 +00:00
|
|
|
ribbon_verts[idx++] = ((float)col) / (XMB_RIBBON_COLS-1) * 2.0f - 1.0f;
|
|
|
|
ribbon_verts[idx++] = ((float)row) / XMB_RIBBON_ROWS * 2.0f - 1.0f;
|
2016-04-19 21:00:55 +00:00
|
|
|
}
|
2016-04-16 19:50:17 +00:00
|
|
|
|
2016-04-17 21:23:37 +00:00
|
|
|
static void xmb_init_ribbon(xmb_handle_t * xmb)
|
2016-04-16 19:50:17 +00:00
|
|
|
{
|
2016-05-10 00:32:49 +00:00
|
|
|
video_coords_t coords;
|
2016-04-19 21:00:55 +00:00
|
|
|
float ribbon_verts[2 * XMB_RIBBON_VERTICES];
|
2016-04-25 11:45:53 +00:00
|
|
|
float dummy[4 * XMB_RIBBON_VERTICES];
|
2016-04-19 21:00:55 +00:00
|
|
|
unsigned i, r, c, col;
|
2016-05-10 00:32:49 +00:00
|
|
|
video_coord_array_t *ca = NULL;
|
2016-04-16 19:50:17 +00:00
|
|
|
|
2016-04-25 11:45:53 +00:00
|
|
|
memset(&dummy[0], 0, 4 * XMB_RIBBON_VERTICES * sizeof(float));
|
2016-05-08 10:33:28 +00:00
|
|
|
ca = menu_display_get_coords_array();
|
2016-04-17 21:23:37 +00:00
|
|
|
|
2016-04-16 19:50:17 +00:00
|
|
|
/* Set up vertices */
|
2016-04-19 21:00:55 +00:00
|
|
|
i = 0;
|
|
|
|
for (r = 0; r < XMB_RIBBON_ROWS - 1; r++)
|
2016-04-16 19:50:17 +00:00
|
|
|
{
|
2016-04-19 21:00:55 +00:00
|
|
|
for (c = 0; c < XMB_RIBBON_COLS; c++)
|
2016-04-16 19:50:17 +00:00
|
|
|
{
|
2016-04-19 21:00:55 +00:00
|
|
|
col = r % 2 ? XMB_RIBBON_COLS - c - 1 : c;
|
|
|
|
xmb_ribbon_set_vertex(ribbon_verts, i, r, col);
|
|
|
|
xmb_ribbon_set_vertex(ribbon_verts, i + 2, r + 1, col);
|
|
|
|
i += 4;
|
2016-04-16 19:50:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-19 21:00:55 +00:00
|
|
|
coords.color = dummy;
|
2016-04-25 22:08:24 +00:00
|
|
|
coords.vertex = ribbon_verts;
|
2016-04-19 21:00:55 +00:00
|
|
|
coords.tex_coord = dummy;
|
2016-04-25 22:08:24 +00:00
|
|
|
coords.lut_tex_coord = dummy;
|
2016-04-17 23:52:16 +00:00
|
|
|
coords.vertices = XMB_RIBBON_VERTICES;
|
|
|
|
|
2016-05-10 00:32:49 +00:00
|
|
|
video_coord_array_append(ca, &coords, XMB_RIBBON_VERTICES);
|
2016-04-16 19:50:17 +00:00
|
|
|
}
|
|
|
|
|
2015-12-11 14:14:39 +00:00
|
|
|
static void *xmb_init(void **userdata)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2015-05-19 22:26:50 +00:00
|
|
|
unsigned width, height;
|
2015-11-02 19:41:42 +00:00
|
|
|
xmb_handle_t *xmb = NULL;
|
|
|
|
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
2014-10-08 23:21:22 +00:00
|
|
|
|
|
|
|
if (!menu)
|
2015-02-02 17:44:56 +00:00
|
|
|
goto error;
|
2014-10-08 23:21:22 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
if (!menu_display_init_first_driver())
|
2015-11-02 19:41:42 +00:00
|
|
|
goto error;
|
|
|
|
|
2015-05-19 22:29:46 +00:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-19 22:26:50 +00:00
|
|
|
|
2015-12-11 13:55:04 +00:00
|
|
|
xmb = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));
|
2014-10-09 02:34:16 +00:00
|
|
|
|
2015-12-11 13:55:04 +00:00
|
|
|
if (!xmb)
|
2015-02-02 17:44:56 +00:00
|
|
|
goto error;
|
2014-10-09 02:34:16 +00:00
|
|
|
|
2015-12-11 14:14:39 +00:00
|
|
|
*userdata = xmb;
|
2014-10-10 13:52:12 +00:00
|
|
|
|
2015-02-12 17:18:38 +00:00
|
|
|
xmb->menu_stack_old = (file_list_t*)calloc(1, sizeof(file_list_t));
|
2015-02-02 17:44:56 +00:00
|
|
|
|
|
|
|
if (!xmb->menu_stack_old)
|
|
|
|
goto error;
|
|
|
|
|
2015-02-12 17:18:38 +00:00
|
|
|
xmb->selection_buf_old = (file_list_t*)calloc(1, sizeof(file_list_t));
|
2014-11-27 16:03:27 +00:00
|
|
|
|
2015-02-02 17:44:56 +00:00
|
|
|
if (!xmb->selection_buf_old)
|
|
|
|
goto error;
|
|
|
|
|
2015-02-12 22:38:44 +00:00
|
|
|
xmb->categories.active.idx = 0;
|
2015-02-12 18:23:11 +00:00
|
|
|
xmb->categories.active.idx_old = 0;
|
2015-02-12 22:38:44 +00:00
|
|
|
xmb->x = 0;
|
|
|
|
xmb->categories.x_pos = 0;
|
|
|
|
xmb->textures.arrow.alpha = 0;
|
|
|
|
xmb->depth = 1;
|
|
|
|
xmb->old_depth = 1;
|
|
|
|
xmb->alpha = 0;
|
2015-12-07 15:55:13 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
|
2015-02-12 17:18:38 +00:00
|
|
|
|
2015-06-13 15:06:03 +00:00
|
|
|
/* TODO/FIXME - we don't use framebuffer at all
|
|
|
|
* for XMB, we should refactor this dependency
|
|
|
|
* away. */
|
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_set_width(width);
|
|
|
|
menu_display_set_height(height);
|
2015-02-27 06:27:58 +00:00
|
|
|
|
2016-04-12 02:53:51 +00:00
|
|
|
menu_display_allocate_white_texture();
|
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_init_horizontal_list(xmb);
|
2016-02-08 06:11:56 +00:00
|
|
|
xmb_font(xmb);
|
2016-04-17 21:23:37 +00:00
|
|
|
xmb_init_ribbon(xmb);
|
2014-11-11 15:28:40 +00:00
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
return menu;
|
2015-02-02 17:44:56 +00:00
|
|
|
|
|
|
|
error:
|
|
|
|
if (menu)
|
|
|
|
free(menu);
|
2015-06-11 19:12:08 +00:00
|
|
|
|
2015-06-07 09:51:06 +00:00
|
|
|
if (xmb)
|
|
|
|
{
|
|
|
|
if (xmb->menu_stack_old)
|
|
|
|
free(xmb->menu_stack_old);
|
2015-06-11 19:12:08 +00:00
|
|
|
xmb->menu_stack_old = NULL;
|
2015-06-07 09:51:06 +00:00
|
|
|
if (xmb->selection_buf_old)
|
|
|
|
free(xmb->selection_buf_old);
|
2015-06-11 19:12:08 +00:00
|
|
|
xmb->selection_buf_old = NULL;
|
2015-06-08 14:08:00 +00:00
|
|
|
if (xmb->horizontal_list)
|
2016-05-24 03:07:54 +00:00
|
|
|
file_list_free(xmb->horizontal_list);
|
2015-06-11 19:12:08 +00:00
|
|
|
xmb->horizontal_list = NULL;
|
2015-06-07 09:51:06 +00:00
|
|
|
}
|
2015-02-02 17:44:56 +00:00
|
|
|
return NULL;
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void xmb_free(void *data)
|
|
|
|
{
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-03-28 19:50:51 +00:00
|
|
|
|
2015-12-11 13:38:57 +00:00
|
|
|
if (xmb)
|
2015-03-28 20:54:09 +00:00
|
|
|
{
|
2015-06-11 19:12:08 +00:00
|
|
|
if (xmb->menu_stack_old)
|
2015-06-15 17:36:16 +00:00
|
|
|
file_list_free(xmb->menu_stack_old);
|
2015-06-11 19:12:08 +00:00
|
|
|
xmb->menu_stack_old = NULL;
|
2015-06-13 17:37:58 +00:00
|
|
|
|
2015-06-11 19:12:08 +00:00
|
|
|
if (xmb->selection_buf_old)
|
2015-06-12 23:27:15 +00:00
|
|
|
file_list_free(xmb->selection_buf_old);
|
2015-06-11 19:12:08 +00:00
|
|
|
xmb->selection_buf_old = NULL;
|
|
|
|
if (xmb->horizontal_list)
|
2015-06-12 21:52:29 +00:00
|
|
|
file_list_free(xmb->horizontal_list);
|
2015-06-11 19:12:08 +00:00
|
|
|
xmb->horizontal_list = NULL;
|
2015-04-25 23:34:21 +00:00
|
|
|
|
2016-05-10 00:32:49 +00:00
|
|
|
video_coord_array_free(&xmb->raster_block.carr);
|
2015-03-28 20:54:09 +00:00
|
|
|
}
|
2015-03-25 14:44:54 +00:00
|
|
|
|
2015-12-05 10:34:56 +00:00
|
|
|
font_driver_bind_block(NULL, NULL);
|
2016-04-17 21:23:37 +00:00
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2016-05-22 20:29:12 +00:00
|
|
|
static void xmb_context_bg_destroy(xmb_handle_t *xmb)
|
|
|
|
{
|
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
video_driver_texture_unload(&xmb->textures.bg);
|
|
|
|
video_driver_texture_unload(&menu_display_white_texture);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool xmb_load_image(void *userdata, void *data, enum menu_image_type type)
|
|
|
|
{
|
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
|
|
|
|
|
|
|
|
if (!xmb || !data)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_IMAGE_NONE:
|
|
|
|
break;
|
|
|
|
case MENU_IMAGE_WALLPAPER:
|
|
|
|
xmb_context_bg_destroy(xmb);
|
|
|
|
video_driver_texture_unload(&xmb->textures.bg);
|
|
|
|
video_driver_texture_load(data,
|
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR,
|
|
|
|
&xmb->textures.bg);
|
|
|
|
menu_display_allocate_white_texture();
|
|
|
|
break;
|
|
|
|
case MENU_IMAGE_THUMBNAIL:
|
|
|
|
{
|
|
|
|
struct texture_image *img = (struct texture_image*)data;
|
|
|
|
xmb->thumbnail_height = xmb->thumbnail_width
|
|
|
|
* (float)img->height / (float)img->width;
|
|
|
|
video_driver_texture_unload(&xmb->thumbnail);
|
|
|
|
video_driver_texture_load(data,
|
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR, &xmb->thumbnail);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-18 00:20:54 +00:00
|
|
|
static const char *xmb_texture_path(unsigned id)
|
|
|
|
{
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case XMB_TEXTURE_MAIN_MENU:
|
|
|
|
#if defined(HAVE_LAKKA)
|
|
|
|
return "lakka.png";
|
|
|
|
#else
|
|
|
|
return "retroarch.png";
|
|
|
|
#endif
|
|
|
|
case XMB_TEXTURE_SETTINGS:
|
|
|
|
return "settings.png";
|
|
|
|
case XMB_TEXTURE_HISTORY:
|
|
|
|
return "history.png";
|
|
|
|
case XMB_TEXTURE_SETTING:
|
|
|
|
return "setting.png";
|
|
|
|
case XMB_TEXTURE_SUBSETTING:
|
|
|
|
return "subsetting.png";
|
|
|
|
case XMB_TEXTURE_ARROW:
|
|
|
|
return "arrow.png";
|
|
|
|
case XMB_TEXTURE_RUN:
|
|
|
|
return "run.png";
|
|
|
|
case XMB_TEXTURE_CLOSE:
|
|
|
|
return "close.png";
|
|
|
|
case XMB_TEXTURE_RESUME:
|
|
|
|
return "resume.png";
|
|
|
|
case XMB_TEXTURE_CLOCK:
|
|
|
|
return "clock.png";
|
|
|
|
case XMB_TEXTURE_POINTER:
|
|
|
|
return "pointer.png";
|
|
|
|
case XMB_TEXTURE_SAVESTATE:
|
|
|
|
return "savestate.png";
|
|
|
|
case XMB_TEXTURE_LOADSTATE:
|
|
|
|
return "loadstate.png";
|
|
|
|
case XMB_TEXTURE_CORE_INFO:
|
|
|
|
return "core-infos.png";
|
|
|
|
case XMB_TEXTURE_CORE_OPTIONS:
|
|
|
|
return "core-options.png";
|
|
|
|
case XMB_TEXTURE_INPUT_REMAPPING_OPTIONS:
|
|
|
|
return "core-input-remapping-options.png";
|
|
|
|
case XMB_TEXTURE_CHEAT_OPTIONS:
|
|
|
|
return "core-cheat-options.png";
|
|
|
|
case XMB_TEXTURE_DISK_OPTIONS:
|
|
|
|
return "core-disk-options.png";
|
|
|
|
case XMB_TEXTURE_SHADER_OPTIONS:
|
|
|
|
return "core-shader-options.png";
|
|
|
|
case XMB_TEXTURE_ACHIEVEMENT_LIST:
|
|
|
|
return "achievement-list.png";
|
|
|
|
case XMB_TEXTURE_SCREENSHOT:
|
|
|
|
return "screenshot.png";
|
|
|
|
case XMB_TEXTURE_RELOAD:
|
|
|
|
return "reload.png";
|
|
|
|
case XMB_TEXTURE_FILE:
|
|
|
|
return "file.png";
|
|
|
|
case XMB_TEXTURE_FOLDER:
|
|
|
|
return "folder.png";
|
|
|
|
case XMB_TEXTURE_ZIP:
|
|
|
|
return "zip.png";
|
|
|
|
case XMB_TEXTURE_MUSIC:
|
|
|
|
return "music.png";
|
|
|
|
case XMB_TEXTURE_IMAGE:
|
|
|
|
return "image.png";
|
|
|
|
case XMB_TEXTURE_MOVIE:
|
|
|
|
return "movie.png";
|
|
|
|
case XMB_TEXTURE_CORE:
|
|
|
|
return "core.png";
|
|
|
|
case XMB_TEXTURE_RDB:
|
|
|
|
return "database.png";
|
|
|
|
case XMB_TEXTURE_CURSOR:
|
|
|
|
return "cursor.png";
|
|
|
|
case XMB_TEXTURE_SWITCH_ON:
|
|
|
|
return "on.png";
|
|
|
|
case XMB_TEXTURE_SWITCH_OFF:
|
|
|
|
return "off.png";
|
|
|
|
case XMB_TEXTURE_ADD:
|
|
|
|
return "add.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
static void xmb_context_reset_textures(
|
|
|
|
xmb_handle_t *xmb, const char *iconpath)
|
2014-10-08 23:21:22 +00:00
|
|
|
{
|
2015-06-06 11:56:31 +00:00
|
|
|
unsigned i;
|
2014-11-07 16:08:44 +00:00
|
|
|
|
2015-06-06 11:56:31 +00:00
|
|
|
for (i = 0; i < XMB_TEXTURE_LAST; i++)
|
2015-02-23 21:54:39 +00:00
|
|
|
{
|
2015-06-06 11:56:31 +00:00
|
|
|
struct texture_image ti = {0};
|
2015-06-12 14:25:32 +00:00
|
|
|
char path[PATH_MAX_LENGTH] = {0};
|
2016-04-18 00:20:54 +00:00
|
|
|
const char *texture_path = xmb_texture_path(i);
|
2015-06-06 11:41:47 +00:00
|
|
|
|
2016-04-18 00:20:54 +00:00
|
|
|
if (texture_path != NULL)
|
|
|
|
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
|
2015-06-06 11:41:47 +00:00
|
|
|
|
2015-12-26 06:37:44 +00:00
|
|
|
if (string_is_empty(path) || !path_file_exists(path))
|
2015-02-23 21:54:39 +00:00
|
|
|
continue;
|
|
|
|
|
2016-05-18 10:57:44 +00:00
|
|
|
image_texture_load(&ti, path);
|
2015-02-23 21:54:39 +00:00
|
|
|
|
2016-05-21 17:43:32 +00:00
|
|
|
video_driver_texture_unload(&xmb->textures.list[i]);
|
2016-02-09 00:45:37 +00:00
|
|
|
video_driver_texture_load(&ti,
|
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR,
|
2016-03-02 21:17:05 +00:00
|
|
|
&xmb->textures.list[i]);
|
2014-11-11 15:28:40 +00:00
|
|
|
|
2016-05-18 10:57:44 +00:00
|
|
|
image_texture_free(&ti);
|
2015-02-23 21:54:39 +00:00
|
|
|
}
|
2015-06-06 11:58:06 +00:00
|
|
|
|
2016-04-12 02:53:51 +00:00
|
|
|
menu_display_allocate_white_texture();
|
|
|
|
|
2016-04-18 00:20:54 +00:00
|
|
|
xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU];
|
2016-05-08 21:19:34 +00:00
|
|
|
xmb->main_menu_node.alpha = xmb->categories.active.alpha;
|
|
|
|
xmb->main_menu_node.zoom = xmb->categories.active.zoom;
|
2015-10-20 12:11:43 +00:00
|
|
|
|
2016-03-02 21:17:05 +00:00
|
|
|
xmb->settings_tab_node.icon = xmb->textures.list[XMB_TEXTURE_SETTINGS];
|
2016-05-08 21:19:34 +00:00
|
|
|
xmb->settings_tab_node.alpha = xmb->categories.active.alpha;
|
|
|
|
xmb->settings_tab_node.zoom = xmb->categories.active.zoom;
|
2015-10-22 18:05:51 +00:00
|
|
|
|
2016-04-18 00:20:54 +00:00
|
|
|
xmb->history_tab_node.icon = xmb->textures.list[XMB_TEXTURE_HISTORY];
|
2016-05-08 21:19:34 +00:00
|
|
|
xmb->history_tab_node.alpha = xmb->categories.active.alpha;
|
|
|
|
xmb->history_tab_node.zoom = xmb->categories.active.zoom;
|
2015-10-24 17:37:59 +00:00
|
|
|
|
2016-04-18 00:20:54 +00:00
|
|
|
xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD];
|
2016-05-08 21:19:34 +00:00
|
|
|
xmb->add_tab_node.alpha = xmb->categories.active.alpha;
|
|
|
|
xmb->add_tab_node.zoom = xmb->categories.active.zoom;
|
2015-06-06 11:56:31 +00:00
|
|
|
}
|
|
|
|
|
2016-05-23 20:53:09 +00:00
|
|
|
static void xmb_context_reset_background(const char *iconpath)
|
2015-06-06 12:01:36 +00:00
|
|
|
{
|
2015-06-12 14:25:32 +00:00
|
|
|
char path[PATH_MAX_LENGTH] = {0};
|
2015-06-06 12:01:36 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
|
|
|
fill_pathname_join(path, iconpath, "bg.png", sizeof(path));
|
|
|
|
|
2016-04-28 18:49:13 +00:00
|
|
|
if (*settings->path.menu_wallpaper)
|
|
|
|
strlcpy(path, settings->path.menu_wallpaper, sizeof(path));
|
2016-05-23 20:53:09 +00:00
|
|
|
|
2015-06-06 12:01:36 +00:00
|
|
|
if (path_file_exists(path))
|
2016-05-27 16:14:47 +00:00
|
|
|
task_push_image_load(path, "cb_menu_wallpaper",
|
2016-05-23 20:53:09 +00:00
|
|
|
menu_display_handle_wallpaper_upload, NULL);
|
2015-06-06 12:01:36 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 16:01:06 +00:00
|
|
|
static void xmb_context_reset(void *data)
|
2015-06-06 11:56:31 +00:00
|
|
|
{
|
2015-06-12 14:25:32 +00:00
|
|
|
char mediapath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char themepath[PATH_MAX_LENGTH] = {0};
|
|
|
|
char iconpath[PATH_MAX_LENGTH] = {0};
|
|
|
|
settings_t *settings = config_get_ptr();
|
2015-12-10 16:01:06 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-06-06 11:56:31 +00:00
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2015-06-20 09:31:10 +00:00
|
|
|
strlcpy(xmb->icon.dir, "png", sizeof(xmb->icon.dir));
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_fill_default_background_path(xmb,
|
|
|
|
xmb->background_file_path, sizeof(xmb->background_file_path));
|
2015-06-20 09:31:10 +00:00
|
|
|
|
2016-04-28 17:26:02 +00:00
|
|
|
fill_pathname_join(
|
|
|
|
mediapath,
|
|
|
|
settings->directory.assets,
|
|
|
|
"xmb",
|
|
|
|
sizeof(mediapath));
|
2016-03-21 20:18:25 +00:00
|
|
|
fill_pathname_join(themepath, mediapath, xmb_theme_ident(), sizeof(themepath));
|
2015-06-06 11:56:31 +00:00
|
|
|
fill_pathname_join(iconpath, themepath, xmb->icon.dir, sizeof(iconpath));
|
|
|
|
fill_pathname_slash(iconpath, sizeof(iconpath));
|
|
|
|
|
2015-12-10 12:48:41 +00:00
|
|
|
xmb_layout(xmb);
|
2016-02-08 06:11:56 +00:00
|
|
|
xmb_font(xmb);
|
2015-06-06 11:56:31 +00:00
|
|
|
xmb_context_reset_textures(xmb, iconpath);
|
2016-05-23 20:53:09 +00:00
|
|
|
xmb_context_reset_background(iconpath);
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_context_reset_horizontal_list(xmb, themepath);
|
2015-11-24 18:34:26 +00:00
|
|
|
|
2016-05-21 18:53:57 +00:00
|
|
|
if (!string_is_equal(xmb_thumbnails_ident(), "OFF"))
|
2016-04-07 18:42:53 +00:00
|
|
|
xmb_update_thumbnail_image(xmb);
|
2014-10-08 23:21:22 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 16:24:56 +00:00
|
|
|
static void xmb_navigation_clear(void *data, bool pending_push)
|
2014-10-09 20:25:13 +00:00
|
|
|
{
|
2015-12-10 16:24:56 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-03-12 17:06:28 +00:00
|
|
|
if (!pending_push)
|
2015-12-10 15:14:53 +00:00
|
|
|
xmb_selection_pointer_changed(xmb, true);
|
2014-10-09 20:25:13 +00:00
|
|
|
}
|
|
|
|
|
2015-12-11 13:26:51 +00:00
|
|
|
static void xmb_navigation_pointer_changed(void *data)
|
2014-10-09 20:25:13 +00:00
|
|
|
{
|
2015-12-11 13:26:51 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-12-10 15:14:53 +00:00
|
|
|
xmb_selection_pointer_changed(xmb, true);
|
2014-10-09 20:25:13 +00:00
|
|
|
}
|
|
|
|
|
2015-12-11 13:26:51 +00:00
|
|
|
static void xmb_navigation_set(void *data, bool scroll)
|
2014-10-09 20:25:13 +00:00
|
|
|
{
|
2015-12-11 13:26:51 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-12-10 15:14:53 +00:00
|
|
|
xmb_selection_pointer_changed(xmb, true);
|
2014-10-09 20:25:13 +00:00
|
|
|
}
|
|
|
|
|
2015-12-11 13:26:51 +00:00
|
|
|
static void xmb_navigation_alphabet(void *data, size_t *unused)
|
2014-10-09 20:25:13 +00:00
|
|
|
{
|
2015-12-11 13:26:51 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-12-10 15:14:53 +00:00
|
|
|
xmb_selection_pointer_changed(xmb, true);
|
2014-10-09 20:25:13 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 18:08:28 +00:00
|
|
|
static void xmb_list_insert(void *userdata,
|
|
|
|
file_list_t *list,
|
2014-10-09 20:25:13 +00:00
|
|
|
const char *path, const char *unused, size_t list_size)
|
|
|
|
{
|
2015-09-25 14:25:33 +00:00
|
|
|
size_t selection;
|
2015-06-13 14:22:05 +00:00
|
|
|
int current = 0;
|
|
|
|
int i = list_size;
|
|
|
|
xmb_node_t *node = NULL;
|
2015-12-10 18:08:28 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
|
2015-02-11 20:00:34 +00:00
|
|
|
|
2015-12-10 18:08:28 +00:00
|
|
|
if (!xmb || !list)
|
2015-02-11 20:00:34 +00:00
|
|
|
return;
|
2015-09-25 14:25:33 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
2015-06-06 12:07:20 +00:00
|
|
|
|
2015-10-19 15:40:38 +00:00
|
|
|
node = (xmb_node_t*)menu_entries_get_userdata_at_offset(list, i);
|
2015-06-15 17:59:07 +00:00
|
|
|
|
|
|
|
if (!node)
|
|
|
|
node = (xmb_node_t*)calloc(1, sizeof(xmb_node_t));
|
2014-10-10 20:08:11 +00:00
|
|
|
|
2015-06-11 18:14:59 +00:00
|
|
|
if (!node)
|
2014-10-11 22:33:17 +00:00
|
|
|
{
|
2014-10-10 20:08:11 +00:00
|
|
|
RARCH_ERR("XMB node could not be allocated.\n");
|
2014-10-11 22:33:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-10-10 20:08:11 +00:00
|
|
|
|
2015-09-25 14:25:33 +00:00
|
|
|
current = selection;
|
2016-05-08 21:22:22 +00:00
|
|
|
node->alpha = xmb->items.passive.alpha;
|
|
|
|
node->zoom = xmb->items.passive.zoom;
|
2014-10-20 18:00:39 +00:00
|
|
|
node->label_alpha = node->alpha;
|
2015-02-11 04:33:53 +00:00
|
|
|
node->y = xmb_item_y(xmb, i, current);
|
2015-02-02 17:44:56 +00:00
|
|
|
node->x = 0;
|
|
|
|
|
|
|
|
if (i == current)
|
|
|
|
{
|
2016-05-08 21:22:22 +00:00
|
|
|
node->alpha = xmb->items.active.alpha;
|
|
|
|
node->label_alpha = xmb->items.active.alpha;
|
|
|
|
node->zoom = xmb->items.active.alpha;
|
2015-02-02 17:44:56 +00:00
|
|
|
}
|
2015-06-11 18:14:59 +00:00
|
|
|
|
2015-06-11 21:02:17 +00:00
|
|
|
file_list_set_userdata(list, i, node);
|
2014-10-09 20:25:13 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 17:59:07 +00:00
|
|
|
static void xmb_list_clear(file_list_t *list)
|
|
|
|
{
|
2015-09-25 20:48:58 +00:00
|
|
|
size_t i;
|
|
|
|
size_t size = list->size;
|
2015-06-15 17:59:07 +00:00
|
|
|
|
|
|
|
for (i = 0; i < size; ++i)
|
|
|
|
{
|
2016-02-25 14:05:18 +00:00
|
|
|
menu_animation_ctx_subject_t subject;
|
|
|
|
float *subjects[5] = {NULL};
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
|
|
|
menu_entries_get_userdata_at_offset(list, i);
|
2015-06-15 17:59:07 +00:00
|
|
|
|
|
|
|
if (!node)
|
2015-06-15 18:48:01 +00:00
|
|
|
continue;
|
2015-06-15 17:59:07 +00:00
|
|
|
|
|
|
|
subjects[0] = &node->alpha;
|
|
|
|
subjects[1] = &node->label_alpha;
|
|
|
|
subjects[2] = &node->zoom;
|
|
|
|
subjects[3] = &node->x;
|
|
|
|
subjects[4] = &node->y;
|
|
|
|
|
2016-02-25 14:05:18 +00:00
|
|
|
subject.count = 5;
|
|
|
|
subject.data = subjects;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_SUBJECT, &subject);
|
2015-06-15 17:59:07 +00:00
|
|
|
|
|
|
|
file_list_free_userdata(list, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 14:21:20 +00:00
|
|
|
static void xmb_list_deep_copy(const file_list_t *src, file_list_t *dst)
|
2015-06-15 17:36:16 +00:00
|
|
|
{
|
2015-09-28 16:44:28 +00:00
|
|
|
size_t i;
|
|
|
|
size_t size = dst->size;
|
2015-06-15 17:36:16 +00:00
|
|
|
|
|
|
|
for (i = 0; i < size; ++i)
|
|
|
|
{
|
2016-02-04 20:40:29 +00:00
|
|
|
xmb_node_t *node = (xmb_node_t*)
|
|
|
|
menu_entries_get_userdata_at_offset(dst, i);
|
2015-06-15 18:48:01 +00:00
|
|
|
|
|
|
|
if (node)
|
|
|
|
{
|
2016-02-25 14:05:18 +00:00
|
|
|
menu_animation_ctx_subject_t subject;
|
|
|
|
float *subjects[5] = {NULL};
|
|
|
|
|
|
|
|
subjects[0] = &node->alpha;
|
|
|
|
subjects[1] = &node->label_alpha;
|
|
|
|
subjects[2] = &node->zoom;
|
|
|
|
subjects[3] = &node->x;
|
|
|
|
subjects[4] = &node->y;
|
2015-09-28 16:44:28 +00:00
|
|
|
|
2016-02-25 14:05:18 +00:00
|
|
|
subject.count = 5;
|
|
|
|
subject.data = subjects;
|
2015-06-15 18:48:01 +00:00
|
|
|
|
2016-02-25 14:05:18 +00:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_SUBJECT, &subject);
|
2015-06-15 18:48:01 +00:00
|
|
|
}
|
|
|
|
|
2015-06-15 17:36:16 +00:00
|
|
|
file_list_free_userdata(dst, i);
|
2015-06-15 17:59:07 +00:00
|
|
|
file_list_free_actiondata(dst, i); /* this one was allocated by us */
|
2015-06-15 17:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
file_list_copy(src, dst);
|
|
|
|
|
|
|
|
size = dst->size;
|
2015-09-28 16:44:28 +00:00
|
|
|
|
2015-06-15 17:36:16 +00:00
|
|
|
for (i = 0; i < size; ++i)
|
|
|
|
{
|
2015-10-19 15:40:38 +00:00
|
|
|
void *src_udata = menu_entries_get_userdata_at_offset(src, i);
|
|
|
|
void *src_adata = (void*)menu_entries_get_actiondata_at_offset(src, i);
|
2015-06-15 17:36:16 +00:00
|
|
|
|
|
|
|
if (src_udata)
|
|
|
|
{
|
2015-09-28 16:49:32 +00:00
|
|
|
void *data = calloc(1, sizeof(xmb_node_t));
|
2015-06-15 17:36:16 +00:00
|
|
|
memcpy(data, src_udata, sizeof(xmb_node_t));
|
|
|
|
file_list_set_userdata(dst, i, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src_adata)
|
|
|
|
{
|
2015-09-28 16:49:32 +00:00
|
|
|
void *data = calloc(1, sizeof(menu_file_list_cbs_t));
|
2015-06-15 17:36:16 +00:00
|
|
|
memcpy(data, src_adata, sizeof(menu_file_list_cbs_t));
|
|
|
|
file_list_set_actiondata(dst, i, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-25 18:27:06 +00:00
|
|
|
static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action)
|
2014-11-27 15:28:45 +00:00
|
|
|
{
|
2015-09-25 14:25:33 +00:00
|
|
|
size_t stack_size, list_size, selection;
|
2015-12-10 15:17:23 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-10-27 09:33:19 +00:00
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-02-13 18:00:34 +00:00
|
|
|
|
2014-11-27 16:03:27 +00:00
|
|
|
if (!xmb)
|
|
|
|
return;
|
2015-09-25 14:25:33 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
2014-11-27 16:03:27 +00:00
|
|
|
|
2015-12-10 14:21:20 +00:00
|
|
|
xmb_list_deep_copy(selection_buf, xmb->selection_buf_old);
|
|
|
|
xmb_list_deep_copy(menu_stack, xmb->menu_stack_old);
|
2015-09-25 14:25:33 +00:00
|
|
|
xmb->selection_ptr_old = selection;
|
2014-11-27 15:28:45 +00:00
|
|
|
|
2016-03-09 21:17:18 +00:00
|
|
|
list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
|
2016-02-04 20:40:29 +00:00
|
|
|
+ XMB_SYSTEM_TAB_END;
|
2015-10-24 19:18:47 +00:00
|
|
|
|
2015-06-07 09:20:36 +00:00
|
|
|
switch (type)
|
2015-02-02 19:40:29 +00:00
|
|
|
{
|
2015-06-07 09:20:36 +00:00
|
|
|
case MENU_LIST_PLAIN:
|
2015-02-02 19:40:29 +00:00
|
|
|
break;
|
2015-06-07 09:20:36 +00:00
|
|
|
case MENU_LIST_HORIZONTAL:
|
2015-06-15 17:00:52 +00:00
|
|
|
xmb->categories.selection_ptr_old = xmb->categories.selection_ptr;
|
2014-11-27 15:28:45 +00:00
|
|
|
|
2015-06-07 09:20:36 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
2015-10-24 19:18:47 +00:00
|
|
|
if (xmb->categories.selection_ptr == 0)
|
|
|
|
{
|
|
|
|
xmb->categories.selection_ptr = list_size;
|
|
|
|
xmb->categories.active.idx = list_size - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
xmb->categories.selection_ptr--;
|
2015-06-07 09:20:36 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-10-24 19:18:47 +00:00
|
|
|
if (xmb->categories.selection_ptr == list_size)
|
|
|
|
{
|
|
|
|
xmb->categories.selection_ptr = 0;
|
|
|
|
xmb->categories.active.idx = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
xmb->categories.selection_ptr++;
|
2015-06-07 09:20:36 +00:00
|
|
|
break;
|
|
|
|
}
|
2015-01-10 22:45:14 +00:00
|
|
|
|
2015-10-17 16:17:59 +00:00
|
|
|
stack_size = menu_stack->size;
|
2015-02-02 17:44:56 +00:00
|
|
|
|
2015-10-17 16:17:59 +00:00
|
|
|
if (menu_stack->list[stack_size - 1].label)
|
|
|
|
free(menu_stack->list[stack_size - 1].label);
|
|
|
|
menu_stack->list[stack_size - 1].label = NULL;
|
2015-06-07 09:20:36 +00:00
|
|
|
|
2015-10-19 15:35:47 +00:00
|
|
|
switch (xmb->categories.selection_ptr)
|
2015-06-07 09:20:36 +00:00
|
|
|
{
|
2015-10-22 02:52:57 +00:00
|
|
|
case XMB_SYSTEM_TAB_MAIN:
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2015-10-19 15:35:47 +00:00
|
|
|
strdup(menu_hash_to_str(MENU_VALUE_MAIN_MENU));
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
2015-10-19 15:35:47 +00:00
|
|
|
MENU_SETTINGS;
|
|
|
|
break;
|
2015-10-22 02:52:57 +00:00
|
|
|
case XMB_SYSTEM_TAB_SETTINGS:
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2015-10-20 12:11:43 +00:00
|
|
|
strdup(menu_hash_to_str(MENU_VALUE_SETTINGS_TAB));
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
2015-10-20 12:11:43 +00:00
|
|
|
MENU_SETTINGS_TAB;
|
|
|
|
break;
|
2015-10-22 18:05:51 +00:00
|
|
|
case XMB_SYSTEM_TAB_HISTORY:
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2015-10-22 18:05:51 +00:00
|
|
|
strdup(menu_hash_to_str(MENU_VALUE_HISTORY_TAB));
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
2015-10-22 18:05:51 +00:00
|
|
|
MENU_HISTORY_TAB;
|
|
|
|
break;
|
2015-10-24 17:37:59 +00:00
|
|
|
case XMB_SYSTEM_TAB_ADD:
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2015-10-24 17:37:59 +00:00
|
|
|
strdup(menu_hash_to_str(MENU_VALUE_ADD_TAB));
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
2015-10-24 17:37:59 +00:00
|
|
|
MENU_ADD_TAB;
|
|
|
|
break;
|
2015-10-19 15:35:47 +00:00
|
|
|
default:
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2015-10-19 15:35:47 +00:00
|
|
|
strdup(menu_hash_to_str(MENU_VALUE_HORIZONTAL_MENU));
|
2016-03-09 21:17:18 +00:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
2015-10-19 15:35:47 +00:00
|
|
|
MENU_SETTING_HORIZONTAL_MENU;
|
|
|
|
break;
|
2015-06-07 09:20:36 +00:00
|
|
|
}
|
|
|
|
break;
|
2015-10-30 09:28:27 +00:00
|
|
|
default:
|
|
|
|
break;
|
2015-03-12 13:53:14 +00:00
|
|
|
}
|
2014-11-27 15:28:45 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 20:59:05 +00:00
|
|
|
|
2015-12-10 15:57:48 +00:00
|
|
|
static void xmb_context_destroy(void *data)
|
2015-01-26 22:45:16 +00:00
|
|
|
{
|
2015-03-16 16:40:05 +00:00
|
|
|
unsigned i;
|
2015-12-10 15:57:48 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
2015-01-26 22:45:16 +00:00
|
|
|
|
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2015-06-07 11:09:35 +00:00
|
|
|
for (i = 0; i < XMB_TEXTURE_LAST; i++)
|
2016-03-02 21:17:05 +00:00
|
|
|
video_driver_texture_unload(&xmb->textures.list[i]);
|
2015-01-30 03:45:15 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_context_destroy_horizontal_list(xmb);
|
2015-12-23 12:47:40 +00:00
|
|
|
xmb_context_bg_destroy(xmb);
|
2015-02-02 17:44:56 +00:00
|
|
|
|
2016-05-08 10:33:28 +00:00
|
|
|
menu_display_font_main_deinit();
|
2015-06-07 11:09:35 +00:00
|
|
|
}
|
2015-01-26 22:45:16 +00:00
|
|
|
|
2015-12-10 15:54:46 +00:00
|
|
|
static void xmb_toggle(void *userdata, bool menu_on)
|
2015-06-07 11:09:35 +00:00
|
|
|
{
|
2016-02-25 14:44:30 +00:00
|
|
|
menu_animation_ctx_entry_t entry;
|
2015-12-07 15:55:13 +00:00
|
|
|
bool tmp = false;
|
2015-12-10 15:54:46 +00:00
|
|
|
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
|
2015-06-07 11:09:35 +00:00
|
|
|
|
|
|
|
if (!xmb)
|
|
|
|
return;
|
|
|
|
|
2015-12-10 14:23:43 +00:00
|
|
|
xmb->depth = xmb_list_get_size(xmb, MENU_LIST_PLAIN);
|
2015-06-07 11:09:35 +00:00
|
|
|
|
|
|
|
if (!menu_on)
|
|
|
|
{
|
|
|
|
xmb->alpha = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-22 11:11:39 +00:00
|
|
|
entry.duration = XMB_DELAY * 2;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.target_value = 1.0f;
|
|
|
|
entry.subject = &xmb->alpha;
|
2016-04-22 11:10:20 +00:00
|
|
|
entry.easing_enum = EASING_OUT_QUAD;
|
2016-02-25 14:44:30 +00:00
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2015-06-07 11:09:35 +00:00
|
|
|
|
2015-12-11 20:41:59 +00:00
|
|
|
tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL);
|
2015-12-07 15:55:13 +00:00
|
|
|
|
|
|
|
if (tmp)
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
|
|
|
else
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
|
2015-06-07 11:09:35 +00:00
|
|
|
|
2015-12-10 14:28:05 +00:00
|
|
|
xmb_toggle_horizontal_list(xmb);
|
2015-06-07 11:09:35 +00:00
|
|
|
}
|
|
|
|
|
2015-06-08 14:13:02 +00:00
|
|
|
static int deferred_push_content_actions(menu_displaylist_info_t *info)
|
|
|
|
{
|
2016-03-09 21:17:18 +00:00
|
|
|
if (!menu_displaylist_ctl(
|
2016-02-24 22:05:54 +00:00
|
|
|
DISPLAYLIST_HORIZONTAL_CONTENT_ACTIONS, info))
|
|
|
|
return -1;
|
2016-02-24 22:19:53 +00:00
|
|
|
menu_displaylist_ctl(DISPLAYLIST_PROCESS, info);
|
2015-10-21 23:38:41 +00:00
|
|
|
return 0;
|
2015-06-08 14:13:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int xmb_list_bind_init_compare_label(menu_file_list_cbs_t *cbs,
|
|
|
|
uint32_t label_hash)
|
|
|
|
{
|
|
|
|
switch (label_hash)
|
|
|
|
{
|
|
|
|
case MENU_LABEL_CONTENT_ACTIONS:
|
|
|
|
cbs->action_deferred_push = deferred_push_content_actions;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-08 14:01:57 +00:00
|
|
|
static int xmb_list_bind_init(menu_file_list_cbs_t *cbs,
|
|
|
|
const char *path, const char *label, unsigned type, size_t idx,
|
|
|
|
const char *elem0, const char *elem1,
|
|
|
|
uint32_t label_hash, uint32_t menu_label_hash)
|
|
|
|
{
|
2015-06-08 14:13:02 +00:00
|
|
|
if (xmb_list_bind_init_compare_label(cbs, label_hash) == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return -1;
|
2015-06-08 14:01:57 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
static int xmb_list_push(void *data, void *userdata,
|
|
|
|
menu_displaylist_info_t *info, unsigned type)
|
2015-10-22 02:12:32 +00:00
|
|
|
{
|
2016-03-04 06:41:45 +00:00
|
|
|
menu_displaylist_ctx_parse_entry_t entry;
|
2015-10-22 02:46:05 +00:00
|
|
|
int ret = -1;
|
2015-12-10 18:02:01 +00:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2015-10-22 02:46:05 +00:00
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case DISPLAYLIST_MAIN_MENU:
|
2016-02-24 21:45:21 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
2015-10-22 04:01:46 +00:00
|
|
|
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.data = menu;
|
|
|
|
entry.info = info;
|
|
|
|
entry.parse_type = PARSE_ACTION;
|
|
|
|
entry.add_empty_entry = false;
|
|
|
|
|
2016-01-19 22:44:32 +00:00
|
|
|
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
2016-01-24 00:51:05 +00:00
|
|
|
{
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2016-01-24 00:51:05 +00:00
|
|
|
}
|
2015-10-22 04:01:46 +00:00
|
|
|
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_START_CORE);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2016-01-31 20:36:41 +00:00
|
|
|
|
2016-05-27 17:18:46 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_START_NET_RETROPAD);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
|
|
|
|
2016-02-03 11:31:29 +00:00
|
|
|
#ifndef HAVE_DYNAMIC
|
|
|
|
if (frontend_driver_has_fork())
|
2015-10-22 02:46:05 +00:00
|
|
|
#endif
|
2016-02-03 11:31:29 +00:00
|
|
|
{
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_CORE_LIST);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2016-02-03 11:31:29 +00:00
|
|
|
}
|
2016-03-04 06:41:45 +00:00
|
|
|
|
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_LOAD_CONTENT_LIST);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
|
|
|
|
2015-10-22 02:46:05 +00:00
|
|
|
#if defined(HAVE_NETWORKING)
|
|
|
|
#if defined(HAVE_LIBRETRODB)
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_ADD_CONTENT_LIST);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
#endif
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_ONLINE_UPDATER);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
#endif
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_INFORMATION_LIST);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
#ifndef HAVE_DYNAMIC
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_RESTART_RETROARCH);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
#endif
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_CONFIGURATIONS);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
|
|
|
|
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_SAVE_CURRENT_CONFIG);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
|
|
|
|
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_SAVE_NEW_CONFIG);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
|
|
|
|
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_HELP_LIST);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
#if !defined(IOS)
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_QUIT_RETROARCH);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
#endif
|
2016-03-04 06:41:45 +00:00
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_SHUTDOWN);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
|
|
|
|
|
|
|
entry.info_label = menu_hash_to_str(MENU_LABEL_REBOOT);
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING, &entry);
|
2015-10-22 02:46:05 +00:00
|
|
|
info->need_push = true;
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
2015-10-22 02:12:32 +00:00
|
|
|
}
|
|
|
|
|
2015-10-22 00:54:25 +00:00
|
|
|
static bool xmb_menu_init_list(void *data)
|
|
|
|
{
|
|
|
|
menu_displaylist_info_t info = {0};
|
2015-10-27 09:33:19 +00:00
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-10-22 00:54:25 +00:00
|
|
|
|
2016-02-04 20:40:29 +00:00
|
|
|
strlcpy(info.label,
|
|
|
|
menu_hash_to_str(MENU_VALUE_MAIN_MENU), sizeof(info.label));
|
2015-10-22 00:54:25 +00:00
|
|
|
|
2016-04-11 03:49:39 +00:00
|
|
|
menu_entries_add(menu_stack, info.path,
|
2016-02-04 20:40:29 +00:00
|
|
|
info.label, info.type, info.flags, 0);
|
2015-10-22 00:54:25 +00:00
|
|
|
|
2015-10-22 01:02:03 +00:00
|
|
|
info.list = selection_buf;
|
2016-03-09 21:17:18 +00:00
|
|
|
|
2016-02-24 22:19:53 +00:00
|
|
|
if (!menu_displaylist_ctl(DISPLAYLIST_MAIN_MENU, &info))
|
|
|
|
return false;
|
2015-10-22 01:02:03 +00:00
|
|
|
|
2015-10-22 00:54:25 +00:00
|
|
|
info.need_push = true;
|
|
|
|
|
2016-02-24 22:19:53 +00:00
|
|
|
if (!menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info))
|
|
|
|
return false;
|
2015-10-22 00:54:25 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-10 15:26:40 +00:00
|
|
|
static int xmb_pointer_tap(void *userdata,
|
|
|
|
unsigned x, unsigned y, unsigned ptr,
|
2015-11-01 19:44:04 +00:00
|
|
|
menu_file_list_cbs_t *cbs,
|
2015-11-01 19:35:43 +00:00
|
|
|
menu_entry_t *entry, unsigned action)
|
2015-11-01 18:17:06 +00:00
|
|
|
{
|
|
|
|
size_t selection, idx;
|
|
|
|
unsigned header_height;
|
|
|
|
bool scroll = false;
|
|
|
|
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
2016-05-08 10:33:28 +00:00
|
|
|
header_height = menu_display_get_header_height();
|
2015-11-01 18:17:06 +00:00
|
|
|
|
2015-11-01 19:44:04 +00:00
|
|
|
if (y < header_height)
|
2015-11-01 18:17:06 +00:00
|
|
|
{
|
2016-04-25 17:09:30 +00:00
|
|
|
menu_entries_pop_stack(&selection, 0, 1);
|
2015-11-01 18:17:06 +00:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
|
|
|
}
|
2015-11-01 19:44:04 +00:00
|
|
|
else if (ptr <= (menu_entries_get_size() - 1))
|
2015-11-01 18:17:06 +00:00
|
|
|
{
|
2015-11-01 19:44:04 +00:00
|
|
|
if (ptr == selection && cbs && cbs->action_select)
|
2015-11-01 18:17:06 +00:00
|
|
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
|
|
|
|
2015-11-01 19:44:04 +00:00
|
|
|
idx = ptr;
|
2015-11-01 18:17:06 +00:00
|
|
|
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-08 23:21:22 +00:00
|
|
|
menu_ctx_driver_t menu_ctx_xmb = {
|
|
|
|
NULL,
|
2015-12-10 13:36:31 +00:00
|
|
|
xmb_messagebox,
|
2015-10-03 03:08:29 +00:00
|
|
|
generic_menu_iterate,
|
2015-03-08 18:15:24 +00:00
|
|
|
xmb_render,
|
2014-10-08 23:21:22 +00:00
|
|
|
xmb_frame,
|
|
|
|
xmb_init,
|
|
|
|
xmb_free,
|
|
|
|
xmb_context_reset,
|
2014-10-09 20:59:05 +00:00
|
|
|
xmb_context_destroy,
|
2014-10-09 17:06:07 +00:00
|
|
|
xmb_populate_entries,
|
2015-01-26 22:45:16 +00:00
|
|
|
xmb_toggle,
|
2014-10-09 20:25:13 +00:00
|
|
|
xmb_navigation_clear,
|
2015-06-06 22:23:40 +00:00
|
|
|
xmb_navigation_pointer_changed,
|
|
|
|
xmb_navigation_pointer_changed,
|
2014-10-09 20:25:13 +00:00
|
|
|
xmb_navigation_set,
|
2015-06-06 22:23:40 +00:00
|
|
|
xmb_navigation_pointer_changed,
|
2015-06-06 22:41:53 +00:00
|
|
|
xmb_navigation_alphabet,
|
|
|
|
xmb_navigation_alphabet,
|
2015-10-22 00:54:25 +00:00
|
|
|
xmb_menu_init_list,
|
2014-10-09 20:25:13 +00:00
|
|
|
xmb_list_insert,
|
2015-12-10 14:48:04 +00:00
|
|
|
NULL,
|
2016-04-11 16:31:49 +00:00
|
|
|
NULL,
|
2015-06-15 17:59:07 +00:00
|
|
|
xmb_list_clear,
|
2014-11-27 15:28:45 +00:00
|
|
|
xmb_list_cache,
|
2015-10-22 02:12:32 +00:00
|
|
|
xmb_list_push,
|
2015-06-15 17:00:52 +00:00
|
|
|
xmb_list_get_selection,
|
2015-06-07 13:43:03 +00:00
|
|
|
xmb_list_get_size,
|
2015-06-08 15:02:14 +00:00
|
|
|
xmb_list_get_entry,
|
2015-02-11 20:00:34 +00:00
|
|
|
NULL,
|
2015-06-08 14:01:57 +00:00
|
|
|
xmb_list_bind_init,
|
2015-06-04 08:39:48 +00:00
|
|
|
xmb_load_image,
|
2014-10-08 23:21:22 +00:00
|
|
|
"xmb",
|
2015-07-07 22:37:44 +00:00
|
|
|
xmb_environ,
|
2015-11-01 18:17:06 +00:00
|
|
|
xmb_pointer_tap,
|
2016-04-27 20:26:09 +00:00
|
|
|
xmb_update_thumbnail_path,
|
|
|
|
xmb_update_thumbnail_image,
|
2014-10-08 23:21:22 +00:00
|
|
|
};
|