* PATH_MAX_LENGTH redefined from 4096 to 2048

* Massive reduction in heap space allocation, going from settings struct
264kb to 119Kb
* Use NAME_MAX_LENGTH for base paths/names, etc
* Use DIR_MAX_LENGTH for directory sizes
This commit is contained in:
libretroadmin 2024-09-09 05:47:32 +02:00
parent 01a9745f5b
commit b8391e233f
74 changed files with 1422 additions and 1391 deletions

View File

@ -1,120 +1,120 @@
Refer also to this page for more information -
https://docs.libretro.com/development/coding-standards/
Struct ordering
---------------
For POD-types, try to order structs as follows (first to last):
* long double (8 bytes, 16 bytes [64bit x86], 12 bytes [32bit x86])
* double (8 bytes)
* int64_t (8 bytes, 8 bytes [32bit ARM],
4 bytes [32bit x86])
* uint64_t (4 bytes [32bit], 8 bytes [32bit ARM], 8 bytes [64bit])
* pointer (4 bytes [32bit], 8 bytes [64bit] [1])
* intptr_t (4 bytes [32bit], 8 bytes [64bit] [1])
* uintptr_t (4 bytes [32bit], 8 bytes [64bit] [1])
* ptrdiff_t (4 bytes [32bit], 8 bytes [64bit] [1])
* ssize_t (4 bytes [32bit], 8 bytes [64bit])
* size_t (4 bytes [32bit], 8 bytes [64bit])
* jmp_buf (4 bytes)
* long (4 bytes [64bit Win], 8 bytes [64bit non-Win],
4 bytes [32bit])
* int32_t (4 bytes)
* unsigned (4 bytes)
* float (4 bytes)
* int (4 bytes)
* enum (4 bytes)
* int16_t (2 bytes)
* char (1 byte)
* bool (1 byte)
[1] PS3 uses 4 byte pointers despite having a 64bit processor
Struct members should be sorted by alignment. Therefore, structs
should be sorted by the largest type inside them.
For example, take a struct like this:
typedef struct
{
size_t capacity;
bool old_format;
bool compress;
bool fuzzy_archive_match;
bool autofix_paths;
char path[PATH_MAX_LENGTH];
char base_content_directory[PATH_MAX_LENGTH];
} playlist_config_t;
size_t has the biggest alignment here, so 'struct playlist_config_t'
inside a struct should come before or after size_t.
*** BEST PRACTICES ***
* If we have pointers and size variable pairs, it's best to
interleave them to increase the probability they go in the
same cacheline. It also makes the code more readable, that
these two variables are connected.
Example:
struct a
{
char* b;
size_t b_len;
char* c;
size_t c_len;
};
Stack size
----------
You have to assume that stack size is going to be limited in
RetroArch. Some game consoles (and other embedded systems)
might have a default stack size as low as 128Kb or less.
Be conservative with stack size but don't try to put very
small structs on heap either [to avoid memory fragmentation
among other things]. A balancing act here is necessary.
Be mindful that heap allocations are slow compared to stack.
Functions
---------
- Avoid doing small getter/setter functions. We want a function
to justify its function call overhead by doing a significant
body of work. Small one-line getter/setter functions for what
is predominantly C-style structs is not useful, plus it leads
to people thinking this function is more complex than it
actually is, thus obfuscating the sourcecode instead of it
being easier to read.
If you can find examples in the codebase that violate this
guideline, do not hesitate to point them out to us.
Variable declaration
--------------------
For C source files, we have to insist you stick to the following:
- Declare variables either at the start of a function or the start
of a code block, depending on the scope they need.
- Do not do initial for loop declarations. Refer to the bulletpoint above:
either declare them at the start of the function, or at the start
of the code block.
Not doing this would break compilation on platforms where we are compiling
these C source files in C89 compatibility mode. If such issues occur in pull
requests, we have to request that it be fixed.
VLA (Variable Length Array)
---------------------------
Do not use VLAs (Variable Length Array) in C source files. These are not
C89-compliant.
Miscellaneous
-------------
- Brace usage follows "Allman style". The brace associated with a control statement is placed on the following line,
indented to the same level as the control statement.
Statements within the braces are indented to the next level.
- A single statement block must not include brackets (unless the block uses a macro that expands into multiple lines)
- If possible, avoid 'while (true)' and use 'for (;;)' instead
Refer also to this page for more information -
https://docs.libretro.com/development/coding-standards/
Struct ordering
---------------
For POD-types, try to order structs as follows (first to last):
* long double (8 bytes, 16 bytes [64bit x86], 12 bytes [32bit x86])
* double (8 bytes)
* int64_t (8 bytes, 8 bytes [32bit ARM],
4 bytes [32bit x86])
* uint64_t (4 bytes [32bit], 8 bytes [32bit ARM], 8 bytes [64bit])
* pointer (4 bytes [32bit], 8 bytes [64bit] [1])
* intptr_t (4 bytes [32bit], 8 bytes [64bit] [1])
* uintptr_t (4 bytes [32bit], 8 bytes [64bit] [1])
* ptrdiff_t (4 bytes [32bit], 8 bytes [64bit] [1])
* ssize_t (4 bytes [32bit], 8 bytes [64bit])
* size_t (4 bytes [32bit], 8 bytes [64bit])
* jmp_buf (4 bytes)
* long (4 bytes [64bit Win], 8 bytes [64bit non-Win],
4 bytes [32bit])
* int32_t (4 bytes)
* unsigned (4 bytes)
* float (4 bytes)
* int (4 bytes)
* enum (4 bytes)
* int16_t (2 bytes)
* char (1 byte)
* bool (1 byte)
[1] PS3 uses 4 byte pointers despite having a 64bit processor
Struct members should be sorted by alignment. Therefore, structs
should be sorted by the largest type inside them.
For example, take a struct like this:
typedef struct
{
size_t capacity;
bool old_format;
bool compress;
bool fuzzy_archive_match;
bool autofix_paths;
char path[PATH_MAX_LENGTH];
char base_content_directory[DIR_MAX_LENGTH];
} playlist_config_t;
size_t has the biggest alignment here, so 'struct playlist_config_t'
inside a struct should come before or after size_t.
*** BEST PRACTICES ***
* If we have pointers and size variable pairs, it's best to
interleave them to increase the probability they go in the
same cacheline. It also makes the code more readable, that
these two variables are connected.
Example:
struct a
{
char* b;
size_t b_len;
char* c;
size_t c_len;
};
Stack size
----------
You have to assume that stack size is going to be limited in
RetroArch. Some game consoles (and other embedded systems)
might have a default stack size as low as 128Kb or less.
Be conservative with stack size but don't try to put very
small structs on heap either [to avoid memory fragmentation
among other things]. A balancing act here is necessary.
Be mindful that heap allocations are slow compared to stack.
Functions
---------
- Avoid doing small getter/setter functions. We want a function
to justify its function call overhead by doing a significant
body of work. Small one-line getter/setter functions for what
is predominantly C-style structs is not useful, plus it leads
to people thinking this function is more complex than it
actually is, thus obfuscating the sourcecode instead of it
being easier to read.
If you can find examples in the codebase that violate this
guideline, do not hesitate to point them out to us.
Variable declaration
--------------------
For C source files, we have to insist you stick to the following:
- Declare variables either at the start of a function or the start
of a code block, depending on the scope they need.
- Do not do initial for loop declarations. Refer to the bulletpoint above:
either declare them at the start of the function, or at the start
of the code block.
Not doing this would break compilation on platforms where we are compiling
these C source files in C89 compatibility mode. If such issues occur in pull
requests, we have to request that it be fixed.
VLA (Variable Length Array)
---------------------------
Do not use VLAs (Variable Length Array) in C source files. These are not
C89-compliant.
Miscellaneous
-------------
- Brace usage follows "Allman style". The brace associated with a control statement is placed on the following line,
indented to the same level as the control statement.
Statements within the braces are indented to the next level.
- A single statement block must not include brackets (unless the block uses a macro that expands into multiple lines)
- If possible, avoid 'while (true)' and use 'for (;;)' instead

View File

