diff --git a/configuration.c b/configuration.c index 4b3fd54712..3099a4375c 100644 --- a/configuration.c +++ b/configuration.c @@ -633,8 +633,8 @@ static void config_set_defaults(void) if (!global->has_set_ips_pref) global->ips_pref = false; - *global->recording.output_dir = '\0'; - *global->recording.config_dir = '\0'; + *global->record.output_dir = '\0'; + *global->record.config_dir = '\0'; *settings->core_options_path = '\0'; *settings->content_history_path = '\0'; @@ -1420,8 +1420,8 @@ static bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_INT_BASE(conf, settings, archive.mode, "archive_mode"); - config_get_path(conf, "recording_output_directory", global->recording.output_dir, sizeof(global->recording.output_dir)); - config_get_path(conf, "recording_config_directory", global->recording.config_dir, sizeof(global->recording.config_dir)); + config_get_path(conf, "recording_output_directory", global->record.output_dir, sizeof(global->record.output_dir)); + config_get_path(conf, "recording_config_directory", global->record.config_dir, sizeof(global->record.config_dir)); #ifdef HAVE_OVERLAY config_get_path(conf, "overlay_directory", global->overlay_dir, sizeof(global->overlay_dir)); @@ -2176,8 +2176,8 @@ bool config_save_file(const char *path) config_set_path(conf, "libretro_path", settings->libretro); config_set_path(conf, "core_options_path", settings->core_options_path); - config_set_path(conf, "recording_output_directory", global->recording.output_dir); - config_set_path(conf, "recording_config_directory", global->recording.config_dir); + config_set_path(conf, "recording_output_directory", global->record.output_dir); + config_set_path(conf, "recording_config_directory", global->record.config_dir); config_set_bool(conf, "suspend_screensaver_enable", settings->ui.suspend_screensaver_enable); config_set_path(conf, "libretro_directory", settings->libretro_directory); diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index 7c78468f15..f1bb220843 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -330,7 +330,7 @@ static int action_ok_record_configfile(const char *path, return menu_list_push_stack_refresh( menu->menu_list, - global->recording.config_dir, + global->record.config_dir, label, type, idx); } diff --git a/record/record_driver.c b/record/record_driver.c index 61c71a5a78..c6083c8e34 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -15,6 +15,7 @@ */ #include +#include #include "record_driver.h" #include "../driver.h" @@ -183,6 +184,7 @@ bool recording_deinit(void) **/ bool recording_init(void) { + char recording_file[PATH_MAX_LENGTH]; struct ffemu_params params = {0}; global_t *global = global_get_ptr(); driver_t *driver = driver_get_ptr(); @@ -209,12 +211,19 @@ bool recording_init(void) (float)global->system.av_info.timing.fps, (float)global->system.av_info.timing.sample_rate); + strlcpy(recording_file, global->record.path, sizeof(recording_file)); + + if (global->record.use_output_dir) + fill_pathname_join(recording_file, + global->record.output_dir, + global->record.path, sizeof(recording_file)); + params.out_width = info->geometry.base_width; params.out_height = info->geometry.base_height; params.fb_width = info->geometry.max_width; params.fb_height = info->geometry.max_height; params.channels = 2; - params.filename = global->record.path; + params.filename = recording_file; params.fps = global->system.av_info.timing.fps; params.samplerate = global->system.av_info.timing.sample_rate; params.pix_fmt = (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ? diff --git a/runloop.h b/runloop.h index 0619cf91f7..843d376caa 100644 --- a/runloop.h +++ b/runloop.h @@ -192,11 +192,6 @@ typedef struct global unsigned windowed_scale; } pending; - struct - { - char output_dir[PATH_MAX_LENGTH]; - char config_dir[PATH_MAX_LENGTH]; - } recording; struct { @@ -348,6 +343,9 @@ typedef struct global uint8_t *gpu_buffer; 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; struct diff --git a/settings.c b/settings.c index 4e5c276afe..d8b6a9a0f3 100644 --- a/settings.c +++ b/settings.c @@ -3871,6 +3871,18 @@ static bool setting_append_list_recording_options( general_read_handler); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT); + CONFIG_BOOL( + global->record.use_output_dir, + "record_use_output_dir", + "Use output directory", + false, + "OFF", + "ON", + group_info.name, + subgroup_info.name, + general_write_handler, + general_read_handler); + END_SUB_GROUP(list, list_info); START_SUB_GROUP(list, list_info, "Miscellaneous", group_info.name, subgroup_info); @@ -6107,7 +6119,7 @@ static bool setting_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - global->recording.output_dir, + global->record.output_dir, "recording_output_directory", "Recording Output Directory", "", @@ -6122,7 +6134,7 @@ static bool setting_append_list_path_options( SD_FLAG_ALLOW_EMPTY | SD_FLAG_PATH_DIR | SD_FLAG_BROWSER_ACTION); CONFIG_DIR( - global->recording.config_dir, + global->record.config_dir, "recording_config_directory", "Recording Config Directory", "",