2015-05-18 13:56:32 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2015-05-18 13:56:32 +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 <file/file_path.h>
|
2016-03-20 13:53:54 +00:00
|
|
|
#include <lists/string_list.h>
|
2016-01-20 03:54:17 +00:00
|
|
|
#include <string/stdstring.h>
|
2015-06-05 10:28:11 +00:00
|
|
|
|
2015-12-06 16:55:27 +00:00
|
|
|
#include "../menu_driver.h"
|
2015-06-26 13:28:01 +00:00
|
|
|
#include "../menu_cbs.h"
|
2015-06-13 17:12:10 +00:00
|
|
|
#include "../menu_input.h"
|
2015-06-08 12:35:58 +00:00
|
|
|
#include "../menu_setting.h"
|
|
|
|
#include "../menu_shader.h"
|
|
|
|
#include "../menu_navigation.h"
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2015-12-11 12:56:00 +00:00
|
|
|
#include "../../core_info.h"
|
2016-05-09 16:20:52 +00:00
|
|
|
#include "../../managers/cheat_manager.h"
|
2015-06-13 17:12:10 +00:00
|
|
|
#include "../../general.h"
|
2015-06-08 12:35:58 +00:00
|
|
|
#include "../../retroarch.h"
|
2015-12-06 18:31:47 +00:00
|
|
|
#include "../../system.h"
|
2015-12-05 09:04:06 +00:00
|
|
|
#include "../../ui/ui_companion_driver.h"
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2015-10-11 18:26:44 +00:00
|
|
|
#ifndef BIND_ACTION_RIGHT
|
|
|
|
#define BIND_ACTION_RIGHT(cbs, name) \
|
|
|
|
cbs->action_right = name; \
|
|
|
|
cbs->action_right_ident = #name;
|
|
|
|
#endif
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2015-09-07 20:30:20 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2015-09-07 19:22:19 +00:00
|
|
|
static int generic_shader_action_parameter_right(
|
|
|
|
struct video_shader *shader, struct video_shader_parameter *param,
|
|
|
|
unsigned type, const char *label, bool wraparound)
|
2015-05-18 13:56:32 +00:00
|
|
|
{
|
|
|
|
if (!shader)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
param->current += param->step;
|
2016-03-01 23:07:31 +00:00
|
|
|
param->current = MIN(MAX(param->minimum, param->current), param->maximum);
|
2015-09-01 23:19:26 +00:00
|
|
|
|
2015-12-05 08:55:13 +00:00
|
|
|
if (ui_companion_is_on_foreground())
|
|
|
|
ui_companion_driver_notify_refresh();
|
2015-09-02 14:36:59 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2015-09-01 23:39:52 +00:00
|
|
|
int shader_action_parameter_right(unsigned type, const char *label, bool wraparound)
|
2015-05-18 13:56:32 +00:00
|
|
|
{
|
2016-02-14 21:13:21 +00:00
|
|
|
video_shader_ctx_t shader_info;
|
|
|
|
struct video_shader_parameter *param = NULL;
|
|
|
|
|
2016-05-08 19:11:27 +00:00
|
|
|
video_shader_driver_get_current_shader(&shader_info);
|
2016-02-14 21:13:21 +00:00
|
|
|
|
|
|
|
param = &shader_info.data->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0];
|
|
|
|
return generic_shader_action_parameter_right(shader_info.data, param, type, label, wraparound);
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|
|
|
|
|
2015-09-01 23:39:52 +00:00
|
|
|
int shader_action_parameter_preset_right(unsigned type, const char *label,
|
2015-05-18 13:56:32 +00:00
|
|
|
bool wraparound)
|
|
|
|
{
|
2015-12-10 18:56:08 +00:00
|
|
|
struct video_shader_parameter *param = NULL;
|
|
|
|
struct video_shader *shader = NULL;
|
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
|
|
|
|
&shader);
|
|
|
|
|
|
|
|
param = shader ?
|
|
|
|
&shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0] :
|
|
|
|
NULL;
|
2015-09-07 19:22:19 +00:00
|
|
|
return generic_shader_action_parameter_right(shader, param, type, label, wraparound);
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|
2015-09-07 20:30:20 +00:00
|
|
|
#endif
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2015-09-05 15:09:57 +00:00
|
|
|
int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
|
2015-05-18 13:56:32 +00:00
|
|
|
bool wraparound)
|
|
|
|
{
|
2015-12-01 02:03:33 +00:00
|
|
|
cheat_manager_toggle_index(idx);
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-09-05 15:09:57 +00:00
|
|
|
int action_right_cheat(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
size_t idx = type - MENU_SETTINGS_CHEAT_BEGIN;
|
|
|
|
return generic_action_cheat_toggle(idx, type, label,
|
|
|
|
wraparound);
|
|
|
|
}
|
|
|
|
|
2015-06-06 18:40:17 +00:00
|
|
|
int action_right_input_desc(unsigned type, const char *label,
|
2015-05-18 13:56:32 +00:00
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN;
|
2015-05-21 02:11:20 +00:00
|
|
|
unsigned inp_desc_user = inp_desc_index_offset / (RARCH_FIRST_CUSTOM_BIND + 4);
|
|
|
|
unsigned inp_desc_button_index_offset = inp_desc_index_offset - (inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 4));
|
2015-05-18 13:56:32 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
2015-05-21 02:11:20 +00:00
|
|
|
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
|
|
|
|
{
|
|
|
|
if (settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] < RARCH_FIRST_CUSTOM_BIND - 1)
|
|
|
|
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset] < 4 - 1)
|
|
|
|
settings->input.remap_ids[inp_desc_user][inp_desc_button_index_offset]++;
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_scroll(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
2015-09-25 12:57:37 +00:00
|
|
|
size_t selection;
|
2015-09-25 16:43:42 +00:00
|
|
|
size_t scroll_accel = 0;
|
2015-05-18 13:56:32 +00:00
|
|
|
unsigned scroll_speed = 0, fast_scroll_speed = 0;
|
2015-09-25 12:57:37 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return false;
|
2015-09-25 16:43:42 +00:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
|
|
|
return false;
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2016-03-01 23:07:31 +00:00
|
|
|
scroll_speed = (MAX(scroll_accel, 2) - 2) / 4 + 1;
|
2015-05-18 13:56:32 +00:00
|
|
|
fast_scroll_speed = 4 + 4 * scroll_speed;
|
|
|
|
|
2015-10-17 17:21:18 +00:00
|
|
|
if (selection + fast_scroll_speed < (menu_entries_get_size()))
|
2015-09-25 13:42:31 +00:00
|
|
|
{
|
|
|
|
size_t idx = selection + fast_scroll_speed;
|
|
|
|
bool scroll = true;
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
else
|
|
|
|
{
|
2015-10-17 17:21:18 +00:00
|
|
|
if ((menu_entries_get_size() > 0))
|
2015-09-25 12:42:28 +00:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_mainmenu(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
2016-02-10 23:59:55 +00:00
|
|
|
menu_ctx_list_t list_info;
|
2015-09-25 16:43:42 +00:00
|
|
|
size_t selection = 0;
|
2015-05-18 13:56:32 +00:00
|
|
|
menu_file_list_cbs_t *cbs = NULL;
|
|
|
|
unsigned push_list = 0;
|
2015-10-27 09:10:33 +00:00
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
2015-10-27 09:33:19 +00:00
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
2015-10-24 19:18:47 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-05-18 13:56:32 +00:00
|
|
|
unsigned action = MENU_ACTION_RIGHT;
|
|
|
|
|
2016-02-11 00:07:30 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SELECTION, &list_info);
|
|
|
|
|
|
|
|
list_info.type = MENU_LIST_PLAIN;
|
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_info);
|
|
|
|
|
|
|
|
if (list_info.size == 1)
|
2015-05-18 13:56:32 +00:00
|
|
|
{
|
2016-02-11 00:07:30 +00:00
|
|
|
menu_ctx_list_t list_horiz_info;
|
|
|
|
menu_ctx_list_t list_tabs_info;
|
2015-12-08 14:20:44 +00:00
|
|
|
|
2016-02-11 00:07:30 +00:00
|
|
|
list_horiz_info.type = MENU_LIST_HORIZONTAL;
|
|
|
|
list_tabs_info.type = MENU_LIST_TABS;
|
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_horiz_info);
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_SIZE, &list_tabs_info);
|
|
|
|
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
2016-02-10 23:59:55 +00:00
|
|
|
|
2016-02-11 00:07:30 +00:00
|
|
|
if ((list_info.selection != (list_horiz_info.size + list_tabs_info.size))
|
2015-10-25 01:59:38 +00:00
|
|
|
|| settings->menu.navigation.wraparound.enable)
|
2015-06-07 13:54:36 +00:00
|
|
|
push_list = 1;
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|
2015-05-21 02:11:20 +00:00
|
|
|
else
|
2015-05-18 13:56:32 +00:00
|
|
|
push_list = 2;
|
|
|
|
|
2015-09-25 16:43:42 +00:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
|
|
|
|
2015-10-19 14:32:51 +00:00
|
|
|
cbs = menu_entries_get_actiondata_at_offset(selection_buf, selection);
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
switch (push_list)
|
|
|
|
{
|
|
|
|
case 1:
|
2016-02-10 05:43:56 +00:00
|
|
|
{
|
|
|
|
menu_ctx_list_t list_info;
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2016-02-10 05:43:56 +00:00
|
|
|
list_info.type = MENU_LIST_HORIZONTAL;
|
|
|
|
list_info.action = action;
|
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_LIST_CACHE, &list_info);
|
|
|
|
|
|
|
|
if (cbs && cbs->action_content_list_switch)
|
|
|
|
return cbs->action_content_list_switch(selection_buf, menu_stack,
|
|
|
|
"", "", 0);
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
action_right_scroll(0, "", false);
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_shader_scale_pass(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0;
|
2015-12-10 18:56:08 +00:00
|
|
|
struct video_shader *shader = NULL;
|
2015-05-18 13:56:32 +00:00
|
|
|
struct video_shader_pass *shader_pass = NULL;
|
2015-05-21 02:11:20 +00:00
|
|
|
|
2015-12-10 18:56:08 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
|
|
|
|
&shader);
|
2015-05-18 13:56:32 +00:00
|
|
|
if (!shader)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
shader_pass = &shader->pass[pass];
|
|
|
|
if (!shader_pass)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
unsigned current_scale = shader_pass->fbo.scale_x;
|
|
|
|
unsigned delta = 1;
|
|
|
|
current_scale = (current_scale + delta) % 6;
|
|
|
|
|
|
|
|
shader_pass->fbo.valid = current_scale;
|
|
|
|
shader_pass->fbo.scale_x = shader_pass->fbo.scale_y = current_scale;
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_shader_filter_pass(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2015-12-10 18:56:08 +00:00
|
|
|
unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0;
|
|
|
|
unsigned delta = 1;
|
|
|
|
struct video_shader *shader = NULL;
|
2015-05-18 13:56:32 +00:00
|
|
|
struct video_shader_pass *shader_pass = NULL;
|
2015-05-21 02:11:20 +00:00
|
|
|
|
2015-12-10 18:56:08 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
|
|
|
|
&shader);
|
2015-05-18 13:56:32 +00:00
|
|
|
if (!shader)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
shader_pass = &shader->pass[pass];
|
|
|
|
if (!shader_pass)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
shader_pass->filter = ((shader_pass->filter + delta) % 3);
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_shader_filter_default(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2016-06-16 10:58:52 +00:00
|
|
|
rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_SMOOTH);
|
2015-06-03 08:33:41 +00:00
|
|
|
if (!setting)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-09-26 00:22:01 +00:00
|
|
|
return menu_action_handle_setting(setting, menu_setting_get_type(setting), MENU_ACTION_RIGHT,
|
2015-06-03 08:33:41 +00:00
|
|
|
wraparound);
|
|
|
|
#else
|
2015-05-18 13:56:32 +00:00
|
|
|
return 0;
|
2015-06-03 08:33:41 +00:00
|
|
|
#endif
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_cheat_num_passes(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
2015-12-12 01:14:50 +00:00
|
|
|
bool refresh = false;
|
2015-05-18 13:56:32 +00:00
|
|
|
unsigned new_size = 0;
|
|
|
|
|
2015-12-01 01:55:07 +00:00
|
|
|
new_size = cheat_manager_get_size() + 1;
|
2015-12-12 01:14:50 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
2015-12-07 15:55:13 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
2015-12-01 01:55:07 +00:00
|
|
|
cheat_manager_realloc(new_size);
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_shader_num_passes(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
2015-12-12 01:14:50 +00:00
|
|
|
bool refresh = false;
|
2015-05-18 13:56:32 +00:00
|
|
|
struct video_shader *shader = NULL;
|
2015-05-21 02:11:20 +00:00
|
|
|
|
2015-12-10 18:56:08 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
|
|
|
|
&shader);
|
2015-05-18 13:56:32 +00:00
|
|
|
if (!shader)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
if ((shader->passes < GFX_MAX_SHADERS))
|
|
|
|
shader->passes++;
|
2015-12-12 01:14:50 +00:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
2015-12-07 15:55:13 +00:00
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
2015-12-10 18:56:08 +00:00
|
|
|
video_shader_resolve_parameters(NULL, shader);
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_right_video_resolution(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
2015-05-21 02:11:20 +00:00
|
|
|
{
|
2016-05-08 12:00:51 +00:00
|
|
|
video_driver_get_next_video_out();
|
2015-05-18 13:56:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-26 06:16:37 +00:00
|
|
|
static int playlist_association_right(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
2015-11-23 17:40:32 +00:00
|
|
|
size_t i, next, found, current = 0;
|
2015-11-19 22:20:13 +00:00
|
|
|
char core_path[PATH_MAX_LENGTH] = {0};
|
2015-11-25 03:05:04 +00:00
|
|
|
core_info_t *info = NULL;
|
2015-11-25 02:38:57 +00:00
|
|
|
struct string_list *stnames = NULL;
|
|
|
|
struct string_list *stcores = NULL;
|
2015-11-20 12:58:19 +00:00
|
|
|
char new_playlist_cores[PATH_MAX_LENGTH] = {0};
|
2015-11-19 22:20:13 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
const char *path = path_basename(label);
|
2015-12-11 12:51:17 +00:00
|
|
|
core_info_list_t *list = NULL;
|
|
|
|
|
2016-05-09 16:11:17 +00:00
|
|
|
core_info_get_list(&list);
|
2015-11-19 22:20:13 +00:00
|
|
|
if (!list)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-11-19 22:20:13 +00:00
|
|
|
|
2015-11-25 02:38:57 +00:00
|
|
|
stnames = string_split(settings->playlist_names, ";");
|
|
|
|
stcores = string_split(settings->playlist_cores, ";");
|
2015-11-19 22:20:13 +00:00
|
|
|
|
|
|
|
if (!menu_playlist_find_associated_core(path, core_path, sizeof(core_path)))
|
|
|
|
strlcpy(core_path, "DETECT", sizeof(core_path));
|
|
|
|
|
|
|
|
for (i = 0; i < list->count; i++)
|
|
|
|
{
|
|
|
|
core_info_t *info = core_info_get(list, i);
|
2016-01-20 03:54:17 +00:00
|
|
|
if (string_is_equal(info->path, core_path))
|
2015-11-19 22:20:13 +00:00
|
|
|
current = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
next = current + 1;
|
|
|
|
if (next >= list->count)
|
|
|
|
{
|
|
|
|
if (wraparound)
|
|
|
|
next = list->count-1;
|
|
|
|
else
|
|
|
|
next = 0;
|
|
|
|
}
|
|
|
|
|
2015-11-25 03:05:04 +00:00
|
|
|
info = core_info_get(list, next);
|
2015-11-19 22:20:13 +00:00
|
|
|
|
|
|
|
found = string_list_find_elem(stnames, path);
|
|
|
|
if (found)
|
|
|
|
string_list_set(stcores, found-1, info->path);
|
|
|
|
|
|
|
|
string_list_join_concat(new_playlist_cores, sizeof(new_playlist_cores), stcores, ";");
|
2015-10-26 06:16:37 +00:00
|
|
|
|
2015-11-19 22:20:13 +00:00
|
|
|
strlcpy(settings->playlist_cores, new_playlist_cores, sizeof(settings->playlist_cores));
|
2015-10-26 06:16:37 +00:00
|
|
|
|
2016-05-23 20:17:28 +00:00
|
|
|
string_list_free(stnames);
|
|
|
|
string_list_free(stcores);
|
2015-10-26 06:16:37 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-06 18:35:39 +00:00
|
|
|
int core_setting_right(unsigned type, const char *label,
|
2015-05-18 13:56:32 +00:00
|
|
|
bool wraparound)
|
|
|
|
{
|
|
|
|
unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START;
|
|
|
|
|
2015-12-09 08:31:22 +00:00
|
|
|
runloop_ctl(RUNLOOP_CTL_CORE_OPTION_NEXT, &idx);
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int disk_options_disk_idx_right(unsigned type, const char *label,
|
|
|
|
bool wraparound)
|
|
|
|
{
|
2016-05-09 18:51:53 +00:00
|
|
|
command_event(CMD_EVENT_DISK_NEXT, NULL);
|
2015-05-18 13:56:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-28 14:56:45 +00:00
|
|
|
int bind_right_generic(unsigned type, const char *label,
|
2015-05-18 13:56:32 +00:00
|
|
|
bool wraparound)
|
|
|
|
{
|
2015-06-04 08:02:27 +00:00
|
|
|
return menu_setting_set(type, label, MENU_ACTION_RIGHT, wraparound);
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 14:01:46 +00:00
|
|
|
static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
|
2016-06-17 18:50:36 +00:00
|
|
|
unsigned type, uint32_t label_hash, const char *menu_label,
|
|
|
|
uint32_t menu_label_hash)
|
2015-05-18 13:56:32 +00:00
|
|
|
{
|
2015-09-07 20:30:20 +00:00
|
|
|
if (type >= MENU_SETTINGS_CHEAT_BEGIN
|
|
|
|
&& type <= MENU_SETTINGS_CHEAT_END)
|
2015-10-11 18:26:44 +00:00
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_cheat);
|
|
|
|
}
|
2015-09-07 20:30:20 +00:00
|
|
|
#ifdef HAVE_SHADER_MANAGER
|
|
|
|
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
|
2015-05-18 13:56:32 +00:00
|
|
|
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
2015-10-11 18:26:44 +00:00
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, shader_action_parameter_right);
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
|
|
|
|
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
|
2015-10-11 18:26:44 +00:00
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, shader_action_parameter_preset_right);
|
|
|
|
}
|
2015-09-07 20:30:20 +00:00
|
|
|
#endif
|
2015-05-18 13:56:32 +00:00
|
|
|
else if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
|
|
|
|
&& type <= MENU_SETTINGS_INPUT_DESC_END)
|
2015-10-11 18:26:44 +00:00
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_input_desc);
|
|
|
|
}
|
2015-10-26 06:16:37 +00:00
|
|
|
else if ((type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START))
|
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, playlist_association_right);
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
else if ((type >= MENU_SETTINGS_CORE_OPTION_START))
|
2015-10-11 18:26:44 +00:00
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, core_setting_right);
|
|
|
|
}
|
2015-06-05 10:28:11 +00:00
|
|
|
else
|
2015-06-07 15:57:42 +00:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX:
|
2015-10-11 18:26:44 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, disk_options_disk_idx_right);
|
2015-06-07 15:57:42 +00:00
|
|
|
break;
|
|
|
|
case MENU_FILE_PLAIN:
|
|
|
|
case MENU_FILE_DIRECTORY:
|
2015-10-25 07:31:55 +00:00
|
|
|
case MENU_FILE_PARENT_DIRECTORY:
|
2015-06-07 15:57:42 +00:00
|
|
|
case MENU_FILE_CARCHIVE:
|
2015-07-15 00:31:11 +00:00
|
|
|
case MENU_FILE_IN_CARCHIVE:
|
2015-06-07 15:57:42 +00:00
|
|
|
case MENU_FILE_CORE:
|
|
|
|
case MENU_FILE_RDB:
|
|
|
|
case MENU_FILE_RDB_ENTRY:
|
2015-07-23 17:44:59 +00:00
|
|
|
case MENU_FILE_RPL_ENTRY:
|
2015-06-07 15:57:42 +00:00
|
|
|
case MENU_FILE_CURSOR:
|
|
|
|
case MENU_FILE_SHADER:
|
|
|
|
case MENU_FILE_SHADER_PRESET:
|
|
|
|
case MENU_FILE_IMAGE:
|
|
|
|
case MENU_FILE_OVERLAY:
|
|
|
|
case MENU_FILE_VIDEOFILTER:
|
|
|
|
case MENU_FILE_AUDIOFILTER:
|
|
|
|
case MENU_FILE_CONFIG:
|
|
|
|
case MENU_FILE_USE_DIRECTORY:
|
|
|
|
case MENU_FILE_PLAYLIST_ENTRY:
|
2015-10-22 20:43:25 +00:00
|
|
|
case MENU_INFO_MESSAGE:
|
2015-06-07 15:57:42 +00:00
|
|
|
case MENU_FILE_DOWNLOAD_CORE:
|
|
|
|
case MENU_FILE_CHEAT:
|
|
|
|
case MENU_FILE_REMAP:
|
2015-06-23 04:44:29 +00:00
|
|
|
case MENU_FILE_MOVIE:
|
|
|
|
case MENU_FILE_MUSIC:
|
2015-06-28 15:21:32 +00:00
|
|
|
case MENU_FILE_IMAGEVIEWER:
|
2015-06-07 22:56:08 +00:00
|
|
|
case MENU_FILE_PLAYLIST_COLLECTION:
|
2015-07-04 02:03:10 +00:00
|
|
|
case MENU_FILE_DOWNLOAD_CORE_CONTENT:
|
2016-05-01 15:30:16 +00:00
|
|
|
case MENU_FILE_DOWNLOAD_THUMBNAIL_CONTENT:
|
2015-07-08 15:29:46 +00:00
|
|
|
case MENU_FILE_SCAN_DIRECTORY:
|
2015-06-07 15:57:42 +00:00
|
|
|
case MENU_SETTING_GROUP:
|
2016-06-19 22:31:13 +00:00
|
|
|
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS_TAB))
|
2016-06-17 18:50:36 +00:00
|
|
|
)
|
2015-06-07 15:57:42 +00:00
|
|
|
{
|
2016-06-17 18:50:36 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
|
|
|
|
break;
|
2015-06-07 15:57:42 +00:00
|
|
|
}
|
2016-06-17 18:50:36 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_scroll);
|
|
|
|
break;
|
2015-06-07 15:57:42 +00:00
|
|
|
case MENU_SETTING_ACTION:
|
|
|
|
case MENU_FILE_CONTENTLIST_ENTRY:
|
2015-10-11 18:26:44 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
|
2015-06-07 15:57:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-12 14:01:46 +00:00
|
|
|
static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
|
2016-06-17 18:43:42 +00:00
|
|
|
const char *label, uint32_t label_hash, const char *menu_label,
|
|
|
|
uint32_t menu_label_hash, const char *elem0)
|
2015-06-07 15:57:42 +00:00
|
|
|
{
|
2015-06-07 16:10:01 +00:00
|
|
|
unsigned i;
|
|
|
|
|
2015-08-17 17:39:12 +00:00
|
|
|
if (cbs->setting)
|
2015-06-07 16:44:42 +00:00
|
|
|
{
|
2015-10-11 11:10:46 +00:00
|
|
|
const char *parent_group = menu_setting_get_parent_group(cbs->setting);
|
2015-06-14 14:06:25 +00:00
|
|
|
|
2016-06-19 22:31:13 +00:00
|
|
|
if (string_is_equal(parent_group, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU))
|
2016-06-17 18:50:36 +00:00
|
|
|
&& (menu_setting_get_type(cbs->setting) == ST_GROUP))
|
2015-06-07 16:44:42 +00:00
|
|
|
{
|
2015-10-11 18:26:44 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_scroll);
|
2015-06-07 16:44:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-07 16:10:01 +00:00
|
|
|
for (i = 0; i < MAX_USERS; i++)
|
|
|
|
{
|
2015-06-14 14:06:25 +00:00
|
|
|
uint32_t label_setting_hash;
|
2015-06-14 18:51:37 +00:00
|
|
|
char label_setting[PATH_MAX_LENGTH];
|
2015-06-14 14:06:25 +00:00
|
|
|
|
2015-06-14 18:51:37 +00:00
|
|
|
label_setting[0] = '\0';
|
2015-06-07 16:10:01 +00:00
|
|
|
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
|
|
|
|
|
2016-06-19 22:37:38 +00:00
|
|
|
label_setting_hash = msg_hash_calculate(label_setting);
|
2015-06-14 14:06:25 +00:00
|
|
|
|
|
|
|
if (label_hash != label_setting_hash)
|
|
|
|
continue;
|
|
|
|
|
2015-10-11 18:26:44 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, bind_right_generic);
|
2015-06-14 14:06:25 +00:00
|
|
|
return 0;
|
2015-06-07 16:10:01 +00:00
|
|
|
}
|
|
|
|
|
2015-06-07 15:57:42 +00:00
|
|
|
if (strstr(label, "rdb_entry"))
|
2015-10-11 18:26:44 +00:00
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_scroll);
|
|
|
|
}
|
2015-06-07 15:57:42 +00:00
|
|
|
else
|
2015-06-05 10:28:11 +00:00
|
|
|
{
|
2016-06-19 22:31:13 +00:00
|
|
|
if (cbs->enum_idx != MSG_UNKNOWN)
|
2015-06-05 10:28:11 +00:00
|
|
|
{
|
2016-06-16 18:14:15 +00:00
|
|
|
switch (cbs->enum_idx)
|
|
|
|
{
|
|
|
|
case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_scale_pass);
|
|
|
|
break;
|
|
|
|
case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_filter_pass);
|
|
|
|
break;
|
|
|
|
case MENU_ENUM_LABEL_VIDEO_SHADER_DEFAULT_FILTER:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_filter_default);
|
|
|
|
break;
|
|
|
|
case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_num_passes);
|
|
|
|
break;
|
|
|
|
case MENU_ENUM_LABEL_CHEAT_NUM_PASSES:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_cheat_num_passes);
|
|
|
|
break;
|
|
|
|
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_video_resolution);
|
|
|
|
break;
|
2016-06-17 18:43:42 +00:00
|
|
|
case MENU_ENUM_LABEL_NO_ITEMS:
|
2016-06-16 18:14:15 +00:00
|
|
|
case MENU_ENUM_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
|
2016-06-19 22:31:13 +00:00
|
|
|
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))
|
2016-06-17 18:43:42 +00:00
|
|
|
)
|
2016-06-16 18:14:15 +00:00
|
|
|
{
|
2016-06-17 18:43:42 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
|
|
|
|
break;
|
2016-06-16 18:14:15 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (label_hash)
|
|
|
|
{
|
|
|
|
case MENU_LABEL_VIDEO_SHADER_SCALE_PASS:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_scale_pass);
|
|
|
|
break;
|
|
|
|
case MENU_LABEL_VIDEO_SHADER_FILTER_PASS:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_filter_pass);
|
|
|
|
break;
|
|
|
|
case MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_filter_default);
|
|
|
|
break;
|
|
|
|
case MENU_LABEL_VIDEO_SHADER_NUM_PASSES:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_shader_num_passes);
|
|
|
|
break;
|
|
|
|
case MENU_LABEL_SCREEN_RESOLUTION:
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_video_resolution);
|
|
|
|
break;
|
|
|
|
case MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE:
|
2016-06-19 22:31:13 +00:00
|
|
|
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU))
|
2016-06-17 18:43:42 +00:00
|
|
|
)
|
2016-06-16 18:14:15 +00:00
|
|
|
{
|
2016-06-17 18:43:42 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
|
|
|
|
break;
|
2016-06-16 18:14:15 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
2015-06-05 10:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-18 13:56:32 +00:00
|
|
|
|
2015-06-07 15:57:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-12 14:01:46 +00:00
|
|
|
int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs,
|
2015-06-07 15:57:42 +00:00
|
|
|
const char *path, const char *label, unsigned type, size_t idx,
|
|
|
|
const char *elem0, const char *elem1, const char *menu_label,
|
|
|
|
uint32_t label_hash, uint32_t menu_label_hash)
|
|
|
|
{
|
|
|
|
if (!cbs)
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-06-07 15:57:42 +00:00
|
|
|
|
2015-10-11 18:26:44 +00:00
|
|
|
BIND_ACTION_RIGHT(cbs, bind_right_generic);
|
2015-10-29 14:00:29 +00:00
|
|
|
|
2016-06-17 18:50:36 +00:00
|
|
|
if (type == MENU_SETTING_NO_ITEM)
|
|
|
|
{
|
2016-06-19 22:31:13 +00:00
|
|
|
if ( string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_TAB)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)) ||
|
|
|
|
string_is_equal(menu_label, msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS_TAB))
|
2016-06-17 18:50:36 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
BIND_ACTION_RIGHT(cbs, action_right_mainmenu);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2015-06-07 15:57:42 +00:00
|
|
|
|
2016-06-17 18:43:42 +00:00
|
|
|
if (menu_cbs_init_bind_right_compare_label(cbs, label, label_hash, menu_label,
|
|
|
|
menu_label_hash, elem0) == 0)
|
2015-06-07 16:36:10 +00:00
|
|
|
return 0;
|
|
|
|
|
2016-06-17 18:50:36 +00:00
|
|
|
if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label, menu_label_hash) == 0)
|
2015-06-07 16:36:10 +00:00
|
|
|
return 0;
|
2015-06-07 15:57:42 +00:00
|
|
|
|
2016-02-10 20:42:18 +00:00
|
|
|
return menu_cbs_exit();
|
2015-05-18 13:56:32 +00:00
|
|
|
}
|