@ -23,6 +23,7 @@
#include <string/stdstring.h>
#include <encodings/utf.h>
#include <retro_miscellaneous.h>
#include <clamping.h>
#include <memalign.h>
#include <audio/conversion/float_to_s16.h>
@ -950,7 +951,7 @@ bool audio_driver_dsp_filter_init(const char *device)
struct string_list *plugs = NULL;
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
char ext_name[16];
char basedir[256];
char basedir[NAME_MAX_LENGTH];
fill_pathname_basedir(basedir, device, sizeof(basedir));
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return false;
@ -1329,7 +1330,7 @@ static void audio_driver_load_menu_bgm_callback(retro_task_t *task,
void audio_driver_load_system_sounds(void)
{
char basename_noext[256];
char basename_noext[NAME_MAX_LENGTH];
char sounds_path[PATH_MAX_LENGTH];
char sounds_fallback_path[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();

View File

@ -67,7 +67,7 @@ typedef struct video4linux
uint32_t *buffer_output;
bool ready;
char dev_name[255];
char dev_name[NAME_MAX_LENGTH];
} video4linux_t;
static int xioctl(int fd, unsigned long request, void *args)

View File

@ -1450,12 +1450,12 @@ static void scan_states(settings_t *settings,
size_t i, cnt = 0;
size_t cnt_in_range = 0;
char state_dir[PATH_MAX_LENGTH];
char state_dir[DIR_MAX_LENGTH];
/* Base name of 128 may be too short for some (<<1%) of the
tosec-based file names, but in practice truncating will not
lead to mismatch */
char state_base[128];
fill_pathname_basedir(state_dir, runloop_st->name.savestate,
sizeof(state_dir));
@ -1605,7 +1605,7 @@ static void scan_states(settings_t *settings,
}
RARCH_DBG("[State]: savestate scanning finished, used slots (in range): "
"%d (%d), max:%d, load index %d, gap index %d, delete index %d\n",
"%d (%d), max:%d, load index %d, gap index %d, delete index %d\n",
cnt, cnt_in_range, max_idx, loa_idx, gap_idx, del_idx);
if (last_index != NULL)
@ -1686,7 +1686,7 @@ static void command_event_set_savestate_garbage_collect(settings_t *settings)
{
filestream_delete(state_to_delete);
RARCH_DBG("[State]: garbage collect, deleting \"%s\" \n",state_to_delete);
/* Construct the save state thumbnail name
/* Construct the save state thumbnail name
* and delete that one as well. */
i = strlen(state_to_delete);
strlcpy(state_to_delete + i,".png",STRLEN_CONST(".png")+1);
@ -1699,7 +1699,7 @@ void command_event_set_replay_auto_index(settings_t *settings)
{
size_t i;
char state_base[128];
char state_dir[PATH_MAX_LENGTH];
char state_dir[DIR_MAX_LENGTH];
struct string_list *dir_list = NULL;
unsigned max_idx = 0;
@ -1766,7 +1766,7 @@ void command_event_set_replay_garbage_collect(
{
/* TODO: debugme */
size_t i, cnt = 0;
char state_dir[PATH_MAX_LENGTH];
char state_dir[DIR_MAX_LENGTH];
char state_base[128];
runloop_state_t *runloop_st = runloop_state_get_ptr();
@ -1873,9 +1873,9 @@ bool command_event_save_core_config(
const char *rarch_path_config)
{
char msg[128];
char config_name[255];
char config_path[PATH_MAX_LENGTH];
char config_dir[PATH_MAX_LENGTH];
char config_name[NAME_MAX_LENGTH];
char config_dir[DIR_MAX_LENGTH];
bool new_path_available = false;
bool overrides_active = false;
const char *core_path = NULL;

View File

@ -3425,7 +3425,7 @@ static config_file_t *open_default_config_file(void)
if (!conf && has_application_data)
{
bool dir_created = false;
char basedir[PATH_MAX_LENGTH];
char basedir[DIR_MAX_LENGTH];
/* Try to create a new config file. */
fill_pathname_basedir(basedir, application_data, sizeof(basedir));
fill_pathname_join_special(conf_path, application_data,
@ -4294,8 +4294,8 @@ bool config_load_override(void *data)
char core_path[PATH_MAX_LENGTH];
char game_path[PATH_MAX_LENGTH];
char content_path[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_directory[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
bool should_append = false;
bool show_notification = true;
rarch_system_info_t *sys_info = (rarch_system_info_t*)data;
@ -4478,7 +4478,7 @@ bool config_load_override(void *data)
bool config_load_override_file(const char *config_path)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
bool should_append = false;
bool show_notification = true;
settings_t *settings = config_st;
@ -4594,7 +4594,7 @@ bool config_unload_override(void)
bool config_load_remap(const char *directory_input_remapping,
void *data)
{
char content_dir_name[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
/* final path for core-specific configuration (prefix+suffix) */
char core_path[PATH_MAX_LENGTH];
/* final path for game-specific configuration (prefix+suffix) */
@ -5455,9 +5455,9 @@ int8_t config_save_overrides(enum override_type type,
struct config_array_setting *array_overrides= NULL;
struct config_path_setting *path_settings = NULL;
struct config_path_setting *path_overrides = NULL;
char config_directory[PATH_MAX_LENGTH];
char override_directory[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char override_directory[DIR_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char override_path[PATH_MAX_LENGTH];
settings_t *overrides = config_st;
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
@ -5994,7 +5994,7 @@ bool input_remapping_save_file(const char *path)
size_t _len;
bool ret;
unsigned i, j;
char remap_file_dir[PATH_MAX_LENGTH];
char remap_file_dir[DIR_MAX_LENGTH];
char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][8] =
{
"b", "y", "select", "start",

View File

@ -465,10 +465,8 @@ typedef struct settings
char cloud_sync_driver[32];
char menu_driver[32];
char cheevos_username[32];
char cheevos_password[256];
char cheevos_token[32];
char cheevos_leaderboards_enable[32];
char cheevos_custom_host[64];
char video_context_driver[32];
char audio_driver[32];
char audio_resampler[32];
@ -477,43 +475,46 @@ typedef struct settings
char midi_driver[32];
char midi_input[32];
char midi_output[32];
char input_keyboard_layout[64];
#ifdef HAVE_LAKKA
char cpu_main_gov[32];
char cpu_menu_gov[32];
#endif
#ifdef HAVE_MICROPHONE
char microphone_driver[32];
char microphone_resampler[32];
char microphone_device[255];
#endif
char input_keyboard_layout[64];
char cheevos_custom_host[64];
#ifdef HAVE_LAKKA
char timezone[TIMEZONE_LENGTH];
#endif
char cheevos_password[NAME_MAX_LENGTH];
#ifdef HAVE_MICROPHONE
char microphone_device[NAME_MAX_LENGTH];
#endif
#ifdef ANDROID
char input_android_physical_keyboard[255];
char input_android_physical_keyboard[NAME_MAX_LENGTH];
#endif
char audio_device[NAME_MAX_LENGTH];
char camera_device[NAME_MAX_LENGTH];
char netplay_mitm_server[NAME_MAX_LENGTH];
char webdav_url[NAME_MAX_LENGTH];
char webdav_username[NAME_MAX_LENGTH];
char webdav_password[NAME_MAX_LENGTH];
char input_reserved_devices[MAX_USERS][255];
char audio_device[255];
char camera_device[255];
char netplay_mitm_server[255];
char crt_switch_timings[NAME_MAX_LENGTH];
char translation_service_url[2048];
char webdav_url[255];
char webdav_username[255];
char webdav_password[255];
char youtube_stream_key[PATH_MAX_LENGTH];
char twitch_stream_key[PATH_MAX_LENGTH];
char facebook_stream_key[PATH_MAX_LENGTH];
char discord_app_id[PATH_MAX_LENGTH];
char ai_service_url[PATH_MAX_LENGTH];
char crt_switch_timings[255];
#ifdef HAVE_LAKKA
char timezone[TIMEZONE_LENGTH];
char cpu_main_gov[32];
char cpu_menu_gov[32];
#endif
char input_reserved_devices[MAX_USERS][NAME_MAX_LENGTH];
} arrays;
struct
@ -525,18 +526,49 @@ typedef struct settings
char netplay_password[128];
char netplay_spectate_password[128];
char netplay_server[255];
char netplay_custom_mitm_server[255];
char network_buildbot_url[255];
char network_buildbot_assets_url[255];
char netplay_server[NAME_MAX_LENGTH];
char netplay_custom_mitm_server[NAME_MAX_LENGTH];
char network_buildbot_url[NAME_MAX_LENGTH];
char network_buildbot_assets_url[NAME_MAX_LENGTH];
char browse_url[4096];
char streaming_title[512];
char path_stream_url[8192];
char bundle_assets_dst_subdir[DIR_MAX_LENGTH];
char directory_audio_filter[DIR_MAX_LENGTH];
char directory_autoconfig[DIR_MAX_LENGTH];
char directory_video_filter[DIR_MAX_LENGTH];
char directory_video_shader[DIR_MAX_LENGTH];
char directory_libretro[DIR_MAX_LENGTH];
char directory_input_remapping[DIR_MAX_LENGTH];
char directory_overlay[DIR_MAX_LENGTH];
char directory_osk_overlay[DIR_MAX_LENGTH];
char directory_screenshot[DIR_MAX_LENGTH];
char directory_system[DIR_MAX_LENGTH];
char directory_cache[DIR_MAX_LENGTH];
char directory_playlist[DIR_MAX_LENGTH];
char directory_content_favorites[DIR_MAX_LENGTH];
char directory_content_history[DIR_MAX_LENGTH];
char directory_content_image_history[DIR_MAX_LENGTH];
char directory_content_music_history[DIR_MAX_LENGTH];
char directory_content_video_history[DIR_MAX_LENGTH];
char directory_runtime_log[DIR_MAX_LENGTH];
char directory_core_assets[DIR_MAX_LENGTH];
char directory_assets[DIR_MAX_LENGTH];
char directory_dynamic_wallpapers[DIR_MAX_LENGTH];
char directory_thumbnails[DIR_MAX_LENGTH];
char directory_menu_config[DIR_MAX_LENGTH];
char directory_menu_content[DIR_MAX_LENGTH];
#ifdef _3DS
char directory_bottom_assets[DIR_MAX_LENGTH];
#endif
#ifdef HAVE_TEST_DRIVERS
char test_input_file_joypad[PATH_MAX_LENGTH];
char test_input_file_general[PATH_MAX_LENGTH];
#endif
char log_dir[DIR_MAX_LENGTH];
char bundle_assets_src[PATH_MAX_LENGTH];
char bundle_assets_dst[PATH_MAX_LENGTH];
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
char path_menu_xmb_font[PATH_MAX_LENGTH];
char menu_content_show_settings_password[PATH_MAX_LENGTH];
char kiosk_mode_password[PATH_MAX_LENGTH];
@ -560,40 +592,11 @@ typedef struct settings
char path_font[PATH_MAX_LENGTH];
char path_rgui_theme_preset[PATH_MAX_LENGTH];
char directory_audio_filter[PATH_MAX_LENGTH];
char directory_autoconfig[PATH_MAX_LENGTH];
char directory_video_filter[PATH_MAX_LENGTH];
char directory_video_shader[PATH_MAX_LENGTH];
char directory_libretro[PATH_MAX_LENGTH];
char directory_input_remapping[PATH_MAX_LENGTH];
char directory_overlay[PATH_MAX_LENGTH];
char directory_osk_overlay[PATH_MAX_LENGTH];
char directory_screenshot[PATH_MAX_LENGTH];
char directory_system[PATH_MAX_LENGTH];
char directory_cache[PATH_MAX_LENGTH];
char directory_playlist[PATH_MAX_LENGTH];
char directory_content_favorites[PATH_MAX_LENGTH];
char directory_content_history[PATH_MAX_LENGTH];
char directory_content_image_history[PATH_MAX_LENGTH];
char directory_content_music_history[PATH_MAX_LENGTH];
char directory_content_video_history[PATH_MAX_LENGTH];
char directory_runtime_log[PATH_MAX_LENGTH];
char directory_core_assets[PATH_MAX_LENGTH];
char directory_assets[PATH_MAX_LENGTH];
char directory_dynamic_wallpapers[PATH_MAX_LENGTH];
char directory_thumbnails[PATH_MAX_LENGTH];
char directory_menu_config[PATH_MAX_LENGTH];
char directory_menu_content[PATH_MAX_LENGTH];
char streaming_title[PATH_MAX_LENGTH];
#ifdef _3DS
char directory_bottom_assets[PATH_MAX_LENGTH];
#endif
#ifdef HAVE_TEST_DRIVERS
char test_input_file_joypad[PATH_MAX_LENGTH];
char test_input_file_general[PATH_MAX_LENGTH];
#endif
char log_dir[PATH_MAX_LENGTH];
char app_icon[PATH_MAX_LENGTH];
char browse_url[4096];
char path_stream_url[8192];
} paths;

View File

@ -120,8 +120,8 @@ bool core_backup_get_backup_path(
time_t current_time;
struct tm time_info;
const char *core_filename = NULL;
char core_dir[PATH_MAX_LENGTH];
char backup_dir[PATH_MAX_LENGTH];
char core_dir[DIR_MAX_LENGTH];
char backup_dir[DIR_MAX_LENGTH];
char backup_filename[PATH_MAX_LENGTH];
backup_dir[0] = '\0';
@ -477,8 +477,8 @@ core_backup_list_t *core_backup_list_init(
struct string_list *dir_list = NULL;
core_backup_list_t *backup_list = NULL;
core_backup_list_entry_t *entries = NULL;
char core_dir[PATH_MAX_LENGTH];
char backup_dir[PATH_MAX_LENGTH];
char core_dir[DIR_MAX_LENGTH];
char backup_dir[DIR_MAX_LENGTH];
core_dir[0] = '\0';
backup_dir[0] = '\0';

View File

@ -542,7 +542,7 @@ static void NETRETROPAD_CORE_PREFIX(update_keyboard_cb)(bool down, unsigned keyc
uint32_t character, uint16_t key_modifiers)
{
struct retro_message message;
char buf[255];
char buf[NAME_MAX_LENGTH];
if (keycode < RETROK_LAST)
{

View File

@ -87,9 +87,9 @@ struct defaults
float settings_video_refresh_rate;
char dirs [DEFAULT_DIR_LAST + 1][PATH_MAX_LENGTH];
char dirs [DEFAULT_DIR_LAST + 1][DIR_MAX_LENGTH];
char path_config[PATH_MAX_LENGTH];
char path_buildbot_server_url[255];
char path_buildbot_server_url[NAME_MAX_LENGTH];
char settings_menu[32];
#ifdef HAVE_MENU

View File

@ -207,7 +207,7 @@ bool disk_index_file_init(
size_t len;
const char *content_file = NULL;
char content_name[256];
char disk_index_file_dir[PATH_MAX_LENGTH];
char disk_index_file_dir[DIR_MAX_LENGTH];
/* Sanity check */
if (!disk_index_file)

View File

@ -210,13 +210,13 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS:
#ifdef HAVE_XMB
{
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
char temp_path[PATH_MAX_LENGTH];
char temp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s, s1, "png", len);
fill_pathname_join_special(temp_dir, dir_assets, "xmb", sizeof(temp_dir));
fill_pathname_join_special(temp_path, temp_dir, xmb_theme_ident(), sizeof(temp_path));
fill_pathname_join_special(s, temp_path, "png", len);
}
#endif
break;
@ -230,14 +230,14 @@ void fill_pathname_application_special(char *s,
strlcpy(s, path_menu_wallpaper, len);
else
{
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
char s3[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
char tmp_path2[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s3, s1, "png", sizeof(s3));
fill_pathname_join_special(s, s3, FILE_PATH_BACKGROUND_IMAGE, len);
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, tmp_dir, xmb_theme_ident(), sizeof(tmp_path));
fill_pathname_join_special(tmp_path2, tmp_path, "png", sizeof(tmp_path2));
fill_pathname_join_special(s, tmp_path2, FILE_PATH_BACKGROUND_IMAGE, len);
}
}
#endif
@ -254,11 +254,11 @@ void fill_pathname_application_special(char *s,
#ifdef HAVE_XMB
if (string_is_equal(menu_ident, "xmb"))
{
char s8[PATH_MAX_LENGTH];
char s4[PATH_MAX_LENGTH];
fill_pathname_join_special(s8, dir_assets, menu_ident, sizeof(s8));
fill_pathname_join_special(s4, s8, xmb_theme_ident(), sizeof(s4));
fill_pathname_join_special(s, s4, "sounds", len);
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
fill_pathname_join_special(tmp_dir, dir_assets, menu_ident, sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, tmp_dir, xmb_theme_ident(), sizeof(tmp_path));
fill_pathname_join_special(s, tmp_path, "sounds", len);
}
else
#endif
@ -266,9 +266,9 @@ void fill_pathname_application_special(char *s,
if ( string_is_equal(menu_ident, "glui")
|| string_is_equal(menu_ident, "ozone"))
{
char s4[PATH_MAX_LENGTH];
fill_pathname_join_special(s4, dir_assets, menu_ident, sizeof(s4));
fill_pathname_join_special(s, s4, "sounds", len);
char tmp_dir[DIR_MAX_LENGTH];
fill_pathname_join_special(tmp_dir, dir_assets, menu_ident, sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "sounds", len);
}
else
#endif
@ -291,12 +291,12 @@ void fill_pathname_application_special(char *s,
#ifdef HAVE_XMB
if (string_is_equal(menu_ident, "xmb"))
{
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, menu_ident, sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s, s1, "png", len);
fill_pathname_join_special(tmp_dir, dir_assets, menu_ident, sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, tmp_dir, xmb_theme_ident(), sizeof(tmp_path));
fill_pathname_join_special(s, tmp_path, "png", len);
}
else
#endif
@ -304,20 +304,20 @@ void fill_pathname_application_special(char *s,
if ( string_is_equal(menu_ident, "ozone")
|| string_is_equal(menu_ident, "glui"))
{
char s5[PATH_MAX_LENGTH];
char s6[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
#if defined(WIIU) || defined(VITA)
/* Smaller 46x46 icons look better on low-DPI devices */
fill_pathname_join_special(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join_special(s6, "png", "icons", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "ozone", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "png", "icons", sizeof(tmp_path));
#else
/* Otherwise, use large 256x256 icons */
fill_pathname_join_special(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join_special(s6, "monochrome", "png", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "monochrome", "png", sizeof(tmp_path));
#endif
fill_pathname_join_special(s, s5, s6, len);
fill_pathname_join_special(s, tmp_dir, tmp_path, len);
}
else
#endif
@ -329,20 +329,20 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS:
#ifdef HAVE_OZONE
{
char s5[PATH_MAX_LENGTH];
char s6[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
#if defined(WIIU) || defined(VITA)
/* Smaller 46x46 icons look better on low-DPI devices */
fill_pathname_join_special(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join_special(s6, "png", "icons", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "ozone", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "png", "icons", sizeof(tmp_path));
#else
/* Otherwise, use large 256x256 icons */
fill_pathname_join_special(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join_special(s6, "monochrome", "png", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "monochrome", "png", sizeof(tmp_path));
#endif
fill_pathname_join_special(s, s5, s6, len);
fill_pathname_join_special(s, tmp_dir, tmp_path, len);
}
#endif
break;
@ -350,11 +350,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_RGUI_FONT:
#ifdef HAVE_RGUI
{
char s7[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s7, dir_assets, "rgui", sizeof(s7));
fill_pathname_join_special(s, s7, "font", len);
fill_pathname_join_special(tmp_dir, dir_assets, "rgui", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "font", len);
}
#endif
break;
@ -362,11 +362,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB:
#ifdef HAVE_XMB
{
char s8[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s, s8, xmb_theme_ident(), len);
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, xmb_theme_ident(), len);
}
#endif
break;
@ -380,35 +380,35 @@ void fill_pathname_application_special(char *s,
strlcpy(s, path_menu_xmb_font, len);
else
{
char s9[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join_special(s, s9, "fallback-font.ttf", len);
fill_pathname_join_special(tmp_dir,
settings->paths.directory_assets, "pkg", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join_special(s, s9, "chinese-fallback-font.ttf", len);
fill_pathname_join_special(tmp_dir,
settings->paths.directory_assets, "pkg", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "chinese-fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join_special(s, s9, "korean-fallback-font.ttf", len);
fill_pathname_join_special(tmp_dir,
settings->paths.directory_assets, "pkg", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "korean-fallback-font.ttf", len);
break;
default:
{
char s8[PATH_MAX_LENGTH];
char tmp_dir2[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s9, s8, xmb_theme_ident(), sizeof(s9));
fill_pathname_join_special(s, s9, FILE_PATH_TTF_FONT, len);
fill_pathname_join_special(tmp_dir2, dir_assets, "xmb", sizeof(tmp_dir2));
fill_pathname_join_special(tmp_dir, tmp_dir2, xmb_theme_ident(), sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, FILE_PATH_TTF_FONT, len);
}
break;
}
@ -418,21 +418,21 @@ void fill_pathname_application_special(char *s,
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS:
{
char s10[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
fill_pathname_join_special(s10, dir_thumbnails, "discord", sizeof(s10));
fill_pathname_join_special(s, s10, "avatars", len);
fill_pathname_join_special(tmp_dir, dir_thumbnails, "discord", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "avatars", len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES:
{
char s12[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
fill_pathname_join_special(s12, dir_thumbnails, "cheevos", len);
fill_pathname_join_special(s, s12, "badges", len);
fill_pathname_join_special(tmp_dir, dir_thumbnails, "cheevos", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "badges", len);
}
break;

View File

@ -131,7 +131,7 @@ static void CFSearchPathForDirectoriesInDomains(
NSUserDomainMask, YES) firstObject];
#else
CFStringRef array_val = nil;
NSArray *arr =
NSArray *arr =
NSSearchPathForDirectoriesInDomains(dir,
NSUserDomainMask, YES);
if ([arr count] != 0)
@ -160,7 +160,7 @@ void get_ios_version(int *major, int *minor);
#define PMGMT_STRMATCH(a,b) (CFStringCompare(a, b, 0) == kCFCompareEqualTo)
#define PMGMT_GETVAL(k,v) CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **) v)
/* Note that AC power sources also include a
/* Note that AC power sources also include a
* laptop battery it is charging. */
static void darwin_check_power_source(
CFDictionaryRef dict,
@ -341,9 +341,9 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
char assets_zip_path[PATH_MAX_LENGTH];
CFURLRef bundle_url;
CFStringRef bundle_path;
char temp_dir[PATH_MAX_LENGTH] = {0};
char temp_dir[DIR_MAX_LENGTH] = {0};
char bundle_path_buf[PATH_MAX_LENGTH] = {0};
char documents_dir_buf[PATH_MAX_LENGTH] = {0};
char documents_dir_buf[DIR_MAX_LENGTH] = {0};
char application_data[PATH_MAX_LENGTH] = {0};
CFBundleRef bundle = CFBundleGetMainBundle();
@ -682,7 +682,7 @@ static enum frontend_architecture frontend_darwin_get_arch(void)
if (uname(&buffer) != 0)
return FRONTEND_ARCH_NONE;
if (string_is_equal(buffer.machine, "x86_64"))
return FRONTEND_ARCH_X86_64;
if (string_is_equal(buffer.machine, "x86"))
@ -696,7 +696,7 @@ static enum frontend_architecture frontend_darwin_get_arch(void)
size_t size = sizeof(type);
sysctlbyname("hw.cputype", &type, &size, NULL, 0);
if (type == CPU_TYPE_X86_64)
return FRONTEND_ARCH_X86_64;
else if (type == CPU_TYPE_X86)
@ -846,7 +846,7 @@ static char* accessibility_mac_language_code(const char* language)
return "Ioana";
else if (string_is_equal(language,"pt_pt"))
return "Joana";
else if (string_is_equal(language,"pt_bt")
else if (string_is_equal(language,"pt_bt")
|| string_is_equal(language,"pt"))
return "Luciana";
else if (string_is_equal(language,"th"))
@ -861,7 +861,7 @@ static char* accessibility_mac_language_code(const char* language)
return "Maged";
else if (string_is_equal(language,"hu"))
return "Mariska";
else if (string_is_equal(language,"zh_tw")
else if (string_is_equal(language,"zh_tw")
|| string_is_equal(language,"zh"))
return "Mei-Jia";
else if (string_is_equal(language,"el"))
@ -884,7 +884,7 @@ static char* accessibility_mac_language_code(const char* language)
return "Yuna";
else if (string_is_equal(language,"pl"))
return "Zosia";
else if (string_is_equal(language,"cs"))
else if (string_is_equal(language,"cs"))
return "Zuzana";
return "";
}
@ -925,16 +925,16 @@ static bool accessibility_speak_macos(int speed,
/* parent process */
speak_pid = pid;
/* Tell the system that we'll ignore the exit status of the child
/* Tell the system that we'll ignore the exit status of the child
* process. This prevents zombie processes. */
signal(SIGCHLD,SIG_IGN);
}
else
{
/* child process: replace process with the say command */
{
/* child process: replace process with the say command */
if (language_speaker && language_speaker[0] != '\0')
{
char* cmd[] = {"say", "-v", NULL,
char* cmd[] = {"say", "-v", NULL,
NULL, "-r", NULL, NULL};
cmd[2] = language_speaker;
cmd[3] = (char *) speak_text;

View File

@ -114,7 +114,7 @@ enum platform_android_flags
};
static pthread_key_t thread_key;
static char app_dir[PATH_MAX_LENGTH];
static char app_dir[DIR_MAX_LENGTH];
unsigned storage_permissions = 0;
struct android_app *g_android = NULL;
static uint8_t g_platform_android_flags = 0;
@ -1482,7 +1482,7 @@ static void frontend_unix_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
static char apk_dir[PATH_MAX_LENGTH];
static char apk_dir[DIR_MAX_LENGTH];
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
*apk_dir = '\0';

View File

@ -142,7 +142,7 @@ enum frontend_powerstate frontend_uwp_get_powerstate(
int *seconds, int *percent)
{
SYSTEM_POWER_STATUS status;
enum frontend_powerstate
enum frontend_powerstate
ret = FRONTEND_POWERSTATE_NONE;
if (GetSystemPowerStatus(&status))
@ -197,7 +197,7 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
{
#ifdef HAVE_MENU
int i;
char home_dir[PATH_MAX_LENGTH];
char home_dir[DIR_MAX_LENGTH];
file_list_t *list = (file_list_t*)data;
enum msg_hash_enums enum_idx = load_content ?
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR :

View File

@ -123,7 +123,7 @@ static void salamander_init(char *s, size_t len)
const char *rarch_config_path = g_defaults.path_config;
bool config_valid = false;
char config_path[PATH_MAX_LENGTH];
char config_dir[PATH_MAX_LENGTH];
char config_dir[DIR_MAX_LENGTH];
config_dir[0] = '\0';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2011-2020 - Daniel De Matteis
* Copyright (C) 2019-2020 - James Leaver
* Copyright (C) 2020 - trngaje
*
*
* 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.
@ -63,7 +63,7 @@
* font file is missing */
bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
{
char font_dir[PATH_MAX_LENGTH];
char font_dir[DIR_MAX_LENGTH];
char font_path[PATH_MAX_LENGTH];
const char *font_file = NULL;
void *bitmap_raw = NULL;

View File

@ -4,7 +4,7 @@
* Copyright (C) 2019-2020 - James Leaver
* Copyright (C) 2020-2022 - trngaje
* Copyright (C) 2022 - Michael Burgardt
*
*
* 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.
@ -50,7 +50,7 @@
* font file is missing */
bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
{
char font_dir[PATH_MAX_LENGTH];
char font_dir[DIR_MAX_LENGTH];
char font_path[PATH_MAX_LENGTH];
const char *font_file = NULL;
void *bitmap_raw = NULL;

View File

@ -39,14 +39,15 @@
* content_label field (for internal use only) */
static void gfx_thumbnail_fill_content_img(char *s, size_t len, const char *src, bool shorten)
{
const char* cut = " (";
const char *cut = " (";
char *scrub_char_ptr = NULL;
/* Copy source label string */
size_t _len = strlcpy(s, src, len);
int bracketpos = -1;
/* Shortening logic: up to first space + bracket */
if (shorten) {
if (shorten)
{
bracketpos = string_find_index_substring_string(src, cut);
if (bracketpos > 0)
_len = bracketpos;
@ -491,13 +492,13 @@ bool gfx_thumbnail_set_content_playlist(
content_name_no_ext = path_remove_extension(tmp_buf);
if (!content_name_no_ext)
content_name_no_ext = tmp_buf;
gfx_thumbnail_fill_content_img(path_data->content_img_full,
sizeof(path_data->content_img_full), content_name_no_ext,false);
gfx_thumbnail_fill_content_img(path_data->content_img,
sizeof(path_data->content_img), path_data->content_label,false);
/* Explicit zero if full name is same as standard name - saves some queries later. */
if(strcmp(path_data->content_img, path_data->content_img_full) == 0)
if(strcmp(path_data->content_img, path_data->content_img_full) == 0)
{
path_data->content_img_full[0] = '\0';
}
@ -532,9 +533,9 @@ bool gfx_thumbnail_set_content_playlist(
char *db_name_no_ext = NULL;
char tmp_buf[PATH_MAX_LENGTH];
const char* pos = strchr(db_name, '|');
if (pos && (size_t) (pos - db_name)+1 < sizeof(tmp_buf)) {
/* If db_name comes from core info, and there are multiple
/* If db_name comes from core info, and there are multiple
* databases mentioned separated by |, use only first one */
strlcpy(tmp_buf, db_name, (size_t) (pos - db_name)+1);
}
@ -569,14 +570,14 @@ bool gfx_thumbnail_set_content_playlist(
bool gfx_thumbnail_set_icon_playlist(
gfx_thumbnail_path_data_t *path_data, playlist_t *playlist, size_t idx)
{
char content_dir[DIR_MAX_LENGTH];
const char *content_path = NULL;
const char *content_label = NULL;
const char *core_name = NULL;
const char *db_name = NULL;
const struct playlist_entry *entry = NULL;
char content_dir[PATH_MAX_LENGTH];
const char *dir_thumbnails = NULL;
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = NULL;
settings_t *settings = config_get_ptr();
if (!path_data)
return false;
@ -642,13 +643,12 @@ bool gfx_thumbnail_set_icon_playlist(
/* Determine content image name */
{
char* content_name_no_ext = NULL;
char tmp_buf[PATH_MAX_LENGTH];
char* content_name_no_ext = NULL;
/* Remove rom file extension
* > path_remove_extension() requires a char * (not const)
* so have to use a temporary buffer... */
const char* base_name = path_basename(path_data->content_path);
const char* base_name = path_basename(path_data->content_path);
strlcpy(tmp_buf, base_name, sizeof(tmp_buf));
content_name_no_ext = path_remove_extension(tmp_buf);
if (!content_name_no_ext)
@ -659,7 +659,7 @@ bool gfx_thumbnail_set_icon_playlist(
gfx_thumbnail_fill_content_img(path_data->content_img,
sizeof(path_data->content_img), path_data->content_label,false);
/* Explicit zero if full name is same as standard name - saves some queries later. */
if(strcmp(path_data->content_img, path_data->content_img_full) == 0)
if(strcmp(path_data->content_img, path_data->content_img_full) == 0)
{
path_data->content_img_full[0] = '\0';
}
@ -696,11 +696,11 @@ bool gfx_thumbnail_set_icon_playlist(
const char* pos = strchr(db_name, '|');
if (pos && (size_t) (pos - db_name)+1 < sizeof(tmp_buf)) {
/* If db_name comes from core info, and there are multiple
/* If db_name comes from core info, and there are multiple
* databases mentioned separated by |, use only first one */
strlcpy(tmp_buf, db_name, (size_t) (pos - db_name)+1);
}
else
else
{
/* Remove .lpl extension
* > path_remove_extension() requires a char * (not const)
@ -741,7 +741,7 @@ bool gfx_thumbnail_update_path(
gfx_thumbnail_path_data_t *path_data,
enum gfx_thumbnail_id thumbnail_id)
{
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *system_name = NULL;
char *thumbnail_path = NULL;
@ -849,7 +849,7 @@ bool gfx_thumbnail_update_path(
/* Try alternative file extensions in turn, if wanted */
for( i=1 ;
settings->bools.playlist_allow_non_png &&
!thumbnail_found &&
!thumbnail_found &&
thumbnail_path[0]!='\0' &&
i<MAX_SUPPORTED_THUMBNAIL_EXTENSIONS ; i++ )
{
@ -866,7 +866,7 @@ bool gfx_thumbnail_update_path(
}
for( i=1 ;
settings->bools.playlist_allow_non_png &&
!thumbnail_found &&
!thumbnail_found &&
i<MAX_SUPPORTED_THUMBNAIL_EXTENSIONS ; i++ )
{
strlcpy(path_get_extension_mutable(thumbnail_path),SUPPORTED_THUMBNAIL_EXTENSIONS[i],6);
@ -882,13 +882,13 @@ bool gfx_thumbnail_update_path(
}
for( i=1 ;
settings->bools.playlist_allow_non_png &&
!thumbnail_found &&
!thumbnail_found &&
i<MAX_SUPPORTED_THUMBNAIL_EXTENSIONS ; i++ )
{
strlcpy(path_get_extension_mutable(thumbnail_path),SUPPORTED_THUMBNAIL_EXTENSIONS[i],6);
thumbnail_found = path_is_valid(thumbnail_path);
}
/* This logic is valid for locally stored thumbnails. For optional downloads,
/* This logic is valid for locally stored thumbnails. For optional downloads,
* gfx_thumbnail_get_img_name() is used */
}

View File

@ -119,7 +119,7 @@ enum disp_widget_flags_enum
DISPWIDG_FLAG_NEGATIVE = (1 << 9)
};
/* There can only be one message animation at a time to
/* There can only be one message animation at a time to
* avoid confusing users */
enum dispgfx_widget_flags
{
@ -246,7 +246,7 @@ typedef struct dispgfx_widget
uint8_t flags;
char assets_pkg_dir[PATH_MAX_LENGTH];
char assets_pkg_dir[DIR_MAX_LENGTH];
char xmb_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from XMB */
char ozone_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
char ozone_regular_font_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
@ -254,7 +254,7 @@ typedef struct dispgfx_widget
char monochrome_png_path[PATH_MAX_LENGTH];
char gfx_widgets_path[PATH_MAX_LENGTH];
char gfx_widgets_status_text[255];
char gfx_widgets_status_text[NAME_MAX_LENGTH];
bool active;
} dispgfx_widget_t;

View File

@ -46,7 +46,7 @@ static void crt_adjust_sr_ini(videocrt_switch_t *p_switch);
/* Global local variables */
static bool ini_overrides_loaded = false;
static char core_name[NAME_MAX_LENGTH]; /* Same size as library_name on retroarch_data.h */
static char content_dir[PATH_MAX_LENGTH];
static char content_dir[DIR_MAX_LENGTH];
#if defined(HAVE_VIDEOCORE) /* Need to add video core to SR2 */
#include "include/userland/interface/vmcs_host/vc_vchi_gencmd.h"
@ -292,7 +292,7 @@ static void switch_res_crt(
int monitor_index, int super_width)
{
char current_core_name[NAME_MAX_LENGTH];
char current_content_dir[PATH_MAX_LENGTH];
char current_content_dir[DIR_MAX_LENGTH];
int flags = 0, ret;
const char *err_msg = NULL;
int w = native_width;
@ -458,7 +458,7 @@ void crt_switch_res_core(
void crt_adjust_sr_ini(videocrt_switch_t *p_switch)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char switchres_ini_override_file[PATH_MAX_LENGTH];
if (p_switch->sr2_active)

View File

@ -354,7 +354,7 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
softfilter_get_implementation_t cb;
const struct softfilter_implementation *impl = NULL;
struct rarch_soft_plug *new_plugs = NULL;
dylib_t lib =
dylib_t lib =
dylib_load(list->elems[i].data);
if (!lib)
@ -419,7 +419,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
{
softfilter_simd_mask_t cpu_features = (softfilter_simd_mask_t)cpu_features_get();
#ifdef HAVE_DYLIB
char basedir[PATH_MAX_LENGTH];
char basedir[DIR_MAX_LENGTH];
char ext_name[16];
#endif
struct string_list *plugs = NULL;

View File

@ -228,7 +228,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
{
case RARCH_WILDCARD_CONTENT_DIR:
{
char content_dir_name[PATH_MAX_LENGTH] = "";
char content_dir_name[DIR_MAX_LENGTH] = "";
const char* rarch_path_basename = path_get(RARCH_PATH_BASENAME);
if (rarch_path_basename)
fill_pathname_parent_dir_name(content_dir_name,
@ -335,7 +335,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
break;
case RARCH_WILDCARD_PRESET_DIR:
{
char preset_dir_name[PATH_MAX_LENGTH];
char preset_dir_name[DIR_MAX_LENGTH];
fill_pathname_parent_dir_name(preset_dir_name, in_preset_path, sizeof(preset_dir_name));
if (string_is_not_equal_fast(preset_dir_name, "", sizeof("")))
strlcpy(preset_dir_name, path_basename_nocompression(preset_dir_name), sizeof(preset_dir_name));
@ -1406,7 +1406,7 @@ static bool video_shader_write_referenced_preset(
bool ret = false;
bool continue_saving_ref = true;
char *new_preset_basedir = strdup(path_to_save);
char *config_dir = (char*)malloc(PATH_MAX_LENGTH);
char *config_dir = (char*)malloc(DIR_MAX_LENGTH);
char *relative_tmp_ref_path = (char*)malloc(PATH_MAX_LENGTH);
char *abs_tmp_ref_path = (char*)malloc(PATH_MAX_LENGTH);
char *path_to_ref = (char*)malloc(PATH_MAX_LENGTH);
@ -1426,7 +1426,7 @@ static bool video_shader_write_referenced_preset(
* loaded presets are located
* and where Save Game Preset, Save Core Preset,
* Save Global Preset save to */
fill_pathname_application_special(config_dir, PATH_MAX_LENGTH,
fill_pathname_application_special(config_dir, DIR_MAX_LENGTH,
APPLICATION_SPECIAL_DIRECTORY_CONFIG);
/* If there is no initial preset path loaded */
@ -2831,9 +2831,9 @@ static bool video_shader_load_auto_shader_preset(settings_t *settings, const cha
size_t i = 0;
char shader_path[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_file_directory[PATH_MAX_LENGTH];
char old_presets_directory[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char config_file_directory[DIR_MAX_LENGTH];
char old_presets_directory[DIR_MAX_LENGTH];
shader_path[0] = '\0';
content_dir_name[0] = '\0';

View File

@ -98,7 +98,7 @@ struct gfx_widget_load_content_animation_state
char content_name[512];
char system_name[512];
char icon_directory[PATH_MAX_LENGTH];
char icon_directory[DIR_MAX_LENGTH];
char icon_file[PATH_MAX_LENGTH];
bool has_icon;
@ -390,7 +390,7 @@ bool gfx_widget_start_load_content_animation(void)
/* If content was found in playlist but the entry
* did not have a db_name, use playlist name itself
* as the system name */
if ( playlist_entry_found
if ( playlist_entry_found
&& !has_system)
{
const char *playlist_path = playlist_get_conf_path(playlist);
@ -539,7 +539,7 @@ static void gfx_widget_load_content_animation_layout(
/* > Note: cannot determine state->icon_x_end
* until text strings are set */
/* Background layout */
/* Background layout */
state->bg_width = last_video_width;
state->bg_height = state->icon_size + (widget_padding * 2);
state->bg_x = 0.0f;
@ -1021,7 +1021,7 @@ static bool gfx_widget_load_content_animation_init(
gfx_animation_t *p_anim,
bool video_is_threaded, bool fullscreen)
{
gfx_widget_load_content_animation_state_t *state =
gfx_widget_load_content_animation_state_t *state =
&p_w_load_content_animation_st;
state->p_disp = p_disp;

View File

@ -15,6 +15,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <retro_miscellaneous.h>
#include "../gfx_widgets.h"
#include "../gfx_animation.h"
#include "../gfx_display.h"
@ -92,8 +94,8 @@ static void gfx_widget_volume_frame(void* data, void *user_data)
if (state->alpha > 0.0f)
{
char msg[255];
char percentage_msg[255];
char msg[NAME_MAX_LENGTH];
char percentage_msg[NAME_MAX_LENGTH];
video_frame_info_t *video_info = (video_frame_info_t*)data;
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data;
gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular;
@ -126,8 +128,8 @@ static void gfx_widget_volume_frame(void* data, void *user_data)
* that extends below the baseline, so we shift
* the text down by the font descender to achieve
* better spacing */
unsigned volume_text_y = (bar_y / 2.0f)
+ font_regular->line_centre_offset
unsigned volume_text_y = (bar_y / 2.0f)
+ font_regular->line_centre_offset
+ font_regular->line_descender;
msg[0] = '\0';
@ -218,7 +220,7 @@ static void gfx_widget_volume_frame(void* data, void *user_data)
gfx_widgets_draw_text(font_regular,
text,
state->widget_width / 2,
state->widget_height / 2.0f
state->widget_height / 2.0f
+ font_regular->line_centre_offset,
video_width, video_height,
text_color, TEXT_ALIGN_CENTER,

View File

@ -66,7 +66,7 @@ typedef struct
unsigned frame;
unsigned action;
unsigned param_num;
char param_str[255];
char param_str[NAME_MAX_LENGTH];
bool handled;
} input_test_step_t;
@ -107,7 +107,7 @@ static bool KTifJSONObjectEndHandler(void* context)
input_test_steps[current_test_step].frame = input_test_steps[current_test_step-1].frame + 60;
else
input_test_steps[current_test_step].frame = pCtx->frame;
input_test_steps[current_test_step].action = pCtx->action;
input_test_steps[current_test_step].param_num = pCtx->param_num;
input_test_steps[current_test_step].handled = false;
@ -118,7 +118,7 @@ static bool KTifJSONObjectEndHandler(void* context)
sizeof(input_test_steps[current_test_step].param_str));
else
input_test_steps[current_test_step].param_str[0] = '\0';
current_test_step++;
last_test_step = current_test_step;
pCtx->frame = 0xffff;
@ -197,7 +197,7 @@ static bool input_test_file_read(const char* file_path)
RARCH_DBG("[Test input driver]: No test input file supplied.\n");
return false;
}
/* Attempt to open test input file */
file = filestream_open(
file_path,
@ -374,7 +374,7 @@ static void* test_input_init(const char *joypad_driver)
input_test_file_read(settings->paths.test_input_file_general);
if (last_test_step > MAX_TEST_STEPS)
last_test_step = 0;
/* No need for keyboard mapping look-up table */
/* input_keymaps_init_keyboard_lut(rarch_key_map_test);*/
return (void*)-1;
@ -407,7 +407,7 @@ static void test_input_poll(void *data)
video_driver_state_t *video_st = video_state_get_ptr();
uint64_t curr_frame = video_st->frame_count;
unsigned i;
for (i=0; i<last_test_step; i++)
{
if (!input_test_steps[i].handled && curr_frame > input_test_steps[i].frame)

View File

@ -540,7 +540,7 @@ typedef struct udev_input_device
#endif
enum udev_input_dev_type type; /* Type of this device */
char devnode[NAME_MAX_LENGTH]; /* Device node path */
char ident[255]; /* Identifier of the device */
char ident[NAME_MAX_LENGTH]; /* Identifier of the device */
} udev_input_device_t;
typedef void (*device_handle_cb)(void *data,

View File

@ -26,6 +26,7 @@
#include <compat/strl.h>
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../connect/joypad_connection.h"
#include "../input_defines.h"
@ -63,8 +64,8 @@ struct libusb_adapter
int endpoint_in_max_size;
int endpoint_out_max_size;
uint8_t manufacturer_name[255];
uint8_t name[255];
uint8_t manufacturer_name[NAME_MAX_LENGTH];
uint8_t name[NAME_MAX_LENGTH];
uint8_t data[2048];
int slot;
@ -523,11 +524,11 @@ static int16_t libusb_hid_joypad_state(
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
if (
(uint16_t)joykey != NO_BTN
(uint16_t)joykey != NO_BTN
&& libusb_hid_joypad_button(data, port_idx, (uint16_t)joykey))
ret |= ( 1 << i);
else if (joyaxis != AXIS_NONE &&
((float)abs(libusb_hid_joypad_axis(data, port_idx, joyaxis))
((float)abs(libusb_hid_joypad_axis(data, port_idx, joyaxis))
/ 0x8000) > joypad_info->axis_threshold)
ret |= (1 << i);
}

View File

@ -30,6 +30,7 @@
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include <formats/rjson.h>
#include <retro_miscellanous.h>
#include "../../config.def.h"
#include "../../verbosity.h"
@ -66,7 +67,7 @@ typedef struct
unsigned frame;
unsigned action;
unsigned param_num;
char param_str[255];
char param_str[NAME_MAX_LENGTH];
bool handled;
} input_test_step_t;
@ -107,7 +108,7 @@ static bool JTifJSONObjectEndHandler(void* context)
input_test_steps[current_test_step].frame = input_test_steps[current_test_step-1].frame + 60;
else
input_test_steps[current_test_step].frame = pCtx->frame;
input_test_steps[current_test_step].action = pCtx->action;
input_test_steps[current_test_step].param_num = pCtx->param_num;
input_test_steps[current_test_step].handled = false;
@ -118,7 +119,7 @@ static bool JTifJSONObjectEndHandler(void* context)
sizeof(input_test_steps[current_test_step].param_str));
else
input_test_steps[current_test_step].param_str[0] = '\0';
current_test_step++;
last_test_step = current_test_step;
pCtx->frame = 0xffff;
@ -197,7 +198,7 @@ static bool input_test_file_read(const char* file_path)
RARCH_DBG("[Test joypad driver]: No test input file supplied.\n");
return false;
}
/* Attempt to open test input file */
file = filestream_open(
file_path,
@ -322,7 +323,7 @@ static void *test_joypad_init(void *data)
{
settings_t *settings = config_get_ptr();
unsigned i;
input_test_file_read(settings->paths.test_input_file_joypad);
if (last_test_step > MAX_TEST_STEPS)
last_test_step = 0;
@ -353,7 +354,7 @@ static int32_t test_joypad_button(unsigned port_num, uint16_t joykey)
return 0;
}
static int16_t test_joypad_axis(unsigned port_num, uint32_t joyaxis)
static int16_t test_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
/*RARCH_DBG("test_joypad_axis %d / %u\n",port_num, joyaxis);*/
if (port_num >= DEFAULT_MAX_PADS)
@ -372,7 +373,7 @@ static int16_t test_joypad_axis(unsigned port_num, uint32_t joyaxis)
return val;
}
return 0;
}
static int16_t test_joypad_state(
@ -399,7 +400,7 @@ static int16_t test_joypad_state(
}
}
}
return ret;
}
@ -410,7 +411,7 @@ static void test_joypad_poll(void)
video_driver_state_t *video_st = video_state_get_ptr();
uint64_t curr_frame = video_st->frame_count;
unsigned i;
for (i=0; i<last_test_step; i++)
{
if (!input_test_steps[i].handled && curr_frame > input_test_steps[i].frame)

View File

@ -204,7 +204,7 @@ struct bsv_movie
size_t frame_ptr;
size_t min_file_pos;
size_t state_size;
bsv_key_data_t key_events[255]; /* uint32_t alignment */
bsv_key_data_t key_events[NAME_MAX_LENGTH]; /* uint32_t alignment */
/* Staging variables for keyboard events */
uint8_t key_event_count;
@ -257,7 +257,7 @@ typedef struct
char joypad_driver[32];
char name[128];
char display_name[128];
char config_name[256]; /* Base name of the RetroArch config file */
char config_name[NAME_MAX_LENGTH]; /* Base name of the RetroArch config file */
bool autoconfigured;
} input_device_info_t;
@ -280,7 +280,7 @@ struct input_remote
typedef struct
{
char display_name[256];
char display_name[NAME_MAX_LENGTH];
} input_mouse_info_t;
typedef struct input_remote input_remote_t;

View File

@ -1060,14 +1060,14 @@ size_t fill_pathname_expand_special(char *out_path,
char *app_dir = NULL;
if (in_path[0] == '~')
{
app_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
fill_pathname_home_dir(app_dir, PATH_MAX_LENGTH * sizeof(char));
app_dir = (char*)malloc(DIR_MAX_LENGTH * sizeof(char));
fill_pathname_home_dir(app_dir, DIR_MAX_LENGTH * sizeof(char));
}
else if (in_path[0] == ':')
{
app_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
app_dir = (char*)malloc(DIR_MAX_LENGTH * sizeof(char));
app_dir[0] = '\0';
fill_pathname_application_dir(app_dir, PATH_MAX_LENGTH * sizeof(char));
fill_pathname_application_dir(app_dir, DIR_MAX_LENGTH * sizeof(char));
}
if (app_dir)
@ -1103,8 +1103,8 @@ size_t fill_pathname_abbreviate_special(char *out_path,
unsigned i;
const char *candidates[3];
const char *notations[3];
char application_dir[PATH_MAX_LENGTH];
char home_dir[PATH_MAX_LENGTH];
char application_dir[DIR_MAX_LENGTH];
char home_dir[DIR_MAX_LENGTH];
application_dir[0] = '\0';
@ -1353,7 +1353,7 @@ void fill_pathname_application_path(char *s, size_t len)
/* This needs to be done so that the path becomes
* /private/var/... and this
* is used consistently throughout for the iOS bundle path */
char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
char resolved_bundle_dir_buf[DIR_MAX_LENGTH] = {0};
if (realpath(s, resolved_bundle_dir_buf))
{
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);

View File

@ -57,7 +57,7 @@ struct content_m3u_file
/* File Initialisation / De-Initialisation */
/* Reads M3U file contents from disk
* - Does nothing if file does not exist
* - Does nothing if file does not exist
* - Returns false in the event of an error */
static bool m3u_file_load(m3u_file_t *m3u_file)
{
@ -473,7 +473,7 @@ bool m3u_file_save(
{
RFILE *file = NULL;
size_t i;
char base_dir[PATH_MAX_LENGTH];
char base_dir[DIR_MAX_LENGTH];
base_dir[0] = '\0';

View File

@ -123,24 +123,39 @@ static INLINE bool bits_any_different(uint32_t *a, uint32_t *b, uint32_t count)
return false;
}
#ifndef PATH_MAX_LENGTH
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(__PSL1GHT__) || defined(__PS3__) || defined(HAVE_EMSCRIPTEN)
#define PATH_MAX_LENGTH 512
#else
/**
* An upper limit for the length of a path (including the filename).
* If a path is longer than this, it may not work properly.
* This value may vary by platform.
*/
#define PATH_MAX_LENGTH 4096
#endif
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(__PSL1GHT__) || defined(__PS3__) || defined(HAVE_EMSCRIPTEN)
#ifndef PATH_MAX_LENGTH
#define PATH_MAX_LENGTH 512
#endif
#ifndef DIR_MAX_LENGTH
#define DIR_MAX_LENGTH 256
#endif
#else
#ifndef PATH_MAX_LENGTH
#define PATH_MAX_LENGTH 2048
#endif
#ifndef DIR_MAX_LENGTH
#define DIR_MAX_LENGTH 1024
#endif
#endif
#ifndef NAME_MAX_LENGTH
/**
* An upper limit for the length of a file or directory (excluding parent directories).
* If a path has a component longer than this, it may not work properly.
*/
#ifndef NAME_MAX_LENGTH
#define NAME_MAX_LENGTH 256
#endif

View File

@ -135,7 +135,7 @@ int main(int argc, char *argv[])
string_is_empty(out_file_path))
{
const char *in_file_name = path_basename(in_file_path);
char in_file_dir[PATH_MAX_LENGTH];
char in_file_dir[DIR_MAX_LENGTH];
in_file_dir[0] = '\0';

View File

@ -42,11 +42,11 @@ typedef struct
enum manual_content_scan_system_name_type system_name_type;
enum manual_content_scan_core_type core_type;
char content_dir[PATH_MAX_LENGTH];
char system_name_content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
char system_name_content_dir[DIR_MAX_LENGTH];
char system_name_database[PATH_MAX_LENGTH];
char system_name_custom[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char core_name[NAME_MAX_LENGTH];
char core_path[PATH_MAX_LENGTH];
char file_exts_core[PATH_MAX_LENGTH];
char file_exts_custom[PATH_MAX_LENGTH];
@ -523,7 +523,7 @@ enum manual_content_scan_playlist_refresh_status
core_type = MANUAL_CONTENT_SCAN_CORE_DETECT;
enum manual_content_scan_playlist_refresh_status
playlist_status = MANUAL_CONTENT_SCAN_PLAYLIST_REFRESH_OK;
char system_name[PATH_MAX_LENGTH];
char system_name[NAME_MAX_LENGTH];
system_name[0] = '\0';
@ -593,9 +593,7 @@ enum manual_content_scan_playlist_refresh_status
{
const char *rdb_path = rdb_list->elems[i].data;
const char *rdb_file = NULL;
char rdb_name[PATH_MAX_LENGTH];
rdb_name[0] = '\0';
char rdb_name[NAME_MAX_LENGTH];
/* Sanity check */
if (string_is_empty(rdb_path))
@ -856,9 +854,7 @@ struct string_list *manual_content_scan_get_menu_system_name_list(
{
const char *rdb_path = rdb_list->elems[i].data;
const char *rdb_file = NULL;
char rdb_name[PATH_MAX_LENGTH];
rdb_name[0] = '\0';
char rdb_name[NAME_MAX_LENGTH];
/* Sanity check */
if (string_is_empty(rdb_path))

View File

@ -83,7 +83,7 @@ enum manual_content_scan_playlist_refresh_status
typedef struct
{
char playlist_file[PATH_MAX_LENGTH];
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
char system_name[PATH_MAX_LENGTH];
char database_name[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];

View File

@ -417,7 +417,7 @@ GENERIC_DEFERRED_CURSOR_MANAGER(deferred_push_cursor_manager_list_deferred_query
static int general_push(menu_displaylist_info_t *info,
unsigned id, enum menu_displaylist_ctl_state state)
{
char newstr2[PATH_MAX_LENGTH];
char newstr2[PATH_MAX_LENGTH*2];
size_t _len = 0;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_state_get_ptr()->driver_data;

View File

@ -625,7 +625,7 @@ int generic_action_ok_displaylist_push(
{
menu_displaylist_info_t info;
char tmp[PATH_MAX_LENGTH];
char parent_dir[PATH_MAX_LENGTH];
char parent_dir[DIR_MAX_LENGTH];
enum menu_displaylist_ctl_state dl_type = DISPLAYLIST_NONE;
const char *menu_label = NULL;
const char *menu_path = NULL;
@ -1357,7 +1357,7 @@ int generic_action_ok_displaylist_push(
break;
case ACTION_OK_DL_RGUI_MENU_THEME_PRESET:
{
char rgui_assets_dir[PATH_MAX_LENGTH];
char rgui_assets_dir[DIR_MAX_LENGTH];
filebrowser_clear_type();
info.type = type;
@ -1970,6 +1970,9 @@ static int file_load_with_detect_core_wrapper(
{
menu_content_ctx_defer_info_t def_info;
#if IOS
char tmp_path[PATH_MAX_LENGTH];
#endif
char menu_path_new[PATH_MAX_LENGTH];
char new_core_path[PATH_MAX_LENGTH];
const char *menu_path = NULL;
@ -1980,7 +1983,6 @@ static int file_load_with_detect_core_wrapper(
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL, NULL);
#if IOS
char tmp_path[PATH_MAX_LENGTH];
if (menu_path)
{
fill_pathname_expand_special(tmp_path, menu_path, sizeof(tmp_path));
@ -3644,7 +3646,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
unsigned action_type)
{
#ifdef HAVE_CONFIGFILE
char content_dir_name[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char remap_file_path[PATH_MAX_LENGTH];
struct menu_state *menu_st = menu_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
@ -4019,7 +4021,7 @@ static int action_ok_path_scan_directory(const char *path,
static int action_ok_path_manual_scan_directory(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
const char *flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MANUAL_CONTENT_SCAN_LIST);
unsigned flush_type = 0;
const char *menu_path = NULL;
@ -4042,7 +4044,7 @@ static int action_ok_path_manual_scan_directory(const char *path,
* can start with /private and this ensures the path starts with it.
* This will allow the path to be properly substituted when
* fill_pathname_expand_special() is called. */
char tmp_dir[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
tmp_dir[0] = '\0';
fill_pathname_expand_special(tmp_dir, content_dir, sizeof(content_dir));
realpath(tmp_dir, content_dir);
@ -4537,8 +4539,8 @@ static int action_ok_cheat_copy_after(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
int i;
struct item_cheat tmp;
char msg[256];
struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr();
unsigned int new_size = cheat_manager_get_size() + 1;
@ -4940,8 +4942,8 @@ finish:
STRLEN_CONST(FILE_PATH_INDEX_DIRS_URL)
))
{
char parent_dir[PATH_MAX_LENGTH];
char parent_dir_encoded[PATH_MAX_LENGTH];
char parent_dir[DIR_MAX_LENGTH];
char parent_dir_encoded[DIR_MAX_LENGTH];
file_transfer_t *transf = NULL;
parent_dir_encoded[0] = '\0';
@ -5150,7 +5152,7 @@ void cb_generic_download(retro_task_t *task,
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
{
static char shaderdir[PATH_MAX_LENGTH] = {0};
static char shaderdir[DIR_MAX_LENGTH] = {0};
const char *dirname = NULL;
const char *dir_video_shader = settings->paths.directory_video_shader;
@ -5695,17 +5697,16 @@ static int action_ok_add_to_favorites(const char *path,
* > If content path is empty, cannot do anything... */
if (!string_is_empty(content_path))
{
union string_list_elem_attr attr;
char core_path[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char content_label[PATH_MAX_LENGTH];
runloop_state_t *runloop_st = runloop_state_get_ptr();
struct retro_system_info *sysinfo = &runloop_st->system.info;
struct string_list *str_list = NULL;
const char *crc32 = NULL;
const char *db_name = NULL;
union string_list_elem_attr attr;
char content_label[PATH_MAX_LENGTH];
char core_path[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
core_path[0] = '\0';
core_name[0] = '\0';

View File

@ -48,6 +48,9 @@ void handle_dbscan_finished(retro_task_t *task,
int action_scan_file(const char *path,
const char *label, unsigned type, size_t idx)
{
#if IOS
char dir_path[DIR_MAX_LENGTH];
#endif
char fullpath[PATH_MAX_LENGTH];
const char *menu_path = NULL;
settings_t *settings = config_get_ptr();
@ -58,7 +61,6 @@ int action_scan_file(const char *path,
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
#if IOS
char dir_path[PATH_MAX_LENGTH];
fill_pathname_expand_special(dir_path, menu_path, sizeof(dir_path));
menu_path = dir_path;
#endif
@ -78,6 +80,9 @@ int action_scan_file(const char *path,
int action_scan_directory(const char *path,
const char *label, unsigned type, size_t idx)
{
#if IOS
char dir_path[DIR_MAX_LENGTH];
#endif
char fullpath[PATH_MAX_LENGTH];
const char *menu_path = NULL;
settings_t *settings = config_get_ptr();
@ -88,7 +93,6 @@ int action_scan_directory(const char *path,
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
#if IOS
char dir_path[PATH_MAX_LENGTH];
fill_pathname_expand_special(dir_path, menu_path, sizeof(dir_path));
menu_path = dir_path;
#endif

View File

@ -516,8 +516,8 @@ typedef struct
float delay_timer;
float alpha;
char str[MENU_SUBLABEL_MAX_LENGTH];
char runtime_fallback_str[255];
char last_played_fallback_str[255];
char runtime_fallback_str[NAME_MAX_LENGTH];
char last_played_fallback_str[NAME_MAX_LENGTH];
} materialui_status_bar_t;
/* Contains the file path(s) and texture pointer
@ -683,8 +683,8 @@ typedef struct materialui_handle
char sysicons_path[PATH_MAX_LENGTH];
char icons_path[PATH_MAX_LENGTH];
char msgbox[1024];
char menu_title[255];
char fullscreen_thumbnail_label[255];
char menu_title[NAME_MAX_LENGTH];
char fullscreen_thumbnail_label[NAME_MAX_LENGTH];
} materialui_handle_t;
static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha)
@ -4257,7 +4257,7 @@ static void materialui_render_menu_entry_default(
int value_x_offset = 0;
uint32_t entry_value_color = 0;
unsigned entry_value_width_max = (usable_width / 2) - mui->margin;
char value_buf[255];
char value_buf[NAME_MAX_LENGTH];
value_buf[0] = '\0';
@ -4378,7 +4378,7 @@ static void materialui_render_menu_entry_default(
if (!string_is_empty(entry_label))
{
int label_width = usable_width;
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -4603,7 +4603,7 @@ static void materialui_render_menu_entry_playlist_list(
/* Draw entry label */
if (!string_is_empty(entry_label))
{
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -4780,7 +4780,7 @@ static void materialui_render_menu_entry_playlist_dual_icon(
(float)mui->font_data.list.line_centre_offset;
bool draw_text_outside = (x_offset != 0);
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -4891,7 +4891,7 @@ static void materialui_render_menu_entry_playlist_desktop(
/* Draw entry label */
if (!string_is_empty(entry_label))
{
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -5684,7 +5684,7 @@ static void materialui_render_header(
unsigned video_width, unsigned video_height,
math_matrix_4x4 *mymat)
{
char menu_title_buf[255];
char menu_title_buf[NAME_MAX_LENGTH];
size_t menu_title_margin = 0;
int usable_sys_bar_width = (int)video_width - (int)mui->nav_bar_layout_width;
int usable_title_bar_width = usable_sys_bar_width;
@ -5919,8 +5919,8 @@ static void materialui_render_header(
/* > Draw core name, if required */
if (menu_core_enable)
{
char core_title[255];
char core_title_buf[255];
char core_title[NAME_MAX_LENGTH];
char core_title_buf[NAME_MAX_LENGTH];
core_title[0] = '\0';
core_title_buf[0] = '\0';
@ -7199,7 +7199,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
if (menu_input_dialog_get_display_kb())
{
size_t _len;
char msg[255];
char msg[NAME_MAX_LENGTH];
struct menu_state *menu_st = menu_state_get_ptr();
const char *str = menu_input_dialog_get_buffer();
const char *label = menu_st->input_dialog_kb_label;
@ -11046,7 +11046,7 @@ static void materialui_list_insert(
for (i = 0; i < MAX_USERS; i++)
{
char val[255];
char val[NAME_MAX_LENGTH];
unsigned user_value = i + 1;
size_t _len = snprintf(val, sizeof(val), "%d", user_value);
strlcpy(val + _len,

View File

@ -624,7 +624,7 @@ struct ozone_handle
char icons_path[PATH_MAX_LENGTH];
char icons_path_default[PATH_MAX_LENGTH];
char tab_path[PATH_MAX_LENGTH];
char fullscreen_thumbnail_label[255];
char fullscreen_thumbnail_label[NAME_MAX_LENGTH];
/* These have to be huge, because runloop_st->name.savestate
* has a hard-coded size of 8192...
@ -633,10 +633,10 @@ struct ozone_handle
char savestate_thumbnail_file_path[8204];
char prev_savestate_thumbnail_file_path[8204];
char selection_core_name[255];
char selection_playtime[255];
char selection_lastplayed[255];
char selection_entry_enumeration[255];
char selection_core_name[NAME_MAX_LENGTH];
char selection_playtime[NAME_MAX_LENGTH];
char selection_lastplayed[NAME_MAX_LENGTH];
char selection_entry_enumeration[NAME_MAX_LENGTH];
char thumbnails_left_status_prev;
char thumbnails_right_status_prev;
@ -2822,7 +2822,7 @@ static bool ozone_reset_theme_textures(ozone_handle_t *ozone)
"cursor_static.png"
};
unsigned i, j;
char theme_path[255];
char theme_path[NAME_MAX_LENGTH];
bool result = true;
for (j = 0; j < ARRAY_SIZE(ozone_themes); j++)
@ -3283,7 +3283,7 @@ static void ozone_draw_sidebar(
};
size_t y;
int entry_width;
char console_title[255];
char console_title[NAME_MAX_LENGTH];
unsigned i, sidebar_height;
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
@ -4085,7 +4085,7 @@ static void ozone_go_to_sidebar(
#endif
}
static void linebreak_after_colon(char (*str)[255])
static void linebreak_after_colon(char (*str)[NAME_MAX_LENGTH])
{
char *delim = (char*)strchr(*str, ':');
if (delim)
@ -4852,7 +4852,7 @@ static void ozone_init_horizontal_list(
for (i = 0; i < list_size; i++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
char *console_name = NULL;
const char *playlist_file = ozone->horizontal_list.list[i].path;
@ -5744,8 +5744,8 @@ border_iterate:
for (i = 0; i < entries_end; i++)
{
char rich_label[255];
char entry_value_ticker[255];
char rich_label[NAME_MAX_LENGTH];
char entry_value_ticker[NAME_MAX_LENGTH];
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
uintptr_t texture;
menu_entry_t entry;
@ -5900,7 +5900,7 @@ border_iterate:
/* Ignore Explore Views */
for (offset = 0; offset < ozone->horizontal_list.size; offset++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
strlcpy(playlist_file_noext, ozone->horizontal_list.list[offset].path, sizeof(playlist_file_noext));
path_remove_extension(playlist_file_noext);
if (string_is_equal(playlist_file_noext, entry.rich_label))
@ -6415,7 +6415,7 @@ static void ozone_draw_thumbnail_bar(
if ( (!(ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER))
&& (!show_left_thumbnail || !show_right_thumbnail || (ozone->animations.left_thumbnail_alpha < 1.0f)))
{
char ticker_buf[255];
char ticker_buf[NAME_MAX_LENGTH];
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
@ -7766,7 +7766,7 @@ static bool INLINE ozone_fullscreen_thumbnails_available(ozone_handle_t *ozone,
static bool ozone_help_available(ozone_handle_t *ozone, size_t current_selection, bool menu_show_sublabels)
{
menu_entry_t last_entry;
char help_msg[255];
char help_msg[NAME_MAX_LENGTH];
help_msg[0] = '\0';
MENU_ENTRY_INITIALIZE(last_entry);
@ -10393,7 +10393,7 @@ static void ozone_draw_header(
bool timedate_enable,
math_matrix_4x4 *mymat)
{
char title[255];
char title[NAME_MAX_LENGTH];
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
@ -11183,8 +11183,8 @@ static void ozone_draw_footer(
{
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
char core_title[255];
char core_title_buf[255];
char core_title[NAME_MAX_LENGTH];
char core_title_buf[NAME_MAX_LENGTH];
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
int usable_width;
unsigned ticker_x_offset = 0;

View File

@ -337,7 +337,7 @@ typedef struct
ssize_t playlist_index;
uint8_t settings_selection_ptr;
size_t playlist_selection_ptr;
size_t playlist_selection[255];
size_t playlist_selection[NAME_MAX_LENGTH];
int16_t scroll_y;
rgui_colors_t colors; /* int16_t alignment */
@ -351,11 +351,11 @@ typedef struct
char savestate_thumbnail_file_path[8204];
char prev_savestate_thumbnail_file_path[8204];
char menu_title[NAME_MAX_LENGTH]; /* Must be a fixed length array... */
char msgbox[1024];
char theme_preset_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char theme_dynamic_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char last_theme_dynamic_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char menu_title[255]; /* Must be a fixed length array... */
char menu_sublabel[MENU_SUBLABEL_MAX_LENGTH]; /* Must be a fixed length array... */
} rgui_t;
@ -4666,7 +4666,7 @@ static void rgui_render_osk(
/* This can never happen, but have to make sure...
* If OSK cannot physically fit on the screen,
* fallback to old style 'message box' implementation */
char msg[255];
char msg[NAME_MAX_LENGTH];
size_t _len = strlcpy(msg, input_label, sizeof(msg));
msg[ _len] = '\n';
msg[++_len] = '\0';
@ -4731,7 +4731,7 @@ static void rgui_render_osk(
/* Draw input label text */
if (!string_is_empty(input_label))
{
char input_label_buf[255];
char input_label_buf[NAME_MAX_LENGTH];
unsigned input_label_length;
int input_label_x, input_label_y;
unsigned ticker_x_offset = 0;
@ -5189,7 +5189,7 @@ static void rgui_render(
* this is better than switching back to the text playlist
* view, which causes ugly flickering when scrolling quickly
* through a list...) */
char thumbnail_title_buf[255];
char thumbnail_title_buf[NAME_MAX_LENGTH];
unsigned title_x, title_width;
const char *thumbnail_title = NULL;
struct menu_state *menu_st = menu_state_get_ptr();
@ -5275,10 +5275,10 @@ static void rgui_render(
{
/* Render usual text */
size_t selection = menu_st->selection_ptr;
char title_buf[255];
size_t title_max_len;
size_t title_len;
unsigned title_x;
char title_buf[NAME_MAX_LENGTH];
unsigned title_y = rgui->term_layout.start_y - rgui->font_height_stride;
unsigned term_end_x = rgui->term_layout.start_x + (rgui->term_layout.width * rgui->font_width_stride);
unsigned timedate_x = term_end_x - (5 * rgui->font_width_stride);
@ -5446,8 +5446,8 @@ static void rgui_render(
for (i = new_start; i < end; i++, y += rgui->font_height_stride)
{
char entry_title_buf[255];
char type_str_buf[255];
char entry_title_buf[NAME_MAX_LENGTH];
char type_str_buf[NAME_MAX_LENGTH];
menu_entry_t entry;
const char *entry_value = NULL;
size_t entry_title_max_len = 0;

View File

@ -284,7 +284,7 @@ enum xmb_pending_thumbnail_type
XMB_PENDING_THUMBNAIL_ICONS
};
typedef struct
typedef struct
{
gfx_thumbnail_path_data_t thumbnail_path_data;
gfx_thumbnail_t icon;
@ -426,8 +426,8 @@ typedef struct xmb_handle
uint8_t system_tab_end;
uint8_t tabs[XMB_SYSTEM_TAB_MAX_LENGTH];
char title_name[255];
char title_name_alt[255];
char title_name[NAME_MAX_LENGTH];
char title_name_alt[NAME_MAX_LENGTH];
/* Cached texts showing current entry index / current list size */
char entry_index_str[32];
@ -439,7 +439,7 @@ typedef struct xmb_handle
* warnings...) */
char savestate_thumbnail_file_path[8204];
char prev_savestate_thumbnail_file_path[8204];
char fullscreen_thumbnail_label[255];
char fullscreen_thumbnail_label[NAME_MAX_LENGTH];
bool allow_horizontal_animation;
bool allow_dynamic_wallpaper;
@ -1532,9 +1532,9 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
}
static void xmb_set_dynamic_icon_content(
void *xmb_handle_ptr,
const char *s,
size_t selection,
void *xmb_handle_ptr,
const char *s,
size_t selection,
xmb_icons_t *thumbnail_icon)
{
xmb_handle_t *xmb = (xmb_handle_t*)xmb_handle_ptr;
@ -2309,7 +2309,7 @@ static void xmb_populate_dynamic_icons(xmb_handle_t *xmb)
xmb_set_dynamic_icon_content(xmb, NULL, i, thumbnail_icon);
gfx_thumbnail_cancel_pending_requests();
}
}
}
}
}
@ -2482,7 +2482,7 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb)
/* Loop through list and set console names */
for (i = 0; i < xmb->horizontal_list.size; i++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
char *console_name = NULL;
const char *playlist_file = xmb->horizontal_list.list[i].path;
@ -4374,7 +4374,7 @@ static int xmb_draw_item(
float icon_x, icon_y, label_offset, gfx_icon_x, gfx_icon_y, gfx_icon_height, gfx_icon_width;
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
char tmp[255];
char tmp[NAME_MAX_LENGTH];
unsigned ticker_x_offset = 0;
const char *ticker_str = NULL;
unsigned entry_type = 0;
@ -4852,7 +4852,7 @@ static int xmb_draw_item(
/* Ignore Explore Views */
for (offset = 0; offset < xmb->horizontal_list.size; offset++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
strlcpy(playlist_file_noext, xmb->horizontal_list.list[offset].path, sizeof(playlist_file_noext));
path_remove_extension(playlist_file_noext);
if (string_is_equal(playlist_file_noext, entry.rich_label))
@ -4880,7 +4880,7 @@ static int xmb_draw_item(
case XMB_SYSTEM_TAB_MAIN:
{
/* Special fall-through for "Load Content" > Playlists > Favorites */
char title[255];
char title[NAME_MAX_LENGTH];
menu_entries_get_title(title, sizeof(title));
if (string_is_equal(title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES)))
; /* no-op */
@ -4947,14 +4947,14 @@ static int xmb_draw_item(
gfx_icon_height = gfx_icon_width = xmb->icon_size;
show_icon_thumbnail =
(xmb->is_playlist
(xmb->is_playlist
&& gfx_thumbnail_is_enabled(&node->thumbnail_icon.thumbnail_path_data, GFX_THUMBNAIL_ICON)
&& (node->thumbnail_icon.icon.status == GFX_THUMBNAIL_STATUS_AVAILABLE));
if (show_icon_thumbnail)
{
texture = node->thumbnail_icon.icon.texture;
gfx_icon_width = gfx_icon_height = (xmb->icon_size * 1.8);
gfx_icon_width = gfx_icon_height = (xmb->icon_size * 1.8);
gfx_thumbnail_get_draw_dimensions(
&node->thumbnail_icon.icon,
@ -5521,9 +5521,9 @@ static bool xmb_load_dynamic_icon(const char *icon_path,
if(gfx_display_reset_icon_texture(
icon_path,
&icon->texture,
TEXTURE_FILTER_MIPMAP_LINEAR,
&width,
&icon->texture,
TEXTURE_FILTER_MIPMAP_LINEAR,
&width,
&height))
{
icon->width = width;
@ -5747,7 +5747,7 @@ static void xmb_render(void *data,
}
}
}
/* Handle any pending icon thumbnail load requests */
if (xmb->thumbnails.pending_icons != XMB_PENDING_THUMBNAIL_NONE)
{
@ -6286,7 +6286,7 @@ static void xmb_draw_fullscreen_thumbnails(
/* Title text */
if (menu_ticker_smooth)
{
char title_buf[255];
char title_buf[NAME_MAX_LENGTH];
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
int title_x = 0;
unsigned ticker_x_offset = 0;
@ -6447,8 +6447,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
math_matrix_4x4 mymat;
unsigned i;
char msg[1024];
char title_msg[255];
char title_truncated[255];
char title_msg[NAME_MAX_LENGTH];
char title_truncated[NAME_MAX_LENGTH];
gfx_thumbnail_shadow_t thumbnail_shadow;
size_t selection = 0;
size_t percent_width = 0;
@ -6898,7 +6898,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
video_height,
shadows_enable,
xmb->icon_size,
xmb->icon_size,
xmb->icon_size,
xmb->textures.list[
powerstate.charging? XMB_TEXTURE_BATTERY_CHARGING :
(powerstate.percent > 80)? XMB_TEXTURE_BATTERY_FULL :
@ -7137,7 +7137,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
{
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
char tmp[255];
char tmp[NAME_MAX_LENGTH];
size_t tmp_len = (video_width - xmb->margins_title_left - xmb->icon_size - title_header_max_width);
unsigned ticker_x_offset = 0;
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;

View File

@ -167,7 +167,7 @@ void menu_contentless_cores_set_runtime(const char *core_id,
if ( !contentless_cores_state
|| !contentless_cores_state->info_entries
|| !runtime_info
|| !runtime_info
|| string_is_empty(core_id))
return;
@ -264,7 +264,7 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
{
size_t i;
char icon_path[PATH_MAX_LENGTH];
char icon_directory[PATH_MAX_LENGTH];
char icon_directory[DIR_MAX_LENGTH];
bool rgba_supported = video_driver_supports_rgba();
core_info_list_t *core_info_list = NULL;

View File

@ -491,7 +491,7 @@ static int filebrowser_parse(
dir_list_append(str_list, "/private/var", NULL, true, false, false, false);
if (str_list->size <= 0)
{
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
fill_pathname_application_dir(dir, sizeof(dir));
if (string_ends_with(full_path, "/") && !string_ends_with(dir, "/"))
strlcat(dir, "/", sizeof(dir));
@ -1679,7 +1679,7 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
* to the displaylist */
if (core_is_pending)
{
char entry_alt_text[256];
char entry_alt_text[NAME_MAX_LENGTH];
size_t _len = strlcpy(entry_alt_text, detect_core_str,
sizeof(entry_alt_text));
entry_alt_text[ _len] = ' ';
@ -1784,8 +1784,8 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
static unsigned menu_displaylist_parse_system_info(file_list_t *list)
{
char entry[256];
char tmp[128];
char entry[NAME_MAX_LENGTH];
unsigned count = 0;
/* RetroArch Version */
@ -2369,7 +2369,7 @@ static int menu_displaylist_parse_playlist(
}
else if (!string_is_empty(info_path))
{
char lpl_basename[256];
char lpl_basename[NAME_MAX_LENGTH];
fill_pathname_base(lpl_basename, info_path, sizeof(lpl_basename));
path_remove_extension(lpl_basename);
menu_driver_set_thumbnail_system(
@ -2406,7 +2406,7 @@ static int menu_displaylist_parse_playlist(
for (i = 0; i < list_size; i++)
{
char menu_entry_label[256];
char menu_entry_label[NAME_MAX_LENGTH];
const struct playlist_entry *entry = NULL;
const char *entry_path = NULL;
bool entry_valid = true;
@ -3483,7 +3483,7 @@ static int menu_displaylist_parse_horizontal_list(
playlist_t *playlist = NULL;
if (!string_is_empty(item->path))
{
char lpl_basename[256];
char lpl_basename[NAME_MAX_LENGTH];
char path_playlist[PATH_MAX_LENGTH];
const char *dir_playlist = settings->paths.directory_playlist;
@ -4404,7 +4404,7 @@ static unsigned menu_displaylist_parse_cores(
menu_displaylist_info_t *info)
{
size_t i, list_size;
char out_dir[PATH_MAX_LENGTH];
char out_dir[DIR_MAX_LENGTH];
struct string_list *str_list = NULL;
unsigned count = 0;
const char *path = info->path;
@ -4568,7 +4568,7 @@ static unsigned menu_displaylist_parse_cores(
if (type == FILE_TYPE_CORE)
{
char core_path[PATH_MAX_LENGTH];
char display_name[256];
char display_name[NAME_MAX_LENGTH];
display_name[0] = '\0';
fill_pathname_join_special(core_path, dir, path, sizeof(core_path));
@ -4878,7 +4878,7 @@ static unsigned menu_displaylist_parse_pl_thumbnail_download_list(
for (i = 0; i < str_list->size; i++)
{
char path_base[PATH_MAX_LENGTH];
char path_base[NAME_MAX_LENGTH];
const char *path;
if (str_list->elems[i].attr.i == FILE_TYPE_DIRECTORY)
@ -4913,8 +4913,8 @@ static unsigned menu_displaylist_parse_content_information(
menu_handle_t *menu, settings_t *settings, file_list_t *info_list)
{
char tmp[8192];
char core_name[256];
char content_label[256];
char core_name[NAME_MAX_LENGTH];
char content_label[NAME_MAX_LENGTH];
playlist_t *playlist = playlist_get_cached();
unsigned idx = menu->rpl_entry_selection_ptr;
const struct playlist_entry *entry = NULL;
@ -5549,7 +5549,7 @@ static int menu_displaylist_parse_input_select_reserved_device_list(
file_list_t *info_list, const char *info_path,
settings_t *settings)
{
char device_label[256];
char device_label[NAME_MAX_LENGTH];
const char *val_disabled = NULL;
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info_path);
struct menu_state *menu_st = menu_state_get_ptr();
@ -5823,7 +5823,7 @@ static int menu_displaylist_parse_input_description_list(
* this button */
if (!string_is_empty(input_desc_btn))
{
char input_description[256];
char input_description[NAME_MAX_LENGTH];
/* > Up to RARCH_FIRST_CUSTOM_BIND, inputs
* are buttons - description can be used
* directly
@ -5974,7 +5974,7 @@ static int menu_displaylist_parse_input_description_kbd_list(
/* Loop over keyboard keys */
for (i = 0; i < RARCH_MAX_KEYS; i++)
{
char input_description[256];
char input_description[NAME_MAX_LENGTH];
unsigned key_id = key_descriptors[i].key;
const char *key_label = key_descriptors[i].desc;
@ -6445,7 +6445,7 @@ static int menu_displaylist_parse_disc_info(file_list_t *info_list,
for (i = 0; list && i < list->size; i++)
{
char drive[2];
char drive_string[256] = {0};
char drive_string[NAME_MAX_LENGTH] = {0};
size_t pos = snprintf(drive_string, sizeof(drive_string),
msg_drive_number, i + 1);
pos += snprintf(drive_string + pos,
@ -6822,8 +6822,8 @@ unsigned menu_displaylist_build_list(
{
case DISPLAYLIST_OPTIONS_OVERRIDES:
{
char config_directory[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char override_path[PATH_MAX_LENGTH];
runloop_state_t *runloop_st = runloop_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_st->system;
@ -7797,7 +7797,7 @@ unsigned menu_displaylist_build_list(
for (p = 0; p < max_users; p++)
{
char val_s[256], val_d[16];
char val_s[NAME_MAX_LENGTH], val_d[16];
snprintf(val_s, sizeof(val_s),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS),
p+1);
@ -8143,7 +8143,7 @@ unsigned menu_displaylist_build_list(
if (net_ifinfo_new(&interfaces))
{
size_t i;
char buf[768];
char buf[1024];
const char *msg_intf = msg_hash_to_str(MSG_INTERFACE);
size_t _len = strlcpy(buf, msg_intf, sizeof(buf));
@ -8351,7 +8351,7 @@ unsigned menu_displaylist_build_list(
{
for (i = 0; i < size; i++)
{
char val_d[256], str[256];
char val_d[NAME_MAX_LENGTH], str[NAME_MAX_LENGTH];
/* If there is exact refresh rate available, use it */
if (video_list[i].refreshrate_float > 0.0f)
snprintf(str, sizeof(str), "%dx%d (%.3f Hz)%s%s",
@ -11742,12 +11742,12 @@ static unsigned menu_displaylist_build_shader_parameter(
val_d,
MENU_ENUM_LABEL_NO_ITEMS,
setting_type,
i, entry_type, NULL);
i, entry_type, NULL);
count = 1;
checked = 1.0;
checked_found = true;
}
else
}
else
{
for (i = 0; current_value < (max + 0.0001f); i++)
{
@ -12326,7 +12326,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.system))
{
char system[256];
char system[NAME_MAX_LENGTH];
/* TODO/FIXME - Localize */
size_t _len = strlcpy(system, "System: ", sizeof(system));
strlcpy(system + _len, cd_info.system, sizeof(system) - _len);
@ -12341,7 +12341,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.serial))
{
char serial[256];
char serial[NAME_MAX_LENGTH];
size_t _len = strlcpy(serial,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL),
sizeof(serial));
@ -12358,7 +12358,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.version))
{
char version[256];
char version[NAME_MAX_LENGTH];
/* TODO/FIXME - localize */
size_t _len = strlcpy(version, "Version: ", sizeof(version));
strlcpy(version + _len, cd_info.version, sizeof(version) - _len);
@ -12373,7 +12373,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.release_date))
{
char release_date[256];
char release_date[NAME_MAX_LENGTH];
/* TODO/FIXME - Localize */
size_t _len = strlcpy(release_date, "Release Date: ",
sizeof(release_date));
@ -15413,7 +15413,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
if (setting->get_string_representation)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
strlcpy(setting->value.target.string, tok, setting->size);
setting->get_string_representation(setting,
val_s, sizeof(val_s));
@ -15479,7 +15479,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.integer = val;
setting->get_string_representation(setting,
@ -15557,7 +15557,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max + half_step; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
*setting->value.target.fraction = i;
setting->get_string_representation(setting,
val_s, sizeof(val_s));
@ -15632,7 +15632,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.unsigned_integer = val;
setting->get_string_representation(setting,
@ -15809,7 +15809,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.integer = val;
setting->get_string_representation(setting,
@ -15886,7 +15886,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
*setting->value.target.fraction = i;
setting->get_string_representation(setting,
val_s, sizeof(val_s));
@ -15960,7 +15960,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.unsigned_integer = val;
setting->get_string_representation(setting,

View File

@ -367,7 +367,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation)
{
bool path_enabled;
char newpath[255];
char newpath[NAME_MAX_LENGTH];
const char *path = NULL;
const char *entry_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
@ -2979,7 +2979,7 @@ static bool menu_shader_manager_save_preset_internal(
}
else
{
char basedir[PATH_MAX_LENGTH];
char basedir[DIR_MAX_LENGTH];
for (i = 0; i < num_target_dirs; i++)
{
@ -3040,7 +3040,7 @@ bool menu_shader_manager_save_preset(const struct video_shader *shader,
const char *dir_menu_config,
bool apply)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
const char *preset_dirs[3] = {0};
settings_t *settings = config_get_ptr();
@ -3074,8 +3074,8 @@ static bool menu_shader_manager_operate_auto_preset(
const char *dir_menu_config,
enum auto_shader_type type, bool apply)
{
char old_presets_directory[PATH_MAX_LENGTH];
char config_directory[PATH_MAX_LENGTH];
char old_presets_directory[DIR_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char tmp[PATH_MAX_LENGTH];
char file[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
@ -7177,7 +7177,7 @@ static int generic_menu_iterate(
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE)))
{
char current_sublabel[255];
char current_sublabel[NAME_MAX_LENGTH];
menu_driver_get_current_menu_sublabel(
menu_st,
current_sublabel, sizeof(current_sublabel));
@ -7718,7 +7718,7 @@ int generic_menu_entry_action(
{
char current_label[128];
char current_value[128];
char title_name[255];
char title_name[NAME_MAX_LENGTH];
char speak_string[512];
speak_string[0] = '\0';

View File

@ -28,6 +28,7 @@
#include <retro_common_api.h>
#include <formats/image.h>
#include <queues/task_queue.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
@ -431,10 +432,9 @@ typedef struct
enum rarch_shader_type preset_type;
enum rarch_shader_type pass_type;
char preset_dir[PATH_MAX_LENGTH];
char pass_dir[DIR_MAX_LENGTH];
char preset_dir[DIR_MAX_LENGTH];
char preset_file_name[PATH_MAX_LENGTH];
char pass_dir[PATH_MAX_LENGTH];
char pass_file_name[PATH_MAX_LENGTH];
} last_shader_selection;
#endif
@ -443,7 +443,7 @@ typedef struct
* loaded via the menu file browser */
struct
{
char directory[PATH_MAX_LENGTH];
char directory[DIR_MAX_LENGTH];
char file_name[PATH_MAX_LENGTH];
} last_start_content;
@ -523,7 +523,7 @@ struct menu_state
char pending_selection[PATH_MAX_LENGTH];
/* Storage container for current menu datetime
* representation string */
char datetime_cache[255];
char datetime_cache[NAME_MAX_LENGTH];
/* Filled with current content path when a core calls
* RETRO_ENVIRONMENT_SHUTDOWN. Value is required in
* generic_menu_entry_action(), and must be cached

View File

@ -21,6 +21,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#include <lists/file_list.h>
@ -113,11 +114,11 @@ typedef struct menu_entry
uint8_t setting_type;
uint8_t flags;
char sublabel[MENU_SUBLABEL_MAX_LENGTH];
char path[255];
char label[255];
char rich_label[255];
char value[255];
char password_value[255];
char path[NAME_MAX_LENGTH];
char label[NAME_MAX_LENGTH];
char rich_label[NAME_MAX_LENGTH];
char value[NAME_MAX_LENGTH];
char password_value[NAME_MAX_LENGTH];
} menu_entry_t;
typedef struct menu_file_list_cbs

View File

@ -9517,7 +9517,7 @@ static bool setting_append_list_input_player_options(
* 2 is the length of '99'; we don't need more users than that.
*/
static char buffer[MAX_USERS][13+2+1];
static char group_label[MAX_USERS][255];
static char group_label[MAX_USERS][NAME_MAX_LENGTH];
unsigned i, j;
rarch_setting_group_info_t group_info;
rarch_setting_group_info_t subgroup_info;
@ -15976,8 +15976,8 @@ static bool setting_append_list(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS);
for (user = 0; user < MAX_USERS; user++)
{
static char binds_list[MAX_USERS][255];
static char binds_label[MAX_USERS][255];
static char binds_list[MAX_USERS][NAME_MAX_LENGTH];
static char binds_label[MAX_USERS][NAME_MAX_LENGTH];
unsigned user_value = user + 1;
size_t _len = snprintf(binds_list[user], sizeof(binds_list[user]), "%d", user_value);
strlcpy(binds_list[user] + _len, "_input_binds_list", sizeof(binds_list[user]) - _len);

View File

@ -706,7 +706,7 @@ static void webdav_do_update(bool success, webdav_cb_state_t *webdav_cb_st)
static bool webdav_update(const char *path, RFILE *rfile, cloud_sync_complete_handler_t cb, void *user_data)
{
webdav_cb_state_t *webdav_cb_st = (webdav_cb_state_t*)calloc(1, sizeof(webdav_cb_state_t));
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
/* TODO: if !settings->bools.cloud_sync_destructive, should move to deleted/ first */
@ -824,7 +824,7 @@ static bool webdav_delete(const char *path, cloud_sync_complete_handler_t cb, vo
}
else
{
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
size_t _len = strlcpy(dir, "deleted/", sizeof(dir));
fill_pathname_basedir(dir + _len, path, sizeof(dir) - _len);
webdav_ensure_dir(dir, webdav_do_backup, webdav_cb_st);

View File

@ -295,7 +295,7 @@ static bool connmanctl_connection_info(void *data, wifi_network_info_t *netinfo)
return true;
}
}
return false;
}
@ -311,7 +311,7 @@ static bool connmanctl_disconnect_ssid(void *data,
netinfo->netid);
pclose(popen(connman->command, "r"));
/* Refresh the state since it has definitely changed */
connmanctl_refresh_services(connman);
@ -323,18 +323,18 @@ static bool connmanctl_connect_ssid(
{
unsigned i;
char netid[160];
char settings_dir[PATH_MAX_LENGTH];
char settings_dir[DIR_MAX_LENGTH];
char settings_path[PATH_MAX_LENGTH];
bool success = false;
connman_t *connman = (connman_t*)data;
settings_t *settings = config_get_ptr();
static struct string_list* list = NULL;
#ifdef HAVE_GFX_WIDGETS
bool widgets_active =
bool widgets_active =
connman->connmanctl_widgets_supported;
#endif
strlcpy(netid, netinfo->netid, sizeof(netid));
fill_pathname_join_special(settings_dir, LAKKA_CONNMAN_DIR,
fill_pathname_join_special(settings_dir, LAKKA_CONNMAN_DIR,
netid, sizeof(settings_dir));
path_mkdir(settings_dir);
@ -394,7 +394,7 @@ static bool connmanctl_connect_ssid(
/* Refresh status to reflect the updated state */
connmanctl_refresh_services(connman);
/* connman is a PITA, return code is not meaningful at all :( */
for (i = 0; i < RBUF_LEN(connman->scan.net_list); i++)
{

View File

@ -1334,7 +1334,7 @@ bool playlist_push(playlist_t *playlist,
if (string_is_empty(core_name))
{
static char base_path[255] = {0};
static char base_path[NAME_MAX_LENGTH] = {0};
fill_pathname_base(base_path, real_core_path, sizeof(base_path));
path_remove_extension(base_path);

View File

@ -151,9 +151,9 @@ typedef struct
bool old_format;
bool compress;
bool fuzzy_archive_match;
bool autofix_paths;
bool autofix_paths;
char path[PATH_MAX_LENGTH];
char base_content_directory[PATH_MAX_LENGTH];
char base_content_directory[DIR_MAX_LENGTH];
} playlist_config_t;
/* Convenience function: copies specified playlist
@ -303,7 +303,7 @@ void playlist_update_runtime(playlist_t *playlist, size_t idx,
const struct playlist_entry *update_entry,
bool register_update);
void playlist_update_thumbnail_name_flag(playlist_t *playlist, size_t idx,
void playlist_update_thumbnail_name_flag(playlist_t *playlist, size_t idx,
enum playlist_thumbnail_name_flags thumbnail_flags);
enum playlist_thumbnail_name_flags playlist_get_next_thumbnail_name_flag(playlist_t *playlist, size_t idx);
enum playlist_thumbnail_name_flags playlist_get_curr_thumbnail_name_flag(playlist_t *playlist, size_t idx);

View File

@ -1,164 +1,165 @@
#ifndef _RECORD_DRIVER_H
#define _RECORD_DRIVER_H
#include <boolean.h>
enum ffemu_pix_format
{
FFEMU_PIX_RGB565 = 0,
FFEMU_PIX_BGR24,
FFEMU_PIX_ARGB8888
};
enum streaming_mode
{
STREAMING_MODE_TWITCH = 0,
STREAMING_MODE_YOUTUBE,
STREAMING_MODE_FACEBOOK,
STREAMING_MODE_LOCAL,
STREAMING_MODE_CUSTOM
};
enum record_config_type
{
RECORD_CONFIG_TYPE_RECORDING_CUSTOM = 0,
RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST,
RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_GIF,
RECORD_CONFIG_TYPE_RECORDING_APNG,
RECORD_CONFIG_TYPE_STREAMING_CUSTOM,
RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_NETPLAY
};
/* Parameters passed to ffemu_new() */
struct record_params
{
/* Framerate per second of input video. */
double fps;
/* Sample rate of input audio. */
double samplerate;
/* Filename to dump to. */
const char *filename;
/* Path to config. Optional. */
const char *config;
const char *audio_resampler;
/* Desired output resolution. */
unsigned out_width;
unsigned out_height;
/* Total size of framebuffer used in input. */
unsigned fb_width;
unsigned fb_height;
/* Audio channels. */
unsigned channels;
unsigned video_record_scale_factor;
unsigned video_stream_scale_factor;
unsigned video_record_threads;
unsigned streaming_mode;
/* Aspect ratio of input video. Parameters are passed to the muxer,
* the video itself is not scaled.
*/
float aspect_ratio;
enum record_config_type preset;
/* Input pixel format. */
enum ffemu_pix_format pix_fmt;
bool video_gpu_record;
};
struct record_video_data
{
const void *data;
unsigned width;
unsigned height;
int pitch;
bool is_dupe;
};
struct record_audio_data
{
const void *data;
size_t frames;
};
typedef struct record_driver
{
void *(*init)(const struct record_params *params);
void (*free)(void *data);
bool (*push_video)(void *data,
const struct record_video_data *video_data);
bool (*push_audio)(void *data,
const struct record_audio_data *audio_data);
bool (*finalize)(void *data);
const char *ident;
} record_driver_t;
struct recording
{
const record_driver_t *driver;
void *data;
size_t gpu_width;
size_t gpu_height;
unsigned width;
unsigned height;
char path[8192];
char config[8192];
char output_dir[8192];
char config_dir[8192];
bool enable;
bool streaming_enable;
bool use_output_dir;
};
typedef struct recording recording_state_t;
/**
* config_get_record_driver_options:
*
* Get an enumerated list of all record driver names, separated by '|'.
*
* Returns: string listing of all record driver names, separated by '|'.
**/
const char* config_get_record_driver_options(void);
void recording_driver_update_streaming_url(void);
bool recording_deinit(void);
/**
* recording_init:
*
* Initializes recording.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool recording_init(void);
void streaming_set_state(bool state);
recording_state_t *recording_state_get_ptr(void);
extern const record_driver_t *record_drivers[];
#endif
#ifndef _RECORD_DRIVER_H
#define _RECORD_DRIVER_H
#include <boolean.h>
#include <retro_miscellaneous.h>
enum ffemu_pix_format
{
FFEMU_PIX_RGB565 = 0,
FFEMU_PIX_BGR24,
FFEMU_PIX_ARGB8888
};
enum streaming_mode
{
STREAMING_MODE_TWITCH = 0,
STREAMING_MODE_YOUTUBE,
STREAMING_MODE_FACEBOOK,
STREAMING_MODE_LOCAL,
STREAMING_MODE_CUSTOM
};
enum record_config_type
{
RECORD_CONFIG_TYPE_RECORDING_CUSTOM = 0,
RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST,
RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_GIF,
RECORD_CONFIG_TYPE_RECORDING_APNG,
RECORD_CONFIG_TYPE_STREAMING_CUSTOM,
RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_NETPLAY
};
/* Parameters passed to ffemu_new() */
struct record_params
{
/* Framerate per second of input video. */
double fps;
/* Sample rate of input audio. */
double samplerate;
/* Filename to dump to. */
const char *filename;
/* Path to config. Optional. */
const char *config;
const char *audio_resampler;
/* Desired output resolution. */
unsigned out_width;
unsigned out_height;
/* Total size of framebuffer used in input. */
unsigned fb_width;
unsigned fb_height;
/* Audio channels. */
unsigned channels;
unsigned video_record_scale_factor;
unsigned video_stream_scale_factor;
unsigned video_record_threads;
unsigned streaming_mode;
/* Aspect ratio of input video. Parameters are passed to the muxer,
* the video itself is not scaled.
*/
float aspect_ratio;
enum record_config_type preset;
/* Input pixel format. */
enum ffemu_pix_format pix_fmt;
bool video_gpu_record;
};
struct record_video_data
{
const void *data;
unsigned width;
unsigned height;
int pitch;
bool is_dupe;
};
struct record_audio_data
{
const void *data;
size_t frames;
};
typedef struct record_driver
{
void *(*init)(const struct record_params *params);
void (*free)(void *data);
bool (*push_video)(void *data,
const struct record_video_data *video_data);
bool (*push_audio)(void *data,
const struct record_audio_data *audio_data);
bool (*finalize)(void *data);
const char *ident;
} record_driver_t;
struct recording
{
const record_driver_t *driver;
void *data;
size_t gpu_width;
size_t gpu_height;
unsigned width;
unsigned height;
char path[PATH_MAX_LENGTH];
char config[PATH_MAX_LENGTH];
char output_dir[DIR_MAX_LENGTH];
char config_dir[DIR_MAX_LENGTH];
bool enable;
bool streaming_enable;
bool use_output_dir;
};
typedef struct recording recording_state_t;
/**
* config_get_record_driver_options:
*
* Get an enumerated list of all record driver names, separated by '|'.
*
* Returns: string listing of all record driver names, separated by '|'.
**/
const char* config_get_record_driver_options(void);
void recording_driver_update_streaming_url(void);
bool recording_deinit(void);
/**
* recording_init:
*
* Initializes recording.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool recording_init(void);
void streaming_set_state(bool state);
recording_state_t *recording_state_get_ptr(void);
extern const record_driver_t *record_drivers[];
#endif

View File

@ -320,9 +320,9 @@ struct rarch_state
char path_config_append_file[PATH_MAX_LENGTH];
char path_config_override_file[PATH_MAX_LENGTH];
char path_core_options_file[PATH_MAX_LENGTH];
char dir_system[PATH_MAX_LENGTH];
char dir_savefile[PATH_MAX_LENGTH];
char dir_savestate[PATH_MAX_LENGTH];
char dir_system[DIR_MAX_LENGTH];
char dir_savefile[DIR_MAX_LENGTH];
char dir_savestate[DIR_MAX_LENGTH];
};
/* Forward declarations */
@ -2165,7 +2165,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
bool show_hidden_files)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
char ext_shaders[255];
char ext_shaders[256];
#endif
char ext_name[16];
const char *exts = NULL;
@ -6162,7 +6162,7 @@ static void retroarch_print_features(void)
static void retroarch_print_version(void)
{
char str[255];
char str[256];
str[0] = '\0';
frontend_driver_attach_console();

View File

@ -5,6 +5,7 @@
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -183,7 +184,7 @@ typedef struct rarch_system_info
unsigned rotation;
unsigned core_requested_rotation;
unsigned performance_level;
char valid_extensions[255];
char valid_extensions[256];
bool load_no_content;
bool supports_vfs;
} rarch_system_info_t;
@ -294,7 +295,7 @@ typedef struct global
} console;
char error_string[255];
char error_string[NAME_MAX_LENGTH];
uint8_t flags;
} global_t;
@ -343,7 +344,7 @@ typedef struct content_state
uint8_t flags;
char companion_ui_crc32[32];
char pending_subsystem_ident[255];
char pending_subsystem_ident[NAME_MAX_LENGTH];
char pending_rom_crc_path[PATH_MAX_LENGTH];
char companion_ui_db_name[PATH_MAX_LENGTH];
} content_state_t;

View File

@ -460,9 +460,9 @@ static bool runloop_environ_cb_get_system_info(unsigned cmd, void *data)
* the pointers are const char *
* (if we don't free them, we get a memory leak) */
if (!string_is_empty(subsys_info->desc))
free((char *)subsys_info->desc);
free((char*)subsys_info->desc);
if (!string_is_empty(subsys_info->ident))
free((char *)subsys_info->ident);
free((char*)subsys_info->ident);
subsys_info->desc = strdup(info[i].desc);
subsys_info->ident = strdup(info[i].ident);
subsys_info->id = info[i].id;
@ -478,11 +478,11 @@ static bool runloop_environ_cb_get_system_info(unsigned cmd, void *data)
* the pointers are const char *
* (if we don't free them, we get a memory leak) */
if (!string_is_empty(subsys_rom_info[j].desc))
free((char *)
free((char*)
subsys_rom_info[j].desc);
if (!string_is_empty(
subsys_rom_info[j].valid_extensions))
free((char *)
free((char*)
subsys_rom_info[j].valid_extensions);
subsys_rom_info[j].desc =
strdup(info[i].roms[j].desc);
@ -1080,7 +1080,7 @@ static bool validate_per_core_options(char *s,
size_t len, bool mkdir,
const char *core_name, const char *game_name)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
config_directory[0] = '\0';
if ( (!s)
@ -1147,7 +1147,7 @@ static bool validate_game_specific_options(char **output)
static bool validate_folder_options(
char *s, size_t len, bool mkdir)
{
char folder_name[PATH_MAX_LENGTH];
char folder_name[DIR_MAX_LENGTH];
runloop_state_t *runloop_st = &runloop_state;
const char *core_name = runloop_st->system.info.library_name;
const char *game_path = path_get(RARCH_PATH_BASENAME);
@ -5184,12 +5184,12 @@ void core_options_reset(void)
void core_options_flush(void)
{
size_t _len;
char msg[256];
runloop_state_t *runloop_st = &runloop_state;
core_option_manager_t *coreopts = runloop_st->core_options;
const char *path_core_options = path_get(RARCH_PATH_CORE_OPTIONS);
const char *core_options_file = NULL;
bool success = false;
char msg[256];
msg[0] = '\0';
@ -7921,11 +7921,11 @@ void runloop_path_set_redirect(settings_t *settings,
const char *old_savefile_dir,
const char *old_savestate_dir)
{
char content_dir_name[PATH_MAX_LENGTH];
char new_savefile_dir[PATH_MAX_LENGTH];
char new_savestate_dir[PATH_MAX_LENGTH];
char intermediate_savefile_dir[PATH_MAX_LENGTH];
char intermediate_savestate_dir[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char new_savefile_dir[DIR_MAX_LENGTH];
char new_savestate_dir[DIR_MAX_LENGTH];
char intermediate_savefile_dir[DIR_MAX_LENGTH];
char intermediate_savestate_dir[DIR_MAX_LENGTH];
runloop_state_t *runloop_st = &runloop_state;
struct retro_system_info *sysinfo = &runloop_st->system.info;
bool sort_savefiles_enable = settings->bools.sort_savefiles_enable;

934
runloop.h
View File

@ -1,467 +1,467 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2021 - 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/>.
*/
#ifndef __RUNLOOP_H
#define __RUNLOOP_H
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#include <libretro.h>
#include <dynamic/dylib.h>
#include <queues/message_queue.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_THREADS
#include <rthreads/rthreads.h>
#endif
#include "dynamic.h"
#include "configuration.h"
#include "core_option_manager.h"
#include "performance_counters.h"
#include "state_manager.h"
#ifdef HAVE_RUNAHEAD
#include "runahead.h"
#endif
#include "tasks/tasks_internal.h"
/* Arbitrary twenty subsystems limit */
#define SUBSYSTEM_MAX_SUBSYSTEMS 20
/* Arbitrary 10 roms for each subsystem limit */
#define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10
#ifdef HAVE_THREADS
#define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) slock_lock((runloop_st)->msg_queue_lock)
#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) slock_unlock((runloop_st)->msg_queue_lock)
#else
#define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) (void)(runloop_st)
#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) (void)(runloop_st)
#endif
#ifdef HAVE_BSV_MOVIE
#define BSV_MOVIE_IS_EOF() || (((input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END) && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_EOF_EXIT)))
#else
#define BSV_MOVIE_IS_EOF()
#endif
/* Time to exit out of the main loop?
* Reasons for exiting:
* a) Shutdown environment callback was invoked.
* b) Quit key was pressed.
* c) Frame count exceeds or equals maximum amount of frames to run.
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
#define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) ((runloop_state.flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED) || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
enum runloop_state_enum
{
RUNLOOP_STATE_ITERATE = 0,
RUNLOOP_STATE_POLLED_AND_SLEEP,
RUNLOOP_STATE_PAUSE,
RUNLOOP_STATE_MENU,
RUNLOOP_STATE_QUIT
};
enum poll_type_override_t
{
POLL_TYPE_OVERRIDE_DONTCARE = 0,
POLL_TYPE_OVERRIDE_EARLY,
POLL_TYPE_OVERRIDE_NORMAL,
POLL_TYPE_OVERRIDE_LATE
};
enum runloop_flags
{
RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT = (1 << 0),
RUNLOOP_FLAG_HAS_SET_CORE = (1 << 1),
RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT = (1 << 2),
RUNLOOP_FLAG_IGNORE_ENVIRONMENT_CB = (1 << 3),
RUNLOOP_FLAG_IS_SRAM_LOAD_DISABLED = (1 << 4),
RUNLOOP_FLAG_IS_SRAM_SAVE_DISABLED = (1 << 5),
RUNLOOP_FLAG_USE_SRAM = (1 << 6),
RUNLOOP_FLAG_PATCH_BLOCKED = (1 << 7),
RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE = (1 << 8),
RUNLOOP_FLAG_OVERRIDES_ACTIVE = (1 << 9),
RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE = (1 << 10),
RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE = (1 << 11),
RUNLOOP_FLAG_REMAPS_CORE_ACTIVE = (1 << 12),
RUNLOOP_FLAG_REMAPS_GAME_ACTIVE = (1 << 13),
RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE = (1 << 14),
RUNLOOP_FLAG_SHUTDOWN_INITIATED = (1 << 15),
RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED = (1 << 16),
RUNLOOP_FLAG_CORE_RUNNING = (1 << 17),
RUNLOOP_FLAG_AUTOSAVE = (1 << 18),
RUNLOOP_FLAG_HAS_VARIABLE_UPDATE = (1 << 19),
RUNLOOP_FLAG_INPUT_IS_DIRTY = (1 << 20),
RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN = (1 << 21),
RUNLOOP_FLAG_RUNAHEAD_AVAILABLE = (1 << 22),
RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE = (1 << 23),
RUNLOOP_FLAG_RUNAHEAD_FORCE_INPUT_DIRTY = (1 << 24),
RUNLOOP_FLAG_SLOWMOTION = (1 << 25),
RUNLOOP_FLAG_FASTMOTION = (1 << 26),
RUNLOOP_FLAG_PAUSED = (1 << 27),
RUNLOOP_FLAG_IDLE = (1 << 28),
RUNLOOP_FLAG_FOCUSED = (1 << 29),
RUNLOOP_FLAG_FORCE_NONBLOCK = (1 << 30),
RUNLOOP_FLAG_IS_INITED = (1 << 31)
};
/* Contains the current retro_fastforwarding_override
* parameters along with any pending updates triggered
* by RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE */
typedef struct fastmotion_overrides
{
struct retro_fastforwarding_override current;
struct retro_fastforwarding_override next;
bool pending;
} fastmotion_overrides_t;
typedef struct
{
unsigned priority;
float duration;
char str[128];
bool set;
} runloop_core_status_msg_t;
/* Contains all callbacks associated with
* core options.
* > At present there is only a single
* callback, 'update_display' - but we
* may wish to add more in the future
* (e.g. for directly informing a core of
* core option value changes, or getting/
* setting extended/non-standard option
* value data types) */
typedef struct core_options_callbacks
{
retro_core_options_update_display_callback_t update_display;
} core_options_callbacks_t;
struct runloop
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
rarch_timer_t shader_delay_timer; /* int64_t alignment */
#endif
retro_time_t core_runtime_last;
retro_time_t core_runtime_usec;
retro_time_t core_run_time;
retro_time_t frame_limit_minimum_time;
retro_time_t frame_limit_last_time;
retro_usec_t frame_time_last; /* int64_t alignment */
struct retro_core_t current_core; /* uint64_t alignment */
#if defined(HAVE_RUNAHEAD)
uint64_t runahead_last_frame_count; /* uint64_t alignment */
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
struct retro_core_t secondary_core; /* uint64_t alignment */
#endif
retro_ctx_load_content_info_t *load_content_info;
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
char *secondary_library_path;
#endif
my_list *runahead_save_state_list;
my_list *input_state_list;
preempt_t *preempt_data;
#endif
#ifdef HAVE_REWIND
struct state_manager_rewind_state rewind_st;
#endif
struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS];
bool *load_no_content_hook;
struct string_list *subsystem_fullpaths;
struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
struct retro_callbacks retro_ctx; /* ptr alignment */
msg_queue_t msg_queue; /* ptr alignment */
retro_input_poll_t input_poll_callback_original; /* ptr alignment */
retro_input_state_t input_state_callback_original; /* ptr alignment */
#ifdef HAVE_RUNAHEAD
function_t retro_reset_callback_original; /* ptr alignment */
function_t original_retro_deinit; /* ptr alignment */
function_t original_retro_unload; /* ptr alignment */
runahead_load_state_function
retro_unserialize_callback_original; /* ptr alignment */
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
struct retro_callbacks secondary_callbacks; /* ptr alignment */
#endif
#endif
#ifdef HAVE_THREADS
slock_t *msg_queue_lock;
#endif
content_state_t content_st; /* ptr alignment */
struct retro_subsystem_rom_info
subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS]
[SUBSYSTEM_MAX_SUBSYSTEM_ROMS]; /* ptr alignment */
core_option_manager_t *core_options;
core_options_callbacks_t core_options_callback;/* ptr alignment */
retro_keyboard_event_t key_event; /* ptr alignment */
retro_keyboard_event_t frontend_key_event; /* ptr alignment */
rarch_system_info_t system; /* ptr alignment */
struct retro_frame_time_callback frame_time; /* ptr alignment */
struct retro_audio_buffer_status_callback audio_buffer_status; /* ptr alignment */
#ifdef HAVE_DYNAMIC
dylib_t lib_handle; /* ptr alignment */
#endif
#if defined(HAVE_RUNAHEAD)
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
dylib_t secondary_lib_handle; /* ptr alignment */
#endif
size_t runahead_save_state_size;
#endif
size_t msg_queue_size;
#if defined(HAVE_RUNAHEAD)
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
int port_map[MAX_USERS];
#endif
#endif
runloop_core_status_msg_t core_status_msg;
unsigned msg_queue_delay;
unsigned pending_windowed_scale;
unsigned max_frames;
unsigned audio_latency;
unsigned fastforward_after_frames;
unsigned perf_ptr_libretro;
unsigned subsystem_current_count;
unsigned entry_state_slot;
unsigned video_swap_interval_auto;
fastmotion_overrides_t fastmotion_override; /* float alignment */
retro_bits_t has_set_libretro_device; /* uint32_t alignment */
enum rarch_core_type current_core_type;
enum rarch_core_type explicit_current_core_type;
enum poll_type_override_t core_poll_type_override;
#if defined(HAVE_RUNAHEAD)
enum rarch_core_type last_core_type;
#endif
uint32_t flags;
int8_t run_frames_and_pause;
char runtime_content_path_basename[8192];
char current_library_name[NAME_MAX_LENGTH];
char current_library_version[256];
char current_valid_extensions[256];
char subsystem_path[256];
#ifdef HAVE_SCREENSHOTS
char max_frames_screenshot_path[PATH_MAX_LENGTH];
#endif
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
char runtime_shader_preset_path[PATH_MAX_LENGTH];
#endif
char runtime_content_path[PATH_MAX_LENGTH];
char runtime_core_path[PATH_MAX_LENGTH];
char savefile_dir[PATH_MAX_LENGTH];
char savestate_dir[PATH_MAX_LENGTH];
struct
{
char *remapfile;
char savefile[8192];
char savestate[8192];
char replay[8192];
char cheatfile[8192];
char ups[8192];
char bps[8192];
char ips[8192];
char xdelta[8192];
char label[8192];
} name;
bool missing_bios;
bool perfcnt_enable;
};
typedef struct runloop runloop_state_t;
RETRO_BEGIN_DECLS
void runloop_path_fill_names(void);
/**
* runloop_environment_cb:
* @cmd : Identifier of command.
* @data : Pointer to data.
*
* Environment callback function implementation.
*
* Returns: true (1) if environment callback command could
* be performed, otherwise false (0).
**/
bool runloop_environment_cb(unsigned cmd, void *data);
void runloop_msg_queue_push(const char *msg,
unsigned prio, unsigned duration,
bool flush,
char *title,
enum message_queue_icon icon,
enum message_queue_category category);
void runloop_set_current_core_type(
enum rarch_core_type type, bool explicitly_set);
/**
* runloop_iterate:
*
* Run Libretro core in RetroArch for one frame.
*
* Returns: 0 on successful run,
* Returns 1 if we have to wait until button input in order
* to wake up the loop.
* Returns -1 if we forcibly quit out of the
* RetroArch iteration loop.
**/
int runloop_iterate(void);
void runloop_system_info_free(void);
/**
* libretro_get_system_info:
* @path : Path to libretro library.
* @info : Pointer to system info information.
* @load_no_content : If true, core should be able to auto-start
* without any content loaded.
*
* Gets system info from an arbitrary lib.
* The struct returned must be freed as strings are allocated dynamically.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool libretro_get_system_info(
const char *path,
struct retro_system_info *info,
bool *load_no_content);
void runloop_performance_counter_register(
struct retro_perf_counter *perf);
void runloop_runtime_log_deinit(
runloop_state_t *runloop_st,
bool content_runtime_log,
bool content_runtime_log_aggregate,
const char *dir_runtime_log,
const char *dir_playlist);
void runloop_event_deinit_core(void);
bool runloop_event_init_core(
settings_t *settings,
void *input_data,
enum rarch_core_type type,
const char *old_savefile_dir,
const char *old_savestate_dir
);
void runloop_pause_checks(void);
void runloop_set_frame_limit(
const struct retro_system_av_info *av_info,
float fastforward_ratio);
float runloop_get_fastforward_ratio(
settings_t *settings,
struct retro_fastforwarding_override *fastmotion_override);
void runloop_set_video_swap_interval(
bool vrr_runloop_enable,
bool crt_switching_active,
unsigned swap_interval_config,
unsigned black_frame_insertion,
unsigned shader_subframes,
float audio_max_timing_skew,
float video_refresh_rate,
double input_fps);
unsigned runloop_get_video_swap_interval(
unsigned swap_interval_config);
void runloop_task_msg_queue_push(
retro_task_t *task, const char *msg,
unsigned prio, unsigned duration,
bool flush);
bool secondary_core_ensure_exists(void *data, settings_t *settings);
void runloop_log_counters(
struct retro_perf_counter **counters, unsigned num);
void runloop_msg_queue_deinit(void);
void runloop_msg_queue_init(void);
void runloop_path_set_basename(const char *path);
void runloop_path_set_names(void);
uint32_t runloop_get_flags(void);
bool runloop_get_entry_state_path(char *path, size_t len, unsigned slot);
bool runloop_get_current_savestate_path(char *path, size_t len);
bool runloop_get_savestate_path(char *path, size_t len, int slot);
bool runloop_get_current_replay_path(char *path, size_t len);
bool runloop_get_replay_path(char *path, size_t len, unsigned slot);
void runloop_state_free(runloop_state_t *runloop_st);
void runloop_path_set_redirect(settings_t *settings, const char *a, const char *b);
void runloop_path_set_special(char **argv, unsigned num_content);
void runloop_path_deinit_subsystem(void);
/**
* init_libretro_symbols:
* @type : Type of core to be loaded.
* If CORE_TYPE_DUMMY, will
* load dummy symbols.
*
* Setup libretro callback symbols.
*
* @return true on success, or false if symbols could not be loaded.
**/
bool runloop_init_libretro_symbols(
void *data,
enum rarch_core_type type,
struct retro_core_t *current_core,
const char *lib_path,
void *_lib_handle_p);
runloop_state_t *runloop_state_get_ptr(void);
RETRO_END_DECLS
#endif
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2021 - 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/>.
*/
#ifndef __RUNLOOP_H
#define __RUNLOOP_H
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#include <libretro.h>
#include <dynamic/dylib.h>
#include <queues/message_queue.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_THREADS
#include <rthreads/rthreads.h>
#endif
#include "dynamic.h"
#include "configuration.h"
#include "core_option_manager.h"
#include "performance_counters.h"
#include "state_manager.h"
#ifdef HAVE_RUNAHEAD
#include "runahead.h"
#endif
#include "tasks/tasks_internal.h"
/* Arbitrary twenty subsystems limit */
#define SUBSYSTEM_MAX_SUBSYSTEMS 20
/* Arbitrary 10 roms for each subsystem limit */
#define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10
#ifdef HAVE_THREADS
#define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) slock_lock((runloop_st)->msg_queue_lock)
#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) slock_unlock((runloop_st)->msg_queue_lock)
#else
#define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) (void)(runloop_st)
#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) (void)(runloop_st)
#endif
#ifdef HAVE_BSV_MOVIE
#define BSV_MOVIE_IS_EOF() || (((input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_END) && (input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_EOF_EXIT)))
#else
#define BSV_MOVIE_IS_EOF()
#endif
/* Time to exit out of the main loop?
* Reasons for exiting:
* a) Shutdown environment callback was invoked.
* b) Quit key was pressed.
* c) Frame count exceeds or equals maximum amount of frames to run.
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
#define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) ((runloop_state.flags & RUNLOOP_FLAG_SHUTDOWN_INITIATED) || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec)
enum runloop_state_enum
{
RUNLOOP_STATE_ITERATE = 0,
RUNLOOP_STATE_POLLED_AND_SLEEP,
RUNLOOP_STATE_PAUSE,
RUNLOOP_STATE_MENU,
RUNLOOP_STATE_QUIT
};
enum poll_type_override_t
{
POLL_TYPE_OVERRIDE_DONTCARE = 0,
POLL_TYPE_OVERRIDE_EARLY,
POLL_TYPE_OVERRIDE_NORMAL,
POLL_TYPE_OVERRIDE_LATE
};
enum runloop_flags
{
RUNLOOP_FLAG_MAX_FRAMES_SCREENSHOT = (1 << 0),
RUNLOOP_FLAG_HAS_SET_CORE = (1 << 1),
RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT = (1 << 2),
RUNLOOP_FLAG_IGNORE_ENVIRONMENT_CB = (1 << 3),
RUNLOOP_FLAG_IS_SRAM_LOAD_DISABLED = (1 << 4),
RUNLOOP_FLAG_IS_SRAM_SAVE_DISABLED = (1 << 5),
RUNLOOP_FLAG_USE_SRAM = (1 << 6),
RUNLOOP_FLAG_PATCH_BLOCKED = (1 << 7),
RUNLOOP_FLAG_REQUEST_SPECIAL_SAVESTATE = (1 << 8),
RUNLOOP_FLAG_OVERRIDES_ACTIVE = (1 << 9),
RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE = (1 << 10),
RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE = (1 << 11),
RUNLOOP_FLAG_REMAPS_CORE_ACTIVE = (1 << 12),
RUNLOOP_FLAG_REMAPS_GAME_ACTIVE = (1 << 13),
RUNLOOP_FLAG_REMAPS_CONTENT_DIR_ACTIVE = (1 << 14),
RUNLOOP_FLAG_SHUTDOWN_INITIATED = (1 << 15),
RUNLOOP_FLAG_CORE_SHUTDOWN_INITIATED = (1 << 16),
RUNLOOP_FLAG_CORE_RUNNING = (1 << 17),
RUNLOOP_FLAG_AUTOSAVE = (1 << 18),
RUNLOOP_FLAG_HAS_VARIABLE_UPDATE = (1 << 19),
RUNLOOP_FLAG_INPUT_IS_DIRTY = (1 << 20),
RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN = (1 << 21),
RUNLOOP_FLAG_RUNAHEAD_AVAILABLE = (1 << 22),
RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE = (1 << 23),
RUNLOOP_FLAG_RUNAHEAD_FORCE_INPUT_DIRTY = (1 << 24),
RUNLOOP_FLAG_SLOWMOTION = (1 << 25),
RUNLOOP_FLAG_FASTMOTION = (1 << 26),
RUNLOOP_FLAG_PAUSED = (1 << 27),
RUNLOOP_FLAG_IDLE = (1 << 28),
RUNLOOP_FLAG_FOCUSED = (1 << 29),
RUNLOOP_FLAG_FORCE_NONBLOCK = (1 << 30),
RUNLOOP_FLAG_IS_INITED = (1 << 31)
};
/* Contains the current retro_fastforwarding_override
* parameters along with any pending updates triggered
* by RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE */
typedef struct fastmotion_overrides
{
struct retro_fastforwarding_override current;
struct retro_fastforwarding_override next;
bool pending;
} fastmotion_overrides_t;
typedef struct
{
unsigned priority;
float duration;
char str[128];
bool set;
} runloop_core_status_msg_t;
/* Contains all callbacks associated with
* core options.
* > At present there is only a single
* callback, 'update_display' - but we
* may wish to add more in the future
* (e.g. for directly informing a core of
* core option value changes, or getting/
* setting extended/non-standard option
* value data types) */
typedef struct core_options_callbacks
{
retro_core_options_update_display_callback_t update_display;
} core_options_callbacks_t;
struct runloop
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
rarch_timer_t shader_delay_timer; /* int64_t alignment */
#endif
retro_time_t core_runtime_last;
retro_time_t core_runtime_usec;
retro_time_t core_run_time;
retro_time_t frame_limit_minimum_time;
retro_time_t frame_limit_last_time;
retro_usec_t frame_time_last; /* int64_t alignment */
struct retro_core_t current_core; /* uint64_t alignment */
#if defined(HAVE_RUNAHEAD)
uint64_t runahead_last_frame_count; /* uint64_t alignment */
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
struct retro_core_t secondary_core; /* uint64_t alignment */
#endif
retro_ctx_load_content_info_t *load_content_info;
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
char *secondary_library_path;
#endif
my_list *runahead_save_state_list;
my_list *input_state_list;
preempt_t *preempt_data;
#endif
#ifdef HAVE_REWIND
struct state_manager_rewind_state rewind_st;
#endif
struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS];
bool *load_no_content_hook;
struct string_list *subsystem_fullpaths;
struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS];
struct retro_callbacks retro_ctx; /* ptr alignment */
msg_queue_t msg_queue; /* ptr alignment */
retro_input_poll_t input_poll_callback_original; /* ptr alignment */
retro_input_state_t input_state_callback_original; /* ptr alignment */
#ifdef HAVE_RUNAHEAD
function_t retro_reset_callback_original; /* ptr alignment */
function_t original_retro_deinit; /* ptr alignment */
function_t original_retro_unload; /* ptr alignment */
runahead_load_state_function
retro_unserialize_callback_original; /* ptr alignment */
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
struct retro_callbacks secondary_callbacks; /* ptr alignment */
#endif
#endif
#ifdef HAVE_THREADS
slock_t *msg_queue_lock;
#endif
content_state_t content_st; /* ptr alignment */
struct retro_subsystem_rom_info
subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS]
[SUBSYSTEM_MAX_SUBSYSTEM_ROMS]; /* ptr alignment */
core_option_manager_t *core_options;
core_options_callbacks_t core_options_callback;/* ptr alignment */
retro_keyboard_event_t key_event; /* ptr alignment */
retro_keyboard_event_t frontend_key_event; /* ptr alignment */
rarch_system_info_t system; /* ptr alignment */
struct retro_frame_time_callback frame_time; /* ptr alignment */
struct retro_audio_buffer_status_callback audio_buffer_status; /* ptr alignment */
#ifdef HAVE_DYNAMIC
dylib_t lib_handle; /* ptr alignment */
#endif
#if defined(HAVE_RUNAHEAD)
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
dylib_t secondary_lib_handle; /* ptr alignment */
#endif
size_t runahead_save_state_size;
#endif
size_t msg_queue_size;
#if defined(HAVE_RUNAHEAD)
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
int port_map[MAX_USERS];
#endif
#endif
runloop_core_status_msg_t core_status_msg;
unsigned msg_queue_delay;
unsigned pending_windowed_scale;
unsigned max_frames;
unsigned audio_latency;
unsigned fastforward_after_frames;
unsigned perf_ptr_libretro;
unsigned subsystem_current_count;
unsigned entry_state_slot;
unsigned video_swap_interval_auto;
fastmotion_overrides_t fastmotion_override; /* float alignment */
retro_bits_t has_set_libretro_device; /* uint32_t alignment */
enum rarch_core_type current_core_type;
enum rarch_core_type explicit_current_core_type;
enum poll_type_override_t core_poll_type_override;
#if defined(HAVE_RUNAHEAD)
enum rarch_core_type last_core_type;
#endif
uint32_t flags;
int8_t run_frames_and_pause;
char runtime_content_path_basename[8192];
char current_library_name[NAME_MAX_LENGTH];
char current_library_version[256];
char current_valid_extensions[256];
char subsystem_path[256];
#ifdef HAVE_SCREENSHOTS
char max_frames_screenshot_path[PATH_MAX_LENGTH];
#endif
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
char runtime_shader_preset_path[PATH_MAX_LENGTH];
#endif
char runtime_content_path[PATH_MAX_LENGTH];
char runtime_core_path[PATH_MAX_LENGTH];
char savefile_dir[DIR_MAX_LENGTH];
char savestate_dir[DIR_MAX_LENGTH];
struct
{
char *remapfile;
char savefile[8192];
char savestate[8192];
char replay[8192];
char cheatfile[8192];
char ups[8192];
char bps[8192];
char ips[8192];
char xdelta[8192];
char label[8192];
} name;
bool missing_bios;
bool perfcnt_enable;
};
typedef struct runloop runloop_state_t;
RETRO_BEGIN_DECLS
void runloop_path_fill_names(void);
/**
* runloop_environment_cb:
* @cmd : Identifier of command.
* @data : Pointer to data.
*
* Environment callback function implementation.
*
* Returns: true (1) if environment callback command could
* be performed, otherwise false (0).
**/
bool runloop_environment_cb(unsigned cmd, void *data);
void runloop_msg_queue_push(const char *msg,
unsigned prio, unsigned duration,
bool flush,
char *title,
enum message_queue_icon icon,
enum message_queue_category category);
void runloop_set_current_core_type(
enum rarch_core_type type, bool explicitly_set);
/**
* runloop_iterate:
*
* Run Libretro core in RetroArch for one frame.
*
* Returns: 0 on successful run,
* Returns 1 if we have to wait until button input in order
* to wake up the loop.
* Returns -1 if we forcibly quit out of the
* RetroArch iteration loop.
**/
int runloop_iterate(void);
void runloop_system_info_free(void);
/**
* libretro_get_system_info:
* @path : Path to libretro library.
* @info : Pointer to system info information.
* @load_no_content : If true, core should be able to auto-start
* without any content loaded.
*
* Gets system info from an arbitrary lib.
* The struct returned must be freed as strings are allocated dynamically.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool libretro_get_system_info(
const char *path,
struct retro_system_info *info,
bool *load_no_content);
void runloop_performance_counter_register(
struct retro_perf_counter *perf);
void runloop_runtime_log_deinit(
runloop_state_t *runloop_st,
bool content_runtime_log,
bool content_runtime_log_aggregate,
const char *dir_runtime_log,
const char *dir_playlist);
void runloop_event_deinit_core(void);
bool runloop_event_init_core(
settings_t *settings,
void *input_data,
enum rarch_core_type type,
const char *old_savefile_dir,
const char *old_savestate_dir
);
void runloop_pause_checks(void);
void runloop_set_frame_limit(
const struct retro_system_av_info *av_info,
float fastforward_ratio);
float runloop_get_fastforward_ratio(
settings_t *settings,
struct retro_fastforwarding_override *fastmotion_override);
void runloop_set_video_swap_interval(
bool vrr_runloop_enable,
bool crt_switching_active,
unsigned swap_interval_config,
unsigned black_frame_insertion,
unsigned shader_subframes,
float audio_max_timing_skew,
float video_refresh_rate,
double input_fps);
unsigned runloop_get_video_swap_interval(
unsigned swap_interval_config);
void runloop_task_msg_queue_push(
retro_task_t *task, const char *msg,
unsigned prio, unsigned duration,
bool flush);
bool secondary_core_ensure_exists(void *data, settings_t *settings);
void runloop_log_counters(
struct retro_perf_counter **counters, unsigned num);
void runloop_msg_queue_deinit(void);
void runloop_msg_queue_init(void);
void runloop_path_set_basename(const char *path);
void runloop_path_set_names(void);
uint32_t runloop_get_flags(void);
bool runloop_get_entry_state_path(char *path, size_t len, unsigned slot);
bool runloop_get_current_savestate_path(char *path, size_t len);
bool runloop_get_savestate_path(char *path, size_t len, int slot);
bool runloop_get_current_replay_path(char *path, size_t len);
bool runloop_get_replay_path(char *path, size_t len, unsigned slot);
void runloop_state_free(runloop_state_t *runloop_st);
void runloop_path_set_redirect(settings_t *settings, const char *a, const char *b);
void runloop_path_set_special(char **argv, unsigned num_content);
void runloop_path_deinit_subsystem(void);
/**
* init_libretro_symbols:
* @type : Type of core to be loaded.
* If CORE_TYPE_DUMMY, will
* load dummy symbols.
*
* Setup libretro callback symbols.
*
* @return true on success, or false if symbols could not be loaded.
**/
bool runloop_init_libretro_symbols(
void *data,
enum rarch_core_type type,
struct retro_core_t *current_core,
const char *lib_path,
void *_lib_handle_p);
runloop_state_t *runloop_state_get_ptr(void);
RETRO_END_DECLS
#endif

View File

@ -229,9 +229,9 @@ runtime_log_t *runtime_log_init(
const char *dir_playlist,
bool log_per_core)
{
char log_file_dir[DIR_MAX_LENGTH];
char content_name[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char log_file_dir[PATH_MAX_LENGTH];
char log_file_path[PATH_MAX_LENGTH];
char tmp_buf[PATH_MAX_LENGTH];
bool supports_no_game = false;
@ -1020,7 +1020,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
return;
case PLAYLIST_LAST_PLAYED_STYLE_AGO:
str[ _len] = ' ';
str[++_len] = '\0';
str[++_len] = '\0';
if (!(runtime_last_played_human(runtime_log, str + _len, len - _len - 2)))
strlcat(str + _len,
msg_hash_to_str(
@ -1118,7 +1118,7 @@ void runtime_log_save(runtime_log_t *runtime_log)
LOG_FILE_RUNTIME_FORMAT_STR,
runtime_log->runtime.hours, runtime_log->runtime.minutes,
runtime_log->runtime.seconds);
rjsonwriter_add_spaces(writer, 2);
rjsonwriter_add_string(writer, "runtime");
rjsonwriter_raw(writer, ":", 1);

View File

@ -6,6 +6,7 @@
#include <retro_timers.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../input/input_driver.h"
#include "../menu/menu_driver.h"
@ -145,7 +146,7 @@ core_info_t* steam_find_core_info_for_dlc(const char* name)
for (i = 0; core_info_list->count > i; i++)
{
char core_info_name[256];
char core_info_name[NAME_MAX_LENGTH];
core_info_t *core_info = core_info_get(core_info_list, i);
/* Find the opening parenthesis for the core name */
char *start = strchr(core_info->display_name, '(');

View File

@ -363,7 +363,7 @@ static bool input_autoconfigure_scan_config_files_internal(
* input_joypad_index, as it can
* get quite messy if reservations are done, due to the swaps above)
* - do not consider "reserved" ports free
* - if there is no reservation, do not change anything
* - if there is no reservation, do not change anything
* (not even the assignment to first free player port)
*/
static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
@ -383,7 +383,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
for (player = 0; player < MAX_USERS; player++)
{
if (first_free_player_slot > MAX_USERS &&
if (first_free_player_slot > MAX_USERS &&
( detected_port == settings->uints.input_joypad_index[player] ||
!input_config_get_device_name(settings->uints.input_joypad_index[player])) &&
settings->uints.input_device_reservation_type[player] != INPUT_DEVICE_RESERVATION_RESERVED )
@ -399,10 +399,10 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
if (first_free_player_slot > settings->uints.input_max_users) {
RARCH_ERR( "[Autoconf]: No free and unreserved player slots found for adding new device"
" \"%s\"! Detected port %d, max_users: %d, first free slot %d\n",
device_name, detected_port,
settings->uints.input_max_users,
device_name, detected_port,
settings->uints.input_max_users,
first_free_player_slot+1);
RARCH_WARN("[Autoconf]: Leaving detected player slot in place: %d\n",
RARCH_WARN("[Autoconf]: Leaving detected player slot in place: %d\n",
prev_assigned_player_slots[detected_port]);
return;
}
@ -410,7 +410,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
for (player = 0; player < MAX_USERS; player++)
{
if (settings->uints.input_device_reservation_type[player] != INPUT_DEVICE_RESERVATION_NONE)
strlcpy(settings_value, settings->arrays.input_reserved_devices[player],
strlcpy(settings_value, settings->arrays.input_reserved_devices[player],
sizeof(settings_value));
else
settings_value[0] = '\0';
@ -419,18 +419,18 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
{
RARCH_DBG("[Autoconf]: Examining reserved device for player %d "
"type %d: %s against %04x:%04x\n",
player+1,
settings->uints.input_device_reservation_type[player],
player+1,
settings->uints.input_device_reservation_type[player],
settings_value, vendor_id, product_id);
if (sscanf(settings_value, "%04x:%04x ",
&settings_value_vendor_id,
&settings_value_product_id) != 2)
{
strlcpy(settings_value_device_name, settings_value,
strlcpy(settings_value_device_name, settings_value,
sizeof(settings_value_device_name));
device_has_reserved_slot =
string_is_equal(device_name, settings_value_device_name) ||
device_has_reserved_slot =
string_is_equal(device_name, settings_value_device_name) ||
string_is_equal(device_display_name, settings_value_device_name);
}
else
@ -440,7 +440,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
if (device_has_reserved_slot)
{
unsigned prev_assigned_port = settings->uints.input_joypad_index[player];
if ( detected_port != prev_assigned_port &&
if ( detected_port != prev_assigned_port &&
!string_is_empty(input_config_get_device_name(prev_assigned_port)) &&
(( settings_value_vendor_id == input_config_get_device_vid(prev_assigned_port) &&
settings_value_product_id == input_config_get_device_pid(prev_assigned_port)) ||
@ -472,7 +472,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
RARCH_LOG("[Autoconf]: Preferred slot was taken earlier by "
"\"%s\", reassigning that to %d\n",
input_config_get_device_name(prev_assigned_port),
input_config_get_device_name(prev_assigned_port),
prev_assigned_player_slots[detected_port]+1);
settings->uints.input_joypad_index[prev_assigned_player_slots[detected_port]] = prev_assigned_port;
if (input_config_get_device_name(prev_assigned_port))
@ -486,7 +486,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
settings->uints.input_joypad_index[first_free_player_slot] = prev_assigned_port;
}
}
else
else
{
RARCH_DBG("[Autoconf]: Device \"%s\" (%x:%x) is reserved for "
"player %d, same as default assignment.\n",
@ -500,7 +500,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
"any player slot.\n",
device_name, vendor_id, product_id);
/* Fallback in case no reservation is set up at all - to preserve any previous setup where input_joypad_index may have been customized. */
if (no_reservation_at_all ||
if (no_reservation_at_all ||
prev_assigned_player_slots[detected_port] == first_free_player_slot)
{
return;
@ -508,7 +508,7 @@ static void reallocate_port_if_needed(unsigned detected_port, int vendor_id,
else
{
unsigned prev_assigned_port = settings->uints.input_joypad_index[first_free_player_slot];
settings->uints.input_joypad_index[first_free_player_slot] = detected_port;
settings->uints.input_joypad_index[first_free_player_slot] = detected_port;
settings->uints.input_joypad_index[prev_assigned_player_slots[detected_port]] = prev_assigned_port;
RARCH_DBG("[Autoconf]: Earlier free player slot found, "
"reassigning to player %d.\n",
@ -834,7 +834,7 @@ bool input_autoconfigure_connect(
if (driver_valid)
{
char dir_driver_autoconfig[PATH_MAX_LENGTH];
char dir_driver_autoconfig[DIR_MAX_LENGTH];
/* Generate driver-specific autoconfig directory */
fill_pathname_join_special(dir_driver_autoconfig,
dir_autoconfig,

View File

@ -320,7 +320,7 @@ static struct string_list *task_cloud_sync_directory_map(void)
if (!list)
{
union string_list_elem_attr attr = {0};
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
list = string_list_new();
if (settings->bools.cloud_sync_sync_configs)
@ -478,9 +478,9 @@ static void task_cloud_sync_backup_file(struct item_file *file)
{
struct tm tm_;
size_t len;
char backup_dir[PATH_MAX_LENGTH];
char new_dir[DIR_MAX_LENGTH];
char backup_dir[DIR_MAX_LENGTH];
char new_path[PATH_MAX_LENGTH];
char new_dir[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *path_dir_core_assets = settings->paths.directory_core_assets;
time_t cur_time = time(NULL);
@ -533,14 +533,14 @@ static void task_cloud_sync_fetch_cb(void *user_data, const char *path, bool suc
static void task_cloud_sync_fetch_server_file(task_cloud_sync_state_t *sync_state)
{
size_t i;
char filename[PATH_MAX_LENGTH];
char directory[DIR_MAX_LENGTH];
struct string_list *dirlist = task_cloud_sync_directory_map();
struct item_file *server_file = &sync_state->server_manifest->list[sync_state->server_idx];
const char *key = CS_FILE_KEY(server_file);
const char *path = strchr(key, PATH_DEFAULT_SLASH_C()) + 1;
char directory[PATH_MAX_LENGTH];
char filename[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
size_t i;
/* we're just fetching a file the server has, we can update this now */
task_cloud_sync_add_to_updated_manifest(sync_state, key, CS_FILE_HASH(server_file), true);

View File

@ -531,7 +531,7 @@ static bool content_file_list_set_info(
* extended path info to cores */
if (!string_is_empty(path))
{
char dir [PATH_MAX_LENGTH];
char dir [DIR_MAX_LENGTH];
char name[NAME_MAX_LENGTH];
const char *archive_delim = NULL;
const char *ext = NULL;
@ -1032,7 +1032,7 @@ static bool content_file_load(
{
wchar_t wnew_path[MAX_PATH];
/* Fallback to a file copy into an accessible directory */
char new_basedir[PATH_MAX_LENGTH];
char new_basedir[DIR_MAX_LENGTH];
char new_path[PATH_MAX_LENGTH];
RARCH_LOG("[Content]: Core does not support VFS"

View File

@ -946,7 +946,7 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
const char *core_name = NULL;
retro_task_t *task = NULL;
core_backup_handle_t *backup_handle = NULL;
char task_title[256];
char task_title[128];
char core_path[PATH_MAX_LENGTH];
core_path[0] = '\0';

View File

@ -150,8 +150,8 @@ typedef struct update_single_core_handle
size_t auto_backup_history_size;
enum update_single_core_status status;
char path_core[PATH_MAX_LENGTH];
char path_dir_libretro[PATH_MAX_LENGTH];
char path_dir_core_assets[PATH_MAX_LENGTH];
char path_dir_libretro[DIR_MAX_LENGTH];
char path_dir_core_assets[DIR_MAX_LENGTH];
bool auto_backup;
} update_single_core_handle_t;
#endif
@ -304,7 +304,7 @@ static void task_core_updater_get_list_handler(retro_task_t *task)
settings_t *settings = config_get_ptr();
file_transfer_t *transf = NULL;
char *tmp_url = NULL;
const char *net_buildbot_url =
const char *net_buildbot_url =
settings->paths.network_buildbot_url;
/* Reset core updater list */
@ -572,7 +572,7 @@ void cb_http_task_core_updater_download(
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
file_transfer_t *transf = (file_transfer_t*)user_data;
core_updater_download_handle_t *download_handle = NULL;
char output_dir[PATH_MAX_LENGTH];
char output_dir[DIR_MAX_LENGTH];
if (!data || !transf)
goto finish;
@ -700,13 +700,13 @@ static void task_core_updater_download_handler(retro_task_t *task)
/* Get CRC of existing core, if required */
if (download_handle->local_crc == 0)
{
const char *local_core_path =
const char *local_core_path =
download_handle->local_core_path;
if (
!string_is_empty(local_core_path)
&& path_is_valid (local_core_path)
)
download_handle->local_crc =
download_handle->local_crc =
task_core_updater_get_core_crc(local_core_path);
}

View File

@ -1157,7 +1157,7 @@ int cue_find_track(const char *cue_path, bool first,
intfstream_info_t info;
char tmp_token[MAX_TOKEN_LEN];
char last_file[PATH_MAX_LENGTH];
char cue_dir[PATH_MAX_LENGTH];
char cue_dir[DIR_MAX_LENGTH];
intfstream_t *fd = NULL;
int64_t last_index = -1;
int64_t cand_index = -1;
@ -1291,7 +1291,7 @@ bool cue_next_file(intfstream_t *fd,
const char *cue_path, char *s, uint64_t len)
{
char tmp_token[MAX_TOKEN_LEN];
char cue_dir[PATH_MAX_LENGTH];
char cue_dir[DIR_MAX_LENGTH];
cue_dir[0] = '\0';
fill_pathname_basedir(cue_dir, cue_path, sizeof(cue_dir));
@ -1373,7 +1373,7 @@ int gdi_find_track(const char *gdi_path, bool first,
if (!(mode == 0 && size == 2352))
{
char last_file[PATH_MAX_LENGTH];
char gdi_dir[PATH_MAX_LENGTH];
char gdi_dir[DIR_MAX_LENGTH];
fill_pathname_basedir(gdi_dir, gdi_path, sizeof(gdi_dir));
fill_pathname_join_special(last_file,
@ -1432,7 +1432,7 @@ bool gdi_next_file(intfstream_t *fd, const char *gdi_path,
/* File name */
if (task_database_cue_get_token(fd, tmp_token, sizeof(tmp_token)) > 0)
{
char gdi_dir[PATH_MAX_LENGTH];
char gdi_dir[DIR_MAX_LENGTH];
fill_pathname_basedir(gdi_dir, gdi_path, sizeof(gdi_dir));
fill_pathname_join_special(path, gdi_dir, tmp_token, (size_t)max_len);

View File

@ -43,7 +43,7 @@ static int file_decompressed_subdir(const char *name,
uint32_t crc32, struct archive_extract_userdata *userdata)
{
size_t _len;
char path_dir[PATH_MAX_LENGTH];
char path_dir[DIR_MAX_LENGTH];
char path[PATH_MAX_LENGTH];
size_t name_len = strlen(name);
char last_char = name[name_len - 1];

View File

@ -21,6 +21,7 @@
#include <file/file_path.h>
#include <net/net_compat.h>
#include <retro_timers.h>
#include <retro_miscellaneous.h>
#ifdef RARCH_INTERNAL
#include "../gfx/video_display_server.h"
@ -40,7 +41,7 @@ enum http_status_enum
struct http_transfer_info
{
int progress;
char url[255];
char url[NAME_MAX_LENGTH];
};
struct http_handle
@ -54,8 +55,8 @@ struct http_handle
} connection;
unsigned status;
bool error;
char connection_elem[255];
char connection_url[255];
char connection_elem[NAME_MAX_LENGTH];
char connection_url[NAME_MAX_LENGTH];
};
typedef struct http_transfer_info http_transfer_info_t;
@ -461,9 +462,9 @@ void* task_push_http_transfer_file(const char* url, bool mute,
retro_task_callback_t cb, file_transfer_t* transfer_data)
{
size_t len;
const char *s = NULL;
char tmp[255] = "";
retro_task_t *t = NULL;
const char *s = NULL;
char tmp[NAME_MAX_LENGTH] = "";
retro_task_t *t = NULL;
if (string_is_empty(url))
return NULL;

View File

@ -77,7 +77,7 @@ typedef struct pl_thumb_handle
enum pl_thumb_status status;
enum playlist_thumbnail_name_flags name_flags;
uint8_t flags;
} pl_thumb_handle_t;
@ -100,7 +100,7 @@ static bool gfx_thumbnail_get_sub_directory(
{
if (!sub_directory)
return false;
switch (type_idx)
{
case 1:
@ -116,7 +116,7 @@ static bool gfx_thumbnail_get_sub_directory(
default:
break;
}
return false;
}
@ -137,7 +137,7 @@ static bool get_thumbnail_paths(
char *path, size_t path_size,
char *url, size_t url_size)
{
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
char tmp_buf[PATH_MAX_LENGTH];
size_t raw_url_len = sizeof(char) * 8192;
char *raw_url = NULL;
@ -146,15 +146,15 @@ static bool get_thumbnail_paths(
const char *img_name = NULL;
const char *sub_dir = NULL;
const char *system_name = NULL;
content_dir[0] = '\0';
if (!pl_thumb->thumbnail_path_data)
return false;
if (string_is_empty(pl_thumb->dir_thumbnails))
return false;
/* Extract required strings */
gfx_thumbnail_get_system( pl_thumb->thumbnail_path_data, &system);
gfx_thumbnail_get_db_name(pl_thumb->thumbnail_path_data, &db_name);
@ -162,13 +162,13 @@ static bool get_thumbnail_paths(
return false;
if (!gfx_thumbnail_get_sub_directory(pl_thumb->type_idx, &sub_dir))
return false;
/* Determine system name */
if (string_is_empty(db_name))
{
if (string_is_empty(system))
return false;
/* If this is a content history or favorites playlist
* then the current 'path_data->system' string is
* meaningless. In this case, we fall back to the
@ -179,7 +179,7 @@ static bool get_thumbnail_paths(
if (!gfx_thumbnail_get_content_dir(
pl_thumb->thumbnail_path_data, content_dir, sizeof(content_dir)))
return false;
system_name = content_dir;
}
else
@ -187,13 +187,13 @@ static bool get_thumbnail_paths(
}
else
system_name = db_name;
/* Generate local path */
fill_pathname_join_special(path, pl_thumb->dir_thumbnails,
system_name, path_size);
fill_pathname_join_special(tmp_buf, path, sub_dir, sizeof(tmp_buf));
fill_pathname_join_special(path, tmp_buf, img_name, path_size);
if (string_is_empty(path))
return false;
if (!(raw_url = (char*)malloc(8192 * sizeof(char))))
@ -213,10 +213,10 @@ static bool get_thumbnail_paths(
free(raw_url);
return false;
}
net_http_urlencode_full(url, raw_url, url_size);
free(raw_url);
return !string_is_empty(url);
}
@ -226,7 +226,7 @@ void cb_http_task_download_pl_thumbnail(
retro_task_t *task, void *task_data,
void *user_data, const char *err)
{
char output_dir[PATH_MAX_LENGTH];
char output_dir[DIR_MAX_LENGTH];
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
file_transfer_t *transf = (file_transfer_t*)user_data;
pl_thumb_handle_t *pl_thumb = NULL;
@ -372,13 +372,13 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
if (!task)
goto task_finished;
if (!(pl_thumb = (pl_thumb_handle_t*)task->state))
goto task_finished;
if (task_get_cancelled(task))
goto task_finished;
switch (pl_thumb->status)
{
case PL_THUMB_BEGIN:
@ -466,7 +466,7 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
pl_thumb->status = PL_THUMB_END;
break;
} else {
/* Increment the name flag to cover the 3 supported naming conventions.
/* Increment the name flag to cover the 3 supported naming conventions.
* Side-effect: all combinations will be tried (3x3 requests for 1 playlist entry)
* even if some files were already downloaded, but that may be useful if later on
* different view priorities are implemented. */
@ -488,9 +488,9 @@ static void task_pl_thumbnail_download_handler(retro_task_t *task)
task_set_progress(task, 100);
goto task_finished;
}
return;
task_finished:
if (task)
task_set_finished(task, true);
@ -518,46 +518,46 @@ bool task_push_pl_thumbnail_download(
const char *playlist_file = NULL;
retro_task_t *task = task_init();
pl_thumb_handle_t *pl_thumb = (pl_thumb_handle_t*)calloc(1, sizeof(pl_thumb_handle_t));
/* Sanity check */
if (!playlist_config || !task || !pl_thumb)
goto error;
if ( string_is_empty(system)
|| string_is_empty(playlist_config->path)
|| string_is_empty(dir_thumbnails))
goto error;
playlist_file = path_basename_nocompression(
playlist_config->path);
if (string_is_empty(playlist_file))
goto error;
/* Only parse supported playlist types */
if (
string_ends_with_size(playlist_file, "_history.lpl",
strlen(playlist_file),
STRLEN_CONST("_history.lpl")
)
)
|| string_is_equal(playlist_file,
FILE_PATH_CONTENT_FAVORITES)
|| string_is_equal(system, "history")
|| string_is_equal(system, "favorites"))
goto error;
/* Concurrent download of thumbnails for the same
* playlist is not allowed */
find_data.func = task_pl_thumbnail_finder;
find_data.userdata = (void*)playlist_config->path;
if (task_queue_find(&find_data))
goto error;
/* Configure handle */
if (!playlist_config_copy(playlist_config, &pl_thumb->playlist_config))
goto error;
pl_thumb->system = strdup(system);
pl_thumb->playlist_path = NULL;
pl_thumb->dir_thumbnails = strdup(dir_thumbnails);
@ -568,31 +568,31 @@ bool task_push_pl_thumbnail_download(
pl_thumb->list_index = 0;
pl_thumb->type_idx = 1;
pl_thumb->status = PL_THUMB_BEGIN;
/* Configure task */
task->handler = task_pl_thumbnail_download_handler;
task->state = pl_thumb;
task->title = strdup(system);
task->alternative_look = true;
task->progress = 0;
task_queue_push(task);
return true;
error:
if (task)
{
free(task);
task = NULL;
}
if (pl_thumb)
{
free(pl_thumb);
pl_thumb = NULL;
}
return false;
}
@ -612,9 +612,9 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
playlist_t *current_playlist = playlist_get_cached();
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
#ifdef HAVE_MATERIALUI
const char *menu_driver = menu_driver_ident();
const char *menu_driver = menu_driver_ident();
#endif
if (!task)
return;
@ -622,7 +622,7 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
if (!pl_thumb || !pl_thumb->thumbnail_path_data)
return;
/* Only refresh if current playlist hasn't changed,
* and menu selection pointer is on the same entry
* (Note: this is crude, but it's sufficient to prevent
@ -635,7 +635,7 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
return;
if (string_is_empty(playlist_get_conf_path(current_playlist)))
return;
#ifdef HAVE_MATERIALUI
if (string_is_equal(menu_driver, "glui"))
{
@ -650,36 +650,36 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
playlist_get_conf_path(current_playlist)))
return;
}
/* Only refresh if left/right thumbnails did not exist
* when the task began, but do exist now
* (with the caveat that we must also refresh if existing
* files have been overwritten) */
if ( !(pl_thumb->flags & PL_THUMB_FLAG_RIGHT_THUMB_EXISTS)
if ( !(pl_thumb->flags & PL_THUMB_FLAG_RIGHT_THUMB_EXISTS)
||(pl_thumb->flags & PL_THUMB_FLAG_OVERWRITE))
if (gfx_thumbnail_update_path(pl_thumb->thumbnail_path_data, GFX_THUMBNAIL_RIGHT))
if (gfx_thumbnail_get_path(pl_thumb->thumbnail_path_data, GFX_THUMBNAIL_RIGHT, &thumbnail_path))
do_refresh = path_is_valid(thumbnail_path);
if (!do_refresh)
if ( !(pl_thumb->flags & PL_THUMB_FLAG_LEFT_THUMB_EXISTS)
|| (pl_thumb->flags & PL_THUMB_FLAG_OVERWRITE))
if (gfx_thumbnail_update_path(pl_thumb->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
if (gfx_thumbnail_get_path(pl_thumb->thumbnail_path_data, GFX_THUMBNAIL_LEFT, &left_thumbnail_path))
do_refresh = path_is_valid(left_thumbnail_path);
if (do_refresh)
{
struct menu_state *menu_st = menu_state_get_ptr();
unsigned i = (unsigned)pl_thumb->list_index;
if ( menu_st->driver_ctx
if ( menu_st->driver_ctx
&& menu_st->driver_ctx->refresh_thumbnail_image)
menu_st->driver_ctx->refresh_thumbnail_image(
menu_st->userdata, i);
}
#endif
}
@ -693,16 +693,16 @@ static void task_pl_entry_thumbnail_free(retro_task_t *task)
static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
{
pl_thumb_handle_t *pl_thumb = NULL;
if (!task)
return;
if (!(pl_thumb = (pl_thumb_handle_t*)task->state))
goto task_finished;
if (task_get_cancelled(task))
goto task_finished;
switch (pl_thumb->status)
{
case PL_THUMB_BEGIN:
@ -710,7 +710,7 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
const char *label = NULL;
const char *right_thumbnail_path = NULL;
const char *left_thumbnail_path = NULL;
/* Check whether current right/left thumbnails
* already exist (required for menu refresh callback) */
pl_thumb->flags &= ~PL_THUMB_FLAG_RIGHT_THUMB_EXISTS;
@ -727,7 +727,7 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
pl_thumb->flags |= PL_THUMB_FLAG_RIGHT_THUMB_EXISTS;
}
}
if (gfx_thumbnail_update_path(
pl_thumb->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
{
@ -739,7 +739,7 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
pl_thumb->flags |= PL_THUMB_FLAG_LEFT_THUMB_EXISTS;
}
}
/* Set task title */
task_free_title(task);
if (gfx_thumbnail_get_label(
@ -748,7 +748,7 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
else
task_set_title(task, strdup(""));
task_set_progress(task, 0);
/* All good - can start iterating */
pl_thumb->status = PL_THUMB_ITERATE_TYPE;
}
@ -757,7 +757,7 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
{
/* Ensure that we only enqueue one transfer
* at a time... */
/* > If HTTP task is NULL, then it either finished
* or an error occurred - in either case,
* current task is 'complete' */
@ -769,21 +769,21 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
break;
pl_thumb->http_task = NULL;
/* Check whether all thumbnail types have been processed */
if (pl_thumb->type_idx > 3)
{
pl_thumb->status = PL_THUMB_END;
break;
}
/* Update progress */
task_set_progress(task, ((pl_thumb->type_idx - 1) * 100) / 3);
/* Download current thumbnail */
if (pl_thumb)
download_pl_thumbnail(pl_thumb);
/* Increment thumbnail type */
pl_thumb->type_idx++;
}
@ -793,11 +793,11 @@ static void task_pl_entry_thumbnail_download_handler(retro_task_t *task)
task_set_progress(task, 100);
goto task_finished;
}
return;
task_finished:
if (task)
task_set_finished(task, true);
}
@ -805,8 +805,8 @@ task_finished:
static bool task_pl_entry_thumbnail_finder(retro_task_t *task, void *user_data)
{
pl_entry_id_t *entry_id = NULL;
if ( task
&& user_data
if ( task
&& user_data
&& task->handler == task_pl_entry_thumbnail_download_handler
&& (entry_id = (pl_entry_id_t*)user_data))
{
@ -819,7 +819,7 @@ static bool task_pl_entry_thumbnail_finder(retro_task_t *task, void *user_data)
}
bool task_push_pl_entry_thumbnail_download(
const char *system,
const char *system,
playlist_t *playlist,
unsigned idx,
bool overwrite,
@ -841,52 +841,52 @@ bool task_push_pl_entry_thumbnail_download(
goto error;
dir_thumbnails = settings->paths.directory_thumbnails;
if (string_is_empty(system) ||
string_is_empty(dir_thumbnails) ||
string_is_empty(playlist_get_conf_path(playlist)))
goto error;
if (idx >= playlist_size(playlist))
goto error;
/* Only parse supported playlist types */
if (string_ends_with_size(system, "_history",
strlen(system),
STRLEN_CONST("_history")
))
goto error;
/* Copy playlist path
* (required for task finder and menu refresh functionality) */
playlist_path = strdup(playlist_get_conf_path(playlist));
/* Concurrent download of thumbnails for the same
* playlist entry is not allowed */
entry_id->playlist_path = playlist_path;
entry_id->idx = idx;
find_data.func = task_pl_entry_thumbnail_finder;
find_data.userdata = (void*)entry_id;
if (task_queue_find(&find_data))
goto error;
free(entry_id);
entry_id = NULL;
/* Initialise thumbnail path data
* > Have to do this here rather than in the
* task handler to avoid thread race conditions */
thumbnail_path_data = gfx_thumbnail_path_init();
if (!thumbnail_path_data)
goto error;
if (!gfx_thumbnail_set_system(
thumbnail_path_data, system, playlist))
goto error;
if (!gfx_thumbnail_set_content_playlist(
thumbnail_path_data, playlist, idx))
goto error;
@ -898,7 +898,7 @@ bool task_push_pl_entry_thumbnail_download(
runloop_msg_queue_push(
msg_hash_to_str(MSG_NO_THUMBNAIL_DOWNLOAD_POSSIBLE),
1, 100, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
goto error;
}
@ -919,7 +919,7 @@ bool task_push_pl_entry_thumbnail_download(
if (overwrite)
pl_thumb->flags = PL_THUMB_FLAG_OVERWRITE;
/* Configure task */
task->handler = task_pl_entry_thumbnail_download_handler;
task->state = pl_thumb;
@ -929,42 +929,42 @@ bool task_push_pl_entry_thumbnail_download(
task->progress = 0;
task->callback = cb_task_pl_entry_thumbnail_refresh_menu;
task->cleanup = task_pl_entry_thumbnail_free;
task_queue_push(task);
return true;
error:
if (task)
{
free(task);
task = NULL;
}
if (pl_thumb)
{
free(pl_thumb);
pl_thumb = NULL;
}
if (entry_id)
{
free(entry_id);
entry_id = NULL;
}
if (playlist_path)
{
free(playlist_path);
playlist_path = NULL;
}
if (thumbnail_path_data)
{
free(thumbnail_path_data);
thumbnail_path_data = NULL;
}
return false;
}

View File

@ -281,7 +281,7 @@ static bool screenshot_dump(
}
else
{
char new_screenshot_dir[PATH_MAX_LENGTH];
char new_screenshot_dir[DIR_MAX_LENGTH];
if (!string_is_empty(screenshot_dir))
{
@ -292,7 +292,7 @@ static bool screenshot_dump(
if (settings->bools.sort_screenshots_by_content_enable &&
!string_is_empty(content_dir))
{
char content_dir_name[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
fill_pathname_parent_dir_name(content_dir_name,
content_dir, sizeof(content_dir_name));
fill_pathname_join_special(

View File

@ -11,6 +11,7 @@ extern "C" {
#endif
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../../../gfx/video_display_server.h"
#include "../../../input/input_driver.h"
@ -1316,7 +1317,7 @@ QWidget *VideoPage::widget()
{
for (i = 0; i < size; i++)
{
char val_d[256], str[256];
char val_d[NAME_MAX_LENGTH], str[NAME_MAX_LENGTH];
snprintf(str, sizeof(str), "%dx%d (%d Hz)", list[i].width, list[i].height, list[i].refreshrate);
snprintf(val_d, sizeof(val_d), "%d", i);

View File

@ -32,6 +32,7 @@ extern "C" {
#include "../../../config.h"
#endif
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include "../../../configuration.h"
@ -503,7 +504,7 @@ void UIntComboBox::populate(double min, double max)
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
unsigned val = (unsigned)i;
*m_setting->value.target.unsigned_integer = val;
@ -640,7 +641,7 @@ UIntRadioButton::UIntRadioButton(msg_hash_enums enum_idx, unsigned value, QWidge
,m_target(m_setting->value.target.unsigned_integer)
,m_value(value)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
unsigned orig_value = *m_setting->value.target.unsigned_integer;
*m_setting->value.target.unsigned_integer = value;
@ -701,7 +702,7 @@ UIntRadioButtons::UIntRadioButtons(rarch_setting_t *setting, QWidget *parent) :
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
*setting->value.target.unsigned_integer = i;
@ -983,7 +984,7 @@ BindButton::BindButton(rarch_setting_t *setting, QWidget *parent) :
QPushButton(parent)
,m_setting(setting)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
setting->get_string_representation(setting, val_s, sizeof(val_s));

View File

@ -42,8 +42,8 @@ void uwp_fill_installed_core_packages(struct string_list *list);
extern const struct rarch_key_map rarch_key_map_uwp[];
extern char uwp_dir_install[PATH_MAX_LENGTH];
extern char uwp_dir_data[PATH_MAX_LENGTH];
extern char uwp_dir_install[DIR_MAX_LENGTH];
extern char uwp_dir_data[DIR_MAX_LENGTH];
extern char uwp_device_family[128];

View File

@ -54,8 +54,8 @@ using namespace Windows::Graphics::Display;
using namespace Windows::Devices::Enumeration;
using namespace Windows::Storage;
char uwp_dir_install[PATH_MAX_LENGTH] = { 0 };
char uwp_dir_data[PATH_MAX_LENGTH] = { 0 };
char uwp_dir_install[DIR_MAX_LENGTH] = { 0 };
char uwp_dir_data[DIR_MAX_LENGTH] = { 0 };
char uwp_device_family[128] = { 0 };
char win32_cpu_model_name[128] = { 0 };
@ -224,7 +224,7 @@ int main(Platform::Array<Platform::String^>^)
Platform::String^ data_dir = local_folder + L"\\";
/* Delete VFS cache dir, we do this because this allows a far more
* concise implementation than manually implementing a function to do this
* concise implementation than manually implementing a function to do this
* This may be a little slower but shouldn't really matter as the cache dir
* should never have more than a few items */
Platform::String^ vfs_dir = local_folder + L"\\VFSCACHE";
@ -274,7 +274,7 @@ App::App() :
/* The first method called when the IFrameworkView is being created. */
void App::Initialize(CoreApplicationView^ applicationView)
{
/* Register event handlers for app lifecycle. This example
/* Register event handlers for app lifecycle. This example
* includes Activated, so that we can make the CoreWindow active and start
* rendering on the window. */
applicationView->Activated +=
@ -365,9 +365,9 @@ void App::Run()
if (!x)
{
/* HACK: I have no idea why is this necessary but
/* HACK: I have no idea why is this necessary but
* it is required to get proper scaling on Xbox *
* Perhaps PreferredLaunchViewSize is broken and
* Perhaps PreferredLaunchViewSize is broken and
* we need to wait until the app starts to call TryResizeView */
m_windowResized = true;
x = true;
@ -379,27 +379,27 @@ void App::Run()
}
/* Required for IFrameworkView.
* Terminate events do not cause Uninitialize to be called.
* Terminate events do not cause Uninitialize to be called.
* It will be called if your IFrameworkView
* class is torn down while the app is in the foreground. */
void App::Uninitialize()
{
main_exit(NULL);
/* If this instance of RetroArch was started from another app/frontend
/* If this instance of RetroArch was started from another app/frontend
* and the frontend passed "launchOnExit" parameter:
* 1. launch the app specified in "launchOnExit", most likely the
* 1. launch the app specified in "launchOnExit", most likely the
* same app that started RetroArch
* 2. RetroArch goes to background and RunAsyncAndCatchErrors doesn't
* 2. RetroArch goes to background and RunAsyncAndCatchErrors doesn't
* return, because the target app is immediately started.
* 3. Explicitly exit in App::OnEnteredBackground if
* m_launchOnExitShutdown is set. Otherwise, RetroArch doesn't
* 3. Explicitly exit in App::OnEnteredBackground if
* m_launchOnExitShutdown is set. Otherwise, RetroArch doesn't
* properly shutdown.
*/
if (m_launchOnExit != nullptr && !m_launchOnExit->IsEmpty())
{
{
try
{
{
/* Launch the target app */
m_launchOnExitShutdown = true;
auto ret = RunAsyncAndCatchErrors<bool>([&]() {
@ -419,12 +419,12 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^
int ret;
int argc = NULL;
std::vector<char*> argv;
/* using std::string as temp buf instead of char* array
/* using std::string as temp buf instead of char* array
* to avoid manual char allocations */
std::vector<std::string> argvTmp;
std::vector<std::string> argvTmp;
ParseProtocolArgs(args, &argc, &argv, &argvTmp);
/* Start only if not already initialized.
/* Start only if not already initialized.
* If there is a game in progress, just return */
if (m_initialized)
return;
@ -442,16 +442,16 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^
bool reset = false;
int width = uwp_get_width();
int height = uwp_get_height();
/* Reset driver to D3D11 if set to OpenGL on boot as cores can
* just set to 'gl' when needed and there is no good reason to
/* Reset driver to D3D11 if set to OpenGL on boot as cores can
* just set to 'gl' when needed and there is no good reason to
* use 'gl' for the menus
* Do not change the default driver if the content is already
* initialized through arguments, as this would crash RA for
* Do not change the default driver if the content is already
* initialized through arguments, as this would crash RA for
* cores that use only ANGLE */
settings_t *settings = config_get_ptr();
content_state_t *p_content = content_state_get_ptr();
char *currentdriver = settings->arrays.video_driver;
if ( strcmpi(currentdriver, "gl") == 0
if ( strcmpi(currentdriver, "gl") == 0
&& !p_content->flags & CONTENT_ST_FLAG_IS_INITED)
{
/* Set driver to default */
@ -460,7 +460,7 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^
config_get_default_video());
reset = true; /* Reset needed */
}
if ( (settings->uints.video_fullscreen_x != width)
if ( (settings->uints.video_fullscreen_x != width)
|| (settings->uints.video_fullscreen_y != height))
{
/* Get width and height from display again */
@ -482,15 +482,15 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^
void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
{
/* This function will ensure that configs are saved in case the app
/* This function will ensure that configs are saved in case the app
* is sent to background or terminated for saving configs on quit
* for saving configs on quit now configs will be saved in
* for saving configs on quit now configs will be saved in
* `retroarch_main_quit` at `retroarch.c`
* If this function is called because of app closed by quit,
* If this function is called because of app closed by quit,
* the below code must be ignored
/* Save app state asynchronously after requesting a deferral.
* Holding a deferral indicates that the application is busy
/* Save app state asynchronously after requesting a deferral.
* Holding a deferral indicates that the application is busy
* performing suspending operations. Be aware that a deferral may
* not be held indefinitely. After about five seconds, the app will
* be forced to exit. */
@ -543,7 +543,7 @@ void App::OnResuming(Platform::Object^ sender, Platform::Object^ args)
void App::OnEnteredBackground(Platform::Object^ sender, EnteredBackgroundEventArgs^ args)
{
/* RetroArch entered background because another app/frontend
/* RetroArch entered background because another app/frontend
* was launched on exit, so properly quit */
if (m_launchOnExitShutdown)
CoreApplication::Exit();
@ -755,12 +755,12 @@ void App::ParseProtocolArgs(Windows::ApplicationModel::Activation::IActivatedEve
argvTmp->clear();
argv->clear();
/* If the app is activated using protocol,
/* If the app is activated using protocol,
* it is expected to be in this format:
* "retroarch:?cmd=<RetroArch CLI arguments>&launchOnExit=<app to launch on exit>"
* For example:
* retroarch:?cmd=retroarch -L cores\core_libretro.dll "c:\mypath\path with spaces\game.rom"&launchOnExit=LaunchApp:
* "cmd" and "launchOnExit" are optional. If none specified,
* "cmd" and "launchOnExit" are optional. If none specified,
* it will normally launch into menu
*/
if (args->Kind == ActivationKind::Protocol)
@ -782,7 +782,7 @@ void App::ParseProtocolArgs(Windows::ApplicationModel::Activation::IActivatedEve
{
std::wstring wsValue(arg->Value->ToString()->Data());
std::string strValue(wsValue.begin(), wsValue.end());
std::istringstream iss(strValue);
std::istringstream iss(strValue);
std::string s;
/* Set escape character to NULL char to preserve backslashes in
@ -790,8 +790,8 @@ void App::ParseProtocolArgs(Windows::ApplicationModel::Activation::IActivatedEve
while (iss >> std::quoted(s, '"', (char)0))
argvTmp->push_back(s);
}
/* If RetroArch UWP app is started using protocol
* with argument "launchOnExit", this gives an option
/* If RetroArch UWP app is started using protocol
* with argument "launchOnExit", this gives an option
* to launch another app on RA exit,
* making it easy to integrate RA with other UWP frontends */
else if (arg->Name == "launchOnExit")
@ -828,7 +828,7 @@ extern "C" {
{
if (App::GetInstance()->IsInitialized())
{
if (fullscreen !=
if (fullscreen !=
ApplicationView::GetForCurrentView()->IsFullScreenMode)
{
if (fullscreen)
@ -840,11 +840,11 @@ extern "C" {
}
else
{
/* In case the window is not activated yet,
* TryResizeView will fail and we have to set the
/* In case the window is not activated yet,
* TryResizeView will fail and we have to set the
* initial parameters instead
* Note that these are preserved after restarting the app
* and used for the UWP splash screen size (!), so they
* Note that these are preserved after restarting the app
* and used for the UWP splash screen size (!), so they
* should be set only during init and not changed afterwards */
ApplicationView::PreferredLaunchViewSize = Size(width, height);
ApplicationView::PreferredLaunchWindowingMode = fullscreen ? ApplicationViewWindowingMode::FullScreen : ApplicationViewWindowingMode::PreferredLaunchViewSize;
@ -970,7 +970,7 @@ extern "C" {
const LONG32 resolution_scale = static_cast<LONG32>(Windows::Graphics::Display::DisplayInformation::GetForCurrentView()->ResolutionScale);
surface_scale = static_cast<float>(resolution_scale) / 100.0f;
ret = static_cast<LONG32>(
CoreWindow::GetForCurrentThread()->Bounds.Height
CoreWindow::GetForCurrentThread()->Bounds.Height
* surface_scale);
}
finished = true;
@ -1014,7 +1014,7 @@ extern "C" {
const LONG32 resolution_scale = static_cast<LONG32>(Windows::Graphics::Display::DisplayInformation::GetForCurrentView()->ResolutionScale);
surface_scale = static_cast<float>(resolution_scale) / 100.0f;
returnValue = static_cast<LONG32>(
CoreWindow::GetForCurrentThread()->Bounds.Width
CoreWindow::GetForCurrentThread()->Bounds.Width
* surface_scale);
}
finished = true;
@ -1073,12 +1073,12 @@ extern "C" {
switch (id)
{
case RETRO_DEVICE_ID_MOUSE_X:
return screen
? uwp_current_input.mouse_screen_x
return screen
? uwp_current_input.mouse_screen_x
: uwp_current_input.mouse_rel_x;
case RETRO_DEVICE_ID_MOUSE_Y:
return screen
? uwp_current_input.mouse_screen_y
return screen
? uwp_current_input.mouse_screen_y
: uwp_current_input.mouse_rel_y;
case RETRO_DEVICE_ID_MOUSE_LEFT:
return uwp_current_input.mouse_left;
@ -1108,12 +1108,12 @@ extern "C" {
switch (id)
{
case RETRO_DEVICE_ID_POINTER_X:
return screen
? uwp_current_input.touch[idx].full_x
return screen
? uwp_current_input.touch[idx].full_x
: uwp_current_input.touch[idx].x;
case RETRO_DEVICE_ID_POINTER_Y:
return screen
? uwp_current_input.touch[idx].full_y
return screen
? uwp_current_input.touch[idx].full_y
: uwp_current_input.touch[idx].y;
case RETRO_DEVICE_ID_POINTER_PRESSED:
return uwp_current_input.touch[idx].isInContact;

View File

@ -112,7 +112,7 @@ typedef struct verbosity_state
/* TODO/FIXME - static public global variables */
static verbosity_state_t main_verbosity_st;
static unsigned verbosity_log_level =
static unsigned verbosity_log_level =
DEFAULT_FRONTEND_LOG_LEVEL;
#ifdef HAVE_LIBNX
@ -454,7 +454,7 @@ void rarch_log_file_init(
const char *log_dir
)
{
char log_directory[PATH_MAX_LENGTH];
char log_directory[DIR_MAX_LENGTH];
char log_file_path[PATH_MAX_LENGTH];
verbosity_state_t *g_verbosity = &main_verbosity_st;
static bool log_file_created = false;