2013-04-17 23:31:49 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 01:50:59 +01:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
2014-04-13 12:12:12 +02:00
|
|
|
*
|
2013-04-17 23:31:49 +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_COMMON_H__
|
|
|
|
#define MENU_COMMON_H__
|
|
|
|
|
2014-05-31 16:48:07 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include "../../boolean.h"
|
2013-10-04 17:05:15 -04:00
|
|
|
#include "../../general.h"
|
2014-05-31 16:48:07 +02:00
|
|
|
#include "menu_navigation.h"
|
2014-03-01 11:53:04 +01:00
|
|
|
#include "../info/core_info.h"
|
2014-03-01 11:41:00 +01:00
|
|
|
#include "file_list.h"
|
2014-05-31 16:48:07 +02:00
|
|
|
#include "history.h"
|
|
|
|
#include "../../input/input_common.h"
|
|
|
|
#include "../../input/keyboard_line.h"
|
2013-04-17 23:31:49 +02:00
|
|
|
|
|
|
|
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
|
2014-05-31 21:23:53 +02:00
|
|
|
|
|
|
|
#ifndef HAVE_SHADER_MANAGER
|
2013-04-17 23:31:49 +02:00
|
|
|
#define HAVE_SHADER_MANAGER
|
2014-05-31 21:23:53 +02:00
|
|
|
#endif
|
|
|
|
|
2013-04-17 23:31:49 +02:00
|
|
|
#include "../../gfx/shader_parse.h"
|
|
|
|
#endif
|
|
|
|
|
2014-05-31 16:48:07 +02:00
|
|
|
#ifdef HAVE_RGUI
|
|
|
|
#define MENU_TEXTURE_FULLSCREEN false
|
|
|
|
#else
|
|
|
|
#define MENU_TEXTURE_FULLSCREEN true
|
|
|
|
#endif
|
2013-04-28 00:35:20 +02:00
|
|
|
|
2014-03-30 17:35:22 +02:00
|
|
|
#ifndef GFX_MAX_SHADERS
|
|
|
|
#define GFX_MAX_SHADERS 16
|
|
|
|
#endif
|
2013-04-17 23:31:49 +02:00
|
|
|
|
2014-04-26 15:35:42 +02:00
|
|
|
#define RGUI_SETTINGS_CORE_INFO_NONE 0xffff
|
|
|
|
#define RGUI_SETTINGS_CORE_OPTION_NONE 0xffff
|
|
|
|
#define RGUI_SETTINGS_CORE_OPTION_START 0x10000
|
|
|
|
|
2014-05-31 16:48:07 +02:00
|
|
|
#define RGUI_MAX_BUTTONS 32
|
|
|
|
#define RGUI_MAX_AXES 32
|
|
|
|
#define RGUI_MAX_HATS 4
|
|
|
|
|
|
|
|
#define RGUI_KEYBOARD_BIND_TIMEOUT_SECONDS 5
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-04-17 23:31:49 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
RGUI_FILE_PLAIN,
|
|
|
|
RGUI_FILE_DIRECTORY,
|
|
|
|
RGUI_FILE_DEVICE,
|
2013-05-20 22:17:26 -04:00
|
|
|
RGUI_FILE_USE_DIRECTORY,
|
2013-04-17 23:31:49 +02:00
|
|
|
RGUI_SETTINGS,
|
2014-05-31 05:14:04 +02:00
|
|
|
RGUI_INFO_SCREEN,
|
2013-10-04 14:53:47 +02:00
|
|
|
RGUI_START_SCREEN,
|
2013-04-17 23:31:49 +02:00
|
|
|
} rgui_file_type_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
RGUI_ACTION_UP,
|
|
|
|
RGUI_ACTION_DOWN,
|
|
|
|
RGUI_ACTION_LEFT,
|
|
|
|
RGUI_ACTION_RIGHT,
|
|
|
|
RGUI_ACTION_OK,
|
|
|
|
RGUI_ACTION_CANCEL,
|
|
|
|
RGUI_ACTION_REFRESH,
|
2014-05-31 05:14:04 +02:00
|
|
|
RGUI_ACTION_SELECT,
|
2013-04-17 23:31:49 +02:00
|
|
|
RGUI_ACTION_START,
|
|
|
|
RGUI_ACTION_MESSAGE,
|
2013-09-26 15:49:17 +02:00
|
|
|
RGUI_ACTION_SCROLL_DOWN,
|
|
|
|
RGUI_ACTION_SCROLL_UP,
|
2013-09-26 22:34:06 +02:00
|
|
|
RGUI_ACTION_MAPPING_PREVIOUS,
|
|
|
|
RGUI_ACTION_MAPPING_NEXT,
|
2013-04-17 23:31:49 +02:00
|
|
|
RGUI_ACTION_NOOP
|
|
|
|
} rgui_action_t;
|
|
|
|
|
2013-09-29 17:58:46 +02:00
|
|
|
struct rgui_bind_state_port
|
|
|
|
{
|
|
|
|
bool buttons[RGUI_MAX_BUTTONS];
|
|
|
|
int16_t axes[RGUI_MAX_AXES];
|
|
|
|
uint16_t hats[RGUI_MAX_HATS];
|
2013-09-29 19:09:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rgui_bind_axis_state
|
|
|
|
{
|
|
|
|
// Default axis state.
|
|
|
|
int16_t rested_axes[RGUI_MAX_AXES];
|
|
|
|
// Locked axis state. If we configured an axis, avoid having the same axis state trigger something again right away.
|
|
|
|
int16_t locked_axes[RGUI_MAX_AXES];
|
2013-09-29 17:58:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rgui_bind_state
|
|
|
|
{
|
|
|
|
struct retro_keybind *target;
|
2014-04-13 12:12:12 +02:00
|
|
|
int64_t timeout_end; // For keyboard binding.
|
2013-09-29 19:37:48 +02:00
|
|
|
unsigned begin;
|
|
|
|
unsigned last;
|
2013-09-29 17:58:46 +02:00
|
|
|
unsigned player;
|
|
|
|
struct rgui_bind_state_port state[MAX_PLAYERS];
|
2013-09-29 19:09:33 +02:00
|
|
|
struct rgui_bind_axis_state axis_state[MAX_PLAYERS];
|
2013-09-29 17:58:46 +02:00
|
|
|
bool skip;
|
|
|
|
};
|
|
|
|
|
2013-09-29 19:09:33 +02:00
|
|
|
void menu_poll_bind_get_rested_axes(struct rgui_bind_state *state);
|
2013-09-29 17:58:46 +02:00
|
|
|
void menu_poll_bind_state(struct rgui_bind_state *state);
|
2013-09-29 19:09:33 +02:00
|
|
|
bool menu_poll_find_trigger(struct rgui_bind_state *state, struct rgui_bind_state *new_state);
|
2014-04-13 12:12:12 +02:00
|
|
|
bool menu_custom_bind_keyboard_cb(void *data, unsigned code);
|
2013-09-29 17:58:46 +02:00
|
|
|
|
2013-04-17 23:31:49 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2013-04-19 17:53:01 +02:00
|
|
|
uint64_t old_input_state;
|
|
|
|
uint64_t trigger_state;
|
|
|
|
bool do_held;
|
|
|
|
|
2013-04-26 23:52:29 +02:00
|
|
|
unsigned delay_timer;
|
|
|
|
unsigned delay_count;
|
|
|
|
|
2013-11-04 16:23:37 +01:00
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
|
|
|
|
2013-04-17 23:31:49 +02:00
|
|
|
uint16_t *frame_buf;
|
|
|
|
size_t frame_buf_pitch;
|
2013-04-19 17:53:01 +02:00
|
|
|
bool frame_buf_show;
|
2013-04-17 23:31:49 +02:00
|
|
|
|
2014-05-31 19:22:23 +02:00
|
|
|
void *menu_stack;
|
|
|
|
void *selection_buf;
|
2013-04-17 23:31:49 +02:00
|
|
|
size_t selection_ptr;
|
2014-05-31 14:52:27 +02:00
|
|
|
unsigned info_selection;
|
2013-04-17 23:31:49 +02:00
|
|
|
bool need_refresh;
|
|
|
|
bool msg_force;
|
2013-10-04 14:53:47 +02:00
|
|
|
bool push_start_screen;
|
2013-04-17 23:31:49 +02:00
|
|
|
|
2014-05-31 19:22:23 +02:00
|
|
|
void *core_info;
|
2014-05-31 20:37:37 +02:00
|
|
|
void *core_info_current;
|
2013-10-05 17:07:56 +02:00
|
|
|
bool defer_core;
|
|
|
|
char deferred_path[PATH_MAX];
|
|
|
|
|
2013-10-03 17:32:59 +02:00
|
|
|
// Quick jumping indices with L/R.
|
|
|
|
// Rebuilt when parsing directory.
|
|
|
|
size_t scroll_indices[2 * (26 + 2) + 1];
|
|
|
|
unsigned scroll_indices_size;
|
2013-10-03 20:44:33 +02:00
|
|
|
unsigned scroll_accel;
|
2013-10-03 17:32:59 +02:00
|
|
|
|
2013-09-15 20:34:36 +02:00
|
|
|
char default_glslp[PATH_MAX];
|
|
|
|
char default_cgp[PATH_MAX];
|
2013-04-17 23:31:49 +02:00
|
|
|
|
|
|
|
const uint8_t *font;
|
|
|
|
bool alloc_font;
|
|
|
|
|
|
|
|
struct retro_system_info info;
|
2013-05-02 14:42:58 +02:00
|
|
|
bool load_no_rom;
|
2013-04-17 23:31:49 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2014-05-31 21:08:32 +02:00
|
|
|
void *shader;
|
2014-05-31 19:22:23 +02:00
|
|
|
void *parameter_shader; // Points to either shader or graphics driver current shader.
|
2013-04-17 23:31:49 +02:00
|
|
|
#endif
|
2013-05-04 16:13:58 +02:00
|
|
|
unsigned current_pad;
|
2013-04-28 00:35:20 +02:00
|
|
|
|
2014-05-31 19:22:23 +02:00
|
|
|
void *history;
|
2013-12-17 19:10:21 +01:00
|
|
|
retro_time_t last_time; // Used to throttle RGUI in case VSync is broken.
|
2013-09-29 17:58:46 +02:00
|
|
|
|
|
|
|
struct rgui_bind_state binds;
|
2013-12-10 19:39:09 +01:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
const char **buffer;
|
|
|
|
const char *label;
|
|
|
|
bool display;
|
|
|
|
} keyboard;
|
2014-04-13 20:09:51 +02:00
|
|
|
|
|
|
|
bool bind_mode_keyboard;
|
2014-05-09 17:29:41 +02:00
|
|
|
retro_time_t time;
|
|
|
|
retro_time_t delta;
|
|
|
|
retro_time_t target_msec;
|
|
|
|
retro_time_t sleep_msec;
|
2013-04-17 23:31:49 +02:00
|
|
|
} rgui_handle_t;
|
|
|
|
|
2014-05-30 17:49:04 +02:00
|
|
|
void *menu_init(const void *data);
|
2014-05-30 20:53:10 +02:00
|
|
|
bool menu_iterate(void);
|
2014-05-09 05:47:32 +02:00
|
|
|
void menu_free(void *data);
|
2013-04-17 23:31:49 +02:00
|
|
|
|
2013-05-05 15:42:14 -04:00
|
|
|
void menu_ticker_line(char *buf, size_t len, unsigned tick, const char *str, bool selected);
|
2013-05-05 11:26:02 +02:00
|
|
|
|
2014-05-30 19:33:10 +02:00
|
|
|
void load_menu_game_prepare(void);
|
|
|
|
void load_menu_game_prepare_dummy(void);
|
|
|
|
bool load_menu_game(void);
|
|
|
|
void load_menu_game_history(unsigned game_index);
|
|
|
|
extern void load_menu_game_new_core(void);
|
|
|
|
void menu_rom_history_push(const char *path, const char *core_path,
|
2013-05-17 18:22:03 +02:00
|
|
|
const char *core_name);
|
2014-05-30 19:33:10 +02:00
|
|
|
void menu_rom_history_push_current(void);
|
2013-04-28 16:38:13 +02:00
|
|
|
|
2014-05-30 19:33:10 +02:00
|
|
|
bool menu_replace_config(const char *path);
|
2013-09-15 15:36:45 +02:00
|
|
|
|
2013-09-22 12:48:33 +02:00
|
|
|
bool menu_save_new_config(void);
|
|
|
|
|
2014-05-22 06:19:15 +02:00
|
|
|
int menu_defer_core(void *data, const char *dir, const char *path, char *deferred_path, size_t sizeof_deferred_path);
|
2014-05-22 03:12:56 +02:00
|
|
|
|
2014-05-30 19:33:10 +02:00
|
|
|
uint64_t menu_input(void);
|
2014-02-01 22:30:03 +01:00
|
|
|
|
2014-05-30 19:33:10 +02:00
|
|
|
void menu_flush_stack_type(unsigned final_type);
|
2014-04-14 02:32:54 +02:00
|
|
|
void menu_update_system_info(void *data, bool *load_no_rom);
|
2014-05-30 22:06:54 +02:00
|
|
|
void menu_build_scroll_indices(file_list_t *buf);
|
2014-04-14 02:32:54 +02:00
|
|
|
|
2013-04-17 23:31:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|