mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 04:21:13 +00:00
Move path settings to paths.c
This commit is contained in:
parent
00a1e3716a
commit
3a7e9a7052
@ -1327,12 +1327,8 @@ static int generic_action_ok(const char *path,
|
||||
break;
|
||||
#endif
|
||||
case ACTION_OK_LOAD_RECORD_CONFIGFILE:
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
flush_char = msg_hash_to_str(flush_id);
|
||||
strlcpy(global->record.config, action_path,
|
||||
sizeof(global->record.config));
|
||||
}
|
||||
flush_char = msg_hash_to_str(flush_id);
|
||||
path_set(RARCH_PATH_RECORD_CONFIG, action_path);
|
||||
break;
|
||||
case ACTION_OK_LOAD_REMAPPING_FILE:
|
||||
{
|
||||
|
@ -4392,8 +4392,8 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_PATH(
|
||||
list, list_info,
|
||||
global->record.config,
|
||||
sizeof(global->record.config),
|
||||
path_get_record_config_ptr(),
|
||||
path_get_record_config_size(),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_RECORD_CONFIG),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RECORD_CONFIG),
|
||||
"",
|
||||
@ -4407,8 +4407,8 @@ static bool setting_append_list(
|
||||
|
||||
CONFIG_STRING(
|
||||
list, list_info,
|
||||
global->record.path,
|
||||
sizeof(global->record.path),
|
||||
path_get_record_ptr(),
|
||||
path_get_record_size(),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_RECORD_PATH),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RECORD_PATH),
|
||||
"",
|
||||
|
40
paths.c
40
paths.c
@ -51,6 +51,8 @@
|
||||
/* For --subsystem content. */
|
||||
static struct string_list *subsystem_fullpaths = NULL;
|
||||
|
||||
static char path_record[PATH_MAX_LENGTH] = {0};
|
||||
static char path_record_config[PATH_MAX_LENGTH] = {0};
|
||||
static char path_server[PATH_MAX_LENGTH] = {0};
|
||||
static char path_savefile[PATH_MAX_LENGTH] = {0};
|
||||
static char path_savestate[PATH_MAX_LENGTH] = {0};
|
||||
@ -490,7 +492,15 @@ void path_fill_names(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Core file path */
|
||||
char *path_get_record_ptr(void)
|
||||
{
|
||||
return path_record;
|
||||
}
|
||||
|
||||
char *path_get_record_config_ptr(void)
|
||||
{
|
||||
return path_record_config;
|
||||
}
|
||||
|
||||
char *path_get_core_ptr(void)
|
||||
{
|
||||
@ -506,6 +516,10 @@ const char *path_get(enum rarch_path_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_PATH_RECORD:
|
||||
return path_record;
|
||||
case RARCH_PATH_RECORD_CONFIG:
|
||||
return path_record_config;
|
||||
case RARCH_PATH_SAVEFILE:
|
||||
return path_savefile;
|
||||
case RARCH_PATH_SAVESTATE:
|
||||
@ -548,6 +562,16 @@ const char *path_get(enum rarch_path_type type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t path_get_record_size(void)
|
||||
{
|
||||
return sizeof(path_record);
|
||||
}
|
||||
|
||||
size_t path_get_record_config_size(void)
|
||||
{
|
||||
return sizeof(path_record_config);
|
||||
}
|
||||
|
||||
size_t path_get_server_size(void)
|
||||
{
|
||||
return sizeof(path_server);
|
||||
@ -676,6 +700,14 @@ bool path_is_empty(enum rarch_path_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_PATH_RECORD:
|
||||
if (string_is_empty(path_record))
|
||||
return true;
|
||||
break;
|
||||
case RARCH_PATH_RECORD_CONFIG:
|
||||
if (string_is_empty(path_record_config))
|
||||
return true;
|
||||
break;
|
||||
case RARCH_PATH_SAVEFILE:
|
||||
if (string_is_empty(path_savefile))
|
||||
return true;
|
||||
@ -745,6 +777,12 @@ void path_clear(enum rarch_path_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_PATH_RECORD:
|
||||
*path_record = '\0';
|
||||
break;
|
||||
case RARCH_PATH_RECORD_CONFIG:
|
||||
*path_record_config = '\0';
|
||||
break;
|
||||
case RARCH_PATH_SAVEFILE:
|
||||
*path_savefile = '\0';
|
||||
break;
|
||||
|
12
paths.h
12
paths.h
@ -50,7 +50,9 @@ enum rarch_path_type
|
||||
RARCH_PATH_CORE_OPTIONS,
|
||||
RARCH_PATH_DEFAULT_SHADER_PRESET,
|
||||
RARCH_PATH_BASENAME,
|
||||
RARCH_PATH_SUBSYSTEM
|
||||
RARCH_PATH_SUBSYSTEM,
|
||||
RARCH_PATH_RECORD,
|
||||
RARCH_PATH_RECORD_CONFIG
|
||||
};
|
||||
|
||||
void path_deinit_subsystem(void);
|
||||
@ -76,12 +78,20 @@ void path_set_basename(const char *path);
|
||||
|
||||
/* get size functions */
|
||||
|
||||
size_t path_get_record_size(void);
|
||||
|
||||
size_t path_get_record_config_size(void);
|
||||
|
||||
size_t path_get_server_size(void);
|
||||
|
||||
size_t path_get_core_size(void);
|
||||
|
||||
/* get ptr functions */
|
||||
|
||||
char *path_get_record_ptr(void);
|
||||
|
||||
char *path_get_record_config_ptr(void);
|
||||
|
||||
char *path_get_core_ptr(void);
|
||||
|
||||
char *path_get_server_ptr(void);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "../runloop.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../msg_hash.h"
|
||||
#include "../paths.h"
|
||||
#include "../list_special.h"
|
||||
|
||||
static bool recording_enable;
|
||||
@ -327,12 +328,13 @@ bool recording_init(void)
|
||||
(float)av_info->timing.fps,
|
||||
(float)av_info->timing.sample_rate);
|
||||
|
||||
strlcpy(recording_file, global->record.path, sizeof(recording_file));
|
||||
strlcpy(recording_file, path_get(RARCH_PATH_RECORD), sizeof(recording_file));
|
||||
|
||||
if (global->record.use_output_dir)
|
||||
fill_pathname_join(recording_file,
|
||||
global->record.output_dir,
|
||||
global->record.path, sizeof(recording_file));
|
||||
path_get(RARCH_PATH_RECORD),
|
||||
sizeof(recording_file));
|
||||
|
||||
params.out_width = av_info->geometry.base_width;
|
||||
params.out_height = av_info->geometry.base_height;
|
||||
@ -346,8 +348,8 @@ bool recording_init(void)
|
||||
FFEMU_PIX_ARGB8888 : FFEMU_PIX_RGB565;
|
||||
params.config = NULL;
|
||||
|
||||
if (*global->record.config)
|
||||
params.config = global->record.config;
|
||||
if (!path_is_empty(RARCH_PATH_RECORD_CONFIG))
|
||||
params.config = path_get(RARCH_PATH_RECORD_CONFIG);
|
||||
|
||||
if (video_driver_supports_recording())
|
||||
{
|
||||
@ -420,7 +422,7 @@ bool recording_init(void)
|
||||
|
||||
RARCH_LOG("%s %s @ %ux%u. (FB size: %ux%u pix_fmt: %u)\n",
|
||||
msg_hash_to_str(MSG_RECORDING_TO),
|
||||
global->record.path,
|
||||
path_get(RARCH_PATH_RECORD),
|
||||
params.out_width, params.out_height,
|
||||
params.fb_width, params.fb_height,
|
||||
(unsigned)params.pix_fmt);
|
||||
|
@ -592,8 +592,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
strlcpy(global->record.path, optarg,
|
||||
sizeof(global->record.path));
|
||||
path_set(RARCH_PATH_RECORD, optarg);
|
||||
{
|
||||
bool *recording_enabled = recording_is_enabled();
|
||||
|
||||
@ -770,8 +769,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||
}
|
||||
|
||||
case RA_OPT_RECORDCONFIG:
|
||||
strlcpy(global->record.config, optarg,
|
||||
sizeof(global->record.config));
|
||||
path_set(RARCH_PATH_RECORD_CONFIG, optarg);
|
||||
break;
|
||||
|
||||
case RA_OPT_MAX_FRAMES:
|
||||
|
@ -752,6 +752,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
path_clear(RARCH_PATH_IPS);
|
||||
path_clear(RARCH_PATH_UPS);
|
||||
path_clear(RARCH_PATH_BPS);
|
||||
path_clear(RARCH_PATH_RECORD);
|
||||
path_clear(RARCH_PATH_RECORD_CONFIG);
|
||||
runloop_overrides_active = false;
|
||||
|
||||
core_unset_input_descriptors();
|
||||
|
@ -158,15 +158,14 @@ typedef struct global
|
||||
/* Recording. */
|
||||
struct
|
||||
{
|
||||
char path[PATH_MAX_LENGTH];
|
||||
char config[PATH_MAX_LENGTH];
|
||||
char output_dir[PATH_MAX_LENGTH];
|
||||
char config_dir[PATH_MAX_LENGTH];
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
|
||||
size_t gpu_width;
|
||||
size_t gpu_height;
|
||||
char output_dir[PATH_MAX_LENGTH];
|
||||
char config_dir[PATH_MAX_LENGTH];
|
||||
bool use_output_dir;
|
||||
} record;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user