RetroArch/menu/cbs/menu_cbs_get_value.c

2374 lines
71 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2017-01-22 13:40:32 +01:00
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* 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-09-01 18:01:41 +02:00
#include <compat/strl.h>
#include <string/stdstring.h>
#include <lists/string_list.h>
2016-09-08 05:39:08 +02:00
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
2015-12-06 17:55:27 +01:00
#include "../menu_driver.h"
#include "../../gfx/gfx_animation.h"
#include "../menu_cbs.h"
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
#include "../menu_shader.h"
#endif
#include "../../tasks/tasks_internal.h"
2016-02-16 04:54:26 +01:00
2016-09-06 06:11:44 +02:00
#include "../../core.h"
#include "../../core_info.h"
2016-09-01 18:01:41 +02:00
#include "../../configuration.h"
2016-06-26 10:12:28 +02:00
#include "../../file_path_special.h"
#include "../../core_option_manager.h"
2020-06-30 19:35:41 +02:00
#ifdef HAVE_CHEATS
#include "../../cheat_manager.h"
2020-06-30 19:35:41 +02:00
#endif
2016-05-10 08:53:14 +02:00
#include "../../performance_counters.h"
#include "../../paths.h"
2017-09-10 00:04:18 -05:00
#include "../../verbosity.h"
#ifdef HAVE_BLUETOOTH
2020-06-17 14:56:44 +03:00
#include "../../bluetooth/bluetooth_driver.h"
#endif
#include "../../playlist.h"
2019-11-29 17:13:35 +00:00
#include "../../manual_content_scan.h"
#include "../misc/cpufreq/cpufreq.h"
#include "../../audio/audio_driver.h"
2017-09-10 22:49:25 -04:00
#ifdef HAVE_NETWORKING
2019-07-24 02:02:57 +02:00
#include "../../network/netplay/netplay.h"
#include "../../network/wifi_driver.h"
2017-09-10 22:49:25 -04:00
#endif
#ifdef HAVE_CHEEVOS
2021-06-01 11:59:27 -06:00
#include "../../cheevos/cheevos_menu.h"
#endif
#ifdef HAVE_MIST
#include "../../steam/steam.h"
#endif
2015-10-11 21:19:18 +02:00
#ifndef BIND_ACTION_GET_VALUE
2020-03-28 01:59:15 +01:00
#define BIND_ACTION_GET_VALUE(cbs, name) (cbs)->action_get_value = (name)
2015-10-11 21:19:18 +02:00
#endif
extern struct key_desc key_descriptors[RARCH_MAX_KEYS];
2017-09-10 00:04:18 -05:00
2019-07-11 11:51:06 +02:00
#ifdef HAVE_AUDIOMIXER
static void menu_action_setting_audio_mixer_stream_name(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_BEGIN);
*w = 19;
strlcpy(s2, path, len2);
if (offset >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
strlcpy(s, audio_driver_mixer_get_stream_name(offset), len);
}
static void menu_action_setting_audio_mixer_stream_volume(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
size_t _len;
unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN);
*w = 19;
strlcpy(s2, path, len2);
if (offset >= AUDIO_MIXER_MAX_SYSTEM_STREAMS)
return;
_len = snprintf(s, len, "%.2f", audio_driver_mixer_get_stream_volume(offset));
strlcpy(s + _len, " dB", len - _len);
}
2019-07-11 11:51:06 +02:00
#endif
2020-06-30 19:35:41 +02:00
#ifdef HAVE_CHEATS
static void menu_action_setting_disp_set_label_cheat_num_passes(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*w = 19;
strlcpy(s2, path, len2);
snprintf(s, len, "%u", cheat_manager_get_buf_size());
}
2020-06-30 19:35:41 +02:00
#endif
#ifdef HAVE_CHEEVOS
static void menu_action_setting_disp_set_label_cheevos_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*w = 19;
strlcpy(s2, path, len2);
2021-06-01 11:59:27 -06:00
rcheevos_menu_get_state(type - MENU_SETTINGS_CHEEVOS_START, s, len);
2017-11-23 20:35:54 -05:00
}
#endif
2017-11-23 20:35:54 -05:00
static void menu_action_setting_disp_set_label_remap_file_info(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2021-11-09 06:03:00 +01:00
runloop_state_t *runloop_st = runloop_state_get_ptr();
const char *remap_path = runloop_st->name.remapfile;
const char *remap_file = NULL;
*w = 19;
if (!string_is_empty(remap_path))
remap_file = path_basename_nocompression(remap_path);
if (!string_is_empty(remap_file))
strlcpy(s, remap_file, len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_override_file_info(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *override_path = path_get(RARCH_PATH_CONFIG_OVERRIDE);
const char *override_file = NULL;
*w = 19;
if (!string_is_empty(override_path))
override_file = path_basename_nocompression(override_path);
if (!string_is_empty(override_file))
strlcpy(s, override_file, len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_configurations(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*w = 19;
strlcpy(s2, path, len2);
2016-09-30 04:43:16 +02:00
if (!path_is_empty(RARCH_PATH_CONFIG))
2016-09-29 08:31:41 +02:00
fill_pathname_base(s, path_get(RARCH_PATH_CONFIG),
2015-06-02 18:31:44 +02:00
len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), len);
}
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
static void menu_action_setting_disp_set_label_shader_filter_pass(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2018-02-27 05:07:17 +01:00
struct video_shader *shader = menu_shader_get();
struct video_shader_pass *shader_pass = shader ? &shader->pass[type - MENU_SETTINGS_SHADER_PASS_FILTER_0] : NULL;
2015-06-02 18:31:44 +02:00
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
2022-07-17 19:23:46 +02:00
if (shader_pass)
{
switch (shader_pass->filter)
{
case 0:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE),
len);
break;
case 1:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LINEAR),
len);
break;
case 2:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NEAREST),
len);
break;
}
}
}
static void menu_action_setting_disp_set_label_shader_watch_for_changes(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
bool val = *cbs->setting->value.target.boolean;
*w = 19;
strlcpy(s2, path, len2);
if (val)
2020-02-22 07:21:35 +01:00
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TRUE), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FALSE), len);
}
static void menu_action_setting_disp_set_label_shader_num_passes(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2018-02-27 05:07:17 +01:00
struct video_shader *shader = menu_shader_get();
unsigned pass_count = shader ? shader->passes : 0;
*w = 19;
strlcpy(s2, path, len2);
2018-02-27 05:07:17 +01:00
snprintf(s, len, "%u", pass_count);
}
static void menu_action_setting_disp_set_label_shader_pass(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2018-02-27 05:07:17 +01:00
struct video_shader *shader = menu_shader_get();
struct video_shader_pass *shader_pass = shader ? &shader->pass[type - MENU_SETTINGS_SHADER_PASS_0] : NULL;
*w = 19;
strlcpy(s2, path, len2);
if (shader_pass && !string_is_empty(shader_pass->source.path))
2017-01-09 03:14:53 +01:00
fill_pathname_base(s, shader_pass->source.path, len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
}
static void menu_action_setting_disp_set_label_shader_default_filter(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
bool val = *cbs->setting->value.target.boolean;
*w = 19;
if (val)
2016-10-30 17:14:13 -05:00
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LINEAR), len);
2015-06-21 23:58:50 +02:00
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NEAREST), len);
}
static void menu_action_setting_disp_set_label_shader_parameter_internal(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2,
unsigned offset)
{
2016-02-14 22:13:21 +01:00
video_shader_ctx_t shader_info;
const struct video_shader_parameter *param = NULL;
*w = 19;
strlcpy(s2, path, len2);
2016-05-08 21:11:27 +02:00
video_shader_driver_get_current_shader(&shader_info);
if (shader_info.data && (param = &shader_info.data->parameters[type - offset]))
snprintf(s, len, "%.2f [%.2f %.2f]",
param->current, param->minimum, param->maximum);
else
*s = '\0';
}
static void menu_action_setting_disp_set_label_shader_parameter(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
menu_action_setting_disp_set_label_shader_parameter_internal(
list, w, type, i,
label, s, len, path, s2, len2,
MENU_SETTINGS_SHADER_PARAMETER_0);
}
static void menu_action_setting_disp_set_label_shader_preset_parameter(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
menu_action_setting_disp_set_label_shader_parameter_internal(
list, w, type, i,
label, s, len, path, s2, len2,
MENU_SETTINGS_SHADER_PRESET_PARAMETER_0);
}
static void menu_action_setting_disp_set_label_shader_scale_pass(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2018-02-27 05:07:17 +01:00
unsigned scale_value = 0;
struct video_shader *shader = menu_shader_get();
struct video_shader_pass *shader_pass = shader ? &shader->pass[type - MENU_SETTINGS_SHADER_PASS_SCALE_0] : NULL;
2015-06-02 18:31:44 +02:00
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
2017-01-09 03:14:53 +01:00
if (!shader_pass)
return;
if (!(scale_value = shader_pass->fbo.scale_x))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE), len);
else
2015-06-02 18:31:44 +02:00
snprintf(s, len, "%ux", scale_value);
}
#endif
2020-07-19 22:44:46 +02:00
#ifdef HAVE_NETWORKING
static void menu_action_setting_disp_set_label_netplay_mitm_server(
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)
2020-07-19 22:44:46 +02:00
{
size_t j;
const char *netplay_mitm_server;
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)list->list[i].actiondata;
2020-07-19 22:44:46 +02:00
*w = 19;
*s = '\0';
strlcpy(path_buf, path, path_buf_size);
2020-07-19 22:44:46 +02:00
if (!cbs || !cbs->setting)
return;
netplay_mitm_server = cbs->setting->value.target.string;
2020-07-19 22:44:46 +02:00
if (string_is_empty(netplay_mitm_server))
return;
for (j = 0; j < ARRAY_SIZE(netplay_mitm_server_list); j++)
{
const mitm_server_t *server = &netplay_mitm_server_list[j];
if (string_is_equal(server->name, netplay_mitm_server))
{
strlcpy(s, msg_hash_to_str(server->description), len);
break;
}
2020-07-19 22:44:46 +02:00
}
}
#endif
static void menu_action_setting_disp_set_label_menu_file_core(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *alt = list->list[i].alt
2021-03-10 05:23:50 +01:00
? list->list[i].alt
: list->list[i].path;
s[0] = '(';
s[1] = 'C';
s[2] = 'O';
s[3] = 'R';
s[4] = 'E';
s[5] = ')';
s[6] = '\0';
*w = (unsigned)STRLEN_CONST("(CORE)");
if (alt)
strlcpy(s2, alt, len2);
}
2020-05-28 17:48:18 +01:00
#ifdef HAVE_NETWORKING
static void menu_action_setting_disp_set_label_core_updater_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
core_updater_list_t *core_list = core_updater_list_get_cached();
const core_updater_list_entry_t *entry = NULL;
const char *alt = list->list[i].alt
2021-03-10 05:23:50 +01:00
? list->list[i].alt
: list->list[i].path;
*s = '\0';
*w = 0;
2020-05-28 17:48:18 +01:00
if (alt)
strlcpy(s2, alt, len2);
/* Search for specified core */
if (core_list &&
core_updater_list_get_filename(core_list, path, &entry) &&
!string_is_empty(entry->local_core_path))
{
core_info_t *core_info = NULL;
2020-05-28 17:48:18 +01:00
/* Check whether core is installed
* > Note: We search core_info here instead
* of calling path_is_valid() since we don't
* want to perform disk access every frame */
if (core_info_find(entry->local_core_path, &core_info))
2020-05-28 17:48:18 +01:00
{
/* Highlight locked cores */
if (core_info->is_locked)
{
s[0] = '[';
s[1] = '#';
s[2] = '!';
s[3] = ']';
s[4] = '\0';
*w = (unsigned)STRLEN_CONST("[#!]");
}
else
{
s[0] = '[';
s[1] = '#';
s[2] = ']';
s[3] = '\0';
*w = (unsigned)STRLEN_CONST("[#]");
}
2020-05-28 17:48:18 +01:00
}
}
}
#endif
2020-06-11 14:12:20 +01:00
static void menu_action_setting_disp_set_label_core_manager_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
core_info_t *core_info = NULL;
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
2020-06-11 14:12:20 +01:00
if (alt)
strlcpy(s2, alt, len2);
/* Check whether core is locked
* > Note: We search core_info here instead of
* calling core_info_get_core_lock() since we
* don't want to perform disk access every frame */
if (core_info_find(path, &core_info) &&
core_info->is_locked)
{
s[0] = '[';
s[1] = '!';
s[2] = ']';
s[3] = '\0';
*w = (unsigned)STRLEN_CONST("[!]");
}
else
{
*s = '\0';
*w = 0;
}
}
#ifdef HAVE_MIST
static void menu_action_setting_disp_set_label_core_manager_steam_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
MistResult result;
steam_core_dlc_list_t *core_dlc_list = NULL;
steam_core_dlc_t *core_dlc = NULL;
bool dlc_installed = false;
*s = '\0';
*w = 0;
if (MIST_IS_ERROR(steam_get_core_dlcs(&core_dlc_list, true))) return;
strlcpy(s2, path, len2);
if (!(core_dlc = steam_get_core_dlc_by_name(core_dlc_list, path)))
return;
result = mist_steam_apps_is_dlc_installed(core_dlc->app_id, &dlc_installed);
if (MIST_IS_ERROR(result))
{
RARCH_ERR("[Steam]: Failed to get dlc install status (%d-%d)\n", MIST_UNPACK_RESULT(result));
return;
}
if (dlc_installed)
{
s[0] = '[';
s[1] = '#';
s[2] = ']';
s[3] = '\0';
*w = (unsigned)STRLEN_CONST("[#]");
}
}
#endif
2022-02-22 18:23:48 +00:00
static void menu_action_setting_disp_set_label_contentless_core(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
*s = '\0';
*w = 0;
if (alt)
strlcpy(s2, alt, len2);
}
#ifndef HAVE_LAKKA_SWITCH
#ifdef HAVE_LAKKA
static void menu_action_setting_disp_cpu_gov_mode(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
enum cpu_scaling_mode mode = get_cpu_scaling_mode(NULL);
if (alt)
strlcpy(s2, alt, len2);
strlcpy(s, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_PERF_MODE_MANAGED_PERF + (int)mode), len);
}
static void menu_action_setting_disp_cpu_gov_choose(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
cpu_scaling_opts_t opts;
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
int fnum = atoi(list->list[i].label);
enum cpu_scaling_mode mode = get_cpu_scaling_mode(&opts);
if (alt)
strlcpy(s2, alt, len2);
if (!fnum)
strlcpy(s, opts.main_policy, len);
else
strlcpy(s, opts.menu_policy, len);
}
static void menu_action_setting_disp_set_label_cpu_policy(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned policyid = atoi(path);
cpu_scaling_driver_t **drivers = get_cpu_scaling_drivers(false);
cpu_scaling_driver_t *d = drivers[policyid];
*s = '\0';
*w = 0;
if (d->affected_cpus)
snprintf(s2, len2, "%s %d [CPU(s) %s]", msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_ENTRY), policyid,
d->affected_cpus);
else
snprintf(s2, len2, "%s %d", msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_ENTRY), policyid);
}
static void menu_action_cpu_managed_freq_label(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
cpu_scaling_opts_t opts;
uint32_t freq = 0;
enum cpu_scaling_mode mode = get_cpu_scaling_mode(&opts);
switch (type)
{
case MENU_SETTINGS_CPU_MANAGED_SET_MINFREQ:
strlcpy(s2, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_MANAGED_MIN_FREQ), len2);
freq = opts.min_freq;
break;
case MENU_SETTINGS_CPU_MANAGED_SET_MAXFREQ:
strlcpy(s2, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_MANAGED_MAX_FREQ), len2);
freq = opts.max_freq;
break;
};
if (freq == 1)
2022-08-25 13:03:08 +02:00
{
s[0] = 'M';
s[1] = 'i';
s[2] = 'n';
s[3] = '.';
s[4] = '\0';
}
else if (freq == ~0U)
2022-08-25 13:03:08 +02:00
{
s[0] = 'M';
s[1] = 'a';
s[2] = 'x';
s[3] = '.';
s[4] = '\0';
}
else
snprintf(s, len, "%u MHz", freq / 1000);
}
static void menu_action_cpu_freq_label(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned policyid = atoi(path);
cpu_scaling_driver_t **drivers = get_cpu_scaling_drivers(false);
cpu_scaling_driver_t *d = drivers[policyid];
switch (type)
{
case MENU_SETTINGS_CPU_POLICY_SET_MINFREQ:
strlcpy(s2, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_MIN_FREQ), len2);
snprintf(s, len, "%u MHz", d->min_policy_freq / 1000);
break;
case MENU_SETTINGS_CPU_POLICY_SET_MAXFREQ:
strlcpy(s2, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_MAX_FREQ), len2);
snprintf(s, len, "%u MHz", d->max_policy_freq / 1000);
break;
case MENU_SETTINGS_CPU_POLICY_SET_GOVERNOR:
strlcpy(s2, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_GOVERNOR), len2);
strlcpy(s, d->scaling_governor, len);
break;
};
}
static void menu_action_cpu_governor_label(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned policyid = atoi(path);
cpu_scaling_driver_t **drivers = get_cpu_scaling_drivers(false);
cpu_scaling_driver_t *d = drivers[policyid];
strlcpy(s2, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CPU_POLICY_GOVERNOR), len2);
strlcpy(s, d->scaling_governor, len);
}
#endif
#endif
static void menu_action_setting_disp_set_label_core_lock(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
core_info_t *core_info = NULL;
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
if (alt)
strlcpy(s2, alt, len2);
/* Check whether core is locked
* > Note: We search core_info here instead of
* calling core_info_get_core_lock() since we
* don't want to perform disk access every frame */
if (core_info_find(path, &core_info) &&
core_info->is_locked)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
*w = (unsigned)strlen(s);
2020-06-11 14:12:20 +01:00
}
static void menu_action_setting_disp_set_label_core_set_standalone_exempt(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
core_info_t *core_info = NULL;
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
if (alt)
strlcpy(s2, alt, len2);
/* Check whether core is excluded from the
* contentless cores menu
* > Note: We search core_info here instead of
* calling core_info_get_core_standalone_exempt()
* since we don't want to perform disk access
* every frame */
if (core_info_find(path, &core_info) &&
core_info->supports_no_game &&
core_info->is_standalone_exempt)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
*w = (unsigned)strlen(s);
}
static void menu_action_setting_disp_set_label_input_desc(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned remap_idx;
settings_t *settings = config_get_ptr();
unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
unsigned btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
if (!settings)
return;
*w = 19;
strlcpy(s2, path, len2);
if ((remap_idx = settings->uints.input_remap_ids[user_idx][btn_idx]) !=
RARCH_UNMAPPED)
{
unsigned mapped_port = settings->uints.input_remap_ports[user_idx];
const char *descriptor = runloop_state_get_ptr()->system.input_desc_btn[mapped_port][remap_idx];
if (!string_is_empty(descriptor))
{
2022-08-25 13:03:08 +02:00
size_t _len = strlcpy(s, descriptor, len);
if (remap_idx < RARCH_FIRST_CUSTOM_BIND) { }
else if (remap_idx % 2 == 0)
2022-08-25 13:03:08 +02:00
{
s[_len ] = ' ';
s[_len+1] = '+';
s[_len+2] = '\0';
}
else
2022-08-25 13:03:08 +02:00
{
s[_len ] = ' ';
s[_len+1] = '-';
s[_len+2] = '\0';
}
return;
}
}
2016-10-26 03:19:46 +02:00
/* If descriptor was not found, set this instead */
s[0] = '-';
s[1] = '-';
s[2] = '-';
s[3] = '\0';
}
2017-09-10 00:04:18 -05:00
static void menu_action_setting_disp_set_label_input_desc_kbd(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned key_id, btn_idx;
2017-09-18 16:39:28 +02:00
unsigned remap_id;
unsigned user_idx;
2017-09-18 16:39:28 +02:00
settings_t *settings = config_get_ptr();
2017-09-10 00:04:18 -05:00
if (!settings)
return;
user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) / RARCH_ANALOG_BIND_LIST_END;
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) - RARCH_ANALOG_BIND_LIST_END * user_idx;
remap_id = settings->uints.input_keymapper_ids[user_idx][btn_idx];
2018-04-12 14:20:38 -05:00
for (key_id = 0; key_id < RARCH_MAX_KEYS - 1; key_id++)
2017-09-10 00:04:18 -05:00
{
2018-09-23 12:10:33 +02:00
if (remap_id == key_descriptors[key_id].key)
2017-09-10 11:30:10 -05:00
break;
2017-09-10 00:04:18 -05:00
}
if (key_descriptors[key_id].key != RETROK_FIRST)
{
/* TODO/FIXME - Localize */
size_t _len = strlcpy(s, "Keyboard ", len);
strlcpy(s + _len, key_descriptors[key_id].desc, len - _len);
}
else
{
s[0] = '-';
s[1] = '-';
s[2] = '-';
s[3] = '\0';
}
2017-09-10 00:04:18 -05:00
*w = 19;
strlcpy(s2, path, len2);
}
2020-06-30 19:35:41 +02:00
#ifdef HAVE_CHEATS
static void menu_action_setting_disp_set_label_cheat(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;
if (cheat_index < cheat_manager_get_buf_size())
{
2018-09-23 12:10:33 +02:00
if (cheat_manager_state.cheats[cheat_index].handler == CHEAT_HANDLER_TYPE_EMU)
snprintf(s, len, "(%s) : %s",
cheat_manager_get_code_state(cheat_index) ?
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON) :
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
2018-09-25 15:43:40 +02:00
cheat_manager_get_code(cheat_index)
2018-08-14 13:29:58 -04:00
? cheat_manager_get_code(cheat_index) :
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)
);
else
snprintf(s, len, "(%s) : %08X",
cheat_manager_get_code_state(cheat_index) ?
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON) :
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
cheat_manager_state.cheats[cheat_index].address
);
}
*w = 19;
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_cheat_match(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned int address = 0;
unsigned int address_mask = 0;
unsigned int prev_val = 0;
unsigned int curr_val = 0;
2018-09-23 12:49:48 +02:00
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_VIEW, cheat_manager_state.match_idx, &address, &address_mask, &prev_val, &curr_val);
/* TODO/FIXME - localize */
2018-09-23 12:49:48 +02:00
snprintf(s, len, "Prev: %u Curr: %u", prev_val, curr_val);
*w = 19;
strlcpy(s2, path, len2);
}
2020-06-30 19:35:41 +02:00
#endif
2015-05-17 19:21:15 +02:00
static void menu_action_setting_disp_set_label_perf_counters_common(
struct retro_perf_counter **counters,
2015-06-02 18:31:44 +02:00
unsigned offset, char *s, size_t len
2015-05-17 19:21:15 +02:00
)
{
if (!counters[offset])
return;
if (!counters[offset]->call_cnt)
return;
/* TODO/FIXME - localize */
2015-06-02 18:31:44 +02:00
snprintf(s, len,
2017-11-27 17:16:38 +01:00
"%" PRIu64 " ticks, %" PRIu64 " runs.",
2017-09-05 16:39:12 -04:00
((uint64_t)counters[offset]->total /
(uint64_t)counters[offset]->call_cnt),
(uint64_t)counters[offset]->call_cnt);
2015-05-17 19:21:15 +02:00
}
static void general_disp_set_label_perf_counters(
struct retro_perf_counter **counters,
unsigned offset,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
char *s2, size_t len2,
const char *path, unsigned *w
)
{
2020-10-14 04:40:20 +02:00
gfx_animation_t *p_anim = anim_get_ptr();
2015-06-02 18:31:44 +02:00
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
2015-05-17 19:21:15 +02:00
menu_action_setting_disp_set_label_perf_counters_common(
2015-06-02 18:31:44 +02:00
counters, offset, s, len);
2020-10-14 04:40:20 +02:00
GFX_ANIMATION_CLEAR_ACTIVE(p_anim);
}
static void menu_action_setting_disp_set_label_perf_counters(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
struct retro_perf_counter **counters = retro_get_perf_counter_rarch();
unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN;
general_disp_set_label_perf_counters(counters, offset, s, len,
s2, len, path, w);
}
static void menu_action_setting_disp_set_label_libretro_perf_counters(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
struct retro_perf_counter **counters = retro_get_perf_counter_libretro();
unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN;
general_disp_set_label_perf_counters(counters, offset, s, len,
s2, len, path, w);
}
static void menu_action_setting_disp_set_label_menu_more(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2016-07-17 00:52:56 +02:00
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len);
2015-07-09 22:24:48 +02:00
*w = 19;
2017-10-04 06:53:47 +02:00
if (!string_is_empty(path))
2017-09-29 21:19:07 +02:00
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_db_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len);
*w = 10;
2017-10-04 06:53:47 +02:00
if (!string_is_empty(path))
2017-09-29 21:19:07 +02:00
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_entry_url(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *representation_label = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
*s = '\0';
*w = 8;
if (!string_is_empty(representation_label))
strlcpy(s2, representation_label, len2);
else
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_entry(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*s = '\0';
*w = 8;
strlcpy(s2, path, len2);
}
#ifdef HAVE_BLUETOOTH
2020-06-17 14:56:44 +03:00
static void menu_action_setting_disp_set_label_bluetooth_is_connected(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
strlcpy(s2, path, len2);
*w = 19;
if (driver_bluetooth_device_is_connected(i))
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_BT_CONNECTED), len);
}
#endif
2020-06-17 14:56:44 +03:00
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
static void menu_action_setting_disp_set_label_wifi_is_online(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
strlcpy(s2, path, len2);
*w = 19;
if (driver_wifi_ssid_is_online(i))
2016-11-08 01:21:21 +01:00
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE), len);
}
#endif
static void menu_action_setting_disp_set_label_menu_disk_index(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned images = 0;
unsigned current = 0;
2021-09-21 19:08:26 +02:00
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
if (!system)
return;
if (!disk_control_enabled(&system->disk_control))
return;
*w = 19;
2015-06-02 18:31:44 +02:00
*s = '\0';
strlcpy(s2, path, len2);
images = disk_control_get_num_images(&system->disk_control);
current = disk_control_get_image_index(&system->disk_control);
if (current >= images)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_DISK), len);
else
2015-06-02 18:31:44 +02:00
snprintf(s, len, "%u", current + 1);
}
static void menu_action_setting_disp_set_label_menu_video_resolution(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
unsigned width = 0, height = 0;
char desc[64] = {0};
*w = 19;
2015-06-02 18:31:44 +02:00
*s = '\0';
strlcpy(s2, path, len2);
2015-03-07 22:48:29 -06:00
if (video_driver_get_video_output_size(&width, &height, desc, sizeof(desc)))
{
#ifdef GEKKO
if (width == 0 || height == 0)
snprintf(s, len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE));
else
#endif
{
if (!string_is_empty(desc))
snprintf(s, len, msg_hash_to_str(MSG_SCREEN_RESOLUTION_FORMAT_DESC),
width, height, desc);
else
snprintf(s, len, msg_hash_to_str(MSG_SCREEN_RESOLUTION_FORMAT_NO_DESC),
width, height);
}
}
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
}
2020-06-30 20:55:05 +02:00
#define MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len, path, label, label_size, s2, len2) \
*s = '\0'; \
2020-06-30 20:55:05 +02:00
strlcpy(s, label, len); \
*w = label_size; \
strlcpy(s2, path, len2)
static void menu_action_setting_disp_set_label_menu_file_plain(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(FILE)", STRLEN_CONST("(FILE)"), s2, len2);
}
2015-06-28 17:21:32 +02:00
static void menu_action_setting_disp_set_label_menu_file_imageviewer(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(IMAGE)", STRLEN_CONST("(IMAGE)"), s2, len2);
2015-06-28 17:21:32 +02:00
}
static void menu_action_setting_disp_set_label_movie(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(MOVIE)", STRLEN_CONST("(MOVIE)"), s2, len2);
}
static void menu_action_setting_disp_set_label_music(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(MUSIC)", STRLEN_CONST("(MUSIC)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_directory(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(DIR)", STRLEN_CONST("(DIR)"), s2, len2);
}
static void menu_action_setting_disp_set_label_generic(
2015-10-25 08:31:55 +01:00
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
*s = '\0';
*w = 0;
2020-06-30 20:55:05 +02:00
strlcpy(s2, path, len2);
2015-10-25 08:31:55 +01:00
}
static void menu_action_setting_disp_set_label_menu_file_carchive(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(COMP)", STRLEN_CONST("(COMP)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_shader(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(SHADER)", STRLEN_CONST("(SHADER)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_shader_preset(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(PRESET)", STRLEN_CONST("(PRESET)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_in_carchive(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(CFILE)", STRLEN_CONST("(CFILE)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_overlay(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(OVERLAY)", STRLEN_CONST("(OVERLAY)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_config(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(CONFIG)", STRLEN_CONST("(CONFIG)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_font(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(FONT)", STRLEN_CONST("(FONT)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_filter(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(FILTER)", STRLEN_CONST("(FILTER)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_rdb(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(RDB)", STRLEN_CONST("(RDB)"), s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_cheat(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
2015-06-02 18:31:44 +02:00
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 20:55:05 +02:00
MENU_ACTION_SETTING_GENERIC_DISP_SET_LABEL_2(w, s, len,
path, "(CHEAT)", STRLEN_CONST("(CHEAT)"), s2, len2);
}
static void menu_action_setting_disp_set_label_core_option_override_info(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *override_path = path_get(RARCH_PATH_CORE_OPTIONS);
core_option_manager_t *coreopts = NULL;
const char *options_file = NULL;
*s = '\0';
*w = 19;
if (!string_is_empty(override_path))
options_file = path_basename_nocompression(override_path);
else if (retroarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts))
{
const char *options_path = coreopts->conf_path;
if (!string_is_empty(options_path))
options_file = path_basename_nocompression(options_path);
}
if (!string_is_empty(options_file))
strlcpy(s, options_file, len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
strlcpy(s2, path, len2);
}
2016-05-18 21:21:58 +02:00
static void menu_action_setting_disp_set_label_playlist_associations(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
playlist_t *playlist = playlist_get_cached();
const char *core_name = NULL;
2016-05-26 06:50:57 +02:00
2016-05-18 21:21:58 +02:00
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
2016-05-18 21:21:58 +02:00
if (!playlist)
return;
2016-05-18 21:21:58 +02:00
core_name = playlist_get_default_core_name(playlist);
2016-05-18 21:21:58 +02:00
if (!string_is_empty(core_name) &&
2019-09-18 18:12:57 +02:00
!string_is_equal(core_name, "DETECT"))
strlcpy(s, core_name, len);
2016-05-18 21:21:58 +02:00
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
}
static void menu_action_setting_disp_set_label_playlist_label_display_mode(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2019-07-28 15:52:48 +02:00
enum playlist_label_display_mode label_display_mode;
playlist_t *playlist = playlist_get_cached();
2019-07-28 15:52:48 +02:00
if (!playlist)
return;
label_display_mode = playlist_get_label_display_mode(playlist);
*w = 19;
strlcpy(s2, path, len2);
switch (label_display_mode)
{
case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES :
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS), len);
break;
case LABEL_DISPLAY_MODE_REMOVE_BRACKETS :
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS), len);
break;
case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES_AND_BRACKETS :
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS), len);
break;
case LABEL_DISPLAY_MODE_KEEP_DISC_INDEX :
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX), len);
break;
case LABEL_DISPLAY_MODE_KEEP_REGION :
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION), len);
break;
case LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX :
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX), len);
break;
default:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT), len);
}
}
static const char *get_playlist_thumbnail_mode_value(playlist_t *playlist, enum playlist_thumbnail_id thumbnail_id)
{
enum playlist_thumbnail_mode thumbnail_mode =
playlist_get_thumbnail_mode(playlist, thumbnail_id);
switch (thumbnail_mode)
{
case PLAYLIST_THUMBNAIL_MODE_OFF:
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF);
case PLAYLIST_THUMBNAIL_MODE_SCREENSHOTS:
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS);
case PLAYLIST_THUMBNAIL_MODE_TITLE_SCREENS:
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS);
case PLAYLIST_THUMBNAIL_MODE_BOXARTS:
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS);
default:
/* PLAYLIST_THUMBNAIL_MODE_DEFAULT */
break;
}
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_THUMBNAIL_MODE_DEFAULT);
}
static void menu_action_setting_disp_set_label_playlist_right_thumbnail_mode(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
playlist_t *playlist = playlist_get_cached();
*w = 19;
strlcpy(s2, path, len2);
if (playlist)
strlcpy(
s,
get_playlist_thumbnail_mode_value(playlist, PLAYLIST_THUMBNAIL_RIGHT),
len);
2022-07-17 19:23:46 +02:00
else
*s = '\0';
}
static void menu_action_setting_disp_set_label_playlist_left_thumbnail_mode(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
playlist_t *playlist = playlist_get_cached();
*w = 19;
strlcpy(s2, path, len2);
if (playlist)
strlcpy(
s,
get_playlist_thumbnail_mode_value(playlist, PLAYLIST_THUMBNAIL_LEFT),
len);
2022-07-17 19:23:46 +02:00
else
*s = '\0';
}
static void menu_action_setting_disp_set_label_playlist_sort_mode(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
enum playlist_sort_mode sort_mode;
playlist_t *playlist = playlist_get_cached();
if (!playlist)
return;
sort_mode = playlist_get_sort_mode(playlist);
*w = 19;
strlcpy(s2, path, len2);
switch (sort_mode)
{
case PLAYLIST_SORT_MODE_ALPHABETICAL:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_SORT_MODE_ALPHABETICAL), len);
break;
case PLAYLIST_SORT_MODE_OFF:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_SORT_MODE_OFF), len);
break;
case PLAYLIST_SORT_MODE_DEFAULT:
default:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_SORT_MODE_DEFAULT), len);
break;
}
}
static void menu_action_setting_disp_set_label_core_options(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
2021-08-06 15:32:51 +01:00
{
const char *category = path;
const char *desc = NULL;
/* Add 'more' value text */
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len);
*w = 19;
/* If this is an options subcategory, fetch
* the category description */
if (!string_is_empty(category))
{
core_option_manager_t *coreopts = NULL;
if (retroarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts))
2021-08-06 15:32:51 +01:00
desc = core_option_manager_get_category_desc(
coreopts, category);
}
/* If this isn't a subcategory (or something
* went wrong...), use top level core options
* menu label */
if (string_is_empty(desc))
desc = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_OPTIONS);
strlcpy(s2, desc, len2);
}
static void menu_action_setting_disp_set_label_core_option(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
core_option_manager_t *coreopts = NULL;
*s = '\0';
*w = 19;
if (retroarch_ctl(RARCH_CTL_CORE_OPTIONS_LIST_GET, &coreopts))
{
2022-07-17 19:23:46 +02:00
const char *coreopt_label = core_option_manager_get_val_label(coreopts,
type - MENU_SETTINGS_CORE_OPTION_START);
2020-07-24 15:31:50 +01:00
if (!string_is_empty(coreopt_label))
strlcpy(s, coreopt_label, len);
}
strlcpy(s2, path, len2);
2016-05-18 21:21:58 +02:00
}
static void menu_action_setting_disp_set_label_achievement_information(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
rarch_setting_t *setting = cbs->setting;
*w = 2;
if (setting && setting->get_string_representation)
setting->get_string_representation(setting, s, len);
2022-07-17 19:23:46 +02:00
else
*s = '\0';
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_manual_content_scan_dir(
file_list_t* list,
2019-11-29 17:13:35 +00:00
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *content_dir = NULL;
*w = 19;
strlcpy(s2, path, len2);
if (manual_content_scan_get_menu_content_dir(&content_dir))
strlcpy(s, content_dir, len);
else
*s = '\0';
2019-11-29 17:13:35 +00:00
}
static void menu_action_setting_disp_set_label_manual_content_scan_system_name(
file_list_t* list,
2019-11-29 17:13:35 +00:00
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *system_name = NULL;
*w = 19;
strlcpy(s2, path, len2);
if (manual_content_scan_get_menu_system_name(&system_name))
strlcpy(s, system_name, len);
else
*s = '\0';
2019-11-29 17:13:35 +00:00
}
static void menu_action_setting_disp_set_label_manual_content_scan_core_name(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
const char *core_name = NULL;
*w = 19;
strlcpy(s2, path, len2);
if (manual_content_scan_get_menu_core_name(&core_name))
strlcpy(s, core_name, len);
else
*s = '\0';
2019-11-29 17:13:35 +00:00
}
static void menu_action_setting_disp_set_label_no_items(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
rarch_setting_t *setting = cbs->setting;
*w = 19;
if (setting && setting->get_string_representation)
setting->get_string_representation(setting, s, len);
else
*s = '\0';
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_setting_bool(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
rarch_setting_t *setting = cbs->setting;
*w = 19;
if (setting)
{
if (*setting->value.target.boolean)
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
}
else
*s = '\0';
strlcpy(s2, path, len2);
}
2016-10-24 05:20:29 +02:00
static void menu_action_setting_disp_set_label_setting_string(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
rarch_setting_t *setting = cbs->setting;
2022-07-17 19:23:46 +02:00
*w = 19;
2016-10-24 05:20:29 +02:00
2018-09-25 15:43:40 +02:00
if (setting->value.target.string)
strlcpy(s, setting->value.target.string, len);
2016-10-24 05:20:29 +02:00
strlcpy(s2, path, len2);
}
static void menu_action_setting_disp_set_label_setting_path(file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *path,
char *s2, size_t len2)
{
2020-06-30 22:15:49 +02:00
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
list->list[i].actiondata;
rarch_setting_t *setting = cbs->setting;
2022-07-17 19:23:46 +02:00
const char *basename = setting ? path_basename(setting->value.target.string) : NULL;
*w = 19;
2016-10-24 05:20:29 +02:00
if (!string_is_empty(basename))
strlcpy(s, basename, len);
2016-10-24 05:20:29 +02:00
strlcpy(s2, path, len2);
}
static int menu_cbs_init_bind_get_string_representation_compare_label(
menu_file_list_cbs_t *cbs)
{
if (cbs->enum_idx != MSG_UNKNOWN)
{
2016-06-16 20:14:15 +02:00
switch (cbs->enum_idx)
{
2016-12-13 16:13:38 +01:00
case MENU_ENUM_LABEL_VIDEO_DRIVER:
case MENU_ENUM_LABEL_AUDIO_DRIVER:
Add microphone support via a new driver (#14731) * Some slight fixes * Update libretro.h * Log calls to RETRO_ENVIRONMENT_GET_MICROPHONE_INTERFACE * Finish proof-of-concept for mic support - It works, but doesn't support floating-point audio yet - It may need to be resampled, too * Add macros that aren't available in SDL 2 * Comment out a variable definition for now - For C89 compliance * Add some comments for clarity * Let ALSA tolerate a null new_rate * Partial ALSA microphone support - Not yet tested - Mic is created and destroyed - Mic can also be paused or unpaused - Mic is paused or unpaused with the rest of the driver - Microphone is not yet read * Install error logging in the ALSA driver - It defers to RARCH_ERR * Free the ALSA microphone in alsa_free * Fix an indent * First draft of alsa_read_microphone * Deinitialize SDL Audio in sdl_audio_free * Save and restore the ALSA error logger - You should always practice safe global state * Add newlines to some RARCH_ERRs * Add some logging * Check for the mic being active via settings instead of via flags * Adjusted a log entry to be less misleading - A frequency of 0Hz looks weird to the uninformed - In reality, it means the driver used the requested frequency * Fix an incorrect format string * Tidy up logging in alsa.c * Rename audio_enable_microphone to audio_enable_input * Rename microphone_device to audio_input_device * Add audio_input_latency and audio_input_block_frames settings * Add all mic-related settings to the options menu * Adjust logging for alsa.c - Log the ALSA library version - Add errno details * Refer to the microphone in logs by name * Use %u instead of %d for some log items * Add input_samples_buf * Remove an inaccurate comment * Change type of input_samples_buf * Clean up audio_driver_flush_microphone_input * Comment convert_float_to_s16 - It helped me understand what it's doing - Turns out it'll work just fine on mono audio * Don't use the resampler for mic input * Fix crash in the ALSA driver when reading from a mic * Update some logging messages * ALSA support now works for mics * Reuse some common functions in alsa.c * Add alsa_thread_microphone_t * Refactor alsa.c - Introduce alsa_init_pcm to init any PCM that we're using - Vastly simplifies the implementation of alsa_init and alsa_init_microphone - Will be used for the read-based versions next * Make ALSA logging a little more consistent * Clean up the mic with alsa_free_microphone if alsa_init_microphone fails * Remove an unused function * Move some cleanup in alsa.c to a common function * First crack at mic support for alsathread - Refactor some duplicate code into functions - Use functions introduced in alsa.c - Create and destroy the mic * Slight cleanups for clarity * Implement alsa_thread_set/get_microphone_state * More work on alsathread - No more crashing, but the mic just returns silence * Slight cleanups for clarity * Add alsa_set_mic_enabled_internal - For setting the state of a microphone while considering its current state * Use alsa_set_mic_enabled_internal * Log a little more info * Log when the audio driver is started/stopped * Move base microphone driver code into a new directory - Add microphone_driver.c to Makefile.common - Rename functions as needed * Initialize and deinitialize the microphone driver * Implement sdl_microphone.c * Un-const an argument - In case the driver context needs to do any locking * Revise comments for microphone_driver.h * Remove an unimplemented function * Remove some functions from the mic driver * Remove mic functions from audio_thread_wrapper * Remove mic functions from sdl_audio * Fix microphone_null * Split the mic code for the alsa audio drivers into microphone drivers * Fix an extra struct member * Add a setting for the mic driver * Add a command to reinitialize the microphone driver * Rename mic-related settings * Add DRIVER_MICROPHONE_MASK to DRIVERS_CMD_ALL * Rename audio_enable_input to microphone_enable * Remove some labels from qt_options * Search for microphone_driver within find_driver_nonempty * Clean up some mic driver code * Pending mics now return silence * Adjust some logging and comments * Some cleanup in the microphone driver * Invert a flag check - Oops * Fix a log message * Fix the wrong flags being checked * Slight refactor of wasapi_init_device - Add a data_flow parameter - Declare it in a header - In preparation for WASAPI mic support * Add some WASAPI macros for _IAudioCaptureClient * Move some common WASAPI functions to audio/common/wasapi.c - They'll be used by the mic and the audio drivers * Add wasapi_log_hr * Generalize mmdevice_list_new to look for capture devices, too * Fix a function declaration * Move driver-specific device_list_new functions into their respective files * Clean up some declarations * First draft of wasapi microphone driver * Add wasapi_microphone_device_list_free * Change function parameter names to be consistent with microphone_driver * Partially implement wasapi_microphone_read - Mostly copied from the audio driver so far - It doesn't compile yet - But it'll be beautiful when I'm done with it * Refactor the mic driver's functions - Rename get_mic_active to mic_alive - Split set_mic_active into start_mic and stop_mic - Refactor the SDL mic driver accordingly * Edit some WASAPI functions for logging and clarity * Implement more of the WASAPI mic driver * Rename write_event to read_event * Pass the WASAPI driver context to the various read functions * Mostly implement the read function for the WASAPI mic driver * Fix a crash in microphone_driver - Forgot to move the position of the name of null_driver * Reduce some logging in wasapi common functions - Only log the chosen audio client format, not all attempted ones * Add some macro wrappers for IAudioClient methods * Update mic driver configuration - Make the mic driver configurable in the menu - Add config items for WASAPI-related options similar to the audio driver * Fix a menu entry scrolling through audio devices instead of mic devices * Add some utility functions * Expose the new utility functions in wasapi.h * Add extra logging in the WASAPI common functions * Add sharemode_name * Use _IAudioClient_Initialize macro in some places * Pass channels to wasapi_init_client - Remember, mics are in mono * Use _IAudioClient_Initialize macro some more * Forgot to pass channels in some places * Add some utility functions * Forgot an #include * Add wasapi_select_device_format * Simplify the format selection logic in wasapi_init_client_sh * Unset the microphone in wasapi_microphone_close_mic - Ought to prevent a potential segfault * Simplify some logging * Fix incorrect value being passed to _IAudioCaptureClient_ReleaseBuffer * Remove some unneeded logging * Add some values to hresult_name * Polish up wasapi_select_device_format - Test for formats manually when Windows can't - Add some debug logging - Check for channels * Compute the fields of WAVEFORMATEXTENSIBLE correctly - As per the doc's stated requirements * Simplify logic for WASAPI client creation * Fix a potential hang in wasapi_microphone_read_shared_buffered * Stop the microphone if the driver is stopped * Don't name the microphone event * Ensure that wasapi_init_client reports the correct format and rate * Implement exclusive microphone read access for WASAPI * Add _IAudioCaptureClient_GetNextPacketSize macro * Organize cases in hresult_name * Clear some extra fields if wasapi_set_format is setting a Pcm format * Adjust some logs * Adjust some logs * Remove unneeded local vars * Add a log * Update wasapi.c * Update wasapi.c * Fix shared-mode mic support in WASAPI producing broken input - Turns out it had nothing to do with shared mode * Reuse a common function - Remove wasapi_microphone_read_shared_buffered - Rename wasapi_microphone_read_exclusive to wasapi_microphone_read_buffered * Remove some code I was using for test purposes * Clarify some language * Double the default shared-mode mic buffer length * Split getting a device's name into a separate function, then use it * Fix the ALSA mic drivers - To comply with changes I previously made to the mic driver interface * Remove unused synchronization primitives from the SDL microphone driver * Add sdl_microphone_mic_use_float * Document audio_driver_state_flags - I needed to understand these to see if similar flags were required for the mic driver * Remove an unused function in wasapi.c * Add and document flags in microphone_driver.h * Remove driver-specific mic start/stop functions - The mic driver itself doesn't do much processing - That honor goes to individual mics * Remove some unused fields in microphone_driver.h * Add CMD_EVENT_MICROPHONE_STOP/START * Remove unused functions from microphone_null * Change how the mic driver state is referenced in some places * Simplify the SDL microphone driver - The driver backend no longer keeps a reference to the mic (the frontend does that) - Remove functions that are no longer needed - Don't track paused state, just query the mic itself * Simplify the WASAPI microphone driver - Don't track the driver running state or the microphone handle, the frontend does that now - Remove support for unbuffered input (hunterk suggested that it wasn't necessary) * Make microphone_wasapi_sh_buffer_length a uint, not an int - It won't be negative anymore - 0 now represents the default value * Make the microphone frontend more robust - Improve documentation for how various functions should be implemented - Closes all microphones before freeing the driver (so backends don't have to) - Tracks the enabled state of each microphone, so backends don't have to (but they still can) * Stop the mic driver in core_unload_game * Ensure mic support is compatible with the revised menu code * Move alsa.h into audio/common * Remove RETRO_ENVIRONMENT_GET_MICROPHONE_ENABLED - It was never really needed * Refactor the ALSA microphone driver - Move common ALSA functions to audio/common/alsa.c - Replace alsa_set_mic_enabled_internal with alsa_start/stop_pcm - Don't track the microphone handle in the ALSA driver context - Remove unneeded fields * Move some common alsathread code into audio/common/alsathread.c * Change return type of mic_driver_open_mic_internal to bool * First crack at resampling mic input * Remove an extraneous check - I think something distracted me when I was writing this line * Add stereo/mono conversion functions * Make alsa_start_pcm and alsa_stop_pcm more robust - They now return success if the stream is already running and stopped, respectively * Revise some mic-related comments in libretro.h * First crack at resampling mic input * Simplify an expression * Simplify an expression * Fix a log tag * Allow mic resampler to be configured separately from audio resampler * Add some comments * Set the source ratio to something sensible * Stop deadlock in `alsathread` mic driver * Allow mics to be initialized even when core is loaded from CLI - When loading content from CLI, the drivers are initialized a little differently - That threw off the mic initialization code * Rename the functions in retro_microphone_interface * Revise some mic-related comments in libretro.h * Update retro_microphone_interface - Add get_mic_rate - Add a parameter to open_mic - The modifications don't do anything yet * Use parameter objects in the microphone handle * Replace get_mic_rate with get_params * Add a microphone interface version * Remove part of a comment * Set the effective params in mic_driver_microphone_handle_init * Drop a stray newline * Change where the mic interface is zeroed - I was accidentally throwing out the version that the core was asking for * Reduce logspam for wasapi_set_nonblock_state - Now it only logs when the sync mode is changed * Change DEFAULT_WASAPI_SH_BUFFER_LENGTH to 0 - -16 is no longer a valid value * Set the new_rate in wasapi_init * Change description of microphone sample rate in the settings * First attempt at resampling configured mic input * Forgot a section * Fix some input samples being skipped * Rename a variable for clarity * Add microphone.outgoing_samples * Update the mic driver - Processed samples are now buffered - The resampler is skipped if the ratio is (very close to) 1 * Remove part of a comment * Update some comments in audio_resampler.h * Slightly refactor the SDL microphone driver - Move SDL_AudioSpec to a field of sdl_microphone_handle_t - Allow SDL to change the requested format and sample rate - Request floating-point input - Implement sdl_microphone_mic_use_float * Fix a non-C89-compliant declaration * Add new files to griffin.c * Remove a C++-style comment * Add two more files to griffin.c * Remove some unneeded declarations in microphone_driver.h * Remove a stray comma in configuration.c - For C89 compliance * Fix compilation on some platforms * Change some function signatures * Make the ALSA drivers always set the audio rate * Fix the alsathread mic driver * Make state_manager_frame_is_reversed return false if HAVE_REWIND isn't defined * Mute the microphone if the core is running in fast-forward, slow-mo, or rewind * Clarify a comment * Clarify a comment * Add a comment * Don't allocate memory for slowmo samples in the mic driver - We're not supporting slowmo for mics, so it's not needed * Fix a { * Add my name to AUTHORS.h * Add driver_lifetime_flags - For drivers that have special setup/teardown needs * Ensure that resetting the mic driver maintains active mic handles - Prevents fullscreen toggle from stopping all mic input * Update CHANGES.md * Move some default microphone settings to a new part of the config file * Ensure that RetroArch can use the audio format that Windows suggests * Remove references to mic support in the SDL audio driver * Remove unused WASAPI functions * Return failure if RetroArch couldn't select a WASAPI format * Ensure that Windows uses the WASAPI mic driver by default * Treat disabled mic support as a warning, not an error * Clarify some WASAPI-related microphone settings * Remove some unused variables * Add or revise microphone-related comments * Rearrange doc comments for microphone types in libretro.h * Remove a space * Remove some unused flags * Remove ALSA error logger - It was never used anyway * Remove unneeded microphone-related arguments * Document a parameter * Remove a logging call * Add a constant for the microphone's shared buffer length for WASAPI * Fix stylistic inconsistencies * Make mic_driver_get_sample_size a macro instead of a function * Move the microphone implementation to the audio directory * Make microphone support optional (but enabled by default) * Fix the griffin build
2023-06-06 15:55:06 -04:00
#ifdef HAVE_MICROPHONE
case MENU_ENUM_LABEL_MICROPHONE_DRIVER:
case MENU_ENUM_LABEL_MICROPHONE_RESAMPLER_DRIVER:
#endif
2016-12-13 16:13:38 +01:00
case MENU_ENUM_LABEL_INPUT_DRIVER:
case MENU_ENUM_LABEL_JOYPAD_DRIVER:
case MENU_ENUM_LABEL_AUDIO_RESAMPLER_DRIVER:
case MENU_ENUM_LABEL_RECORD_DRIVER:
2018-06-04 07:48:08 +02:00
case MENU_ENUM_LABEL_MIDI_DRIVER:
2016-12-13 16:13:38 +01:00
case MENU_ENUM_LABEL_LOCATION_DRIVER:
case MENU_ENUM_LABEL_CAMERA_DRIVER:
2020-06-17 14:56:44 +03:00
case MENU_ENUM_LABEL_BLUETOOTH_DRIVER:
2016-12-13 16:13:38 +01:00
case MENU_ENUM_LABEL_WIFI_DRIVER:
case MENU_ENUM_LABEL_MENU_DRIVER:
#ifdef HAVE_LAKKA
case MENU_ENUM_LABEL_TIMEZONE:
#endif
2016-12-13 16:13:38 +01:00
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label);
break;
2020-06-17 14:56:44 +03:00
case MENU_ENUM_LABEL_CONNECT_BLUETOOTH:
#ifdef HAVE_BLUETOOTH
2020-06-17 14:56:44 +03:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_bluetooth_is_connected);
#endif
2020-06-17 14:56:44 +03:00
break;
case MENU_ENUM_LABEL_CONNECT_WIFI:
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_wifi_is_online);
#endif
break;
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_CHEAT_NUM_PASSES:
2020-06-30 19:35:41 +02:00
#ifdef HAVE_CHEATS
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_cheat_num_passes);
2020-06-30 19:35:41 +02:00
#endif
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_REMAP_FILE_INFO:
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_remap_file_info);
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_OVERRIDE_FILE_INFO:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_override_file_info);
break;
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_filter_pass);
#endif
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_scale_pass);
#endif
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_NUM_PASSES:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_num_passes);
#endif
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_SHADER_WATCH_FOR_CHANGES:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_watch_for_changes);
#endif
break;
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_VIDEO_SHADER_PASS:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_pass);
#endif
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_VIDEO_SHADER_DEFAULT_FILTER:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_default_filter);
#endif
2016-06-16 20:14:15 +02:00
break;
case MENU_ENUM_LABEL_CONFIGURATIONS:
2016-06-16 20:14:15 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_configurations);
break;
case MENU_ENUM_LABEL_SCREEN_RESOLUTION:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_menu_video_resolution);
break;
2021-08-06 15:32:51 +01:00
case MENU_ENUM_LABEL_CORE_OPTIONS:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_options);
break;
case MENU_ENUM_LABEL_PLAYLISTS_TAB:
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY:
case MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST:
2016-12-13 01:06:28 +01:00
case MENU_ENUM_LABEL_FAVORITES:
case MENU_ENUM_LABEL_CORE_OPTION_OVERRIDE_LIST:
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS:
case MENU_ENUM_LABEL_SHADER_OPTIONS:
case MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS:
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_PARAMETERS:
2019-08-24 01:44:50 +02:00
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE:
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_SAVE_AS:
case MENU_ENUM_LABEL_CHEAT_FILE_SAVE_AS:
case MENU_ENUM_LABEL_FRONTEND_COUNTERS:
case MENU_ENUM_LABEL_CORE_COUNTERS:
case MENU_ENUM_LABEL_DATABASE_MANAGER_LIST:
case MENU_ENUM_LABEL_CURSOR_MANAGER_LIST:
case MENU_ENUM_LABEL_RESTART_CONTENT:
case MENU_ENUM_LABEL_CLOSE_CONTENT:
case MENU_ENUM_LABEL_RESUME_CONTENT:
case MENU_ENUM_LABEL_TAKE_SCREENSHOT:
case MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS:
case MENU_ENUM_LABEL_CORE_INFORMATION:
case MENU_ENUM_LABEL_SYSTEM_INFORMATION:
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST:
2016-11-05 16:55:57 -05:00
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE:
2016-06-16 20:14:15 +02:00
case MENU_ENUM_LABEL_SAVE_STATE:
case MENU_ENUM_LABEL_LOAD_STATE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_menu_more);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_playlist_associations);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_playlist_label_display_mode);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_RIGHT_THUMBNAIL_MODE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_playlist_right_thumbnail_mode);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LEFT_THUMBNAIL_MODE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_playlist_left_thumbnail_mode);
break;
case MENU_ENUM_LABEL_PLAYLIST_MANAGER_SORT_MODE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_playlist_sort_mode);
break;
2019-11-29 17:13:35 +00:00
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DIR:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_manual_content_scan_dir);
break;
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_SYSTEM_NAME:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_manual_content_scan_system_name);
break;
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_CORE_NAME:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_manual_content_scan_core_name);
break;
2020-06-11 14:12:20 +01:00
#ifdef HAVE_NETWORKING
case MENU_ENUM_LABEL_CORE_UPDATER_ENTRY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_updater_entry);
break;
#endif
case MENU_ENUM_LABEL_CORE_MANAGER_ENTRY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_manager_entry);
break;
#ifdef HAVE_MIST
case MENU_ENUM_LABEL_CORE_MANAGER_STEAM_ENTRY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_manager_steam_entry);
break;
#endif
2022-02-22 18:23:48 +00:00
case MENU_ENUM_LABEL_CONTENTLESS_CORE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_contentless_core);
break;
case MENU_ENUM_LABEL_CORE_OPTION_OVERRIDE_INFO:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_option_override_info);
break;
#ifndef HAVE_LAKKA_SWITCH
#ifdef HAVE_LAKKA
case MENU_ENUM_LABEL_CPU_PERF_MODE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_cpu_gov_mode);
break;
case MENU_ENUM_LABEL_CPU_POLICY_CORE_GOVERNOR:
case MENU_ENUM_LABEL_CPU_POLICY_MENU_GOVERNOR:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_cpu_gov_choose);
break;
case MENU_ENUM_LABEL_CPU_POLICY_ENTRY:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_cpu_policy);
break;
case MENU_ENUM_LABEL_CPU_POLICY_MIN_FREQ:
case MENU_ENUM_LABEL_CPU_POLICY_MAX_FREQ:
BIND_ACTION_GET_VALUE(cbs, menu_action_cpu_freq_label);
break;
case MENU_ENUM_LABEL_CPU_MANAGED_MIN_FREQ:
case MENU_ENUM_LABEL_CPU_MANAGED_MAX_FREQ:
BIND_ACTION_GET_VALUE(cbs, menu_action_cpu_managed_freq_label);
break;
case MENU_ENUM_LABEL_CPU_POLICY_GOVERNOR:
BIND_ACTION_GET_VALUE(cbs, menu_action_cpu_governor_label);
break;
#endif
#endif
2016-06-16 20:14:15 +02:00
default:
return -1;
2016-06-16 20:14:15 +02:00
}
}
else
return -1;
return 0;
}
static int menu_cbs_init_bind_get_string_representation_compare_type(
2015-06-07 17:52:01 +02:00
menu_file_list_cbs_t *cbs, unsigned type)
{
2019-12-02 06:47:51 +01:00
unsigned i;
typedef struct info_range_list
{
2019-12-02 06:47:51 +01:00
unsigned min;
unsigned max;
void (*cb)(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);
} info_range_list_t;
info_range_list_t info_list[] = {
#ifdef HAVE_AUDIOMIXER
{
MENU_SETTINGS_AUDIO_MIXER_STREAM_BEGIN,
MENU_SETTINGS_AUDIO_MIXER_STREAM_END,
menu_action_setting_audio_mixer_stream_name
},
{
MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN,
MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_END,
menu_action_setting_audio_mixer_stream_volume
},
2019-07-11 11:51:06 +02:00
#endif
2019-12-02 06:47:51 +01:00
{
MENU_SETTINGS_INPUT_DESC_BEGIN,
MENU_SETTINGS_INPUT_DESC_END,
menu_action_setting_disp_set_label_input_desc
},
2020-06-30 19:35:41 +02:00
#ifdef HAVE_CHEATS
2019-12-02 06:47:51 +01:00
{
MENU_SETTINGS_CHEAT_BEGIN,
MENU_SETTINGS_CHEAT_END,
menu_action_setting_disp_set_label_cheat
},
2020-06-30 19:35:41 +02:00
#endif
2019-12-02 06:47:51 +01:00
{
MENU_SETTINGS_PERF_COUNTERS_BEGIN,
MENU_SETTINGS_PERF_COUNTERS_END,
menu_action_setting_disp_set_label_perf_counters
},
{
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN,
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END,
menu_action_setting_disp_set_label_libretro_perf_counters
},
{
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
MENU_SETTINGS_INPUT_DESC_KBD_END,
menu_action_setting_disp_set_label_input_desc_kbd
},
};
for (i = 0; i < ARRAY_SIZE(info_list); i++)
2017-09-10 00:04:18 -05:00
{
2019-12-02 06:47:51 +01:00
if (type >= info_list[i].min && type <= info_list[i].max)
{
BIND_ACTION_GET_VALUE(cbs, info_list[i].cb);
return 0;
}
2017-09-10 00:04:18 -05:00
}
2019-12-02 06:47:51 +01:00
switch (type)
{
2019-12-02 06:47:51 +01:00
case FILE_TYPE_CORE:
case FILE_TYPE_DIRECT_LOAD:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_core);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_PLAIN:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_plain);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_MOVIE:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_movie);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_MUSIC:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_music);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_IMAGE:
case FILE_TYPE_IMAGEVIEWER:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_imageviewer);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_DIRECTORY:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_directory);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_PARENT_DIRECTORY:
case FILE_TYPE_USE_DIRECTORY:
2019-12-02 06:47:51 +01:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_generic);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_CARCHIVE:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_carchive);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_OVERLAY:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_overlay);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_FONT:
case FILE_TYPE_VIDEO_FONT:
2019-12-02 06:47:51 +01:00
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_font);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_SHADER:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_shader);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_SHADER_PRESET:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_shader_preset);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_CONFIG:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_config);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_IN_CARCHIVE:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_in_carchive);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_VIDEOFILTER:
case FILE_TYPE_AUDIOFILTER:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_filter);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_RDB:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_rdb);
2019-12-02 06:47:51 +01:00
break;
case FILE_TYPE_CHEAT:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_file_cheat);
2019-12-02 06:47:51 +01:00
break;
case MENU_SETTINGS_CHEAT_MATCH:
2020-06-30 19:35:41 +02:00
#ifdef HAVE_CHEATS
2019-12-02 06:47:51 +01:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_cheat_match);
2020-06-30 19:35:41 +02:00
#endif
2019-12-02 06:47:51 +01:00
break;
case MENU_SETTING_SUBGROUP:
case MENU_SETTINGS_CUSTOM_BIND_ALL:
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
case MENU_SETTING_ACTION:
case MENU_SETTING_ACTION_LOADSTATE:
case 7: /* Run */
case MENU_SETTING_ACTION_DELETE_ENTRY:
case MENU_SETTING_ACTION_CORE_DISK_OPTIONS:
case MENU_EXPLORE_TAB:
2022-02-22 18:23:48 +00:00
case MENU_CONTENTLESS_CORES_TAB:
2019-12-02 06:47:51 +01:00
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_more);
2019-12-02 06:47:51 +01:00
break;
case MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX:
BIND_ACTION_GET_VALUE(cbs,
2015-10-11 21:19:18 +02:00
menu_action_setting_disp_set_label_menu_disk_index);
2019-12-02 06:47:51 +01:00
break;
case 31: /* Database entry */
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_db_entry);
break;
case 25: /* URL directory entries */
case 26: /* URL entries */
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_entry_url);
break;
case MENU_SETTING_DROPDOWN_SETTING_INT_ITEM:
case MENU_SETTING_DROPDOWN_SETTING_UINT_ITEM:
case MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM:
case MENU_SETTING_DROPDOWN_ITEM:
case MENU_SETTING_NO_ITEM:
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_no_items);
break;
case MENU_SETTING_ACTION_CORE_LOCK:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_lock);
break;
case MENU_SETTING_ACTION_CORE_SET_STANDALONE_EXEMPT:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_core_set_standalone_exempt);
break;
2019-12-02 06:47:51 +01:00
case 32: /* Recent history entry */
case 65535: /* System info entry */
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_entry);
break;
default:
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label);
break;
}
2015-06-07 17:52:01 +02:00
return 0;
}
int menu_cbs_init_bind_get_string_representation(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
2015-06-07 17:52:01 +02:00
{
if (!cbs)
2015-06-07 18:36:10 +02:00
return -1;
2015-06-07 17:52:01 +02:00
2020-06-25 14:38:06 +02:00
if ( string_starts_with_size(
label, "input_player", STRLEN_CONST("input_player")) &&
string_ends_with_size(label, "joypad_index", strlen(label),
STRLEN_CONST("joypad_index"))
2020-05-23 02:29:13 +02:00
)
2016-11-03 20:06:39 +01:00
{
BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label);
return 0;
}
if (cbs->enum_idx != MSG_UNKNOWN)
{
2016-06-16 17:52:32 +02:00
switch (cbs->enum_idx)
{
2016-07-08 18:38:09 +02:00
case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY:
#ifdef HAVE_CHEEVOS
2016-07-08 18:19:10 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_cheevos_entry);
#endif
return 0;
2016-06-16 17:52:32 +02:00
case MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY:
case MENU_ENUM_LABEL_SYSTEM_INFORMATION:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_menu_more);
2016-06-16 17:52:32 +02:00
return 0;
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST:
2016-11-05 16:55:57 -05:00
case MENU_ENUM_LABEL_ACHIEVEMENT_LIST_HARDCORE:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_achievement_information);
return 0;
case MENU_ENUM_LABEL_NETPLAY_MITM_SERVER:
2018-02-04 19:57:31 +01:00
#ifdef HAVE_NETWORKING
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_netplay_mitm_server);
2018-02-04 19:57:31 +01:00
#endif
return 0;
2016-06-16 17:52:32 +02:00
default:
break;
}
}
if (cbs->setting && !cbs->setting->get_string_representation)
{
2020-06-30 05:21:47 +02:00
switch (cbs->setting->type)
{
case ST_BOOL:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_setting_bool);
return 0;
case ST_STRING:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_setting_string);
return 0;
case ST_PATH:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_setting_path);
return 0;
2016-06-16 17:52:32 +02:00
default:
break;
}
}
2019-07-25 11:49:49 +01:00
if ((type >= MENU_SETTINGS_CORE_OPTION_START) &&
(type < MENU_SETTINGS_CHEEVOS_START))
{
BIND_ACTION_GET_VALUE(cbs,
2021-08-06 15:32:51 +01:00
menu_action_setting_disp_set_label_core_option);
return 0;
}
2016-05-18 21:21:58 +02:00
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
if (type >= MENU_SETTINGS_SHADER_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
{
2015-10-11 21:19:18 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_parameter);
return 0;
}
2015-06-27 19:24:46 +02:00
else if (type >= MENU_SETTINGS_SHADER_PRESET_PARAMETER_0
&& type <= MENU_SETTINGS_SHADER_PRESET_PARAMETER_LAST)
{
2015-10-11 21:19:18 +02:00
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_shader_preset_parameter);
2015-06-27 19:24:46 +02:00
return 0;
}
#endif
if (menu_cbs_init_bind_get_string_representation_compare_label(cbs) == 0)
2015-06-07 18:36:10 +02:00
return 0;
if (menu_cbs_init_bind_get_string_representation_compare_type(cbs, type) == 0)
2015-06-07 18:36:10 +02:00
return 0;
2015-06-07 17:52:01 +02:00
2015-06-07 18:36:10 +02:00
return -1;
}