2015-06-16 02:15:32 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2017-01-22 13:40:32 +01:00
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2017-12-11 23:55:31 -08:00
|
|
|
*
|
2015-06-16 02:15:32 +02: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MENU_ENTRIES_H__
|
|
|
|
#define __MENU_ENTRIES_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2015-08-21 21:19:29 +02:00
|
|
|
#include <boolean.h>
|
2016-06-03 05:49:46 +02:00
|
|
|
#include <retro_common_api.h>
|
2015-08-21 21:19:29 +02:00
|
|
|
|
2018-02-25 00:39:20 +01:00
|
|
|
#include <lists/file_list.h>
|
2016-09-15 16:36:36 +02:00
|
|
|
|
2015-06-16 02:15:32 +02:00
|
|
|
#include "menu_setting.h"
|
2019-05-01 11:41:13 +02:00
|
|
|
#include "menu_input.h"
|
2015-11-08 13:19:54 -02:00
|
|
|
#include "menu_displaylist.h"
|
2015-06-16 02:15:32 +02:00
|
|
|
|
2016-06-03 05:49:46 +02:00
|
|
|
RETRO_BEGIN_DECLS
|
2015-06-16 02:15:32 +02:00
|
|
|
|
2019-07-19 16:02:37 +01:00
|
|
|
#define MENU_SUBLABEL_MAX_LENGTH 1024
|
|
|
|
|
2021-04-20 13:40:33 +01:00
|
|
|
#define MENU_SEARCH_FILTER_MAX_TERMS 8
|
|
|
|
#define MENU_SEARCH_FILTER_MAX_LENGTH 64
|
|
|
|
|
2016-02-25 19:27:06 +01:00
|
|
|
enum menu_entries_ctl_state
|
|
|
|
{
|
|
|
|
MENU_ENTRIES_CTL_NONE = 0,
|
|
|
|
MENU_ENTRIES_CTL_SETTINGS_GET,
|
|
|
|
MENU_ENTRIES_CTL_SET_REFRESH,
|
|
|
|
MENU_ENTRIES_CTL_UNSET_REFRESH,
|
|
|
|
MENU_ENTRIES_CTL_NEEDS_REFRESH,
|
|
|
|
/* Sets the starting index of the menu entry list. */
|
|
|
|
MENU_ENTRIES_CTL_SET_START,
|
|
|
|
/* Returns the starting index of the menu entry list. */
|
|
|
|
MENU_ENTRIES_CTL_START_GET,
|
|
|
|
MENU_ENTRIES_CTL_REFRESH,
|
|
|
|
MENU_ENTRIES_CTL_CLEAR,
|
|
|
|
MENU_ENTRIES_CTL_SHOW_BACK
|
|
|
|
};
|
2015-10-17 19:38:33 +02:00
|
|
|
|
2018-02-25 00:39:20 +01:00
|
|
|
enum menu_list_type
|
|
|
|
{
|
|
|
|
MENU_LIST_PLAIN = 0,
|
|
|
|
MENU_LIST_HORIZONTAL,
|
|
|
|
MENU_LIST_TABS
|
|
|
|
};
|
|
|
|
|
2020-08-14 20:21:44 +02:00
|
|
|
enum menu_entry_type
|
|
|
|
{
|
|
|
|
MENU_ENTRY_ACTION = 0,
|
|
|
|
MENU_ENTRY_BOOL,
|
|
|
|
MENU_ENTRY_INT,
|
|
|
|
MENU_ENTRY_UINT,
|
|
|
|
MENU_ENTRY_FLOAT,
|
|
|
|
MENU_ENTRY_PATH,
|
|
|
|
MENU_ENTRY_DIR,
|
|
|
|
MENU_ENTRY_STRING,
|
|
|
|
MENU_ENTRY_HEX,
|
|
|
|
MENU_ENTRY_BIND,
|
|
|
|
MENU_ENTRY_ENUM,
|
|
|
|
MENU_ENTRY_SIZE
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-02-25 00:39:20 +01:00
|
|
|
typedef struct menu_ctx_list
|
|
|
|
{
|
2020-08-14 20:21:44 +02:00
|
|
|
const char *path;
|
|
|
|
char *fullpath;
|
|
|
|
const char *label;
|
|
|
|
file_list_t *list;
|
|
|
|
void *entry;
|
2018-02-25 00:39:20 +01:00
|
|
|
size_t idx;
|
|
|
|
size_t selection;
|
|
|
|
size_t size;
|
|
|
|
size_t list_size;
|
2020-08-14 20:21:44 +02:00
|
|
|
unsigned entry_type;
|
|
|
|
unsigned action;
|
|
|
|
enum menu_list_type type;
|
2018-02-25 00:39:20 +01:00
|
|
|
} menu_ctx_list_t;
|
|
|
|
|
2021-09-07 11:55:12 +02:00
|
|
|
typedef struct menu_search_terms
|
2021-04-20 13:40:33 +01:00
|
|
|
{
|
|
|
|
size_t size;
|
|
|
|
char terms[MENU_SEARCH_FILTER_MAX_TERMS][MENU_SEARCH_FILTER_MAX_LENGTH];
|
2021-09-07 11:55:12 +02:00
|
|
|
} menu_search_terms_t;
|
2021-04-20 13:40:33 +01:00
|
|
|
|
2015-10-17 18:57:47 +02:00
|
|
|
typedef struct menu_file_list_cbs
|
|
|
|
{
|
2017-09-09 01:10:00 +02:00
|
|
|
rarch_setting_t *setting;
|
|
|
|
int (*action_iterate)(const char *label, unsigned action);
|
2018-04-11 06:11:54 +02:00
|
|
|
int (*action_deferred_push)(menu_displaylist_info_t *info);
|
2018-04-11 06:11:23 +02:00
|
|
|
int (*action_select)(const char *path, const char *label, unsigned type,
|
2019-12-21 06:01:38 +01:00
|
|
|
size_t idx, size_t entry_idx);
|
2015-10-17 18:57:47 +02:00
|
|
|
int (*action_get_title)(const char *path, const char *label,
|
|
|
|
unsigned type, char *s, size_t len);
|
2018-04-11 06:12:26 +02:00
|
|
|
int (*action_ok)(const char *path, const char *label, unsigned type,
|
2015-10-17 18:57:47 +02:00
|
|
|
size_t idx, size_t entry_idx);
|
|
|
|
int (*action_cancel)(const char *path, const char *label, unsigned type,
|
|
|
|
size_t idx);
|
|
|
|
int (*action_scan)(const char *path, const char *label, unsigned type,
|
|
|
|
size_t idx);
|
2019-12-19 16:30:53 +01:00
|
|
|
int (*action_start)(const char *path, const char *label, unsigned type,
|
|
|
|
size_t idx, size_t entry_idx);
|
2018-04-11 06:11:23 +02:00
|
|
|
int (*action_info)(unsigned type, const char *label);
|
2018-04-11 06:11:38 +02:00
|
|
|
int (*action_left)(unsigned type, const char *label, bool wraparound);
|
|
|
|
int (*action_right)(unsigned type, const char *label, bool wraparound);
|
2016-07-09 13:49:31 +02:00
|
|
|
int (*action_label)(file_list_t *list,
|
|
|
|
unsigned type, unsigned i,
|
|
|
|
const char *label, const char *path,
|
|
|
|
char *s, size_t len);
|
2016-10-20 15:57:35 +02:00
|
|
|
int (*action_sublabel)(file_list_t *list,
|
|
|
|
unsigned type, unsigned i,
|
|
|
|
const char *label, const char *path,
|
|
|
|
char *s, size_t len);
|
2015-10-17 18:57:47 +02:00
|
|
|
void (*action_get_value)(file_list_t* list,
|
|
|
|
unsigned *w, unsigned type, unsigned i,
|
|
|
|
const char *label, char *s, size_t len,
|
|
|
|
const char *path,
|
|
|
|
char *path_buf, size_t path_buf_size);
|
2021-09-07 11:55:12 +02:00
|
|
|
menu_search_terms_t search;
|
2020-08-14 20:21:44 +02:00
|
|
|
enum msg_hash_enums enum_idx;
|
|
|
|
char action_sublabel_cache[MENU_SUBLABEL_MAX_LENGTH];
|
|
|
|
char action_title_cache [512];
|
|
|
|
bool checked;
|
2015-10-17 18:57:47 +02:00
|
|
|
} menu_file_list_cbs_t;
|
|
|
|
|
2020-08-14 20:21:44 +02:00
|
|
|
typedef struct menu_entry
|
|
|
|
{
|
|
|
|
size_t entry_idx;
|
|
|
|
unsigned idx;
|
|
|
|
unsigned type;
|
|
|
|
unsigned spacing;
|
|
|
|
enum msg_hash_enums enum_idx;
|
|
|
|
char path[255];
|
|
|
|
char label[255];
|
|
|
|
char sublabel[MENU_SUBLABEL_MAX_LENGTH];
|
|
|
|
char rich_label[255];
|
|
|
|
char value[255];
|
|
|
|
char password_value[255];
|
|
|
|
bool checked;
|
|
|
|
bool path_enabled;
|
|
|
|
bool label_enabled;
|
|
|
|
bool rich_label_enabled;
|
|
|
|
bool value_enabled;
|
|
|
|
bool sublabel_enabled;
|
|
|
|
} menu_entry_t;
|
|
|
|
|
2015-06-16 02:15:32 +02:00
|
|
|
int menu_entries_get_title(char *title, size_t title_len);
|
|
|
|
|
2022-09-05 01:01:38 +03:00
|
|
|
int menu_entries_get_label(char *label, size_t label_len);
|
|
|
|
|
2015-08-17 18:14:51 +02:00
|
|
|
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
2015-06-16 02:15:32 +02:00
|
|
|
|
2015-10-27 10:33:19 +01:00
|
|
|
file_list_t *menu_entries_get_selection_buf_ptr(size_t idx);
|
2015-10-17 17:44:57 +02:00
|
|
|
|
2015-10-27 10:33:19 +01:00
|
|
|
file_list_t *menu_entries_get_menu_stack_ptr(size_t idx);
|
2015-10-17 17:44:57 +02:00
|
|
|
|
2015-10-17 18:31:16 +02:00
|
|
|
void menu_entries_get_last_stack(const char **path, const char **label,
|
2016-06-20 00:31:13 +02:00
|
|
|
unsigned *file_type, enum msg_hash_enums *enum_idx, size_t *entry_idx);
|
2015-10-17 18:31:16 +02:00
|
|
|
|
2015-10-17 18:57:47 +02:00
|
|
|
menu_file_list_cbs_t *menu_entries_get_last_stack_actiondata(void);
|
|
|
|
|
2016-04-26 00:19:23 +07:00
|
|
|
void menu_entries_pop_stack(size_t *ptr, size_t idx, bool animate);
|
2015-10-17 18:38:14 +02:00
|
|
|
|
2015-10-17 19:10:37 +02:00
|
|
|
void menu_entries_flush_stack(const char *needle, unsigned final_type);
|
|
|
|
|
2015-10-27 10:29:50 +01:00
|
|
|
size_t menu_entries_get_stack_size(size_t idx);
|
2015-10-17 19:14:49 +02:00
|
|
|
|
2015-10-17 19:21:18 +02:00
|
|
|
size_t menu_entries_get_size(void);
|
|
|
|
|
2020-09-01 00:42:24 +02:00
|
|
|
void menu_entries_prepend(file_list_t *list,
|
|
|
|
const char *path, const char *label,
|
2016-06-20 00:31:13 +02:00
|
|
|
enum msg_hash_enums enum_idx,
|
2016-04-11 18:02:50 +02:00
|
|
|
unsigned type, size_t directory_ptr, size_t entry_idx);
|
|
|
|
|
2022-08-27 17:40:52 +02:00
|
|
|
bool menu_entries_append(file_list_t *list,
|
2019-04-22 20:11:34 +02:00
|
|
|
const char *path, const char *label,
|
2016-06-20 00:31:13 +02:00
|
|
|
enum msg_hash_enums enum_idx,
|
2022-08-27 17:40:52 +02:00
|
|
|
unsigned type, size_t directory_ptr, size_t entry_idx,
|
|
|
|
rarch_setting_t *setting);
|
2016-06-15 01:15:37 +02:00
|
|
|
|
2015-12-11 21:32:00 +01:00
|
|
|
bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data);
|
|
|
|
|
2021-04-20 13:40:33 +01:00
|
|
|
bool menu_entries_search_push(const char *search_term);
|
2021-09-09 15:22:12 +02:00
|
|
|
|
2021-04-20 13:40:33 +01:00
|
|
|
bool menu_entries_search_pop(void);
|
2021-09-09 15:22:12 +02:00
|
|
|
|
2021-09-07 11:55:12 +02:00
|
|
|
menu_search_terms_t *menu_entries_search_get_terms(void);
|
2021-09-09 15:22:12 +02:00
|
|
|
|
2021-04-20 13:40:33 +01:00
|
|
|
/* Convenience function: Appends list of current
|
|
|
|
* search terms to specified string */
|
|
|
|
void menu_entries_search_append_terms_string(char *s, size_t len);
|
2021-09-09 15:22:12 +02:00
|
|
|
|
|
|
|
menu_search_terms_t *menu_entries_search_get_terms_internal(void);
|
|
|
|
|
2021-04-20 13:40:33 +01:00
|
|
|
/* Searches current menu list for specified 'needle'
|
|
|
|
* string. If string is found, returns true and sets
|
|
|
|
* 'idx' to the matching list entry index. */
|
|
|
|
bool menu_entries_list_search(const char *needle, size_t *idx);
|
|
|
|
|
2020-09-13 09:03:21 +02:00
|
|
|
/* Menu entry interface -
|
|
|
|
*
|
|
|
|
* This provides an abstraction of the currently displayed
|
|
|
|
* menu.
|
|
|
|
*
|
|
|
|
* It is organized into an event-based system where the UI companion
|
|
|
|
* calls this functions and RetroArch responds by changing the global
|
|
|
|
* state (including arranging for these functions to return different
|
|
|
|
* values).
|
|
|
|
*
|
|
|
|
* Its only interaction back to the UI is to arrange for
|
|
|
|
* notify_list_loaded on the UI companion.
|
|
|
|
*/
|
|
|
|
|
2019-05-01 11:41:13 +02:00
|
|
|
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
|
|
|
size_t i, void *userdata, bool use_representation);
|
|
|
|
|
2019-11-15 14:51:54 +00:00
|
|
|
int menu_entry_action(
|
|
|
|
menu_entry_t *entry, size_t i, enum menu_action action);
|
2019-05-01 11:41:13 +02:00
|
|
|
|
2020-09-13 09:03:21 +02:00
|
|
|
#define MENU_ENTRY_INIT(entry) \
|
|
|
|
entry.path[0] = '\0'; \
|
|
|
|
entry.label[0] = '\0'; \
|
|
|
|
entry.sublabel[0] = '\0'; \
|
|
|
|
entry.rich_label[0] = '\0'; \
|
|
|
|
entry.value[0] = '\0'; \
|
|
|
|
entry.password_value[0] = '\0'; \
|
|
|
|
entry.enum_idx = MSG_UNKNOWN; \
|
|
|
|
entry.entry_idx = 0; \
|
|
|
|
entry.idx = 0; \
|
|
|
|
entry.type = 0; \
|
|
|
|
entry.spacing = 0; \
|
|
|
|
entry.path_enabled = true; \
|
|
|
|
entry.label_enabled = true; \
|
|
|
|
entry.rich_label_enabled = true; \
|
|
|
|
entry.value_enabled = true; \
|
|
|
|
entry.sublabel_enabled = true
|
2019-05-01 11:41:13 +02:00
|
|
|
|
2016-06-03 05:49:46 +02:00
|
|
|
RETRO_END_DECLS
|
2015-06-16 02:15:32 +02:00
|
|
|
|
|
|
|
#endif
|