Be consistent with frontend_driver_get_core_extension - core extension

var should at most be 16 chars big, make only one exception once
This commit is contained in:
libretroadmin 2023-08-15 15:01:57 +02:00
parent 1765d491d1
commit 40a0ced947
7 changed files with 65 additions and 88 deletions

View file

@ -224,7 +224,7 @@ static bool audio_driver_free_devices_list(void)
{
audio_driver_state_t *audio_st = &audio_driver_st;
if (
!audio_st->current_audio
!audio_st->current_audio
|| !audio_st->current_audio->device_list_free
|| !audio_st->context_audio_data)
return false;
@ -274,7 +274,7 @@ static void audio_driver_deinit_resampler(void)
static bool audio_driver_deinit_internal(bool audio_enable)
{
audio_driver_state_t *audio_st = &audio_driver_st;
if ( audio_st->current_audio
if ( audio_st->current_audio
&& audio_st->current_audio->free)
{
if (audio_st->context_audio_data)
@ -412,7 +412,7 @@ static void audio_driver_flush(
struct resampler_data src_data;
float audio_volume_gain = (audio_st->mute_enable ||
(audio_fastforward_mute && is_fastforward))
? 0.0f
? 0.0f
: audio_st->volume_gain;
src_data.data_out = NULL;
@ -462,7 +462,7 @@ static void audio_driver_flush(
{
/* Readjust the audio input rate. */
int half_size = (int)(audio_st->buffer_size / 2);
int avail =
(int)audio_st->current_audio->write_avail(
audio_st->context_audio_data);
@ -526,7 +526,7 @@ static void audio_driver_flush(
audio_st->last_flush_time = flush_time;
}
audio_st->resampler->process(
audio_st->resampler_data, &src_data);
@ -542,7 +542,7 @@ static void audio_driver_flush(
if (audio_st->mixer_volume_gain == 1.0f)
override = false;
mixer_gain = audio_st->mixer_volume_gain;
}
audio_mixer_mix(audio_st->output_samples_buf,
src_data.output_frames, mixer_gain, override);
@ -710,7 +710,7 @@ bool audio_driver_init_internal(
audio_driver_st.context_audio_data))
audio_driver_st.flags |= AUDIO_FLAG_USE_FLOAT;
if ( !audio_sync
if ( !audio_sync
&& (audio_driver_st.flags & AUDIO_FLAG_ACTIVE))
{
if ( (audio_driver_st.flags & AUDIO_FLAG_ACTIVE)
@ -948,9 +948,8 @@ bool audio_driver_dsp_filter_init(const char *device)
retro_dsp_filter_t *audio_driver_dsp = NULL;
struct string_list *plugs = NULL;
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
char ext_name[32];
char ext_name[16];
char basedir[256];
ext_name[0] = '\0';
fill_pathname_basedir(basedir, device, sizeof(basedir));
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return false;
@ -1242,7 +1241,7 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
* so have to do it here */
free(buf);
buf = NULL;
break;
break;
case AUDIO_MIXER_TYPE_OGG:
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
break;
@ -1627,12 +1626,12 @@ bool audio_driver_callback(void)
#ifdef HAVE_MENU
#ifdef HAVE_NETWORKING
bool core_paused = runloop_paused ||
( settings->bools.menu_pause_libretro
( settings->bools.menu_pause_libretro
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL));
#else
bool core_paused = runloop_paused ||
(settings->bools.menu_pause_libretro
(settings->bools.menu_pause_libretro
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE));
#endif
#else
@ -1667,7 +1666,7 @@ bool audio_driver_start(bool is_shutdown)
{
audio_driver_state_t *audio_st = &audio_driver_st;
if (
!audio_st->current_audio
!audio_st->current_audio
|| !audio_st->current_audio->start
|| !audio_st->context_audio_data)
goto error;

View file

@ -86,7 +86,7 @@ static bool core_backup_get_backup_dir(
* core directory as a base */
fill_pathname_join_special(tmp,
string_is_empty(dir_core_assets)
? dir_libretro
? dir_libretro
: dir_core_assets,
"core_backups", sizeof(tmp));
@ -174,11 +174,9 @@ bool core_backup_get_backup_path(
/* Returns detected type of specified core backup file */
enum core_backup_type core_backup_get_backup_type(const char *backup_path)
{
char core_ext[16];
const char *backup_ext = NULL;
struct string_list *metadata_list = NULL;
char core_ext[255];
core_ext[0] = '\0';
if (string_is_empty(backup_path) || !path_is_valid(backup_path))
goto error;
@ -224,7 +222,7 @@ enum core_backup_type core_backup_get_backup_type(const char *backup_path)
string_list_free(metadata_list);
metadata_list = NULL;
return CORE_BACKUP_TYPE_ARCHIVE;
}
@ -487,7 +485,7 @@ core_backup_list_t *core_backup_list_init(
char core_dir[PATH_MAX_LENGTH];
char backup_dir[PATH_MAX_LENGTH];
core_dir[0] = '\0';
core_dir[0] = '\0';
backup_dir[0] = '\0';
/* Get core filename and parent directory */

View file

@ -164,15 +164,12 @@ static void salamander_init(char *s, size_t len)
if (!config_valid)
{
char executable_name[PATH_MAX_LENGTH];
executable_name[0] = '\0';
char core_ext[16];
/* No config file - search filesystem for
* first available core */
frontend_driver_get_core_extension(
executable_name, sizeof(executable_name));
find_and_set_first_file(s, len, executable_name);
core_ext, sizeof(core_ext));
find_and_set_first_file(s, len, core_ext);
/* Save result to new config file */
if (!string_is_empty(s))

View file

@ -257,7 +257,7 @@ static int filebrowser_parse(
filter_ext ? subsystem->roms[content_get_subsystem_rom_id()].valid_extensions : NULL,
true, show_hidden_files, true, false);
}
else if ((type_default == FILE_TYPE_MANUAL_SCAN_DAT)
else if ((type_default == FILE_TYPE_MANUAL_SCAN_DAT)
|| (type_default == FILE_TYPE_SIDELOAD_CORE))
ret = dir_list_initialize(&str_list, path,
exts, true, show_hidden_files, false, false);
@ -1574,9 +1574,7 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
* selection of this core
* 3) Hope that the user does not attempt to
* load unsupported content... */
char exts[32];
exts[0] = '\0';
char exts[16];
/* Attempt to identify 'broken' platforms by fetching
* the core file extension - if there is none, then
* it is impossible for RetroArch to populate a
@ -1926,7 +1924,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
uint64_t memory_used = memory_total - frontend_driver_get_free_memory();
if (memory_used != 0 && memory_total != 0)
{
_len = strlcpy(entry,
_len = strlcpy(entry,
msg_hash_to_str(MSG_MEMORY), sizeof(entry));
snprintf(entry + _len, sizeof(entry) - _len, ": %" PRIu64 "/%" PRIu64 " MB",
BYTES_TO_MB(memory_used), BYTES_TO_MB(memory_total));
@ -1989,7 +1987,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
{
gfx_ctx_ident_t ident_info;
video_context_driver_get_ident(&ident_info);
/* Video Context Driver */
snprintf(entry, sizeof(entry), "%s: %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER),
@ -2000,7 +1998,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
0, 0, NULL))
count++;
{
gfx_ctx_metrics_t metrics;
float val = 0.0f;
@ -6742,7 +6740,7 @@ unsigned menu_displaylist_build_list(
count++;
if ( string_is_equal(current_input->ident, "android")
|| (string_is_equal(current_input->ident, "cocoa")
|| (string_is_equal(current_input->ident, "cocoa")
&& string_is_equal(os_ver, "iOS")))
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_ENABLE_DEVICE_VIBRATION,
@ -10380,8 +10378,8 @@ unsigned menu_displaylist_build_list(
#ifdef _3DS
u8 device_model = 0xFF;
CFGU_GetSystemModel(&device_model);
if ( (device_model == 2)
|| (device_model == 4)
if ( (device_model == 2)
|| (device_model == 4)
|| (device_model == 5))
{
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
@ -12200,7 +12198,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
char mixer_stream_str[128];
unsigned id = info->type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_BEGIN;
size_t _len = strlcpy(mixer_stream_str, "mixer_stream_", sizeof(mixer_stream_str));
lbl[0] = '\0';
snprintf(mixer_stream_str + _len, sizeof(mixer_stream_str) - _len, "%d", id);
@ -13122,7 +13120,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY,
FILE_TYPE_NONE, 0, 0, NULL);
if ( (count != prev_count)
if ( (count != prev_count)
|| (selection >= count))
{
info->flags |= MD_FLAG_NEED_REFRESH
@ -14626,8 +14624,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
break;
case DISPLAYLIST_FILE_BROWSER_SELECT_SIDELOAD_CORE:
{
char ext_names[NAME_MAX_LENGTH];
ext_names[0] = '\0';
char ext_names[32];
info->type_default = FILE_TYPE_SIDELOAD_CORE;
@ -14682,9 +14679,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
menu_entries_clear(info->list);
{
char ext_name[16];
ext_name[0] = '\0';
filebrowser_clear_type();
info->type_default = FILE_TYPE_PLAIN;
if (frontend_driver_get_core_extension(

View file

@ -860,7 +860,7 @@ static int setting_uint_action_left_default(
{
settings_t *settings = config_get_ptr();
if (settings &&
if (settings &&
settings->bools.menu_navigation_wraparound_enable)
{
float max = setting->max;
@ -1040,7 +1040,7 @@ void setting_generic_handle_change(rarch_setting_t *setting)
if (setting->change_handler)
setting->change_handler(setting);
if ( setting->cmd_trigger_idx
if ( setting->cmd_trigger_idx
&& !(setting->flags & SD_FLAG_CMD_TRIGGER_EVENT_TRIGGERED))
command_event(setting->cmd_trigger_idx, NULL);
}
@ -1078,7 +1078,7 @@ static int setting_fraction_action_left_default(
if (!setting)
return -1;
*setting->value.target.fraction =
*setting->value.target.fraction =
*setting->value.target.fraction - setting->step;
if (setting->flags & SD_FLAG_ENFORCE_MINRANGE)
@ -1218,7 +1218,7 @@ static void setting_get_string_representation_st_bool(rarch_setting_t *setting,
char *s, size_t len)
{
if (setting)
strlcpy(s, *setting->value.target.boolean
strlcpy(s, *setting->value.target.boolean
? setting->boolean.on_label
: setting->boolean.off_label,
len);
@ -1247,7 +1247,7 @@ static void setting_get_string_representation_st_dir(rarch_setting_t *setting,
if (setting)
strlcpy(s,
*setting->value.target.string
? setting->value.target.string
? setting->value.target.string
: setting->dir.empty_path,
len);
}
@ -2546,7 +2546,7 @@ static int setting_action_ok_bind_defaults(
return -1;
target = &input_config_binds[setting->index_offset][0];
def_binds = (setting->index_offset)
def_binds = (setting->index_offset)
? retro_keybinds_rest
: retro_keybinds_1;
binds->begin = MENU_SETTINGS_BIND_BEGIN;
@ -5656,7 +5656,7 @@ static int setting_uint_action_left_custom_viewport_height(
custom->height = setting->min;
else if (settings->bools.video_scale_integer)
{
struct retro_game_geometry *geom =
struct retro_game_geometry *geom =
(struct retro_game_geometry*)&av_info->geometry;
unsigned int rotation = retroarch_get_rotation();
if (rotation % 2)
@ -7110,7 +7110,7 @@ static void menu_settings_list_current_add_range(
if ((*list)[idx].type == ST_FLOAT)
(*list)[idx].ui_type = ST_UI_TYPE_FLOAT_SLIDER_AND_SPINBOX;
(*list)[idx].min = min;
(*list)[idx].step = step;
(*list)[idx].max = max;
@ -8052,9 +8052,9 @@ static void general_write_handler(rarch_setting_t *setting)
#if defined(DINGUX) && defined(DINGUX_BETA)
case MENU_ENUM_LABEL_VIDEO_DINGUX_REFRESH_RATE:
{
enum dingux_refresh_rate
enum dingux_refresh_rate
current_refresh_rate = DINGUX_REFRESH_RATE_60HZ;
enum dingux_refresh_rate
enum dingux_refresh_rate
target_refresh_rate =
(enum dingux_refresh_rate)settings->uints.video_dingux_refresh_rate;
bool refresh_rate_valid = false;
@ -8102,7 +8102,7 @@ static void general_write_handler(rarch_setting_t *setting)
settings->modified = true;
settings->bools.video_hdr_enable = *setting->value.target.boolean;
rarch_cmd = CMD_EVENT_REINIT;
rarch_cmd = CMD_EVENT_REINIT;
break;
case MENU_ENUM_LABEL_VIDEO_HDR_MAX_NITS:
{
@ -8971,10 +8971,10 @@ static bool setting_append_list_input_player_options(
strlcpy(label_mouse_index[user],
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX),
sizeof(label_mouse_index[user]));
strlcpy(label_bind_all[user],
strlcpy(label_bind_all[user],
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL),
sizeof(label_bind_all[user]));
strlcpy(label_bind_defaults[user],
strlcpy(label_bind_defaults[user],
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL),
sizeof(label_bind_defaults[user]));
strlcpy(label_bind_all_save_autoconfig[user],
@ -9132,8 +9132,8 @@ static bool setting_append_list_input_player_options(
char label[NAME_MAX_LENGTH];
char name[NAME_MAX_LENGTH];
size_t _len = 0;
i = (j < RARCH_ANALOG_BIND_LIST_END)
? input_config_bind_order[j]
i = (j < RARCH_ANALOG_BIND_LIST_END)
? input_config_bind_order[j]
: j;
if (input_config_bind_map_get_meta(i))
@ -9230,7 +9230,7 @@ static bool setting_append_list_input_libretro_device_options(
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_LIBRETRO_DEVICE),
user + 1);
strlcpy(label_device_type[user],
strlcpy(label_device_type[user],
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE),
sizeof(label_device_type[user]));
@ -9296,7 +9296,7 @@ static bool setting_append_list_input_remap_port_options(
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_REMAP_PORT),
user + 1);
strlcpy(label_port[user],
strlcpy(label_port[user],
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_PORT),
sizeof(label_port[user]));
@ -9489,10 +9489,7 @@ static bool setting_append_list(
if (frontend_driver_has_fork())
#endif
{
char ext_name[255];
ext_name[0] = '\0';
char ext_name[16];
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
{
CONFIG_ACTION(
@ -9504,7 +9501,7 @@ static bool setting_append_list(
parent_group);
(*list)[list_info->index - 1].size = (uint32_t)path_get_realsize(RARCH_PATH_CORE);
(*list)[list_info->index - 1].value.target.string = path_get_ptr(RARCH_PATH_CORE);
(*list)[list_info->index - 1].values = ext_name;
(*list)[list_info->index - 1].values = ext_name;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_LOAD_CORE);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_BROWSER_ACTION);
}
@ -11527,7 +11524,7 @@ static bool setting_append_list(
&setting_get_string_representation_hex_and_uint,
0,
(cheat_manager_state.total_memory_size == 0)
? 0
? 0
: (cheat_manager_state.total_memory_size - 1),
1);
@ -13267,7 +13264,7 @@ static bool setting_append_list(
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 0, 5, 1, true, true);
}
}
}
#endif
END_SUB_GROUP(list, list_info, parent_group);
@ -13412,7 +13409,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].offset_by = 0;
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ADVANCED);
menu_settings_list_current_add_range(list, list_info, -20, 20, 1.0, true, true);
CONFIG_BOOL(
list, list_info,
&settings->bools.crt_switch_custom_refresh_enable,
@ -14386,7 +14383,7 @@ static bool setting_append_list(
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_BOOL(
@ -14401,7 +14398,7 @@ static bool setting_append_list(
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_BOOL(
@ -14416,7 +14413,7 @@ static bool setting_append_list(
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_BOOL(
@ -14431,7 +14428,7 @@ static bool setting_append_list(
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
general_read_handler,
SD_FLAG_NONE
);
CONFIG_BOOL(
@ -14446,7 +14443,7 @@ static bool setting_append_list(
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
general_read_handler,
SD_FLAG_NONE
);
#endif
@ -14933,7 +14930,7 @@ static bool setting_append_list(
&group_info,
&subgroup_info,
parent_group);
CONFIG_ACTION(
list, list_info,
MENU_ENUM_LABEL_INPUT_RETROPAD_BINDS,
@ -22000,7 +21997,7 @@ static bool setting_append_list(
MENU_ENUM_LABEL_VALUE_ACCOUNTS_FACEBOOK,
&group_info,
&subgroup_info,
parent_group);
parent_group);
#endif
END_SUB_GROUP(list, list_info, parent_group);
@ -22089,7 +22086,7 @@ static bool setting_append_list(
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
break;
break;
case SETTINGS_LIST_USER_ACCOUNTS_CHEEVOS:
START_GROUP(list, list_info, &group_info,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ACCOUNTS_CHEEVOS_SETTINGS),
@ -23114,7 +23111,7 @@ static rarch_setting_t *menu_setting_new_internal(rarch_setting_info_t *list_inf
if (!list)
return NULL;
root =
root =
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU);
for (i = 0; i < (unsigned)list_info->size; i++)

View file

@ -1368,7 +1368,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
char ext_shaders[255];
#endif
char ext_name[255];
char ext_name[16];
const char *exts = NULL;
bool recursive = false;
@ -1378,11 +1378,8 @@ struct string_list *dir_list_new_special(const char *input_dir,
exts = filter;
break;
case DIR_LIST_CORES:
ext_name[0] = '\0';
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return NULL;
exts = ext_name;
break;
case DIR_LIST_RECURSIVE:
@ -3256,14 +3253,12 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_CORE_INFO_INIT:
{
char ext_name[255];
char ext_name[16];
const char *dir_libretro = settings->paths.directory_libretro;
const char *path_libretro_info = settings->paths.path_libretro_info;
bool show_hidden_files = settings->bools.show_hidden_files;
bool core_info_cache_enable = settings->bools.core_info_cache_enable;
ext_name[0] = '\0';
command_event(CMD_EVENT_CORE_INFO_DEINIT, NULL);
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
@ -5473,10 +5468,7 @@ static void retroarch_parse_input_libretro_path(const char *path)
if (!string_is_empty(path_ext))
{
char core_ext[255];
core_ext[0] = '\0';
char core_ext[16];
if ( string_is_empty(settings->paths.directory_libretro)
|| !frontend_driver_get_core_extension(core_ext,
sizeof(core_ext))

View file

@ -5099,7 +5099,7 @@ void LoadCoreWindow::onLoadCustomCoreClicked()
size_t _len;
QString path;
QByteArray pathArray;
char core_ext[32];
char core_ext[16];
char filters[128];
const char *pathData = NULL;
settings_t *settings = config_get_ptr();